Check whether just some words in the input are ALL CAPS
param list words: The words to inspect
returns: `True` if some but not all items in `words` are ALL CAPS
@param array $tokens
@return boolean
340454
public function allCapDifferential(array $tokens) : bool
    {
        $upperCase = array_map('strtoupper', $tokens);
        $intersection = array_values( array_intersect( $tokens, $upperCase));        
        return count($intersection) > 0 && count($intersection) < count($tokens);                
    }
1044541
protected function countGroupClose(Array $tokens)
	{
		return array_reduce($tokens, function ($carry, $item) {
			return $carry += $item instanceof Token\Group\Close;
		}, 0);
	}
801227
protected static function _tokenize(array $tokens) {
		$inString = false;
		$results = array();
		$cpt = 0;
		$previousTokenId = null;
		foreach ($tokens as $tokenId => $token) {
			if ($token['content'] === '"') {
				if (!$inString) {
					$token['id'] = T_START_DOUBLE_QUOTE;
					$token['name'] = 'T_START_DOUBLE_QUOTE';
				} else {
					$token['id'] = T_END_DOUBLE_QUOTE;
					$token['name'] = 'T_END_DOUBLE_QUOTE';
				}
				$inString = !$inString;
			}

			$isCurlyBrace = (
				$token['content'] === '$' &&
				isset($tokens[$tokenId + 1]) &&
				$tokens[$tokenId + 1]['content'] === '{'
			);
			if ($isCurlyBrace) {
				$token['id'] = T_DOLLAR_CURLY_BRACES;
				$token['name'] = 'T_DOLLAR_CURLY_BRACES';
			}

			$isArray = (
				!$token['id'] &&
				$token['content'] === '(' &&
				$previousTokenId !== null &&
				$tokens[$previousTokenId]['id'] === T_ARRAY
			);
			if ($isArray) {
				$token['id'] = T_ARRAY_OPEN;
				$token['name'] = 'T_ARRAY_OPEN';
			}

			$isShortArray = (
				!$token['id'] &&
				$token['content'] === '[' &&
				$previousTokenId !== null && (
					$tokens[$previousTokenId]['id'] !== T_VARIABLE &&
					$tokens[$previousTokenId]['id'] !== T_ENCAPSED_AND_WHITESPACE
				)
			);
			if ($isShortArray) {
				$token['id'] = T_SHORT_ARRAY_OPEN;
				$token['name'] = 'T_SHORT_ARRAY_OPEN';
			}

			if ($token['content'] === '(' && !$token['id']) {
				$token['id'] = T_START_BRACKET;
				$token['name'] = 'T_START_BRACKET';
			}

			if ($token['id'] !== T_WHITESPACE) {
				$previousTokenId = $tokenId;
			}

			if ($token['id'] === T_IF) {
				$i = $cpt;
				$spaces = '';
				while ($i-- > 0 && $results[$i]['id'] === T_WHITESPACE) {
					$spaces = $results[$i]['content'] . $spaces;
				}
				if ($i >= 0 && $results[$i]['id'] === T_ELSE) {
					$token['id'] = T_ELSEIF;
					$token['name'] = 'T_ELSEIF';
					$token['content'] = $results[$i]['content'] . $spaces . $token['content'];
					$cpt = $i;
				}
			}

			$results[$cpt++] = $token;
		}

		return $results;
	}
546173
protected function isNextTokenAnException($tokens, $ptr)
    {
        return in_array($tokens[($ptr + 1)]['code'], $this->exceptions)
            && $tokens[($ptr + 1)]['column'] - $tokens[($ptr)]['column'] == 1;
    }
6298
public static function isTokenValid(string $token): bool
    {
        if (!static::hasTokenStored()) {
            return false;
        }

        $storedToken = static::getStoredToken();
        return $storedToken->getToken() === $token;
    }
1163057
public function lastTokenIs($classNames)
    {
        $token = $this->getLastToken();
        foreach ($classNames as $className) {
            if ($token instanceof $className) {
                return true;
            }
        }

        return false;
    }
1234792
private function _checkProhibitedKeywords($token) {
		if ($this->_isActive('checkProhibitedKeywords')) {
			foreach ($this->_prohibitedKeywords as $keyword) {
				if (strpos($token->text, $keyword) !== FALSE) {
					$msg = $this->_getMessage('PROHIBITED_KEYWORD', $token->text);
					$this->_writeError('checkProhibitedKeywords', $msg);
				}
			}
		}
	}
465901
def _is_wrapped(self, token, tokens):
        
        for t in tokens:
            is_wrapped = self._wraps((token, t))
            if is_wrapped:
                return True
        return False
154675
public static function hasToken(array $coll, $token)
    {
        if (!\is_array($token)) {
            return false;
        }

        return \in_array(\token_name($token[0]), $coll);
    }
1202932
private function sortTokens(array $tokens): array
    {
        $tagCounts = $this->docTagHelper->getTagCounts($tokens);

        usort($tokens, function (array $leftToken, array $rightToken) use ($tagCounts): int {
            return $this->compareTokensForSorting($leftToken, $rightToken, $tagCounts);
        });

        return $tokens;
    }
1062380
protected function containsThrowToken(array $tokens, int $scopeOpener, int $scopeCloser): bool
    {
        for ($i = $scopeOpener + 1; $i < $scopeCloser; $i++) {
            if ($tokens[$i]['code'] !== T_THROW) {
                continue;
            }

            return true;
        }

        return false;
    }
703210
public static function offset(array $tokens, $index)
    {
        if (count($tokens) < 1) {
            return 0;
        }

        if (null === $index) {
            $index = count($tokens) - 1;
        }

        $source = '';

        for ($i = 0; $i < $index; ++$i) {
            $source .= $tokens[$i]->content();
        }

        return strlen($source);
    }
685416
public function isSameAs(Token $token)
    {
        $hasNumberWildcard = ($this->hasNumber() && $token->hasNumber());
        if ($hasNumberWildcard && $this->number !== $token->number) {
            return false;
        }
        $hasValueWildcard = ($this->hasValue() && $token->hasValue());
        if ($hasValueWildcard && $this->value !== $token->value) {
            return false;
        }
        $hasLineNumberWildcard = ($this->hasLineNumber() && $token->hasLineNumber());
        if ($hasLineNumberWildcard && $this->lineNumber !== $token->lineNumber) {
            return false;
        }

        return true;
    }
1180878
public static function hasSyntax($token, $syntax = self::VAR_SYNTAX)
    {
        if (!\is_array($token)) {
            return false;
        }

        $regexp = \sprintf('#%s#', $syntax);

        return (bool) \preg_match($regexp, $token[1]);
    }
1341516
public static function isClause($token)
    {
        if (($token->type === Token::TYPE_KEYWORD && isset(Parser::$STATEMENT_PARSERS[$token->keyword]))
            || ($token->type === Token::TYPE_NONE && strtoupper($token->token) === 'DELIMITER')
        ) {
            return 2;
        } elseif ($token->type === Token::TYPE_KEYWORD && isset(Parser::$KEYWORD_PARSERS[$token->keyword])
        ) {
            return 1;
        }

        return false;
    }
858909
private static boolean hasManyCaps(final String word) {
        if ("i".equalsIgnoreCase(word)) return false;
        int capCharCount = 0;
        for (int i = 0; i < word.length(); i++) {
            if (isUpperCase(word.charAt(i))) capCharCount++;
            if (capCharCount == 2) return true;
        }
        return false;
    }
1017098
public function contains($type)
	{
		foreach($this->tokens as $token)
		{
			if($token->is($type))
			{
				return true;
			}
		}
		
		return false;
	}