Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/vendor/phpunit/php-token-stream/src/ |
Upload File : |
<?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; } }