Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Plugin.php

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\PHPCodeSniffer

Code

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal