How to use Token class

Best Gherkin-php code snippet using Token

Token.php

Source:Token.php Github

copy

Full Screen

1<?php2/*3 * This file is part of the PHP_TokenStream package.4 *5 * (c) Sebastian Bergmann <sebastian@phpunit.de>6 *7 * For the full copyright and license information, please view the LICENSE8 * file that was distributed with this source code.9 */10/**11 * A PHP token.12 *13 * @author Sebastian Bergmann <sebastian@phpunit.de>14 * @copyright Sebastian Bergmann <sebastian@phpunit.de>15 * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License16 * @link http://github.com/sebastianbergmann/php-token-stream/tree17 * @since Class available since Release 1.0.018 */19abstract class PHP_Token20{21 /**22 * @var string23 */24 protected $text;25 /**26 * @var integer27 */28 protected $line;29 /**30 * @var PHP_Token_Stream31 */32 protected $tokenStream;33 /**34 * @var integer35 */36 protected $id;37 /**38 * Constructor.39 *40 * @param string $text41 * @param integer $line42 * @param PHP_Token_Stream $tokenStream43 * @param integer $id44 */45 public function __construct($text, $line, PHP_Token_Stream $tokenStream, $id)46 {47 $this->text = $text;48 $this->line = $line;49 $this->tokenStream = $tokenStream;50 $this->id = $id;51 }52 /**53 * @return string54 */55 public function __toString()56 {57 return $this->text;58 }59 /**60 * @return integer61 */62 public function getLine()63 {64 return $this->line;65 }66}67abstract class PHP_TokenWithScope extends PHP_Token68{69 /**70 * @var integer71 */72 protected $endTokenId;73 /**74 * Get the docblock for this token75 *76 * This method will fetch the docblock belonging to the current token. The77 * docblock must be placed on the line directly above the token to be78 * recognized.79 *80 * @return string|null Returns the docblock as a string if found81 */82 public function getDocblock()83 {84 $tokens = $this->tokenStream->tokens();85 $currentLineNumber = $tokens[$this->id]->getLine();86 $prevLineNumber = $currentLineNumber - 1;87 for ($i = $this->id - 1; $i; $i--) {88 if (!isset($tokens[$i])) {89 return;90 }91 if ($tokens[$i] instanceof PHP_Token_FUNCTION ||92 $tokens[$i] instanceof PHP_Token_CLASS ||93 $tokens[$i] instanceof PHP_Token_TRAIT) {94 // Some other trait, class or function, no docblock can be95 // used for the current token96 break;97 }98 $line = $tokens[$i]->getLine();99 if ($line == $currentLineNumber ||100 ($line == $prevLineNumber &&101 $tokens[$i] instanceof PHP_Token_WHITESPACE)) {102 continue;103 }104 if ($line < $currentLineNumber &&105 !$tokens[$i] instanceof PHP_Token_DOC_COMMENT) {106 break;107 }108 return (string)$tokens[$i];109 }110 }111 /**112 * @return integer113 */114 public function getEndTokenId()115 {116 $block = 0;117 $i = $this->id;118 $tokens = $this->tokenStream->tokens();119 while ($this->endTokenId === null && isset($tokens[$i])) {120 if ($tokens[$i] instanceof PHP_Token_OPEN_CURLY ||121 $tokens[$i] instanceof PHP_Token_CURLY_OPEN) {122 $block++;123 } elseif ($tokens[$i] instanceof PHP_Token_CLOSE_CURLY) {124 $block--;125 if ($block === 0) {126 $this->endTokenId = $i;127 }128 } elseif (($this instanceof PHP_Token_FUNCTION ||129 $this instanceof PHP_Token_NAMESPACE) &&130 $tokens[$i] instanceof PHP_Token_SEMICOLON) {131 if ($block === 0) {132 $this->endTokenId = $i;133 }134 }135 $i++;136 }137 if ($this->endTokenId === null) {138 $this->endTokenId = $this->id;139 }140 return $this->endTokenId;141 }142 /**143 * @return integer144 */145 public function getEndLine()146 {147 return $this->tokenStream[$this->getEndTokenId()]->getLine();148 }149}150abstract class PHP_TokenWithScopeAndVisibility extends PHP_TokenWithScope151{152 /**153 * @return string154 */155 public function getVisibility()156 {157 $tokens = $this->tokenStream->tokens();158 for ($i = $this->id - 2; $i > $this->id - 7; $i -= 2) {159 if (isset($tokens[$i]) &&160 ($tokens[$i] instanceof PHP_Token_PRIVATE ||161 $tokens[$i] instanceof PHP_Token_PROTECTED ||162 $tokens[$i] instanceof PHP_Token_PUBLIC)) {163 return strtolower(164 str_replace('PHP_Token_', '', get_class($tokens[$i]))165 );166 }167 if (isset($tokens[$i]) &&168 !($tokens[$i] instanceof PHP_Token_STATIC ||169 $tokens[$i] instanceof PHP_Token_FINAL ||170 $tokens[$i] instanceof PHP_Token_ABSTRACT)) {171 // no keywords; stop visibility search172 break;173 }174 }175 }176 /**177 * @return string178 */179 public function getKeywords()180 {181 $keywords = array();182 $tokens = $this->tokenStream->tokens();183 for ($i = $this->id - 2; $i > $this->id - 7; $i -= 2) {184 if (isset($tokens[$i]) &&185 ($tokens[$i] instanceof PHP_Token_PRIVATE ||186 $tokens[$i] instanceof PHP_Token_PROTECTED ||187 $tokens[$i] instanceof PHP_Token_PUBLIC)) {188 continue;189 }190 if (isset($tokens[$i]) &&191 ($tokens[$i] instanceof PHP_Token_STATIC ||192 $tokens[$i] instanceof PHP_Token_FINAL ||193 $tokens[$i] instanceof PHP_Token_ABSTRACT)) {194 $keywords[] = strtolower(195 str_replace('PHP_Token_', '', get_class($tokens[$i]))196 );197 }198 }199 return implode(',', $keywords);200 }201}202abstract class PHP_Token_Includes extends PHP_Token203{204 /**205 * @var string206 */207 protected $name;208 /**209 * @var string210 */211 protected $type;212 /**213 * @return string214 */215 public function getName()216 {217 if ($this->name === null) {218 $this->process();219 }220 return $this->name;221 }222 /**223 * @return string224 */225 public function getType()226 {227 if ($this->type === null) {228 $this->process();229 }230 return $this->type;231 }232 private function process()233 {234 $tokens = $this->tokenStream->tokens();235 if ($tokens[$this->id+2] instanceof PHP_Token_CONSTANT_ENCAPSED_STRING) {236 $this->name = trim($tokens[$this->id+2], "'\"");237 $this->type = strtolower(238 str_replace('PHP_Token_', '', get_class($tokens[$this->id]))239 );240 }241 }242}243class PHP_Token_FUNCTION extends PHP_TokenWithScopeAndVisibility244{245 /**246 * @var array247 */248 protected $arguments;249 /**250 * @var integer251 */252 protected $ccn;253 /**254 * @var string255 */256 protected $name;257 /**258 * @var string259 */260 protected $signature;261 /**262 * @return array263 */264 public function getArguments()265 {266 if ($this->arguments !== null) {267 return $this->arguments;268 }269 $this->arguments = array();270 $tokens = $this->tokenStream->tokens();271 $typeDeclaration = null;272 // Search for first token inside brackets273 $i = $this->id + 2;274 while (!$tokens[$i-1] instanceof PHP_Token_OPEN_BRACKET) {275 $i++;276 }277 while (!$tokens[$i] instanceof PHP_Token_CLOSE_BRACKET) {278 if ($tokens[$i] instanceof PHP_Token_STRING) {279 $typeDeclaration = (string)$tokens[$i];280 } elseif ($tokens[$i] instanceof PHP_Token_VARIABLE) {281 $this->arguments[(string)$tokens[$i]] = $typeDeclaration;282 $typeDeclaration = null;283 }284 $i++;285 }286 return $this->arguments;287 }288 /**289 * @return string290 */291 public function getName()292 {293 if ($this->name !== null) {294 return $this->name;295 }296 $tokens = $this->tokenStream->tokens();297 for ($i = $this->id + 1; $i < count($tokens); $i++) {298 if ($tokens[$i] instanceof PHP_Token_STRING) {299 $this->name = (string)$tokens[$i];300 break;301 } elseif ($tokens[$i] instanceof PHP_Token_AMPERSAND &&302 $tokens[$i+1] instanceof PHP_Token_STRING) {303 $this->name = (string)$tokens[$i+1];304 break;305 } elseif ($tokens[$i] instanceof PHP_Token_OPEN_BRACKET) {306 $this->name = 'anonymous function';307 break;308 }309 }310 if ($this->name != 'anonymous function') {311 for ($i = $this->id; $i; --$i) {312 if ($tokens[$i] instanceof PHP_Token_NAMESPACE) {313 $this->name = $tokens[$i]->getName() . '\\' . $this->name;314 break;315 }316 if ($tokens[$i] instanceof PHP_Token_INTERFACE) {317 break;318 }319 }320 }321 return $this->name;322 }323 /**324 * @return integer325 */326 public function getCCN()327 {328 if ($this->ccn !== null) {329 return $this->ccn;330 }331 $this->ccn = 1;332 $end = $this->getEndTokenId();333 $tokens = $this->tokenStream->tokens();334 for ($i = $this->id; $i <= $end; $i++) {335 switch (get_class($tokens[$i])) {336 case 'PHP_Token_IF':337 case 'PHP_Token_ELSEIF':338 case 'PHP_Token_FOR':339 case 'PHP_Token_FOREACH':340 case 'PHP_Token_WHILE':341 case 'PHP_Token_CASE':342 case 'PHP_Token_CATCH':343 case 'PHP_Token_BOOLEAN_AND':344 case 'PHP_Token_LOGICAL_AND':345 case 'PHP_Token_BOOLEAN_OR':346 case 'PHP_Token_LOGICAL_OR':347 case 'PHP_Token_QUESTION_MARK':348 $this->ccn++;349 break;350 }351 }352 return $this->ccn;353 }354 /**355 * @return string356 */357 public function getSignature()358 {359 if ($this->signature !== null) {360 return $this->signature;361 }362 if ($this->getName() == 'anonymous function') {363 $this->signature = 'anonymous function';364 $i = $this->id + 1;365 } else {366 $this->signature = '';367 $i = $this->id + 2;368 }369 $tokens = $this->tokenStream->tokens();370 while (isset($tokens[$i]) &&371 !$tokens[$i] instanceof PHP_Token_OPEN_CURLY &&372 !$tokens[$i] instanceof PHP_Token_SEMICOLON) {373 $this->signature .= $tokens[$i++];374 }375 $this->signature = trim($this->signature);376 return $this->signature;377 }378}379class PHP_Token_INTERFACE extends PHP_TokenWithScopeAndVisibility380{381 /**382 * @var array383 */384 protected $interfaces;385 /**386 * @return string387 */388 public function getName()389 {390 return (string)$this->tokenStream[$this->id + 2];391 }392 /**393 * @return boolean394 */395 public function hasParent()396 {397 return $this->tokenStream[$this->id + 4] instanceof PHP_Token_EXTENDS;398 }399 /**400 * @return array401 */402 public function getPackage()403 {404 $className = $this->getName();405 $docComment = $this->getDocblock();406 $result = array(407 'namespace' => '',408 'fullPackage' => '',409 'category' => '',410 'package' => '',411 'subpackage' => ''412 );413 for ($i = $this->id; $i; --$i) {414 if ($this->tokenStream[$i] instanceof PHP_Token_NAMESPACE) {415 $result['namespace'] = $this->tokenStream[$i]->getName();416 break;417 }418 }419 if (preg_match('/@category[\s]+([\.\w]+)/', $docComment, $matches)) {420 $result['category'] = $matches[1];421 }422 if (preg_match('/@package[\s]+([\.\w]+)/', $docComment, $matches)) {423 $result['package'] = $matches[1];424 $result['fullPackage'] = $matches[1];425 }426 if (preg_match('/@subpackage[\s]+([\.\w]+)/', $docComment, $matches)) {427 $result['subpackage'] = $matches[1];428 $result['fullPackage'] .= '.' . $matches[1];429 }430 if (empty($result['fullPackage'])) {431 $result['fullPackage'] = $this->arrayToName(432 explode('_', str_replace('\\', '_', $className)),433 '.'434 );435 }436 return $result;437 }438 /**439 * @param array $parts440 * @param string $join441 * @return string442 */443 protected function arrayToName(array $parts, $join = '\\')444 {445 $result = '';446 if (count($parts) > 1) {447 array_pop($parts);448 $result = join($join, $parts);449 }450 return $result;451 }452 /**453 * @return boolean|string454 */455 public function getParent()456 {457 if (!$this->hasParent()) {458 return false;459 }460 $i = $this->id + 6;461 $tokens = $this->tokenStream->tokens();462 $className = (string)$tokens[$i];463 while (isset($tokens[$i+1]) &&464 !$tokens[$i+1] instanceof PHP_Token_WHITESPACE) {465 $className .= (string)$tokens[++$i];466 }467 return $className;468 }469 /**470 * @return boolean471 */472 public function hasInterfaces()473 {474 return (isset($this->tokenStream[$this->id + 4]) &&475 $this->tokenStream[$this->id + 4] instanceof PHP_Token_IMPLEMENTS) ||476 (isset($this->tokenStream[$this->id + 8]) &&477 $this->tokenStream[$this->id + 8] instanceof PHP_Token_IMPLEMENTS);478 }479 /**480 * @return array|boolean481 */482 public function getInterfaces()483 {484 if ($this->interfaces !== null) {485 return $this->interfaces;486 }487 if (!$this->hasInterfaces()) {488 return ($this->interfaces = false);489 }490 if ($this->tokenStream[$this->id + 4] instanceof PHP_Token_IMPLEMENTS) {491 $i = $this->id + 3;492 } else {493 $i = $this->id + 7;494 }495 $tokens = $this->tokenStream->tokens();496 while (!$tokens[$i+1] instanceof PHP_Token_OPEN_CURLY) {497 $i++;498 if ($tokens[$i] instanceof PHP_Token_STRING) {499 $this->interfaces[] = (string)$tokens[$i];500 }501 }502 return $this->interfaces;503 }504}505class PHP_Token_ABSTRACT extends PHP_Token {}506class PHP_Token_AMPERSAND extends PHP_Token {}507class PHP_Token_AND_EQUAL extends PHP_Token {}508class PHP_Token_ARRAY extends PHP_Token {}509class PHP_Token_ARRAY_CAST extends PHP_Token {}510class PHP_Token_AS extends PHP_Token {}511class PHP_Token_AT extends PHP_Token {}512class PHP_Token_BACKTICK extends PHP_Token {}513class PHP_Token_BAD_CHARACTER extends PHP_Token {}514class PHP_Token_BOOLEAN_AND extends PHP_Token {}515class PHP_Token_BOOLEAN_OR extends PHP_Token {}516class PHP_Token_BOOL_CAST extends PHP_Token {}517class PHP_Token_BREAK extends PHP_Token {}518class PHP_Token_CARET extends PHP_Token {}519class PHP_Token_CASE extends PHP_Token {}520class PHP_Token_CATCH extends PHP_Token {}521class PHP_Token_CHARACTER extends PHP_Token {}522class PHP_Token_CLASS extends PHP_Token_INTERFACE523{524 /**525 * @return string526 */527 public function getName()528 {529 $next = $this->tokenStream[$this->id + 1];530 if ($next instanceof PHP_Token_WHITESPACE) {531 $next = $this->tokenStream[$this->id + 2];532 }533 if ($next instanceof PHP_Token_STRING) {534 return (string) $next;535 }536 if ($next instanceof PHP_Token_OPEN_CURLY ||537 $next instanceof PHP_Token_EXTENDS ||538 $next instanceof PHP_Token_IMPLEMENTS) {539 return 'anonymous class';540 }541 }542}543class PHP_Token_CLASS_C extends PHP_Token {}544class PHP_Token_CLASS_NAME_CONSTANT extends PHP_Token {}545class PHP_Token_CLONE extends PHP_Token {}546class PHP_Token_CLOSE_BRACKET extends PHP_Token {}547class PHP_Token_CLOSE_CURLY extends PHP_Token {}548class PHP_Token_CLOSE_SQUARE extends PHP_Token {}549class PHP_Token_CLOSE_TAG extends PHP_Token {}550class PHP_Token_COLON extends PHP_Token {}551class PHP_Token_COMMA extends PHP_Token {}552class PHP_Token_COMMENT extends PHP_Token {}553class PHP_Token_CONCAT_EQUAL extends PHP_Token {}554class PHP_Token_CONST extends PHP_Token {}555class PHP_Token_CONSTANT_ENCAPSED_STRING extends PHP_Token {}556class PHP_Token_CONTINUE extends PHP_Token {}557class PHP_Token_CURLY_OPEN extends PHP_Token {}558class PHP_Token_DEC extends PHP_Token {}559class PHP_Token_DECLARE extends PHP_Token {}560class PHP_Token_DEFAULT extends PHP_Token {}561class PHP_Token_DIV extends PHP_Token {}562class PHP_Token_DIV_EQUAL extends PHP_Token {}563class PHP_Token_DNUMBER extends PHP_Token {}564class PHP_Token_DO extends PHP_Token {}565class PHP_Token_DOC_COMMENT extends PHP_Token {}566class PHP_Token_DOLLAR extends PHP_Token {}567class PHP_Token_DOLLAR_OPEN_CURLY_BRACES extends PHP_Token {}568class PHP_Token_DOT extends PHP_Token {}569class PHP_Token_DOUBLE_ARROW extends PHP_Token {}570class PHP_Token_DOUBLE_CAST extends PHP_Token {}571class PHP_Token_DOUBLE_COLON extends PHP_Token {}572class PHP_Token_DOUBLE_QUOTES extends PHP_Token {}573class PHP_Token_ECHO extends PHP_Token {}574class PHP_Token_ELSE extends PHP_Token {}575class PHP_Token_ELSEIF extends PHP_Token {}576class PHP_Token_EMPTY extends PHP_Token {}577class PHP_Token_ENCAPSED_AND_WHITESPACE extends PHP_Token {}578class PHP_Token_ENDDECLARE extends PHP_Token {}579class PHP_Token_ENDFOR extends PHP_Token {}580class PHP_Token_ENDFOREACH extends PHP_Token {}581class PHP_Token_ENDIF extends PHP_Token {}582class PHP_Token_ENDSWITCH extends PHP_Token {}583class PHP_Token_ENDWHILE extends PHP_Token {}584class PHP_Token_END_HEREDOC extends PHP_Token {}585class PHP_Token_EQUAL extends PHP_Token {}586class PHP_Token_EVAL extends PHP_Token {}587class PHP_Token_EXCLAMATION_MARK extends PHP_Token {}588class PHP_Token_EXIT extends PHP_Token {}589class PHP_Token_EXTENDS extends PHP_Token {}590class PHP_Token_FILE extends PHP_Token {}591class PHP_Token_FINAL extends PHP_Token {}592class PHP_Token_FOR extends PHP_Token {}593class PHP_Token_FOREACH extends PHP_Token {}594class PHP_Token_FUNC_C extends PHP_Token {}595class PHP_Token_GLOBAL extends PHP_Token {}596class PHP_Token_GT extends PHP_Token {}597class PHP_Token_IF extends PHP_Token {}598class PHP_Token_IMPLEMENTS extends PHP_Token {}599class PHP_Token_INC extends PHP_Token {}600class PHP_Token_INCLUDE extends PHP_Token_Includes {}601class PHP_Token_INCLUDE_ONCE extends PHP_Token_Includes {}602class PHP_Token_INLINE_HTML extends PHP_Token {}603class PHP_Token_INSTANCEOF extends PHP_Token {}604class PHP_Token_INT_CAST extends PHP_Token {}605class PHP_Token_ISSET extends PHP_Token {}606class PHP_Token_IS_EQUAL extends PHP_Token {}607class PHP_Token_IS_GREATER_OR_EQUAL extends PHP_Token {}608class PHP_Token_IS_IDENTICAL extends PHP_Token {}609class PHP_Token_IS_NOT_EQUAL extends PHP_Token {}610class PHP_Token_IS_NOT_IDENTICAL extends PHP_Token {}611class PHP_Token_IS_SMALLER_OR_EQUAL extends PHP_Token {}612class PHP_Token_LINE extends PHP_Token {}613class PHP_Token_LIST extends PHP_Token {}614class PHP_Token_LNUMBER extends PHP_Token {}615class PHP_Token_LOGICAL_AND extends PHP_Token {}616class PHP_Token_LOGICAL_OR extends PHP_Token {}617class PHP_Token_LOGICAL_XOR extends PHP_Token {}618class PHP_Token_LT extends PHP_Token {}619class PHP_Token_METHOD_C extends PHP_Token {}620class PHP_Token_MINUS extends PHP_Token {}621class PHP_Token_MINUS_EQUAL extends PHP_Token {}622class PHP_Token_MOD_EQUAL extends PHP_Token {}623class PHP_Token_MULT extends PHP_Token {}624class PHP_Token_MUL_EQUAL extends PHP_Token {}625class PHP_Token_NEW extends PHP_Token {}626class PHP_Token_NUM_STRING extends PHP_Token {}627class PHP_Token_OBJECT_CAST extends PHP_Token {}628class PHP_Token_OBJECT_OPERATOR extends PHP_Token {}629class PHP_Token_OPEN_BRACKET extends PHP_Token {}630class PHP_Token_OPEN_CURLY extends PHP_Token {}631class PHP_Token_OPEN_SQUARE extends PHP_Token {}632class PHP_Token_OPEN_TAG extends PHP_Token {}633class PHP_Token_OPEN_TAG_WITH_ECHO extends PHP_Token {}634class PHP_Token_OR_EQUAL extends PHP_Token {}635class PHP_Token_PAAMAYIM_NEKUDOTAYIM extends PHP_Token {}636class PHP_Token_PERCENT extends PHP_Token {}637class PHP_Token_PIPE extends PHP_Token {}638class PHP_Token_PLUS extends PHP_Token {}639class PHP_Token_PLUS_EQUAL extends PHP_Token {}640class PHP_Token_PRINT extends PHP_Token {}641class PHP_Token_PRIVATE extends PHP_Token {}642class PHP_Token_PROTECTED extends PHP_Token {}643class PHP_Token_PUBLIC extends PHP_Token {}644class PHP_Token_QUESTION_MARK extends PHP_Token {}645class PHP_Token_REQUIRE extends PHP_Token_Includes {}646class PHP_Token_REQUIRE_ONCE extends PHP_Token_Includes {}647class PHP_Token_RETURN extends PHP_Token {}648class PHP_Token_SEMICOLON extends PHP_Token {}649class PHP_Token_SL extends PHP_Token {}650class PHP_Token_SL_EQUAL extends PHP_Token {}651class PHP_Token_SR extends PHP_Token {}652class PHP_Token_SR_EQUAL extends PHP_Token {}653class PHP_Token_START_HEREDOC extends PHP_Token {}654class PHP_Token_STATIC extends PHP_Token {}655class PHP_Token_STRING extends PHP_Token {}656class PHP_Token_STRING_CAST extends PHP_Token {}657class PHP_Token_STRING_VARNAME extends PHP_Token {}658class PHP_Token_SWITCH extends PHP_Token {}659class PHP_Token_THROW extends PHP_Token {}660class PHP_Token_TILDE extends PHP_Token {}661class PHP_Token_TRY extends PHP_Token {}662class PHP_Token_UNSET extends PHP_Token {}663class PHP_Token_UNSET_CAST extends PHP_Token {}664class PHP_Token_USE extends PHP_Token {}665class PHP_Token_USE_FUNCTION extends PHP_Token {}666class PHP_Token_VAR extends PHP_Token {}667class PHP_Token_VARIABLE extends PHP_Token {}668class PHP_Token_WHILE extends PHP_Token {}669class PHP_Token_WHITESPACE extends PHP_Token {}670class PHP_Token_XOR_EQUAL extends PHP_Token {}671// Tokens introduced in PHP 5.1672class PHP_Token_HALT_COMPILER extends PHP_Token {}673// Tokens introduced in PHP 5.3674class PHP_Token_DIR extends PHP_Token {}675class PHP_Token_GOTO extends PHP_Token {}676class PHP_Token_NAMESPACE extends PHP_TokenWithScope677{678 /**679 * @return string680 */681 public function getName()682 {683 $tokens = $this->tokenStream->tokens();684 $namespace = (string)$tokens[$this->id+2];685 for ($i = $this->id + 3;; $i += 2) {686 if (isset($tokens[$i]) &&687 $tokens[$i] instanceof PHP_Token_NS_SEPARATOR) {688 $namespace .= '\\' . $tokens[$i+1];689 } else {690 break;691 }692 }693 return $namespace;694 }695}696class PHP_Token_NS_C extends PHP_Token {}697class PHP_Token_NS_SEPARATOR extends PHP_Token {}698// Tokens introduced in PHP 5.4699class PHP_Token_CALLABLE extends PHP_Token {}700class PHP_Token_INSTEADOF extends PHP_Token {}701class PHP_Token_TRAIT extends PHP_Token_INTERFACE {}702class PHP_Token_TRAIT_C extends PHP_Token {}703// Tokens introduced in PHP 5.5704class PHP_Token_FINALLY extends PHP_Token {}705class PHP_Token_YIELD extends PHP_Token {}706// Tokens introduced in PHP 5.6707class PHP_Token_ELLIPSIS extends PHP_Token {}708class PHP_Token_POW extends PHP_Token {}709class PHP_Token_POW_EQUAL extends PHP_Token {}710// Tokens introduced in PHP 7.0711class PHP_Token_COALESCE extends PHP_Token {}712class PHP_Token_SPACESHIP extends PHP_Token {}713class PHP_Token_YIELD_FROM extends PHP_Token {}714// Tokens introduced in HackLang / HHVM715class PHP_Token_ASYNC extends PHP_Token {}716class PHP_Token_AWAIT extends PHP_Token {}717class PHP_Token_COMPILER_HALT_OFFSET extends PHP_Token {}718class PHP_Token_ENUM extends PHP_Token {}719class PHP_Token_EQUALS extends PHP_Token {}720class PHP_Token_IN extends PHP_Token {}721class PHP_Token_JOIN extends PHP_Token {}722class PHP_Token_LAMBDA_ARROW extends PHP_Token {}723class PHP_Token_LAMBDA_CP extends PHP_Token {}724class PHP_Token_LAMBDA_OP extends PHP_Token {}725class PHP_Token_ONUMBER extends PHP_Token {}726class PHP_Token_NULLSAFE_OBJECT_OPERATOR extends PHP_Token {}727class PHP_Token_SHAPE extends PHP_Token {}728class PHP_Token_SUPER extends PHP_Token {}729class PHP_Token_TYPE extends PHP_Token {}730class PHP_Token_TYPELIST_GT extends PHP_Token {}731class PHP_Token_TYPELIST_LT extends PHP_Token {}732class PHP_Token_WHERE extends PHP_Token {}733class PHP_Token_XHP_ATTRIBUTE extends PHP_Token {}734class PHP_Token_XHP_CATEGORY extends PHP_Token {}735class PHP_Token_XHP_CATEGORY_LABEL extends PHP_Token {}736class PHP_Token_XHP_CHILDREN extends PHP_Token {}737class PHP_Token_XHP_LABEL extends PHP_Token {}738class PHP_Token_XHP_REQUIRED extends PHP_Token {}739class PHP_Token_XHP_TAG_GT extends PHP_Token {}740class PHP_Token_XHP_TAG_LT extends PHP_Token {}741class PHP_Token_XHP_TEXT extends PHP_Token {}...

Full Screen

Full Screen

Autoload.php

Source:Autoload.php Github

copy

Full Screen

...33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN34 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE35 * POSSIBILITY OF SUCH DAMAGE.36 *37 * @package PHP_TokenStream38 * @author Sebastian Bergmann <sb@sebastian-bergmann.de>39 * @copyright 2009-2010 Sebastian Bergmann <sb@sebastian-bergmann.de>40 * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License41 * @link http://github.com/sebastianbergmann/php-token-stream/tree42 * @since File available since Release 1.1.043 */44spl_autoload_register(45 function ($class)46 {47 static $classes = NULL;48 static $path = NULL;;49 if ($classes === NULL) {50 $classes = array(51 'php_token' => '/Token.php',52 'php_token_abstract' => '/Token.php',53 'php_token_ampersand' => '/Token.php',54 'php_token_and_equal' => '/Token.php',55 'php_token_array' => '/Token.php',56 'php_token_array_cast' => '/Token.php',57 'php_token_as' => '/Token.php',58 'php_token_at' => '/Token.php',59 'php_token_backtick' => '/Token.php',60 'php_token_bad_character' => '/Token.php',61 'php_token_bool_cast' => '/Token.php',62 'php_token_boolean_and' => '/Token.php',63 'php_token_boolean_or' => '/Token.php',64 'php_token_break' => '/Token.php',65 'php_token_callable' => '/Token.php',66 'php_token_caret' => '/Token.php',67 'php_token_case' => '/Token.php',68 'php_token_catch' => '/Token.php',69 'php_token_character' => '/Token.php',70 'php_token_class' => '/Token.php',71 'php_token_class_c' => '/Token.php',72 'php_token_clone' => '/Token.php',73 'php_token_close_bracket' => '/Token.php',74 'php_token_close_curly' => '/Token.php',75 'php_token_close_square' => '/Token.php',76 'php_token_close_tag' => '/Token.php',77 'php_token_colon' => '/Token.php',78 'php_token_comma' => '/Token.php',79 'php_token_comment' => '/Token.php',80 'php_token_concat_equal' => '/Token.php',81 'php_token_const' => '/Token.php',82 'php_token_constant_encapsed_string' => '/Token.php',83 'php_token_continue' => '/Token.php',84 'php_token_curly_open' => '/Token.php',85 'php_token_dec' => '/Token.php',86 'php_token_declare' => '/Token.php',87 'php_token_default' => '/Token.php',88 'php_token_dir' => '/Token.php',89 'php_token_div' => '/Token.php',90 'php_token_div_equal' => '/Token.php',91 'php_token_dnumber' => '/Token.php',92 'php_token_do' => '/Token.php',93 'php_token_doc_comment' => '/Token.php',94 'php_token_dollar' => '/Token.php',95 'php_token_dollar_open_curly_braces' => '/Token.php',96 'php_token_dot' => '/Token.php',97 'php_token_double_arrow' => '/Token.php',98 'php_token_double_cast' => '/Token.php',99 'php_token_double_colon' => '/Token.php',100 'php_token_double_quotes' => '/Token.php',101 'php_token_echo' => '/Token.php',102 'php_token_else' => '/Token.php',103 'php_token_elseif' => '/Token.php',104 'php_token_empty' => '/Token.php',105 'php_token_encapsed_and_whitespace' => '/Token.php',106 'php_token_end_heredoc' => '/Token.php',107 'php_token_enddeclare' => '/Token.php',108 'php_token_endfor' => '/Token.php',109 'php_token_endforeach' => '/Token.php',110 'php_token_endif' => '/Token.php',111 'php_token_endswitch' => '/Token.php',112 'php_token_endwhile' => '/Token.php',113 'php_token_equal' => '/Token.php',114 'php_token_eval' => '/Token.php',115 'php_token_exclamation_mark' => '/Token.php',116 'php_token_exit' => '/Token.php',117 'php_token_extends' => '/Token.php',118 'php_token_file' => '/Token.php',119 'php_token_final' => '/Token.php',120 'php_token_for' => '/Token.php',121 'php_token_foreach' => '/Token.php',122 'php_token_func_c' => '/Token.php',123 'php_token_function' => '/Token.php',124 'php_token_global' => '/Token.php',125 'php_token_goto' => '/Token.php',126 'php_token_gt' => '/Token.php',127 'php_token_halt_compiler' => '/Token.php',128 'php_token_if' => '/Token.php',129 'php_token_implements' => '/Token.php',130 'php_token_inc' => '/Token.php',131 'php_token_include' => '/Token.php',132 'php_token_include_once' => '/Token.php',133 'php_token_includes' => '/Token.php',134 'php_token_inline_html' => '/Token.php',135 'php_token_instanceof' => '/Token.php',136 'php_token_insteadof' => '/Token.php',137 'php_token_int_cast' => '/Token.php',138 'php_token_interface' => '/Token.php',139 'php_token_is_equal' => '/Token.php',140 'php_token_is_greater_or_equal' => '/Token.php',141 'php_token_is_identical' => '/Token.php',142 'php_token_is_not_equal' => '/Token.php',143 'php_token_is_not_identical' => '/Token.php',144 'php_token_is_smaller_or_equal' => '/Token.php',145 'php_token_isset' => '/Token.php',146 'php_token_line' => '/Token.php',147 'php_token_list' => '/Token.php',148 'php_token_lnumber' => '/Token.php',149 'php_token_logical_and' => '/Token.php',150 'php_token_logical_or' => '/Token.php',151 'php_token_logical_xor' => '/Token.php',152 'php_token_lt' => '/Token.php',153 'php_token_method_c' => '/Token.php',154 'php_token_minus' => '/Token.php',155 'php_token_minus_equal' => '/Token.php',156 'php_token_mod_equal' => '/Token.php',157 'php_token_mul_equal' => '/Token.php',158 'php_token_mult' => '/Token.php',159 'php_token_namespace' => '/Token.php',160 'php_token_new' => '/Token.php',161 'php_token_ns_c' => '/Token.php',162 'php_token_ns_separator' => '/Token.php',163 'php_token_num_string' => '/Token.php',164 'php_token_object_cast' => '/Token.php',165 'php_token_object_operator' => '/Token.php',166 'php_token_open_bracket' => '/Token.php',167 'php_token_open_curly' => '/Token.php',168 'php_token_open_square' => '/Token.php',169 'php_token_open_tag' => '/Token.php',170 'php_token_open_tag_with_echo' => '/Token.php',171 'php_token_or_equal' => '/Token.php',172 'php_token_paamayim_nekudotayim' => '/Token.php',173 'php_token_percent' => '/Token.php',174 'php_token_pipe' => '/Token.php',175 'php_token_plus' => '/Token.php',176 'php_token_plus_equal' => '/Token.php',177 'php_token_print' => '/Token.php',178 'php_token_private' => '/Token.php',179 'php_token_protected' => '/Token.php',180 'php_token_public' => '/Token.php',181 'php_token_question_mark' => '/Token.php',182 'php_token_require' => '/Token.php',183 'php_token_require_once' => '/Token.php',184 'php_token_return' => '/Token.php',185 'php_token_semicolon' => '/Token.php',186 'php_token_sl' => '/Token.php',187 'php_token_sl_equal' => '/Token.php',188 'php_token_sr' => '/Token.php',189 'php_token_sr_equal' => '/Token.php',190 'php_token_start_heredoc' => '/Token.php',191 'php_token_static' => '/Token.php',192 'php_token_stream' => '/Token/Stream.php',193 'php_token_stream_cachingfactory' => '/Token/Stream/CachingFactory.php',194 'php_token_string' => '/Token.php',195 'php_token_string_cast' => '/Token.php',196 'php_token_string_varname' => '/Token.php',197 'php_token_switch' => '/Token.php',198 'php_token_throw' => '/Token.php',199 'php_token_tilde' => '/Token.php',200 'php_token_trait' => '/Token.php',201 'php_token_trait_c' => '/Token.php',202 'php_token_try' => '/Token.php',203 'php_token_unset' => '/Token.php',204 'php_token_unset_cast' => '/Token.php',205 'php_token_use' => '/Token.php',206 'php_token_var' => '/Token.php',207 'php_token_variable' => '/Token.php',208 'php_token_while' => '/Token.php',209 'php_token_whitespace' => '/Token.php',210 'php_token_xor_equal' => '/Token.php',211 'php_tokenwithscope' => '/Token.php',212 'php_tokenwithscopeandvisibility' => '/Token.php'213 );214 $path = dirname(dirname(dirname(__FILE__)));215 }216 $cn = strtolower($class);217 if (isset($classes[$cn])) {218 require $path . $classes[$cn];219 }220 }221);...

Full Screen

Full Screen

Token

Using AI Code Generation

copy

Full Screen

1require_once 'Gherkin/Token.php';2require_once 'Gherkin/Lexer.php';3require_once 'Gherkin/Parser.php';4require_once 'Gherkin/Feature.php';5require_once 'Gherkin/Scenario.php';6require_once 'Gherkin/Step.php';7require_once 'Gherkin/Gherkin.php';8require_once 'Gherkin/Exception.php';9require_once 'Gherkin/Exception/ParserException.php';10require_once 'Gherkin/Exception/ParserException/UnexpectedTokenException.php';11require_once 'Gherkin/Exception/ParserException/UnexpectedEOFException.php';12require_once 'Gherkin/Exception/ParserException/UnexpectedIndentException.php';13require_once 'Gherkin/Exception/ParserException/InvalidLanguageException.php';14require_once 'Gherkin/Exception/ParserException/InvalidFeatureException.php';15require_once 'Gherkin/Exception/ParserException/InvalidScenarioException.php';16require_once 'Gherkin/Exception/ParserException/InvalidStepException.php';17require_once 'Gherkin/Exception/ParserException/InvalidTagException.php';18require_once 'Gherkin/Exception/ParserException/InvalidTableException.php';

Full Screen

Full Screen

Token

Using AI Code Generation

copy

Full Screen

1require_once('vendor/autoload.php');2use Behat\Gherkin\Gherkin;3use Behat\Gherkin\Keywords\KeywordsInterface;4use Behat\Gherkin\Keywords\ArrayKeywords;5use Behat\Gherkin\Lexer;6use Behat\Gherkin\Parser;7use Behat\Gherkin\Node\FeatureNode;8use Behat\Gherkin\Node\ScenarioNode;9use Behat\Gherkin\Node\ScenarioOutlineNode;10use Behat\Gherkin\Node\StepNode;11use Behat\Gherkin\Node\TableNode;12use Behat\Gherkin\Node\PyStringNode;13use Behat\Gherkin\Node\BackgroundNode;

Full Screen

Full Screen

Token

Using AI Code Generation

copy

Full Screen

1use Behat\Gherkin\Token;2use Behat\Gherkin\TokenMatcher;3use Behat\Gherkin\Token;4use Behat\Gherkin\TokenMatcher;5use Behat\Gherkin\Token;6use Behat\Gherkin\TokenMatcher;7use Behat\Gherkin\Token;8use Behat\Gherkin\TokenMatcher;9use Behat\Gherkin\Token;10use Behat\Gherkin\TokenMatcher;11use Behat\Gherkin\Token;12use Behat\Gherkin\TokenMatcher;13use Behat\Gherkin\Token;14use Behat\Gherkin\TokenMatcher;15use Behat\Gherkin\Token;16use Behat\Gherkin\TokenMatcher;17use Behat\Gherkin\Token;18use Behat\Gherkin\TokenMatcher;19use Behat\Gherkin\Token;

Full Screen

Full Screen

Token

Using AI Code Generation

copy

Full Screen

1require_once('Token.php');2require_once('TokenScanner.php');3require_once('Gherkin.php');4require_once('Parser.php');5require_once('Feature.php');6require_once('Scenario.php');7require_once('Step.php');8require_once('GherkinException.php');9require_once('GherkinFormatter.php');10require_once('GherkinFormatterInterface.php');11require_once('GherkinFormatterJson.php');12require_once('GherkinFormatterPretty.php');13require_once('GherkinFormatterProgress.php');14require_once('GherkinFormatterSnippets.php');15require_once('GherkinFormatterXml.php');16require_once('GherkinFormatterYaml.php');17require_once('GherkinListener.php');18require_once('GherkinListenerInterface.php');19require_once('GherkinLexer.php');20require_once('GherkinLexerInterface.php');21require_once('GherkinLexerEn.php');22require_once('

Full Screen

Full Screen

Token

Using AI Code Generation

copy

Full Screen

1require 'vendor/autoload.php';2use Behat\Gherkin\Token;3use Behat\Gherkin\TokenMatcher;4use Behat\Gherkin\TokenScanner;5use Behat\Gherkin\TokenQueue;6use Behat\Gherkin\Parser;7use Behat\Gherkin\Lexer;8use Behat\Gherkin\Gherkin;9use Behat\Gherkin\Keywords\KeywordsInterface;10use Behat\Gherkin\Keywords\ArrayKeywords;11use Behat\Gherkin\Keywords\Keywords;12use Behat\Gherkin\Keywords\KeywordsEn;13use Behat\Gherkin\Keywords\KeywordsFr;14use Behat\Gherkin\Keywords\KeywordsJa;15use Behat\Gherkin\Keywords\KeywordsZh;16use Behat\Gherkin\Keywords\KeywordsRu;17use Behat\Gherkin\Keywords\KeywordsDe;18use Behat\Gherkin\Keywords\KeywordsEs;19use Behat\Gherkin\Keywords\KeywordsIt;20use Behat\Gherkin\Keywords\KeywordsKo;

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Gherkin-php automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used methods in Token

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful