function Help::__construct
Same name in this branch
- 11.1.x vendor/squizlabs/php_codesniffer/src/Util/Help.php \PHP_CodeSniffer\Util\Help::__construct()
File
-
vendor/
phpunit/ phpunit/ src/ TextUI/ Help.php, line 37
Class
- Help
- @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
Namespace
PHPUnit\TextUICode
public function __construct(?int $width = null, ?bool $withColor = null) {
if ($width === null) {
$width = (new Console())->getNumberOfColumns();
}
if ($withColor === null) {
$this->hasColor = (new Console())->hasColorSupport();
}
else {
$this->hasColor = $withColor;
}
foreach ($this->elements() as $options) {
foreach ($options as $option) {
if (isset($option['arg'])) {
$this->lengthOfLongestOptionName = max($this->lengthOfLongestOptionName, strlen($option['arg']));
}
}
}
$this->columnsAvailableForDescription = $width - $this->lengthOfLongestOptionName - 4;
}