think\console\output\Descriptor::calculateTotalWidthForOptions PHP Метод

calculateTotalWidthForOptions() приватный Метод

private calculateTotalWidthForOptions ( Option[] $options ) : integer
$options think\console\input\Option[]
Результат integer
    private function calculateTotalWidthForOptions($options)
    {
        $totalWidth = 0;
        foreach ($options as $option) {
            $nameLength = 4 + strlen($option->getName()) + 2;
            // - + shortcut + , + whitespace + name + --
            if ($option->acceptValue()) {
                $valueLength = 1 + strlen($option->getName());
                // = + value
                $valueLength += $option->isValueOptional() ? 2 : 0;
                // [ + ]
                $nameLength += $valueLength;
            }
            $totalWidth = max($totalWidth, $nameLength);
        }
        return $totalWidth;
    }