WSDL\Lexer\TokenObject::create PHP Method

create() public static method

public static create ( string $name, string $value ) : TokenObject
$name string
$value string
return TokenObject
    public static function create($name, $value)
    {
        return new self($name, $value);
    }

Usage Example

コード例 #1
0
ファイル: Tokenizer.php プロジェクト: piotrooo/wsdl-creator
 /**
  * @param string $string
  * @return array
  * @throws Exception
  */
 public function lex($string)
 {
     $tokens = array();
     $offset = 0;
     while (isset($string[$offset])) {
         foreach (self::$tokenMap as $regex => $token) {
             if (preg_match($regex, $string, $matches, null, $offset)) {
                 $tokens[] = TokenObject::create($token, trim($matches[0]));
                 $offset += strlen($matches[0]);
                 continue 2;
             }
         }
         throw new Exception(sprintf('Unexpected character: >%s< offset >%d<', $string[$offset], $offset));
     }
     $tokens[] = TokenObject::create(Token::EOF, 'eof');
     return $tokens;
 }