You are here

public function PHP_Token_FUNCTION::getCCN in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/phpunit/php-token-stream/src/Token.php \PHP_Token_FUNCTION::getCCN()

Return value

integer

File

vendor/phpunit/php-token-stream/src/Token.php, line 381

Class

PHP_Token_FUNCTION

Code

public function getCCN() {
  if ($this->ccn !== null) {
    return $this->ccn;
  }
  $this->ccn = 1;
  $end = $this
    ->getEndTokenId();
  $tokens = $this->tokenStream
    ->tokens();
  for ($i = $this->id; $i <= $end; $i++) {
    switch (get_class($tokens[$i])) {
      case 'PHP_Token_IF':
      case 'PHP_Token_ELSEIF':
      case 'PHP_Token_FOR':
      case 'PHP_Token_FOREACH':
      case 'PHP_Token_WHILE':
      case 'PHP_Token_CASE':
      case 'PHP_Token_CATCH':
      case 'PHP_Token_BOOLEAN_AND':
      case 'PHP_Token_LOGICAL_AND':
      case 'PHP_Token_BOOLEAN_OR':
      case 'PHP_Token_LOGICAL_OR':
      case 'PHP_Token_QUESTION_MARK':
        $this->ccn++;
        break;
    }
  }
  return $this->ccn;
}