updated backend
This commit is contained in:
parent
1fea0f4fe7
commit
11521c2339
3459 changed files with 72735 additions and 168535 deletions
1117
pfosten/vendor/phpunit/php-token-stream/src/Token.php
vendored
1117
pfosten/vendor/phpunit/php-token-stream/src/Token.php
vendored
File diff suppressed because it is too large
Load diff
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of the PHP_TokenStream package.
|
||||
* This file is part of php-token-stream.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
|
|
@ -10,19 +10,13 @@
|
|||
|
||||
/**
|
||||
* A stream of PHP tokens.
|
||||
*
|
||||
* @author Sebastian Bergmann <sebastian@phpunit.de>
|
||||
* @copyright Sebastian Bergmann <sebastian@phpunit.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/php-token-stream/tree
|
||||
* @since Class available since Release 1.0.0
|
||||
*/
|
||||
class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $customTokens = array(
|
||||
protected static $customTokens = [
|
||||
'(' => 'PHP_Token_OPEN_BRACKET',
|
||||
')' => 'PHP_Token_CLOSE_BRACKET',
|
||||
'[' => 'PHP_Token_OPEN_SQUARE',
|
||||
|
|
@ -51,7 +45,7 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
'^' => 'PHP_Token_CARET',
|
||||
'~' => 'PHP_Token_TILDE',
|
||||
'`' => 'PHP_Token_BACKTICK'
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* @var string
|
||||
|
|
@ -61,17 +55,17 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $tokens = array();
|
||||
protected $tokens = [];
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
* @var int
|
||||
*/
|
||||
protected $position = 0;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $linesOfCode = array('loc' => 0, 'cloc' => 0, 'ncloc' => 0);
|
||||
protected $linesOfCode = ['loc' => 0, 'cloc' => 0, 'ncloc' => 0];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
|
|
@ -101,7 +95,7 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $lineToFunctionMap = array();
|
||||
protected $lineToFunctionMap = [];
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
|
@ -123,7 +117,7 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
$this->tokens = array();
|
||||
$this->tokens = [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -142,7 +136,6 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
|
||||
/**
|
||||
* @return string
|
||||
* @since Method available since Release 1.1.0
|
||||
*/
|
||||
public function getFilename()
|
||||
{
|
||||
|
|
@ -174,9 +167,9 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
|
||||
if ($lastNonWhitespaceTokenWasDoubleColon && $name == 'CLASS') {
|
||||
$name = 'CLASS_NAME_CONSTANT';
|
||||
} elseif ($name == 'USE' && isset($tokens[$i+2][0]) && $tokens[$i+2][0] == T_FUNCTION) {
|
||||
} elseif ($name == 'USE' && isset($tokens[$i + 2][0]) && $tokens[$i + 2][0] == T_FUNCTION) {
|
||||
$name = 'USE_FUNCTION';
|
||||
$text .= $tokens[$i+1][1] . $tokens[$i+2][1];
|
||||
$text .= $tokens[$i + 1][1] . $tokens[$i + 2][1];
|
||||
$skip = 2;
|
||||
}
|
||||
|
||||
|
|
@ -188,7 +181,7 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
|
||||
$this->tokens[] = new $tokenClass($text, $line, $this, $id++);
|
||||
$lines = substr_count($text, "\n");
|
||||
$line += $lines;
|
||||
$line += $lines;
|
||||
|
||||
if ($tokenClass == 'PHP_Token_HALT_COMPILER') {
|
||||
break;
|
||||
|
|
@ -212,7 +205,7 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
* @return int
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
|
|
@ -271,7 +264,6 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
|
||||
/**
|
||||
* @return array
|
||||
* @since Method available since Release 1.1.0
|
||||
*/
|
||||
public function getTraits()
|
||||
{
|
||||
|
|
@ -296,19 +288,19 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
*
|
||||
* @param bool $categorize OPTIONAL
|
||||
* @param string $category OPTIONAL Either 'require_once', 'require',
|
||||
* 'include_once', 'include'.
|
||||
* 'include_once', 'include'.
|
||||
*
|
||||
* @return array
|
||||
* @since Method available since Release 1.1.0
|
||||
*/
|
||||
public function getIncludes($categorize = false, $category = null)
|
||||
{
|
||||
if ($this->includes === null) {
|
||||
$this->includes = array(
|
||||
'require_once' => array(),
|
||||
'require' => array(),
|
||||
'include_once' => array(),
|
||||
'include' => array()
|
||||
);
|
||||
$this->includes = [
|
||||
'require_once' => [],
|
||||
'require' => [],
|
||||
'include_once' => [],
|
||||
'include' => []
|
||||
];
|
||||
|
||||
foreach ($this->tokens as $token) {
|
||||
switch (get_class($token)) {
|
||||
|
|
@ -342,7 +334,6 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
* Returns the name of the function or method a line belongs to.
|
||||
*
|
||||
* @return string or null if the line is not in a function or method
|
||||
* @since Method available since Release 1.2.0
|
||||
*/
|
||||
public function getFunctionForLine($line)
|
||||
{
|
||||
|
|
@ -355,12 +346,12 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
|
||||
protected function parse()
|
||||
{
|
||||
$this->interfaces = array();
|
||||
$this->classes = array();
|
||||
$this->traits = array();
|
||||
$this->functions = array();
|
||||
$class = array();
|
||||
$classEndLine = array();
|
||||
$this->interfaces = [];
|
||||
$this->classes = [];
|
||||
$this->traits = [];
|
||||
$this->functions = [];
|
||||
$class = [];
|
||||
$classEndLine = [];
|
||||
$trait = false;
|
||||
$traitEndLine = false;
|
||||
$interface = false;
|
||||
|
|
@ -375,8 +366,8 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
$interface = $token->getName();
|
||||
$interfaceEndLine = $token->getEndLine();
|
||||
|
||||
$this->interfaces[$interface] = array(
|
||||
'methods' => array(),
|
||||
$this->interfaces[$interface] = [
|
||||
'methods' => [],
|
||||
'parent' => $token->getParent(),
|
||||
'keywords' => $token->getKeywords(),
|
||||
'docblock' => $token->getDocblock(),
|
||||
|
|
@ -384,13 +375,13 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
'endLine' => $interfaceEndLine,
|
||||
'package' => $token->getPackage(),
|
||||
'file' => $this->filename
|
||||
);
|
||||
];
|
||||
break;
|
||||
|
||||
case 'PHP_Token_CLASS':
|
||||
case 'PHP_Token_TRAIT':
|
||||
$tmp = array(
|
||||
'methods' => array(),
|
||||
$tmp = [
|
||||
'methods' => [],
|
||||
'parent' => $token->getParent(),
|
||||
'interfaces'=> $token->getInterfaces(),
|
||||
'keywords' => $token->getKeywords(),
|
||||
|
|
@ -399,15 +390,13 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
'endLine' => $token->getEndLine(),
|
||||
'package' => $token->getPackage(),
|
||||
'file' => $this->filename
|
||||
);
|
||||
];
|
||||
|
||||
if ($token instanceof PHP_Token_CLASS) {
|
||||
$class[] = $token->getName();
|
||||
$classEndLine[] = $token->getEndLine();
|
||||
|
||||
if ($class[count($class)-1] != 'anonymous class') {
|
||||
$this->classes[$class[count($class)-1]] = $tmp;
|
||||
}
|
||||
$this->classes[$class[count($class) - 1]] = $tmp;
|
||||
} else {
|
||||
$trait = $token->getName();
|
||||
$traitEndLine = $token->getEndLine();
|
||||
|
|
@ -417,7 +406,7 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
|
||||
case 'PHP_Token_FUNCTION':
|
||||
$name = $token->getName();
|
||||
$tmp = array(
|
||||
$tmp = [
|
||||
'docblock' => $token->getDocblock(),
|
||||
'keywords' => $token->getKeywords(),
|
||||
'visibility'=> $token->getVisibility(),
|
||||
|
|
@ -426,7 +415,7 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
'endLine' => $token->getEndLine(),
|
||||
'ccn' => $token->getCCN(),
|
||||
'file' => $this->filename
|
||||
);
|
||||
];
|
||||
|
||||
if (empty($class) &&
|
||||
$trait === false &&
|
||||
|
|
@ -438,11 +427,11 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
$tmp['startLine'],
|
||||
$tmp['endLine']
|
||||
);
|
||||
} elseif (!empty($class) && $class[count($class)-1] != 'anonymous class') {
|
||||
$this->classes[$class[count($class)-1]]['methods'][$name] = $tmp;
|
||||
} elseif (!empty($class)) {
|
||||
$this->classes[$class[count($class) - 1]]['methods'][$name] = $tmp;
|
||||
|
||||
$this->addFunctionToMap(
|
||||
$class[count($class)-1] . '::' . $name,
|
||||
$class[count($class) - 1] . '::' . $name,
|
||||
$tmp['startLine'],
|
||||
$tmp['endLine']
|
||||
);
|
||||
|
|
@ -461,7 +450,7 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
|
||||
case 'PHP_Token_CLOSE_CURLY':
|
||||
if (!empty($classEndLine) &&
|
||||
$classEndLine[count($classEndLine)-1] == $token->getLine()) {
|
||||
$classEndLine[count($classEndLine) - 1] == $token->getLine()) {
|
||||
array_pop($classEndLine);
|
||||
array_pop($class);
|
||||
} elseif ($traitEndLine !== false &&
|
||||
|
|
@ -494,7 +483,7 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
|
|
@ -502,7 +491,7 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
* @return int
|
||||
*/
|
||||
public function key()
|
||||
{
|
||||
|
|
@ -525,8 +514,9 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
}
|
||||
|
||||
/**
|
||||
* @param integer $offset
|
||||
* @return boolean
|
||||
* @param int $offset
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
|
|
@ -534,8 +524,10 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
}
|
||||
|
||||
/**
|
||||
* @param integer $offset
|
||||
* @param int $offset
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws OutOfBoundsException
|
||||
*/
|
||||
public function offsetGet($offset)
|
||||
|
|
@ -553,8 +545,8 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
}
|
||||
|
||||
/**
|
||||
* @param integer $offset
|
||||
* @param mixed $value
|
||||
* @param int $offset
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
|
|
@ -562,7 +554,8 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
}
|
||||
|
||||
/**
|
||||
* @param integer $offset
|
||||
* @param int $offset
|
||||
*
|
||||
* @throws OutOfBoundsException
|
||||
*/
|
||||
public function offsetUnset($offset)
|
||||
|
|
@ -582,7 +575,8 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
/**
|
||||
* Seek to an absolute position.
|
||||
*
|
||||
* @param integer $position
|
||||
* @param int $position
|
||||
*
|
||||
* @throws OutOfBoundsException
|
||||
*/
|
||||
public function seek($position)
|
||||
|
|
@ -600,9 +594,9 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param integer $startLine
|
||||
* @param integer $endLine
|
||||
* @param string $name
|
||||
* @param int $startLine
|
||||
* @param int $endLine
|
||||
*/
|
||||
private function addFunctionToMap($name, $startLine, $endLine)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of the PHP_TokenStream package.
|
||||
* This file is part of php-token-stream.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
|
|
@ -10,22 +10,17 @@
|
|||
|
||||
/**
|
||||
* A caching factory for token stream objects.
|
||||
*
|
||||
* @author Sebastian Bergmann <sebastian@phpunit.de>
|
||||
* @copyright Sebastian Bergmann <sebastian@phpunit.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/php-token-stream/tree
|
||||
* @since Class available since Release 1.0.0
|
||||
*/
|
||||
class PHP_Token_Stream_CachingFactory
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $cache = array();
|
||||
protected static $cache = [];
|
||||
|
||||
/**
|
||||
* @param string $filename
|
||||
* @param string $filename
|
||||
*
|
||||
* @return PHP_Token_Stream
|
||||
*/
|
||||
public static function get($filename)
|
||||
|
|
@ -45,7 +40,7 @@ class PHP_Token_Stream_CachingFactory
|
|||
if (is_string($filename)) {
|
||||
unset(self::$cache[$filename]);
|
||||
} else {
|
||||
self::$cache = array();
|
||||
self::$cache = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue