function Plugin::getMaxDepth
Determines the maximum search depth when searching for Coding Standards.
Return value
int
Throws
\InvalidArgumentException
File
-
vendor/
dealerdirect/ phpcodesniffer-composer-installer/ src/ Plugin.php, line 592
Class
- Plugin
- PHP_CodeSniffer standard installation manager.
Namespace
PHPCSStandards\Composer\Plugin\Installers\PHPCodeSnifferCode
private function getMaxDepth() {
$maxDepth = 3;
$extra = $this->composer
->getPackage()
->getExtra();
if (array_key_exists(self::KEY_MAX_DEPTH, $extra)) {
$maxDepth = $extra[self::KEY_MAX_DEPTH];
$minDepth = $this->getMinDepth();
if ((string) (int) $maxDepth !== (string) $maxDepth || $maxDepth <= $minDepth || is_float($maxDepth) === true) {
$message = vsprintf(self::MESSAGE_ERROR_WRONG_MAX_DEPTH, array(
'key' => self::KEY_MAX_DEPTH,
'min' => $minDepth,
'given' => var_export($maxDepth, true),
));
throw new \InvalidArgumentException($message);
}
}
return (int) $maxDepth;
}