VerifyNameNode() закрытый публичный статический Метод

final public static VerifyNameNode ( $Node )
Пример #1
0
 public function leaveNode(\PHPParser_Node $Node)
 {
     switch (true) {
         //Field
         case $Node instanceof \PHPParser_Node_Expr_PropertyFetch:
             $Name = AST::VerifyNameNode($Node->name);
             $this->AccessorBuilder->{$Name};
             break;
             //Method
         //Method
         case $Node instanceof \PHPParser_Node_Expr_MethodCall:
             $Name = AST::VerifyNameNode($Node->name);
             $this->AccessorBuilder->{$Name}();
             break;
             //Indexor
         //Indexor
         case $Node instanceof \PHPParser_Node_Expr_ArrayDimFetch:
             if (!$Node->dim instanceof PHPParserConstantValueNode) {
                 throw new \Storm\Drivers\Fluent\Object\Functional\ASTException('Property indexor must be a constant value');
             }
             $this->AccessorBuilder[$this->GetNodeValue($Node->dim)];
             break;
             //Invocation
         //Invocation
         case $Node instanceof \PHPParser_Node_Expr_FuncCall:
             if ($Node->name instanceof \PHPParser_Node_Expr_Variable && $Node->name->name === $this->EntityVariableName) {
                 $this->AccessorBuilder();
             }
             break;
         default:
             return;
     }
 }
 public function leaveNode(\PHPParser_Node $Node)
 {
     switch (true) {
         case $Node instanceof \PHPParser_Node_Expr_Variable:
             $Name = AST::VerifyNameNode($Node->name);
             $this->UnresolvedVariables[$Name] = true;
     }
 }
 public function leaveNode(\PHPParser_Node $Node)
 {
     switch (true) {
         case $Node instanceof \PHPParser_Node_Expr_Variable:
             $Name = AST::VerifyNameNode($Node->name);
             if (isset($this->VariableValueMap[$Name])) {
                 return new PHPParserConstantValueNode($this->VariableValueMap[$Name]);
             }
     }
 }
 private function GetConstantValue(\PHPParser_Node $Node, &$IsConstant)
 {
     switch (true) {
         case $Node instanceof PHPParserConstantValueNode:
             return $Node->Value;
         case $Node instanceof \PHPParser_Node_Scalar_DNumber:
         case $Node instanceof \PHPParser_Node_Scalar_LNumber:
         case $Node instanceof \PHPParser_Node_Scalar_String:
             $Value = $Node->value;
             break;
         case $Node instanceof \PHPParser_Node_Expr_ConstFetch:
             $Value = constant($Node->name);
             break;
         case $Node instanceof \PHPParser_Node_Expr_ClassConstFetch:
             $Value = constant($Node->class . '::' . $Node->name);
             break;
         case $Node instanceof \PHPParser_Node_Expr_StaticPropertyFetch:
             $Name = AST::VerifyNameNode($Node->class);
             $ClassName = (string) $Node->class;
             $Value = $ClassName::${$Node->name};
             break;
         case $Node instanceof \PHPParser_Node_Expr_Array:
             $Value = [];
             foreach ($Node->items as $Key => $Item) {
                 $IsKeyConstant = true;
                 $IsValueConstant = true;
                 $Key = $Item->key === null ? null : $this->GetConstantValue($Item->key, $IsKeyConstant);
                 $ItemValue = $this->GetConstantValue($Item->value, $IsValueConstant);
                 if (!$IsKeyConstant || !$IsValueConstant) {
                     $IsConstant = false;
                     return;
                 }
                 $Key !== null ? $Value[$Key] = $ItemValue : ($Value[] = $ItemValue);
             }
             break;
         default:
             $IsConstant = false;
             return;
     }
     $IsConstant = true;
     return $Value;
 }
 private function VerifyVariableNode(\PHPParser_Node_Expr_Variable $Node)
 {
     AST::VerifyNameNode($Node->name);
 }