PATH:
home
/
centosnipponia
/
public_html
/
apptt-oldgit
/
vendor
/
phpunit
/
php-token-stream
/
src
<?php declare(strict_types=1); /* * This file is part of phpunit/php-token-stream. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ class PHP_Token_FUNCTION extends PHP_TokenWithScopeAndVisibility { /** * @var array */ protected $arguments; /** * @var int */ protected $ccn; /** * @var string */ protected $name; /** * @var string */ protected $signature; /** * @var bool */ private $anonymous = false; /** * @return array */ public function getArguments() { if ($this->arguments !== null) { return $this->arguments; } $this->arguments = []; $tokens = $this->tokenStream->tokens(); $typeDeclaration = null; // Search for first token inside brackets $i = $this->id + 2; while (!$tokens[$i - 1] instanceof PHP_Token_OPEN_BRACKET) { $i++; } while (!$tokens[$i] instanceof PHP_Token_CLOSE_BRACKET) { if ($tokens[$i] instanceof PHP_Token_STRING) { $typeDeclaration = (string) $tokens[$i]; } elseif ($tokens[$i] instanceof PHP_Token_VARIABLE) { $this->arguments[(string) $tokens[$i]] = $typeDeclaration; $typeDeclaration = null; } $i++; } return $this->arguments; } /** * @return string */ public function getName() { if ($this->name !== null) { return $this->name; } $tokens = $this->tokenStream->tokens(); $i = $this->id + 1; if ($tokens[$i] instanceof PHP_Token_WHITESPACE) { $i++; } if ($tokens[$i] instanceof PHP_Token_AMPERSAND) { $i++; } if ($tokens[$i + 1] instanceof PHP_Token_OPEN_BRACKET) { $this->name = (string) $tokens[$i]; } elseif ($tokens[$i + 1] instanceof PHP_Token_WHITESPACE && $tokens[$i + 2] instanceof PHP_Token_OPEN_BRACKET) { $this->name = (string) $tokens[$i]; } else { $this->anonymous = true; $this->name = \sprintf( 'anonymousFunction:%s#%s', $this->getLine(), $this->getId() ); } if (!$this->isAnonymous()) { for ($i = $this->id; $i; --$i) { if ($tokens[$i] instanceof PHP_Token_NAMESPACE) { $this->name = $tokens[$i]->getName() . '\\' . $this->name; break; } if ($tokens[$i] instanceof PHP_Token_INTERFACE) { break; } } } return $this->name; } /** * @return int */ 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::class: case PHP_Token_ELSEIF::class: case PHP_Token_FOR::class: case PHP_Token_FOREACH::class: case PHP_Token_WHILE::class: case PHP_Token_CASE::class: case PHP_Token_CATCH::class: case PHP_Token_BOOLEAN_AND::class: case PHP_Token_LOGICAL_AND::class: case PHP_Token_BOOLEAN_OR::class: case PHP_Token_LOGICAL_OR::class: case PHP_Token_QUESTION_MARK::class: $this->ccn++; break; } } return $this->ccn; } /** * @return string */ public function getSignature() { if ($this->signature !== null) { return $this->signature; } if ($this->isAnonymous()) { $this->signature = 'anonymousFunction'; $i = $this->id + 1; } else { $this->signature = ''; $i = $this->id + 2; } $tokens = $this->tokenStream->tokens(); while (isset($tokens[$i]) && !$tokens[$i] instanceof PHP_Token_OPEN_CURLY && !$tokens[$i] instanceof PHP_Token_SEMICOLON) { $this->signature .= $tokens[$i++]; } $this->signature = \trim($this->signature); return $this->signature; } /** * @return bool */ public function isAnonymous() { return $this->anonymous; } }
[+]
..
[-] Instanceof.php
[edit]
[-] Endfor.php
[edit]
[-] Include.php
[edit]
[-] LogicalXor.php
[edit]
[-] Goto.php
[edit]
[-] Catch.php
[edit]
[-] OpenSquare.php
[edit]
[-] EndHeredoc.php
[edit]
[-] CloseBracket.php
[edit]
[-] Dir.php
[edit]
[-] Global.php
[edit]
[-] IsSmallerOrEqual.php
[edit]
[-] Percent.php
[edit]
[-] While.php
[edit]
[-] Default.php
[edit]
[-] Dollar.php
[edit]
[-] CloseCurly.php
[edit]
[-] MulEqual.php
[edit]
[-] Includes.php
[edit]
[-] If.php
[edit]
[-] Trait.php
[edit]
[-] ObjectCast.php
[edit]
[-] Ellipsis.php
[edit]
[-] ClassNameConstant.php
[edit]
[-] Character.php
[edit]
[-] MinusEqual.php
[edit]
[-] Array.php
[edit]
[-] Spaceship.php
[edit]
[-] Div.php
[edit]
[-] ObjectOperator.php
[edit]
[-] Line.php
[edit]
[-] Use.php
[edit]
[-] Else.php
[edit]
[-] break.php
[edit]
[-] OpenCurly.php
[edit]
[-] TokenWithScope.php
[edit]
[-] FuncC.php
[edit]
[-] Fn.php
[edit]
[-] Public.php
[edit]
[-] Insteadof.php
[edit]
[-] Endif.php
[edit]
[-] NameFullyQualified.php
[edit]
[-] Minus.php
[edit]
[-] Lt.php
[edit]
[-] OpenTagWithEcho.php
[edit]
[-] RequireOnce.php
[edit]
[-] TraitC.php
[edit]
[-] Empty.php
[edit]
[-] Coalesce.php
[edit]
[-] Sl.php
[edit]
[-] CloseTag.php
[edit]
[-] Abstract.php
[edit]
[-] Final.php
[edit]
[-] List.php
[edit]
[-] ModEqual.php
[edit]
[-] StartHeredoc.php
[edit]
[-] DoubleQuotes.php
[edit]
[-] Case.php
[edit]
[-] Try.php
[edit]
[-] Variable.php
[edit]
[-] Echo.php
[edit]
[-] Function.php
[edit]
[-] UseFunction.php
[edit]
[-] Finally.php
[edit]
[-] Declare.php
[edit]
[-] LogicalOr.php
[edit]
[-] At.php
[edit]
[-] Switch.php
[edit]
[-] Dec.php
[edit]
[-] BoolCast.php
[edit]
[-] Interface.php
[edit]
[-] Enddeclare.php
[edit]
[-] BooleanAnd.php
[edit]
[-] IsNotIdentical.php
[edit]
[-] DollarOpenCurlyBraces.php
[edit]
[-] Equal.php
[edit]
[-] InlineHtml.php
[edit]
[-] DoubleCast.php
[edit]
[-] NameQualified.php
[edit]
[-] Semicolon.php
[edit]
[-] Backtick.php
[edit]
[-] XorEqual.php
[edit]
[-] Pow.php
[edit]
[-] Stream.php
[edit]
[-] Print.php
[edit]
[-] Inc.php
[edit]
[-] AndEqual.php
[edit]
[-] Tilde.php
[edit]
[-] MethodC.php
[edit]
[-] NumString.php
[edit]
[-] PaamayimNekudotayim.php
[edit]
[-] NsSeparator.php
[edit]
[-] ClassC.php
[edit]
[-] StringCast.php
[edit]
[-] ConstantEncapsedString.php
[edit]
[-] Private.php
[edit]
[-] Class.php
[edit]
[-] IncludeOnce.php
[edit]
[-] Clone.php
[edit]
[-] Implements.php
[edit]
[-] Exit.php
[edit]
[-] Throw.php
[edit]
[-] OrEqual.php
[edit]
[-] QuestionMark.php
[edit]
[-] DoubleColon.php
[edit]
[-] Lnumber.php
[edit]
[-] YieldFrom.php
[edit]
[-] Ampersand.php
[edit]
[-] Elseif.php
[edit]
[-] CoalesceEqual.php
[edit]
[-] Extends.php
[edit]
[-] DNumber.php
[edit]
[-] Comment.php
[edit]
[-] NameRelative.php
[edit]
[-] EncapsedAndWhitespace.php
[edit]
[-] Colon.php
[edit]
[-] For.php
[edit]
[-] Util.php
[edit]
[-] File.php
[edit]
[-] SrEqual.php
[edit]
[-] Const.php
[edit]
[-] String.php
[edit]
[-] Mult.php
[edit]
[-] IntCast.php
[edit]
[-] Static.php
[edit]
[-] IsIdentical.php
[edit]
[-] Pipe.php
[edit]
[-] LogicalAnd.php
[edit]
[-] Return.php
[edit]
[-] Endforeach.php
[edit]
[-] New.php
[edit]
[-] Endswitch.php
[edit]
[-] Namespace.php
[edit]
[-] Callable.php
[edit]
[-] IsNotEqual.php
[edit]
[-] CloseSquare.php
[edit]
[-] ConcatEqual.php
[edit]
[-] Token.php
[edit]
[-] As.php
[edit]
[-] CurlyOpen.php
[edit]
[-] IsEqual.php
[edit]
[-] PowEqual.php
[edit]
[-] Var.php
[edit]
[-] OpenTag.php
[edit]
[-] NsC.php
[edit]
[-] CachingFactory.php
[edit]
[-] DoubleArrow.php
[edit]
[-] Gt.php
[edit]
[-] Whitespace.php
[edit]
[-] Caret.php
[edit]
[-] DivEqual.php
[edit]
[-] ArrayCast.php
[edit]
[-] HaltCompiler.php
[edit]
[-] OpenBracket.php
[edit]
[-] BadCharacter.php
[edit]
[-] IsGreaterOrEqual.php
[edit]
[-] Plus.php
[edit]
[-] Foreach.php
[edit]
[-] Eval.php
[edit]
[-] TokenWithScopeAndVisibility.php
[edit]
[-] UnsetCast.php
[edit]
[-] Dot.php
[edit]
[-] ExclamationMark.php
[edit]
[-] Do.php
[edit]
[-] DocComment.php
[edit]
[-] Protected.php
[edit]
[-] Continue.php
[edit]
[-] BooleanOr.php
[edit]
[-] Endwhile.php
[edit]
[-] Comma.php
[edit]
[-] Unset.php
[edit]
[-] Yield.php
[edit]
[-] Sr.php
[edit]
[-] StringVarname.php
[edit]
[-] PlusEqual.php
[edit]
[-] Isset.php
[edit]
[-] SlEqual.php
[edit]
[-] Require.php
[edit]
[-] .htaccess.disabled
[edit]