http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/lib/PHPParser/PrettyPrinter/Default.php ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/lib/PHPParser/PrettyPrinter/Default.php b/vendor/nikic/php-parser/lib/PHPParser/PrettyPrinter/Default.php deleted file mode 100644 index 416ea3f..0000000 --- a/vendor/nikic/php-parser/lib/PHPParser/PrettyPrinter/Default.php +++ /dev/null @@ -1,725 +0,0 @@ -<?php - -class PHPParser_PrettyPrinter_Default extends PHPParser_PrettyPrinterAbstract -{ - // Special nodes - - public function pParam(PHPParser_Node_Param $node) { - return ($node->type ? (is_string($node->type) ? $node->type : $this->p($node->type)) . ' ' : '') - . ($node->byRef ? '&' : '') - . '$' . $node->name - . ($node->default ? ' = ' . $this->p($node->default) : ''); - } - - public function pArg(PHPParser_Node_Arg $node) { - return ($node->byRef ? '&' : '') . $this->p($node->value); - } - - public function pConst(PHPParser_Node_Const $node) { - return $node->name . ' = ' . $this->p($node->value); - } - - // Names - - public function pName(PHPParser_Node_Name $node) { - return implode('\\', $node->parts); - } - - public function pName_FullyQualified(PHPParser_Node_Name_FullyQualified $node) { - return '\\' . implode('\\', $node->parts); - } - - public function pName_Relative(PHPParser_Node_Name_Relative $node) { - return 'namespace\\' . implode('\\', $node->parts); - } - - // Magic Constants - - public function pScalar_ClassConst(PHPParser_Node_Scalar_ClassConst $node) { - return '__CLASS__'; - } - - public function pScalar_TraitConst(PHPParser_Node_Scalar_TraitConst $node) { - return '__TRAIT__'; - } - - public function pScalar_DirConst(PHPParser_Node_Scalar_DirConst $node) { - return '__DIR__'; - } - - public function pScalar_FileConst(PHPParser_Node_Scalar_FileConst $node) { - return '__FILE__'; - } - - public function pScalar_FuncConst(PHPParser_Node_Scalar_FuncConst $node) { - return '__FUNCTION__'; - } - - public function pScalar_LineConst(PHPParser_Node_Scalar_LineConst $node) { - return '__LINE__'; - } - - public function pScalar_MethodConst(PHPParser_Node_Scalar_MethodConst $node) { - return '__METHOD__'; - } - - public function pScalar_NSConst(PHPParser_Node_Scalar_NSConst $node) { - return '__NAMESPACE__'; - } - - // Scalars - - public function pScalar_String(PHPParser_Node_Scalar_String $node) { - return '\'' . $this->pNoIndent(addcslashes($node->value, '\'\\')) . '\''; - } - - public function pScalar_Encapsed(PHPParser_Node_Scalar_Encapsed $node) { - return '"' . $this->pEncapsList($node->parts, '"') . '"'; - } - - public function pScalar_LNumber(PHPParser_Node_Scalar_LNumber $node) { - return (string) $node->value; - } - - public function pScalar_DNumber(PHPParser_Node_Scalar_DNumber $node) { - $stringValue = (string) $node->value; - - // ensure that number is really printed as float - return ctype_digit($stringValue) ? $stringValue . '.0' : $stringValue; - } - - // Assignments - - public function pExpr_Assign(PHPParser_Node_Expr_Assign $node) { - return $this->pInfixOp('Expr_Assign', $node->var, ' = ', $node->expr); - } - - public function pExpr_AssignRef(PHPParser_Node_Expr_AssignRef $node) { - return $this->pInfixOp('Expr_AssignRef', $node->var, ' =& ', $node->expr); - } - - public function pExpr_AssignPlus(PHPParser_Node_Expr_AssignPlus $node) { - return $this->pInfixOp('Expr_AssignPlus', $node->var, ' += ', $node->expr); - } - - public function pExpr_AssignMinus(PHPParser_Node_Expr_AssignMinus $node) { - return $this->pInfixOp('Expr_AssignMinus', $node->var, ' -= ', $node->expr); - } - - public function pExpr_AssignMul(PHPParser_Node_Expr_AssignMul $node) { - return $this->pInfixOp('Expr_AssignMul', $node->var, ' *= ', $node->expr); - } - - public function pExpr_AssignDiv(PHPParser_Node_Expr_AssignDiv $node) { - return $this->pInfixOp('Expr_AssignDiv', $node->var, ' /= ', $node->expr); - } - - public function pExpr_AssignConcat(PHPParser_Node_Expr_AssignConcat $node) { - return $this->pInfixOp('Expr_AssignConcat', $node->var, ' .= ', $node->expr); - } - - public function pExpr_AssignMod(PHPParser_Node_Expr_AssignMod $node) { - return $this->pInfixOp('Expr_AssignMod', $node->var, ' %= ', $node->expr); - } - - public function pExpr_AssignBitwiseAnd(PHPParser_Node_Expr_AssignBitwiseAnd $node) { - return $this->pInfixOp('Expr_AssignBitwiseAnd', $node->var, ' &= ', $node->expr); - } - - public function pExpr_AssignBitwiseOr(PHPParser_Node_Expr_AssignBitwiseOr $node) { - return $this->pInfixOp('Expr_AssignBitwiseOr', $node->var, ' |= ', $node->expr); - } - - public function pExpr_AssignBitwiseXor(PHPParser_Node_Expr_AssignBitwiseXor $node) { - return $this->pInfixOp('Expr_AssignBitwiseXor', $node->var, ' ^= ', $node->expr); - } - - public function pExpr_AssignShiftLeft(PHPParser_Node_Expr_AssignShiftLeft $node) { - return $this->pInfixOp('Expr_AssignShiftLeft', $node->var, ' <<= ', $node->expr); - } - - public function pExpr_AssignShiftRight(PHPParser_Node_Expr_AssignShiftRight $node) { - return $this->pInfixOp('Expr_AssignShiftRight', $node->var, ' >>= ', $node->expr); - } - - // Binary expressions - - public function pExpr_Plus(PHPParser_Node_Expr_Plus $node) { - return $this->pInfixOp('Expr_Plus', $node->left, ' + ', $node->right); - } - - public function pExpr_Minus(PHPParser_Node_Expr_Minus $node) { - return $this->pInfixOp('Expr_Minus', $node->left, ' - ', $node->right); - } - - public function pExpr_Mul(PHPParser_Node_Expr_Mul $node) { - return $this->pInfixOp('Expr_Mul', $node->left, ' * ', $node->right); - } - - public function pExpr_Div(PHPParser_Node_Expr_Div $node) { - return $this->pInfixOp('Expr_Div', $node->left, ' / ', $node->right); - } - - public function pExpr_Concat(PHPParser_Node_Expr_Concat $node) { - return $this->pInfixOp('Expr_Concat', $node->left, ' . ', $node->right); - } - - public function pExpr_Mod(PHPParser_Node_Expr_Mod $node) { - return $this->pInfixOp('Expr_Mod', $node->left, ' % ', $node->right); - } - - public function pExpr_BooleanAnd(PHPParser_Node_Expr_BooleanAnd $node) { - return $this->pInfixOp('Expr_BooleanAnd', $node->left, ' && ', $node->right); - } - - public function pExpr_BooleanOr(PHPParser_Node_Expr_BooleanOr $node) { - return $this->pInfixOp('Expr_BooleanOr', $node->left, ' || ', $node->right); - } - - public function pExpr_BitwiseAnd(PHPParser_Node_Expr_BitwiseAnd $node) { - return $this->pInfixOp('Expr_BitwiseAnd', $node->left, ' & ', $node->right); - } - - public function pExpr_BitwiseOr(PHPParser_Node_Expr_BitwiseOr $node) { - return $this->pInfixOp('Expr_BitwiseOr', $node->left, ' | ', $node->right); - } - - public function pExpr_BitwiseXor(PHPParser_Node_Expr_BitwiseXor $node) { - return $this->pInfixOp('Expr_BitwiseXor', $node->left, ' ^ ', $node->right); - } - - public function pExpr_ShiftLeft(PHPParser_Node_Expr_ShiftLeft $node) { - return $this->pInfixOp('Expr_ShiftLeft', $node->left, ' << ', $node->right); - } - - public function pExpr_ShiftRight(PHPParser_Node_Expr_ShiftRight $node) { - return $this->pInfixOp('Expr_ShiftRight', $node->left, ' >> ', $node->right); - } - - public function pExpr_LogicalAnd(PHPParser_Node_Expr_LogicalAnd $node) { - return $this->pInfixOp('Expr_LogicalAnd', $node->left, ' and ', $node->right); - } - - public function pExpr_LogicalOr(PHPParser_Node_Expr_LogicalOr $node) { - return $this->pInfixOp('Expr_LogicalOr', $node->left, ' or ', $node->right); - } - - public function pExpr_LogicalXor(PHPParser_Node_Expr_LogicalXor $node) { - return $this->pInfixOp('Expr_LogicalXor', $node->left, ' xor ', $node->right); - } - - public function pExpr_Equal(PHPParser_Node_Expr_Equal $node) { - return $this->pInfixOp('Expr_Equal', $node->left, ' == ', $node->right); - } - - public function pExpr_NotEqual(PHPParser_Node_Expr_NotEqual $node) { - return $this->pInfixOp('Expr_NotEqual', $node->left, ' != ', $node->right); - } - - public function pExpr_Identical(PHPParser_Node_Expr_Identical $node) { - return $this->pInfixOp('Expr_Identical', $node->left, ' === ', $node->right); - } - - public function pExpr_NotIdentical(PHPParser_Node_Expr_NotIdentical $node) { - return $this->pInfixOp('Expr_NotIdentical', $node->left, ' !== ', $node->right); - } - - public function pExpr_Greater(PHPParser_Node_Expr_Greater $node) { - return $this->pInfixOp('Expr_Greater', $node->left, ' > ', $node->right); - } - - public function pExpr_GreaterOrEqual(PHPParser_Node_Expr_GreaterOrEqual $node) { - return $this->pInfixOp('Expr_GreaterOrEqual', $node->left, ' >= ', $node->right); - } - - public function pExpr_Smaller(PHPParser_Node_Expr_Smaller $node) { - return $this->pInfixOp('Expr_Smaller', $node->left, ' < ', $node->right); - } - - public function pExpr_SmallerOrEqual(PHPParser_Node_Expr_SmallerOrEqual $node) { - return $this->pInfixOp('Expr_SmallerOrEqual', $node->left, ' <= ', $node->right); - } - - public function pExpr_Instanceof(PHPParser_Node_Expr_Instanceof $node) { - return $this->pInfixOp('Expr_Instanceof', $node->expr, ' instanceof ', $node->class); - } - - // Unary expressions - - public function pExpr_BooleanNot(PHPParser_Node_Expr_BooleanNot $node) { - return $this->pPrefixOp('Expr_BooleanNot', '!', $node->expr); - } - - public function pExpr_BitwiseNot(PHPParser_Node_Expr_BitwiseNot $node) { - return $this->pPrefixOp('Expr_BitwiseNot', '~', $node->expr); - } - - public function pExpr_UnaryMinus(PHPParser_Node_Expr_UnaryMinus $node) { - return $this->pPrefixOp('Expr_UnaryMinus', '-', $node->expr); - } - - public function pExpr_UnaryPlus(PHPParser_Node_Expr_UnaryPlus $node) { - return $this->pPrefixOp('Expr_UnaryPlus', '+', $node->expr); - } - - public function pExpr_PreInc(PHPParser_Node_Expr_PreInc $node) { - return $this->pPrefixOp('Expr_PreInc', '++', $node->var); - } - - public function pExpr_PreDec(PHPParser_Node_Expr_PreDec $node) { - return $this->pPrefixOp('Expr_PreDec', '--', $node->var); - } - - public function pExpr_PostInc(PHPParser_Node_Expr_PostInc $node) { - return $this->pPostfixOp('Expr_PostInc', $node->var, '++'); - } - - public function pExpr_PostDec(PHPParser_Node_Expr_PostDec $node) { - return $this->pPostfixOp('Expr_PostDec', $node->var, '--'); - } - - public function pExpr_ErrorSuppress(PHPParser_Node_Expr_ErrorSuppress $node) { - return $this->pPrefixOp('Expr_ErrorSuppress', '@', $node->expr); - } - - // Casts - - public function pExpr_Cast_Int(PHPParser_Node_Expr_Cast_Int $node) { - return $this->pPrefixOp('Expr_Cast_Int', '(int) ', $node->expr); - } - - public function pExpr_Cast_Double(PHPParser_Node_Expr_Cast_Double $node) { - return $this->pPrefixOp('Expr_Cast_Double', '(double) ', $node->expr); - } - - public function pExpr_Cast_String(PHPParser_Node_Expr_Cast_String $node) { - return $this->pPrefixOp('Expr_Cast_String', '(string) ', $node->expr); - } - - public function pExpr_Cast_Array(PHPParser_Node_Expr_Cast_Array $node) { - return $this->pPrefixOp('Expr_Cast_Array', '(array) ', $node->expr); - } - - public function pExpr_Cast_Object(PHPParser_Node_Expr_Cast_Object $node) { - return $this->pPrefixOp('Expr_Cast_Object', '(object) ', $node->expr); - } - - public function pExpr_Cast_Bool(PHPParser_Node_Expr_Cast_Bool $node) { - return $this->pPrefixOp('Expr_Cast_Bool', '(bool) ', $node->expr); - } - - public function pExpr_Cast_Unset(PHPParser_Node_Expr_Cast_Unset $node) { - return $this->pPrefixOp('Expr_Cast_Unset', '(unset) ', $node->expr); - } - - // Function calls and similar constructs - - public function pExpr_FuncCall(PHPParser_Node_Expr_FuncCall $node) { - return $this->p($node->name) . '(' . $this->pCommaSeparated($node->args) . ')'; - } - - public function pExpr_MethodCall(PHPParser_Node_Expr_MethodCall $node) { - return $this->pVarOrNewExpr($node->var) . '->' . $this->pObjectProperty($node->name) - . '(' . $this->pCommaSeparated($node->args) . ')'; - } - - public function pExpr_StaticCall(PHPParser_Node_Expr_StaticCall $node) { - return $this->p($node->class) . '::' - . ($node->name instanceof PHPParser_Node_Expr - ? ($node->name instanceof PHPParser_Node_Expr_Variable - || $node->name instanceof PHPParser_Node_Expr_ArrayDimFetch - ? $this->p($node->name) - : '{' . $this->p($node->name) . '}') - : $node->name) - . '(' . $this->pCommaSeparated($node->args) . ')'; - } - - public function pExpr_Empty(PHPParser_Node_Expr_Empty $node) { - return 'empty(' . $this->p($node->expr) . ')'; - } - - public function pExpr_Isset(PHPParser_Node_Expr_Isset $node) { - return 'isset(' . $this->pCommaSeparated($node->vars) . ')'; - } - - public function pExpr_Print(PHPParser_Node_Expr_Print $node) { - return 'print ' . $this->p($node->expr); - } - - public function pExpr_Eval(PHPParser_Node_Expr_Eval $node) { - return 'eval(' . $this->p($node->expr) . ')'; - } - - public function pExpr_Include(PHPParser_Node_Expr_Include $node) { - static $map = array( - PHPParser_Node_Expr_Include::TYPE_INCLUDE => 'include', - PHPParser_Node_Expr_Include::TYPE_INCLUDE_ONCE => 'include_once', - PHPParser_Node_Expr_Include::TYPE_REQUIRE => 'require', - PHPParser_Node_Expr_Include::TYPE_REQUIRE_ONCE => 'require_once', - ); - - return $map[$node->type] . ' ' . $this->p($node->expr); - } - - public function pExpr_List(PHPParser_Node_Expr_List $node) { - $pList = array(); - foreach ($node->vars as $var) { - if (null === $var) { - $pList[] = ''; - } else { - $pList[] = $this->p($var); - } - } - - return 'list(' . implode(', ', $pList) . ')'; - } - - // Other - - public function pExpr_Variable(PHPParser_Node_Expr_Variable $node) { - if ($node->name instanceof PHPParser_Node_Expr) { - return '${' . $this->p($node->name) . '}'; - } else { - return '$' . $node->name; - } - } - - public function pExpr_Array(PHPParser_Node_Expr_Array $node) { - return 'array(' . $this->pCommaSeparated($node->items) . ')'; - } - - public function pExpr_ArrayItem(PHPParser_Node_Expr_ArrayItem $node) { - return (null !== $node->key ? $this->p($node->key) . ' => ' : '') - . ($node->byRef ? '&' : '') . $this->p($node->value); - } - - public function pExpr_ArrayDimFetch(PHPParser_Node_Expr_ArrayDimFetch $node) { - return $this->pVarOrNewExpr($node->var) - . '[' . (null !== $node->dim ? $this->p($node->dim) : '') . ']'; - } - - public function pExpr_ConstFetch(PHPParser_Node_Expr_ConstFetch $node) { - return $this->p($node->name); - } - - public function pExpr_ClassConstFetch(PHPParser_Node_Expr_ClassConstFetch $node) { - return $this->p($node->class) . '::' . $node->name; - } - - public function pExpr_PropertyFetch(PHPParser_Node_Expr_PropertyFetch $node) { - return $this->pVarOrNewExpr($node->var) . '->' . $this->pObjectProperty($node->name); - } - - public function pExpr_StaticPropertyFetch(PHPParser_Node_Expr_StaticPropertyFetch $node) { - return $this->p($node->class) . '::$' . $this->pObjectProperty($node->name); - } - - public function pExpr_ShellExec(PHPParser_Node_Expr_ShellExec $node) { - return '`' . $this->pEncapsList($node->parts, '`') . '`'; - } - - public function pExpr_Closure(PHPParser_Node_Expr_Closure $node) { - return ($node->static ? 'static ' : '') - . 'function ' . ($node->byRef ? '&' : '') - . '(' . $this->pCommaSeparated($node->params) . ')' - . (!empty($node->uses) ? ' use(' . $this->pCommaSeparated($node->uses) . ')': '') - . ' {' . "\n" . $this->pStmts($node->stmts) . "\n" . '}'; - } - - public function pExpr_ClosureUse(PHPParser_Node_Expr_ClosureUse $node) { - return ($node->byRef ? '&' : '') . '$' . $node->var; - } - - public function pExpr_New(PHPParser_Node_Expr_New $node) { - return 'new ' . $this->p($node->class) . '(' . $this->pCommaSeparated($node->args) . ')'; - } - - public function pExpr_Clone(PHPParser_Node_Expr_Clone $node) { - return 'clone ' . $this->p($node->expr); - } - - public function pExpr_Ternary(PHPParser_Node_Expr_Ternary $node) { - // a bit of cheating: we treat the ternary as a binary op where the ?...: part is the operator. - // this is okay because the part between ? and : never needs parentheses. - return $this->pInfixOp('Expr_Ternary', - $node->cond, ' ?' . (null !== $node->if ? ' ' . $this->p($node->if) . ' ' : '') . ': ', $node->else - ); - } - - public function pExpr_Exit(PHPParser_Node_Expr_Exit $node) { - return 'die' . (null !== $node->expr ? '(' . $this->p($node->expr) . ')' : ''); - } - - public function pExpr_Yield(PHPParser_Node_Expr_Yield $node) { - if ($node->value === null) { - return 'yield'; - } else { - // this is a bit ugly, but currently there is no way to detect whether the parentheses are necessary - return '(yield ' - . ($node->key !== null ? $this->p($node->key) . ' => ' : '') - . $this->p($node->value) - . ')'; - } - } - - // Declarations - - public function pStmt_Namespace(PHPParser_Node_Stmt_Namespace $node) { - if ($this->canUseSemicolonNamespaces) { - return 'namespace ' . $this->p($node->name) . ';' . "\n\n" . $this->pStmts($node->stmts, false); - } else { - return 'namespace' . (null !== $node->name ? ' ' . $this->p($node->name) : '') - . ' {' . "\n" . $this->pStmts($node->stmts) . "\n" . '}'; - } - } - - public function pStmt_Use(PHPParser_Node_Stmt_Use $node) { - return 'use ' . $this->pCommaSeparated($node->uses) . ';'; - } - - public function pStmt_UseUse(PHPParser_Node_Stmt_UseUse $node) { - return $this->p($node->name) - . ($node->name->getLast() !== $node->alias ? ' as ' . $node->alias : ''); - } - - public function pStmt_Interface(PHPParser_Node_Stmt_Interface $node) { - return 'interface ' . $node->name - . (!empty($node->extends) ? ' extends ' . $this->pCommaSeparated($node->extends) : '') - . "\n" . '{' . "\n" . $this->pStmts($node->stmts) . "\n" . '}'; - } - - public function pStmt_Class(PHPParser_Node_Stmt_Class $node) { - return $this->pModifiers($node->type) - . 'class ' . $node->name - . (null !== $node->extends ? ' extends ' . $this->p($node->extends) : '') - . (!empty($node->implements) ? ' implements ' . $this->pCommaSeparated($node->implements) : '') - . "\n" . '{' . "\n" . $this->pStmts($node->stmts) . "\n" . '}'; - } - - public function pStmt_Trait(PHPParser_Node_Stmt_Trait $node) { - return 'trait ' . $node->name - . "\n" . '{' . "\n" . $this->pStmts($node->stmts) . "\n" . '}'; - } - - public function pStmt_TraitUse(PHPParser_Node_Stmt_TraitUse $node) { - return 'use ' . $this->pCommaSeparated($node->traits) - . (empty($node->adaptations) - ? ';' - : ' {' . "\n" . $this->pStmts($node->adaptations) . "\n" . '}'); - } - - public function pStmt_TraitUseAdaptation_Precedence(PHPParser_Node_Stmt_TraitUseAdaptation_Precedence $node) { - return $this->p($node->trait) . '::' . $node->method - . ' insteadof ' . $this->pCommaSeparated($node->insteadof) . ';'; - } - - public function pStmt_TraitUseAdaptation_Alias(PHPParser_Node_Stmt_TraitUseAdaptation_Alias $node) { - return (null !== $node->trait ? $this->p($node->trait) . '::' : '') - . $node->method . ' as' - . (null !== $node->newModifier ? ' ' . $this->pModifiers($node->newModifier) : '') - . (null !== $node->newName ? ' ' . $node->newName : '') - . ';'; - } - - public function pStmt_Property(PHPParser_Node_Stmt_Property $node) { - return $this->pModifiers($node->type) . $this->pCommaSeparated($node->props) . ';'; - } - - public function pStmt_PropertyProperty(PHPParser_Node_Stmt_PropertyProperty $node) { - return '$' . $node->name - . (null !== $node->default ? ' = ' . $this->p($node->default) : ''); - } - - public function pStmt_ClassMethod(PHPParser_Node_Stmt_ClassMethod $node) { - return $this->pModifiers($node->type) - . 'function ' . ($node->byRef ? '&' : '') . $node->name - . '(' . $this->pCommaSeparated($node->params) . ')' - . (null !== $node->stmts - ? "\n" . '{' . "\n" . $this->pStmts($node->stmts) . "\n" . '}' - : ';'); - } - - public function pStmt_ClassConst(PHPParser_Node_Stmt_ClassConst $node) { - return 'const ' . $this->pCommaSeparated($node->consts) . ';'; - } - - public function pStmt_Function(PHPParser_Node_Stmt_Function $node) { - return 'function ' . ($node->byRef ? '&' : '') . $node->name - . '(' . $this->pCommaSeparated($node->params) . ')' - . "\n" . '{' . "\n" . $this->pStmts($node->stmts) . "\n" . '}'; - } - - public function pStmt_Const(PHPParser_Node_Stmt_Const $node) { - return 'const ' . $this->pCommaSeparated($node->consts) . ';'; - } - - public function pStmt_Declare(PHPParser_Node_Stmt_Declare $node) { - return 'declare (' . $this->pCommaSeparated($node->declares) . ') {' - . "\n" . $this->pStmts($node->stmts) . "\n" . '}'; - } - - public function pStmt_DeclareDeclare(PHPParser_Node_Stmt_DeclareDeclare $node) { - return $node->key . ' = ' . $this->p($node->value); - } - - // Control flow - - public function pStmt_If(PHPParser_Node_Stmt_If $node) { - return 'if (' . $this->p($node->cond) . ') {' - . "\n" . $this->pStmts($node->stmts) . "\n" . '}' - . $this->pImplode($node->elseifs) - . (null !== $node->else ? $this->p($node->else) : ''); - } - - public function pStmt_ElseIf(PHPParser_Node_Stmt_ElseIf $node) { - return ' elseif (' . $this->p($node->cond) . ') {' - . "\n" . $this->pStmts($node->stmts) . "\n" . '}'; - } - - public function pStmt_Else(PHPParser_Node_Stmt_Else $node) { - return ' else {' . "\n" . $this->pStmts($node->stmts) . "\n" . '}'; - } - - public function pStmt_For(PHPParser_Node_Stmt_For $node) { - return 'for (' - . $this->pCommaSeparated($node->init) . ';' . (!empty($node->cond) ? ' ' : '') - . $this->pCommaSeparated($node->cond) . ';' . (!empty($node->loop) ? ' ' : '') - . $this->pCommaSeparated($node->loop) - . ') {' . "\n" . $this->pStmts($node->stmts) . "\n" . '}'; - } - - public function pStmt_Foreach(PHPParser_Node_Stmt_Foreach $node) { - return 'foreach (' . $this->p($node->expr) . ' as ' - . (null !== $node->keyVar ? $this->p($node->keyVar) . ' => ' : '') - . ($node->byRef ? '&' : '') . $this->p($node->valueVar) . ') {' - . "\n" . $this->pStmts($node->stmts) . "\n" . '}'; - } - - public function pStmt_While(PHPParser_Node_Stmt_While $node) { - return 'while (' . $this->p($node->cond) . ') {' - . "\n" . $this->pStmts($node->stmts) . "\n" . '}'; - } - - public function pStmt_Do(PHPParser_Node_Stmt_Do $node) { - return 'do {' . "\n" . $this->pStmts($node->stmts) . "\n" - . '} while (' . $this->p($node->cond) . ');'; - } - - public function pStmt_Switch(PHPParser_Node_Stmt_Switch $node) { - return 'switch (' . $this->p($node->cond) . ') {' - . "\n" . $this->pStmts($node->cases) . "\n" . '}'; - } - - public function pStmt_Case(PHPParser_Node_Stmt_Case $node) { - return (null !== $node->cond ? 'case ' . $this->p($node->cond) : 'default') . ':' - . ($node->stmts ? "\n" . $this->pStmts($node->stmts) : ''); - } - - public function pStmt_TryCatch(PHPParser_Node_Stmt_TryCatch $node) { - return 'try {' . "\n" . $this->pStmts($node->stmts) . "\n" . '}' - . $this->pImplode($node->catches) - . ($node->finallyStmts !== null - ? ' finally {' . "\n" . $this->pStmts($node->finallyStmts) . "\n" . '}' - : ''); - } - - public function pStmt_Catch(PHPParser_Node_Stmt_Catch $node) { - return ' catch (' . $this->p($node->type) . ' $' . $node->var . ') {' - . "\n" . $this->pStmts($node->stmts) . "\n" . '}'; - } - - public function pStmt_Break(PHPParser_Node_Stmt_Break $node) { - return 'break' . ($node->num !== null ? ' ' . $this->p($node->num) : '') . ';'; - } - - public function pStmt_Continue(PHPParser_Node_Stmt_Continue $node) { - return 'continue' . ($node->num !== null ? ' ' . $this->p($node->num) : '') . ';'; - } - - public function pStmt_Return(PHPParser_Node_Stmt_Return $node) { - return 'return' . (null !== $node->expr ? ' ' . $this->p($node->expr) : '') . ';'; - } - - public function pStmt_Throw(PHPParser_Node_Stmt_Throw $node) { - return 'throw ' . $this->p($node->expr) . ';'; - } - - public function pStmt_Label(PHPParser_Node_Stmt_Label $node) { - return $node->name . ':'; - } - - public function pStmt_Goto(PHPParser_Node_Stmt_Goto $node) { - return 'goto ' . $node->name . ';'; - } - - // Other - - public function pStmt_Echo(PHPParser_Node_Stmt_Echo $node) { - return 'echo ' . $this->pCommaSeparated($node->exprs) . ';'; - } - - public function pStmt_Static(PHPParser_Node_Stmt_Static $node) { - return 'static ' . $this->pCommaSeparated($node->vars) . ';'; - } - - public function pStmt_Global(PHPParser_Node_Stmt_Global $node) { - return 'global ' . $this->pCommaSeparated($node->vars) . ';'; - } - - public function pStmt_StaticVar(PHPParser_Node_Stmt_StaticVar $node) { - return '$' . $node->name - . (null !== $node->default ? ' = ' . $this->p($node->default) : ''); - } - - public function pStmt_Unset(PHPParser_Node_Stmt_Unset $node) { - return 'unset(' . $this->pCommaSeparated($node->vars) . ');'; - } - - public function pStmt_InlineHTML(PHPParser_Node_Stmt_InlineHTML $node) { - return '?>' . $this->pNoIndent("\n" . $node->value) . '<?php '; - } - - public function pStmt_HaltCompiler(PHPParser_Node_Stmt_HaltCompiler $node) { - return '__halt_compiler();' . $node->remaining; - } - - // Helpers - - public function pObjectProperty($node) { - if ($node instanceof PHPParser_Node_Expr) { - return '{' . $this->p($node) . '}'; - } else { - return $node; - } - } - - public function pModifiers($modifiers) { - return ($modifiers & PHPParser_Node_Stmt_Class::MODIFIER_PUBLIC ? 'public ' : '') - . ($modifiers & PHPParser_Node_Stmt_Class::MODIFIER_PROTECTED ? 'protected ' : '') - . ($modifiers & PHPParser_Node_Stmt_Class::MODIFIER_PRIVATE ? 'private ' : '') - . ($modifiers & PHPParser_Node_Stmt_Class::MODIFIER_STATIC ? 'static ' : '') - . ($modifiers & PHPParser_Node_Stmt_Class::MODIFIER_ABSTRACT ? 'abstract ' : '') - . ($modifiers & PHPParser_Node_Stmt_Class::MODIFIER_FINAL ? 'final ' : ''); - } - - public function pEncapsList(array $encapsList, $quote) { - $return = ''; - foreach ($encapsList as $element) { - if (is_string($element)) { - $return .= addcslashes($element, "\n\r\t\f\v$" . $quote . "\\"); - } else { - $return .= '{' . $this->p($element) . '}'; - } - } - - return $return; - } - - public function pVarOrNewExpr(PHPParser_Node $node) { - if ($node instanceof PHPParser_Node_Expr_New) { - return '(' . $this->p($node) . ')'; - } else { - return $this->p($node); - } - } -} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/lib/PHPParser/PrettyPrinter/Zend.php ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/lib/PHPParser/PrettyPrinter/Zend.php b/vendor/nikic/php-parser/lib/PHPParser/PrettyPrinter/Zend.php deleted file mode 100644 index f9fd0c4..0000000 --- a/vendor/nikic/php-parser/lib/PHPParser/PrettyPrinter/Zend.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -/** - * This class is only retained for backwards compatibility. Use PHPParser_PrettyPrinter_Default instead. - * - * @deprecated - */ -class PHPParser_PrettyPrinter_Zend extends PHPParser_PrettyPrinter_Default -{ -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/lib/PHPParser/PrettyPrinterAbstract.php ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/lib/PHPParser/PrettyPrinterAbstract.php b/vendor/nikic/php-parser/lib/PHPParser/PrettyPrinterAbstract.php deleted file mode 100644 index def9ea3..0000000 --- a/vendor/nikic/php-parser/lib/PHPParser/PrettyPrinterAbstract.php +++ /dev/null @@ -1,262 +0,0 @@ -<?php - -abstract class PHPParser_PrettyPrinterAbstract -{ - protected $precedenceMap = array( - // [precedence, associativity] where for the latter -1 is %left, 0 is %nonassoc and 1 is %right - 'Expr_BitwiseNot' => array( 1, 1), - 'Expr_PreInc' => array( 1, 1), - 'Expr_PreDec' => array( 1, 1), - 'Expr_PostInc' => array( 1, -1), - 'Expr_PostDec' => array( 1, -1), - 'Expr_UnaryPlus' => array( 1, 1), - 'Expr_UnaryMinus' => array( 1, 1), - 'Expr_Cast_Int' => array( 1, 1), - 'Expr_Cast_Double' => array( 1, 1), - 'Expr_Cast_String' => array( 1, 1), - 'Expr_Cast_Array' => array( 1, 1), - 'Expr_Cast_Object' => array( 1, 1), - 'Expr_Cast_Bool' => array( 1, 1), - 'Expr_Cast_Unset' => array( 1, 1), - 'Expr_ErrorSuppress' => array( 1, 1), - 'Expr_Instanceof' => array( 2, 0), - 'Expr_BooleanNot' => array( 3, 1), - 'Expr_Mul' => array( 4, -1), - 'Expr_Div' => array( 4, -1), - 'Expr_Mod' => array( 4, -1), - 'Expr_Plus' => array( 5, -1), - 'Expr_Minus' => array( 5, -1), - 'Expr_Concat' => array( 5, -1), - 'Expr_ShiftLeft' => array( 6, -1), - 'Expr_ShiftRight' => array( 6, -1), - 'Expr_Smaller' => array( 7, 0), - 'Expr_SmallerOrEqual' => array( 7, 0), - 'Expr_Greater' => array( 7, 0), - 'Expr_GreaterOrEqual' => array( 7, 0), - 'Expr_Equal' => array( 8, 0), - 'Expr_NotEqual' => array( 8, 0), - 'Expr_Identical' => array( 8, 0), - 'Expr_NotIdentical' => array( 8, 0), - 'Expr_BitwiseAnd' => array( 9, -1), - 'Expr_BitwiseXor' => array(10, -1), - 'Expr_BitwiseOr' => array(11, -1), - 'Expr_BooleanAnd' => array(12, -1), - 'Expr_BooleanOr' => array(13, -1), - 'Expr_Ternary' => array(14, -1), - // parser uses %left for assignments, but they really behave as %right - 'Expr_Assign' => array(15, 1), - 'Expr_AssignRef' => array(15, 1), - 'Expr_AssignPlus' => array(15, 1), - 'Expr_AssignMinus' => array(15, 1), - 'Expr_AssignMul' => array(15, 1), - 'Expr_AssignDiv' => array(15, 1), - 'Expr_AssignConcat' => array(15, 1), - 'Expr_AssignMod' => array(15, 1), - 'Expr_AssignBitwiseAnd' => array(15, 1), - 'Expr_AssignBitwiseOr' => array(15, 1), - 'Expr_AssignBitwiseXor' => array(15, 1), - 'Expr_AssignShiftLeft' => array(15, 1), - 'Expr_AssignShiftRight' => array(15, 1), - 'Expr_LogicalAnd' => array(16, -1), - 'Expr_LogicalXor' => array(17, -1), - 'Expr_LogicalOr' => array(18, -1), - 'Expr_Include' => array(19, -1), - ); - - protected $noIndentToken; - protected $canUseSemicolonNamespaces; - - public function __construct() { - $this->noIndentToken = '_NO_INDENT_' . mt_rand(); - } - - /** - * Pretty prints an array of statements. - * - * @param PHPParser_Node[] $stmts Array of statements - * - * @return string Pretty printed statements - */ - public function prettyPrint(array $stmts) { - $this->preprocessNodes($stmts); - - return str_replace("\n" . $this->noIndentToken, "\n", $this->pStmts($stmts, false)); - } - - /** - * Pretty prints an expression. - * - * @param PHPParser_Node_Expr $node Expression node - * - * @return string Pretty printed node - */ - public function prettyPrintExpr(PHPParser_Node_Expr $node) { - return str_replace("\n" . $this->noIndentToken, "\n", $this->p($node)); - } - - /** - * Pretty prints a file of statements (includes the opening <?php tag if it is required). - * - * @param PHPParser_Node[] $stmts Array of statements - * - * @return string Pretty printed statements - */ - public function prettyPrintFile(array $stmts) { - $p = trim($this->prettyPrint($stmts)); - - $p = preg_replace('/^\?>\n?/', '', $p, -1, $count); - $p = preg_replace('/<\?php$/', '', $p); - - if (!$count) { - $p = "<?php\n\n" . $p; - } - - return $p; - } - - /** - * Preprocesses the top-level nodes to initialize pretty printer state. - * - * @param PHPParser_Node[] $nodes Array of nodes - */ - protected function preprocessNodes(array $nodes) { - /* We can use semicolon-namespaces unless there is a global namespace declaration */ - $this->canUseSemicolonNamespaces = true; - foreach ($nodes as $node) { - if ($node instanceof PHPParser_Node_Stmt_Namespace && null === $node->name) { - $this->canUseSemicolonNamespaces = false; - } - } - } - - /** - * Pretty prints an array of nodes (statements) and indents them optionally. - * - * @param PHPParser_Node[] $nodes Array of nodes - * @param bool $indent Whether to indent the printed nodes - * - * @return string Pretty printed statements - */ - protected function pStmts(array $nodes, $indent = true) { - $pNodes = array(); - foreach ($nodes as $node) { - $pNodes[] = $this->pComments($node->getAttribute('comments', array())) - . $this->p($node) - . ($node instanceof PHPParser_Node_Expr ? ';' : ''); - } - - if ($indent) { - return ' ' . preg_replace( - '~\n(?!$|' . $this->noIndentToken . ')~', - "\n" . ' ', - implode("\n", $pNodes) - ); - } else { - return implode("\n", $pNodes); - } - } - - /** - * Pretty prints a node. - * - * @param PHPParser_Node $node Node to be pretty printed - * - * @return string Pretty printed node - */ - protected function p(PHPParser_Node $node) { - return $this->{'p' . $node->getType()}($node); - } - - protected function pInfixOp($type, PHPParser_Node $leftNode, $operatorString, PHPParser_Node $rightNode) { - list($precedence, $associativity) = $this->precedenceMap[$type]; - - return $this->pPrec($leftNode, $precedence, $associativity, -1) - . $operatorString - . $this->pPrec($rightNode, $precedence, $associativity, 1); - } - - protected function pPrefixOp($type, $operatorString, PHPParser_Node $node) { - list($precedence, $associativity) = $this->precedenceMap[$type]; - return $operatorString . $this->pPrec($node, $precedence, $associativity, 1); - } - - protected function pPostfixOp($type, PHPParser_Node $node, $operatorString) { - list($precedence, $associativity) = $this->precedenceMap[$type]; - return $this->pPrec($node, $precedence, $associativity, -1) . $operatorString; - } - - /** - * Prints an expression node with the least amount of parentheses necessary to preserve the meaning. - * - * @param PHPParser_Node $node Node to pretty print - * @param int $parentPrecedence Precedence of the parent operator - * @param int $parentAssociativity Associativity of parent operator - * (-1 is left, 0 is nonassoc, 1 is right) - * @param int $childPosition Position of the node relative to the operator - * (-1 is left, 1 is right) - * - * @return string The pretty printed node - */ - protected function pPrec(PHPParser_Node $node, $parentPrecedence, $parentAssociativity, $childPosition) { - $type = $node->getType(); - if (isset($this->precedenceMap[$type])) { - $childPrecedence = $this->precedenceMap[$type][0]; - if ($childPrecedence > $parentPrecedence - || ($parentPrecedence == $childPrecedence && $parentAssociativity != $childPosition) - ) { - return '(' . $this->{'p' . $type}($node) . ')'; - } - } - - return $this->{'p' . $type}($node); - } - - /** - * Pretty prints an array of nodes and implodes the printed values. - * - * @param PHPParser_Node[] $nodes Array of Nodes to be printed - * @param string $glue Character to implode with - * - * @return string Imploded pretty printed nodes - */ - protected function pImplode(array $nodes, $glue = '') { - $pNodes = array(); - foreach ($nodes as $node) { - $pNodes[] = $this->p($node); - } - - return implode($glue, $pNodes); - } - - /** - * Pretty prints an array of nodes and implodes the printed values with commas. - * - * @param PHPParser_Node[] $nodes Array of Nodes to be printed - * - * @return string Comma separated pretty printed nodes - */ - protected function pCommaSeparated(array $nodes) { - return $this->pImplode($nodes, ', '); - } - - /** - * Signals the pretty printer that a string shall not be indented. - * - * @param string $string Not to be indented string - * - * @return mixed String marked with $this->noIndentToken's. - */ - protected function pNoIndent($string) { - return str_replace("\n", "\n" . $this->noIndentToken, $string); - } - - protected function pComments(array $comments) { - $result = ''; - - foreach ($comments as $comment) { - $result .= $comment->getReformattedText() . "\n"; - } - - return $result; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/lib/PHPParser/Serializer.php ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/lib/PHPParser/Serializer.php b/vendor/nikic/php-parser/lib/PHPParser/Serializer.php deleted file mode 100644 index e63decc..0000000 --- a/vendor/nikic/php-parser/lib/PHPParser/Serializer.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php - -interface PHPParser_Serializer -{ - /** - * Serializes statements into some string format. - * - * @param array $nodes Statements - * - * @return string Serialized string - */ - public function serialize(array $nodes); -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/lib/PHPParser/Serializer/XML.php ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/lib/PHPParser/Serializer/XML.php b/vendor/nikic/php-parser/lib/PHPParser/Serializer/XML.php deleted file mode 100644 index fda785b..0000000 --- a/vendor/nikic/php-parser/lib/PHPParser/Serializer/XML.php +++ /dev/null @@ -1,78 +0,0 @@ -<?php - -class PHPParser_Serializer_XML implements PHPParser_Serializer -{ - protected $writer; - - /** - * Constructs a XML serializer. - */ - public function __construct() { - $this->writer = new XMLWriter; - $this->writer->openMemory(); - $this->writer->setIndent(true); - } - - public function serialize(array $nodes) { - $this->writer->flush(); - $this->writer->startDocument('1.0', 'UTF-8'); - - $this->writer->startElement('AST'); - $this->writer->writeAttribute('xmlns:node', 'http://nikic.github.com/PHPParser/XML/node'); - $this->writer->writeAttribute('xmlns:subNode', 'http://nikic.github.com/PHPParser/XML/subNode'); - $this->writer->writeAttribute('xmlns:attribute', 'http://nikic.github.com/PHPParser/XML/attribute'); - $this->writer->writeAttribute('xmlns:scalar', 'http://nikic.github.com/PHPParser/XML/scalar'); - - $this->_serialize($nodes); - - $this->writer->endElement(); - - return $this->writer->outputMemory(); - } - - protected function _serialize($node) { - if ($node instanceof PHPParser_Node) { - $this->writer->startElement('node:' . $node->getType()); - - foreach ($node->getAttributes() as $name => $value) { - $this->writer->startElement('attribute:' . $name); - $this->_serialize($value); - $this->writer->endElement(); - } - - foreach ($node as $name => $subNode) { - $this->writer->startElement('subNode:' . $name); - $this->_serialize($subNode); - $this->writer->endElement(); - } - - $this->writer->endElement(); - } elseif ($node instanceof PHPParser_Comment) { - $this->writer->startElement('comment'); - $this->writer->writeAttribute('isDocComment', $node instanceof PHPParser_Comment_Doc ? 'true' : 'false'); - $this->writer->writeAttribute('line', $node->getLine()); - $this->writer->text($node->getText()); - $this->writer->endElement(); - } elseif (is_array($node)) { - $this->writer->startElement('scalar:array'); - foreach ($node as $subNode) { - $this->_serialize($subNode); - } - $this->writer->endElement(); - } elseif (is_string($node)) { - $this->writer->writeElement('scalar:string', $node); - } elseif (is_int($node)) { - $this->writer->writeElement('scalar:int', $node); - } elseif (is_float($node)) { - $this->writer->writeElement('scalar:float', $node); - } elseif (true === $node) { - $this->writer->writeElement('scalar:true'); - } elseif (false === $node) { - $this->writer->writeElement('scalar:false'); - } elseif (null === $node) { - $this->writer->writeElement('scalar:null'); - } else { - throw new InvalidArgumentException('Unexpected node type'); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/lib/PHPParser/Template.php ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/lib/PHPParser/Template.php b/vendor/nikic/php-parser/lib/PHPParser/Template.php deleted file mode 100644 index 750dcf2..0000000 --- a/vendor/nikic/php-parser/lib/PHPParser/Template.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php - -/** - * @deprecated - */ -class PHPParser_Template -{ - protected $parser; - protected $template; - - /** - * Creates a new code template from a template string. - * - * @param PHPParser_Parser $parser A parser instance - * @param string $template The template string - */ - public function __construct(PHPParser_Parser $parser, $template) { - $this->parser = $parser; - $this->template = $template; - } - - /** - * Get the statements of the template with the passed in placeholders - * replaced. - * - * @param array $placeholders Placeholders - * - * @return PHPParser_Node[] Statements - */ - public function getStmts(array $placeholders) { - return $this->parser->parse( - $this->getTemplateWithPlaceholdersReplaced($placeholders) - ); - } - - protected function getTemplateWithPlaceholdersReplaced(array $placeholders) { - if (empty($placeholders)) { - return $this->template; - } - - return strtr($this->template, $this->preparePlaceholders($placeholders)); - } - - /* - * Prepare the placeholders for replacement. This means that - * a) all placeholders will be surrounded with __. - * b) ucfirst/lcfirst variations of the placeholders are generated. - * - * E.g. for an input array of ['foo' => 'bar'] the result will be - * ['__foo__' => 'bar', '__Foo__' => 'Bar']. - */ - protected function preparePlaceholders(array $placeholders) { - $preparedPlaceholders = array(); - - foreach ($placeholders as $name => $value) { - $preparedPlaceholders['__' . $name . '__'] = $value; - - if (ctype_lower($name[0])) { - $ucfirstName = ucfirst($name); - if (!isset($placeholders[$ucfirstName])) { - $preparedPlaceholders['__' . $ucfirstName . '__'] = ucfirst($value); - } - } - - if (ctype_upper($name[0])) { - $lcfirstName = lcfirst($name); - if (!isset($placeholders[$lcfirstName])) { - $preparedPlaceholders['__' . $lcfirstName . '__'] = lcfirst($value); - } - } - } - - return $preparedPlaceholders; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/lib/PHPParser/TemplateLoader.php ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/lib/PHPParser/TemplateLoader.php b/vendor/nikic/php-parser/lib/PHPParser/TemplateLoader.php deleted file mode 100644 index f6f125e..0000000 --- a/vendor/nikic/php-parser/lib/PHPParser/TemplateLoader.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -/** - * @deprecated - */ -class PHPParser_TemplateLoader -{ - protected $parser; - protected $baseDir; - protected $suffix; - - /** - * Constructs a filesystem template loader. - * - * The templates are loaded from {baseDir}/{name}{suffix}. - * - * @param PHPParser_Parser $parser A PHP parser instance - * @param string $baseDir The base directory to load templates from - * @param string $suffix An optional suffix to append after the template name - */ - public function __construct(PHPParser_Parser $parser, $baseDir, $suffix = '') { - if (!is_dir($baseDir)) { - throw new InvalidArgumentException( - sprintf('The specified base directory "%s" does not exist', $baseDir) - ); - } - - $this->parser = $parser; - $this->baseDir = $baseDir; - $this->suffix = $suffix; - } - - /** - * Loads the template with the specified name. - * - * @param string $name The name of template - * - * @return PHPParser_Template The loaded template - */ - public function load($name) { - $file = $this->baseDir . '/' . $name . $this->suffix; - - if (!is_file($file)) { - throw new InvalidArgumentException( - sprintf('The file "%s" does not exist', $file) - ); - } - - return new PHPParser_Template($this->parser, file_get_contents($file)); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/lib/PHPParser/Unserializer.php ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/lib/PHPParser/Unserializer.php b/vendor/nikic/php-parser/lib/PHPParser/Unserializer.php deleted file mode 100644 index 34808c8..0000000 --- a/vendor/nikic/php-parser/lib/PHPParser/Unserializer.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php - -interface PHPParser_Unserializer -{ - /** - * Unserializes a string in some format into a node tree. - * - * @param string $string Serialized string - * - * @return array Statements - */ - public function unserialize($string); -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/lib/PHPParser/Unserializer/XML.php ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/lib/PHPParser/Unserializer/XML.php b/vendor/nikic/php-parser/lib/PHPParser/Unserializer/XML.php deleted file mode 100644 index b6dd0da..0000000 --- a/vendor/nikic/php-parser/lib/PHPParser/Unserializer/XML.php +++ /dev/null @@ -1,133 +0,0 @@ -<?php - -class PHPParser_Unserializer_XML implements PHPParser_Unserializer -{ - protected $reader; - - public function __construct() { - $this->reader = new XMLReader; - } - - public function unserialize($string) { - $this->reader->XML($string); - - $this->reader->read(); - if ('AST' !== $this->reader->name) { - throw new DomainException('AST root element not found'); - } - - return $this->read($this->reader->depth); - } - - protected function read($depthLimit, $throw = true, &$nodeFound = null) { - $nodeFound = true; - while ($this->reader->read() && $depthLimit < $this->reader->depth) { - if (XMLReader::ELEMENT !== $this->reader->nodeType) { - continue; - } - - if ('node' === $this->reader->prefix) { - return $this->readNode(); - } elseif ('scalar' === $this->reader->prefix) { - return $this->readScalar(); - } elseif ('comment' === $this->reader->name) { - return $this->readComment(); - } else { - throw new DomainException(sprintf('Unexpected node of type "%s"', $this->reader->name)); - } - } - - $nodeFound = false; - if ($throw) { - throw new DomainException('Expected node or scalar'); - } - } - - protected function readNode() - { - $className = 'PHPParser_Node_' . $this->reader->localName; - - // create the node without calling it's constructor - $node = unserialize( - sprintf( - "O:%d:\"%s\":2:{s:11:\"\0*\0subNodes\";a:0:{}s:13:\"\0*\0attributes\";a:0:{}}", - strlen($className), $className - ) - ); - - $depthLimit = $this->reader->depth; - while ($this->reader->read() && $depthLimit < $this->reader->depth) { - if (XMLReader::ELEMENT !== $this->reader->nodeType) { - continue; - } - - $type = $this->reader->prefix; - if ('subNode' !== $type && 'attribute' !== $type) { - throw new DomainException( - sprintf('Expected sub node or attribute, got node of type "%s"', $this->reader->name) - ); - } - - $name = $this->reader->localName; - $value = $this->read($this->reader->depth); - - if ('subNode' === $type) { - $node->$name = $value; - } else { - $node->setAttribute($name, $value); - } - } - - return $node; - } - - protected function readScalar() { - switch ($name = $this->reader->localName) { - case 'array': - $depth = $this->reader->depth; - $array = array(); - while (true) { - $node = $this->read($depth, false, $nodeFound); - if (!$nodeFound) { - break; - } - $array[] = $node; - } - return $array; - case 'string': - return $this->reader->readString(); - case 'int': - $text = $this->reader->readString(); - if (false === $int = filter_var($text, FILTER_VALIDATE_INT)) { - throw new DomainException(sprintf('"%s" is not a valid integer', $text)); - } - return $int; - case 'float': - $text = $this->reader->readString(); - if (false === $float = filter_var($text, FILTER_VALIDATE_FLOAT)) { - throw new DomainException(sprintf('"%s" is not a valid float', $text)); - } - return $float; - case 'true': - case 'false': - case 'null': - if (!$this->reader->isEmptyElement) { - throw new DomainException(sprintf('"%s" scalar must be empty', $name)); - } - return constant($name); - default: - throw new DomainException(sprintf('Unknown scalar type "%s"', $name)); - } - } - - protected function readComment() { - $className = $this->reader->getAttribute('isDocComment') === 'true' - ? 'PHPParser_Comment_Doc' - : 'PHPParser_Comment' - ; - return new $className( - $this->reader->readString(), - $this->reader->getAttribute('line') - ); - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/lib/bootstrap.php ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/lib/bootstrap.php b/vendor/nikic/php-parser/lib/bootstrap.php deleted file mode 100644 index 5b812b4..0000000 --- a/vendor/nikic/php-parser/lib/bootstrap.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php - -require dirname(__FILE__) . '/PHPParser/Autoloader.php'; -PHPParser_Autoloader::register(); - -/* - * lcfirst() was added in PHP 5.3, so we have to emulate it for PHP 5.2. - */ -if (!function_exists('lcfirst')) { - function lcfirst($string) { - $string[0] = strtolower($string[0]); - return $string; - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/phpunit.xml.dist ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/phpunit.xml.dist b/vendor/nikic/php-parser/phpunit.xml.dist deleted file mode 100644 index f965e8e..0000000 --- a/vendor/nikic/php-parser/phpunit.xml.dist +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<phpunit backupGlobals="false" - backupStaticAttributes="false" - colors="false" - convertErrorsToExceptions="true" - convertNoticesToExceptions="true" - convertWarningsToExceptions="true" - processIsolation="false" - stopOnFailure="false" - syntaxCheck="false" - bootstrap="./lib/bootstrap.php"> - <testsuites> - <testsuite name="PHPParser Test Suite"> - <directory>./test/</directory> - </testsuite> - </testsuites> - - <filter> - <whitelist> - <directory suffix=".php">./lib/PHPParser/</directory> - </whitelist> - </filter> -</phpunit> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/test/PHPParser/Tests/Builder/ClassTest.php ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/test/PHPParser/Tests/Builder/ClassTest.php b/vendor/nikic/php-parser/test/PHPParser/Tests/Builder/ClassTest.php deleted file mode 100644 index 6591ca7..0000000 --- a/vendor/nikic/php-parser/test/PHPParser/Tests/Builder/ClassTest.php +++ /dev/null @@ -1,91 +0,0 @@ -<?php - -class PHPParser_Tests_Builder_ClassTest extends PHPUnit_Framework_TestCase -{ - protected function createClassBuilder($class) { - return new PHPParser_Builder_Class($class); - } - - public function testExtendsImplements() { - $node = $this->createClassBuilder('SomeLogger') - ->extend('BaseLogger') - ->implement('Namespaced\Logger', new PHPParser_Node_Name('SomeInterface')) - ->getNode() - ; - - $this->assertEquals( - new PHPParser_Node_Stmt_Class('SomeLogger', array( - 'extends' => new PHPParser_Node_Name('BaseLogger'), - 'implements' => array( - new PHPParser_Node_Name('Namespaced\Logger'), - new PHPParser_Node_Name('SomeInterface') - ), - )), - $node - ); - } - - public function testAbstract() { - $node = $this->createClassBuilder('Test') - ->makeAbstract() - ->getNode() - ; - - $this->assertEquals( - new PHPParser_Node_Stmt_Class('Test', array( - 'type' => PHPParser_Node_Stmt_Class::MODIFIER_ABSTRACT - )), - $node - ); - } - - public function testFinal() { - $node = $this->createClassBuilder('Test') - ->makeFinal() - ->getNode() - ; - - $this->assertEquals( - new PHPParser_Node_Stmt_Class('Test', array( - 'type' => PHPParser_Node_Stmt_Class::MODIFIER_FINAL - )), - $node - ); - } - - public function testStatementOrder() { - $method = new PHPParser_Node_Stmt_ClassMethod('testMethod'); - $property = new PHPParser_Node_Stmt_Property( - PHPParser_Node_Stmt_Class::MODIFIER_PUBLIC, - array(new PHPParser_Node_Stmt_PropertyProperty('testProperty')) - ); - $const = new PHPParser_Node_Stmt_ClassConst(array( - new PHPParser_Node_Const('TEST_CONST', new PHPParser_Node_Scalar_String('ABC')) - )); - $use = new PHPParser_Node_Stmt_TraitUse(array(new PHPParser_Node_Name('SomeTrait'))); - - $node = $this->createClassBuilder('Test') - ->addStmt($method) - ->addStmt($property) - ->addStmts(array($const, $use)) - ->getNode() - ; - - $this->assertEquals( - new PHPParser_Node_Stmt_Class('Test', array( - 'stmts' => array($use, $const, $property, $method) - )), - $node - ); - } - - /** - * @expectedException LogicException - * @expectedExceptionMessage Unexpected node of type "Stmt_Echo" - */ - public function testInvalidStmtError() { - $this->createClassBuilder('Test') - ->addStmt(new PHPParser_Node_Stmt_Echo(array())) - ; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/test/PHPParser/Tests/Builder/FunctionTest.php ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/test/PHPParser/Tests/Builder/FunctionTest.php b/vendor/nikic/php-parser/test/PHPParser/Tests/Builder/FunctionTest.php deleted file mode 100644 index 2992f82..0000000 --- a/vendor/nikic/php-parser/test/PHPParser/Tests/Builder/FunctionTest.php +++ /dev/null @@ -1,70 +0,0 @@ -<?php - -class PHPParser_Tests_Builder_FunctionTest extends PHPUnit_Framework_TestCase -{ - public function createFunctionBuilder($name) { - return new PHPParser_Builder_Function($name); - } - - public function testReturnByRef() { - $node = $this->createFunctionBuilder('test') - ->makeReturnByRef() - ->getNode() - ; - - $this->assertEquals( - new PHPParser_Node_Stmt_Function('test', array( - 'byRef' => true - )), - $node - ); - } - - public function testParams() { - $param1 = new PHPParser_Node_Param('test1'); - $param2 = new PHPParser_Node_Param('test2'); - $param3 = new PHPParser_Node_Param('test3'); - - $node = $this->createFunctionBuilder('test') - ->addParam($param1) - ->addParams(array($param2, $param3)) - ->getNode() - ; - - $this->assertEquals( - new PHPParser_Node_Stmt_Function('test', array( - 'params' => array($param1, $param2, $param3) - )), - $node - ); - } - - public function testStmts() { - $stmt1 = new PHPParser_Node_Expr_Print(new PHPParser_Node_Scalar_String('test1')); - $stmt2 = new PHPParser_Node_Expr_Print(new PHPParser_Node_Scalar_String('test2')); - $stmt3 = new PHPParser_Node_Expr_Print(new PHPParser_Node_Scalar_String('test3')); - - $node = $this->createFunctionBuilder('test') - ->addStmt($stmt1) - ->addStmts(array($stmt2, $stmt3)) - ->getNode() - ; - - $this->assertEquals( - new PHPParser_Node_Stmt_Function('test', array( - 'stmts' => array($stmt1, $stmt2, $stmt3) - )), - $node - ); - } - - /** - * @expectedException LogicException - * @expectedExceptionMessage Expected parameter node, got "Name" - */ - public function testInvalidParamError() { - $this->createFunctionBuilder('test') - ->addParam(new PHPParser_Node_Name('foo')) - ; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/test/PHPParser/Tests/Builder/InterfaceTest.php ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/test/PHPParser/Tests/Builder/InterfaceTest.php b/vendor/nikic/php-parser/test/PHPParser/Tests/Builder/InterfaceTest.php deleted file mode 100644 index fb36338..0000000 --- a/vendor/nikic/php-parser/test/PHPParser/Tests/Builder/InterfaceTest.php +++ /dev/null @@ -1,91 +0,0 @@ -<?php - -/** - * This class unit-tests the interface builder - */ -class PHPParser_Tests_Builder_InterfaceTest extends PHPUnit_Framework_TestCase -{ - /** @var PHPParser_Builder_Interface */ - protected $builder; - - protected function setUp() { - $this->builder = new PHPParser_Builder_Interface('Contract'); - } - - private function dump($node) { - $pp = new PHPParser_PrettyPrinter_Default(); - return $pp->prettyPrint(array($node)); - } - - public function testEmpty() { - $contract = $this->builder->getNode(); - $this->assertInstanceOf('PHPParser_Node_Stmt_Interface', $contract); - $this->assertEquals('Contract', $contract->name); - } - - public function testExtending() { - $contract = $this->builder->extend('Space\Root1', 'Root2')->getNode(); - $this->assertEquals( - new PHPParser_Node_Stmt_Interface('Contract', array( - 'extends' => array( - new PHPParser_Node_Name('Space\Root1'), - new PHPParser_Node_Name('Root2') - ), - )), $contract - ); - } - - public function testAddMethod() { - $method = new PHPParser_Node_Stmt_ClassMethod('doSomething'); - $contract = $this->builder->addStmt($method)->getNode(); - $this->assertEquals(array($method), $contract->stmts); - } - - public function testAddConst() { - $const = new PHPParser_Node_Stmt_ClassConst(array( - new PHPParser_Node_Const('SPEED_OF_LIGHT', new PHPParser_Node_Scalar_DNumber(299792458)) - )); - $contract = $this->builder->addStmt($const)->getNode(); - $this->assertEquals(299792458, $contract->stmts[0]->consts[0]->value->value); - } - - public function testOrder() { - $const = new PHPParser_Node_Stmt_ClassConst(array( - new PHPParser_Node_Const('SPEED_OF_LIGHT', new PHPParser_Node_Scalar_DNumber(299792458)) - )); - $method = new PHPParser_Node_Stmt_ClassMethod('doSomething'); - $contract = $this->builder - ->addStmt($method) - ->addStmt($const) - ->getNode() - ; - - $this->assertInstanceOf('PHPParser_Node_Stmt_ClassConst', $contract->stmts[0]); - $this->assertInstanceOf('PHPParser_Node_Stmt_ClassMethod', $contract->stmts[1]); - } - - /** - * @expectedException LogicException - * @expectedExceptionMessage Unexpected node of type "Stmt_PropertyProperty" - */ - public function testInvalidStmtError() { - $this->builder->addStmt(new PHPParser_Node_Stmt_PropertyProperty('invalid')); - } - - public function testFullFunctional() { - $const = new PHPParser_Node_Stmt_ClassConst(array( - new PHPParser_Node_Const('SPEED_OF_LIGHT', new PHPParser_Node_Scalar_DNumber(299792458)) - )); - $method = new PHPParser_Node_Stmt_ClassMethod('doSomething'); - $contract = $this->builder - ->addStmt($method) - ->addStmt($const) - ->getNode() - ; - - eval($this->dump($contract)); - - $this->assertTrue(interface_exists('Contract', false)); - } -} - http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/test/PHPParser/Tests/Builder/MethodTest.php ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/test/PHPParser/Tests/Builder/MethodTest.php b/vendor/nikic/php-parser/test/PHPParser/Tests/Builder/MethodTest.php deleted file mode 100644 index 6f4624a..0000000 --- a/vendor/nikic/php-parser/test/PHPParser/Tests/Builder/MethodTest.php +++ /dev/null @@ -1,137 +0,0 @@ -<?php - -class PHPParser_Tests_Builder_MethodTest extends PHPUnit_Framework_TestCase -{ - public function createMethodBuilder($name) { - return new PHPParser_Builder_Method($name); - } - - public function testModifiers() { - $node = $this->createMethodBuilder('test') - ->makePublic() - ->makeAbstract() - ->makeStatic() - ->getNode() - ; - - $this->assertEquals( - new PHPParser_Node_Stmt_ClassMethod('test', array( - 'type' => PHPParser_Node_Stmt_Class::MODIFIER_PUBLIC - | PHPParser_Node_Stmt_Class::MODIFIER_ABSTRACT - | PHPParser_Node_Stmt_Class::MODIFIER_STATIC, - 'stmts' => null, - )), - $node - ); - - $node = $this->createMethodBuilder('test') - ->makeProtected() - ->makeFinal() - ->getNode() - ; - - $this->assertEquals( - new PHPParser_Node_Stmt_ClassMethod('test', array( - 'type' => PHPParser_Node_Stmt_Class::MODIFIER_PROTECTED - | PHPParser_Node_Stmt_Class::MODIFIER_FINAL - )), - $node - ); - - $node = $this->createMethodBuilder('test') - ->makePrivate() - ->getNode() - ; - - $this->assertEquals( - new PHPParser_Node_Stmt_ClassMethod('test', array( - 'type' => PHPParser_Node_Stmt_Class::MODIFIER_PRIVATE - )), - $node - ); - } - - public function testReturnByRef() { - $node = $this->createMethodBuilder('test') - ->makeReturnByRef() - ->getNode() - ; - - $this->assertEquals( - new PHPParser_Node_Stmt_ClassMethod('test', array( - 'byRef' => true - )), - $node - ); - } - - public function testParams() { - $param1 = new PHPParser_Node_Param('test1'); - $param2 = new PHPParser_Node_Param('test2'); - $param3 = new PHPParser_Node_Param('test3'); - - $node = $this->createMethodBuilder('test') - ->addParam($param1) - ->addParams(array($param2, $param3)) - ->getNode() - ; - - $this->assertEquals( - new PHPParser_Node_Stmt_ClassMethod('test', array( - 'params' => array($param1, $param2, $param3) - )), - $node - ); - } - - public function testStmts() { - $stmt1 = new PHPParser_Node_Expr_Print(new PHPParser_Node_Scalar_String('test1')); - $stmt2 = new PHPParser_Node_Expr_Print(new PHPParser_Node_Scalar_String('test2')); - $stmt3 = new PHPParser_Node_Expr_Print(new PHPParser_Node_Scalar_String('test3')); - - $node = $this->createMethodBuilder('test') - ->addStmt($stmt1) - ->addStmts(array($stmt2, $stmt3)) - ->getNode() - ; - - $this->assertEquals( - new PHPParser_Node_Stmt_ClassMethod('test', array( - 'stmts' => array($stmt1, $stmt2, $stmt3) - )), - $node - ); - } - - /** - * @expectedException LogicException - * @expectedExceptionMessage Cannot add statements to an abstract method - */ - public function testAddStmtToAbstractMethodError() { - $this->createMethodBuilder('test') - ->makeAbstract() - ->addStmt(new PHPParser_Node_Expr_Print(new PHPParser_Node_Scalar_String('test'))) - ; - } - - /** - * @expectedException LogicException - * @expectedExceptionMessage Cannot make method with statements abstract - */ - public function testMakeMethodWithStmtsAbstractError() { - $this->createMethodBuilder('test') - ->addStmt(new PHPParser_Node_Expr_Print(new PHPParser_Node_Scalar_String('test'))) - ->makeAbstract() - ; - } - - /** - * @expectedException LogicException - * @expectedExceptionMessage Expected parameter node, got "Name" - */ - public function testInvalidParamError() { - $this->createMethodBuilder('test') - ->addParam(new PHPParser_Node_Name('foo')) - ; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/test/PHPParser/Tests/Builder/ParamTest.php ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/test/PHPParser/Tests/Builder/ParamTest.php b/vendor/nikic/php-parser/test/PHPParser/Tests/Builder/ParamTest.php deleted file mode 100644 index 4010ea8..0000000 --- a/vendor/nikic/php-parser/test/PHPParser/Tests/Builder/ParamTest.php +++ /dev/null @@ -1,118 +0,0 @@ -<?php - -class PHPParser_Tests_Builder_ParamTest extends PHPUnit_Framework_TestCase -{ - public function createParamBuilder($name) { - return new PHPParser_Builder_Param($name); - } - - /** - * @dataProvider provideTestDefaultValues - */ - public function testDefaultValues($value, $expectedValueNode) { - $node = $this->createParamBuilder('test') - ->setDefault($value) - ->getNode() - ; - - $this->assertEquals($expectedValueNode, $node->default); - } - - public function provideTestDefaultValues() { - return array( - array( - null, - new PHPParser_Node_Expr_ConstFetch(new PHPParser_Node_Name('null')) - ), - array( - true, - new PHPParser_Node_Expr_ConstFetch(new PHPParser_Node_Name('true')) - ), - array( - false, - new PHPParser_Node_Expr_ConstFetch(new PHPParser_Node_Name('false')) - ), - array( - 31415, - new PHPParser_Node_Scalar_LNumber(31415) - ), - array( - 3.1415, - new PHPParser_Node_Scalar_DNumber(3.1415) - ), - array( - 'Hallo World', - new PHPParser_Node_Scalar_String('Hallo World') - ), - array( - array(1, 2, 3), - new PHPParser_Node_Expr_Array(array( - new PHPParser_Node_Expr_ArrayItem(new PHPParser_Node_Scalar_LNumber(1)), - new PHPParser_Node_Expr_ArrayItem(new PHPParser_Node_Scalar_LNumber(2)), - new PHPParser_Node_Expr_ArrayItem(new PHPParser_Node_Scalar_LNumber(3)), - )) - ), - array( - array('foo' => 'bar', 'bar' => 'foo'), - new PHPParser_Node_Expr_Array(array( - new PHPParser_Node_Expr_ArrayItem( - new PHPParser_Node_Scalar_String('bar'), - new PHPParser_Node_Scalar_String('foo') - ), - new PHPParser_Node_Expr_ArrayItem( - new PHPParser_Node_Scalar_String('foo'), - new PHPParser_Node_Scalar_String('bar') - ), - )) - ), - array( - new PHPParser_Node_Scalar_DirConst, - new PHPParser_Node_Scalar_DirConst - ) - ); - } - - public function testTypeHints() { - $node = $this->createParamBuilder('test') - ->setTypeHint('array') - ->getNode() - ; - - $this->assertEquals( - new PHPParser_Node_Param('test', null, 'array'), - $node - ); - - $node = $this->createParamBuilder('test') - ->setTypeHint('callable') - ->getNode() - ; - - $this->assertEquals( - new PHPParser_Node_Param('test', null, 'callable'), - $node - ); - - $node = $this->createParamBuilder('test') - ->setTypeHint('Some\Class') - ->getNode() - ; - - $this->assertEquals( - new PHPParser_Node_Param('test', null, new PHPParser_Node_Name('Some\Class')), - $node - ); - } - - public function testByRef() { - $node = $this->createParamBuilder('test') - ->makeByRef() - ->getNode() - ; - - $this->assertEquals( - new PHPParser_Node_Param('test', null, null, true), - $node - ); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/test/PHPParser/Tests/Builder/PropertyTest.php ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/test/PHPParser/Tests/Builder/PropertyTest.php b/vendor/nikic/php-parser/test/PHPParser/Tests/Builder/PropertyTest.php deleted file mode 100644 index fa880b2..0000000 --- a/vendor/nikic/php-parser/test/PHPParser/Tests/Builder/PropertyTest.php +++ /dev/null @@ -1,123 +0,0 @@ -<?php - -class PHPParser_Tests_Builder_PropertyTest extends PHPUnit_Framework_TestCase -{ - public function createPropertyBuilder($name) { - return new PHPParser_Builder_Property($name); - } - - public function testModifiers() { - $node = $this->createPropertyBuilder('test') - ->makePrivate() - ->makeStatic() - ->getNode() - ; - - $this->assertEquals( - new PHPParser_Node_Stmt_Property( - PHPParser_Node_Stmt_Class::MODIFIER_PRIVATE - | PHPParser_Node_Stmt_Class::MODIFIER_STATIC, - array( - new PHPParser_Node_Stmt_PropertyProperty('test') - ) - ), - $node - ); - - $node = $this->createPropertyBuilder('test') - ->makeProtected() - ->getNode() - ; - - $this->assertEquals( - new PHPParser_Node_Stmt_Property( - PHPParser_Node_Stmt_Class::MODIFIER_PROTECTED, - array( - new PHPParser_Node_Stmt_PropertyProperty('test') - ) - ), - $node - ); - - $node = $this->createPropertyBuilder('test') - ->makePublic() - ->getNode() - ; - - $this->assertEquals( - new PHPParser_Node_Stmt_Property( - PHPParser_Node_Stmt_Class::MODIFIER_PUBLIC, - array( - new PHPParser_Node_Stmt_PropertyProperty('test') - ) - ), - $node - ); - } - - /** - * @dataProvider provideTestDefaultValues - */ - public function testDefaultValues($value, $expectedValueNode) { - $node = $this->createPropertyBuilder('test') - ->setDefault($value) - ->getNode() - ; - - $this->assertEquals($expectedValueNode, $node->props[0]->default); - } - - public function provideTestDefaultValues() { - return array( - array( - null, - new PHPParser_Node_Expr_ConstFetch(new PHPParser_Node_Name('null')) - ), - array( - true, - new PHPParser_Node_Expr_ConstFetch(new PHPParser_Node_Name('true')) - ), - array( - false, - new PHPParser_Node_Expr_ConstFetch(new PHPParser_Node_Name('false')) - ), - array( - 31415, - new PHPParser_Node_Scalar_LNumber(31415) - ), - array( - 3.1415, - new PHPParser_Node_Scalar_DNumber(3.1415) - ), - array( - 'Hallo World', - new PHPParser_Node_Scalar_String('Hallo World') - ), - array( - array(1, 2, 3), - new PHPParser_Node_Expr_Array(array( - new PHPParser_Node_Expr_ArrayItem(new PHPParser_Node_Scalar_LNumber(1)), - new PHPParser_Node_Expr_ArrayItem(new PHPParser_Node_Scalar_LNumber(2)), - new PHPParser_Node_Expr_ArrayItem(new PHPParser_Node_Scalar_LNumber(3)), - )) - ), - array( - array('foo' => 'bar', 'bar' => 'foo'), - new PHPParser_Node_Expr_Array(array( - new PHPParser_Node_Expr_ArrayItem( - new PHPParser_Node_Scalar_String('bar'), - new PHPParser_Node_Scalar_String('foo') - ), - new PHPParser_Node_Expr_ArrayItem( - new PHPParser_Node_Scalar_String('foo'), - new PHPParser_Node_Scalar_String('bar') - ), - )) - ), - array( - new PHPParser_Node_Scalar_DirConst, - new PHPParser_Node_Scalar_DirConst - ) - ); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/test/PHPParser/Tests/BuilderFactoryTest.php ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/test/PHPParser/Tests/BuilderFactoryTest.php b/vendor/nikic/php-parser/test/PHPParser/Tests/BuilderFactoryTest.php deleted file mode 100644 index 0eaf8a9..0000000 --- a/vendor/nikic/php-parser/test/PHPParser/Tests/BuilderFactoryTest.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php - -class PHPParser_Tests_BuilderFactoryTest extends PHPUnit_Framework_TestCase -{ - /** - * @dataProvider provideTestFactory - */ - public function testFactory($methodName, $className) { - $factory = new PHPParser_BuilderFactory; - $this->assertInstanceOf($className, $factory->$methodName('test')); - } - - public function provideTestFactory() { - return array( - array('class', 'PHPParser_Builder_Class'), - array('interface', 'PHPParser_Builder_Interface'), - array('method', 'PHPParser_Builder_Method'), - array('function', 'PHPParser_Builder_Function'), - array('property', 'PHPParser_Builder_Property'), - array('param', 'PHPParser_Builder_Param'), - ); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/test/PHPParser/Tests/CodeTestAbstract.php ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/test/PHPParser/Tests/CodeTestAbstract.php b/vendor/nikic/php-parser/test/PHPParser/Tests/CodeTestAbstract.php deleted file mode 100644 index d315385..0000000 --- a/vendor/nikic/php-parser/test/PHPParser/Tests/CodeTestAbstract.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -abstract class PHPParser_Tests_CodeTestAbstract extends PHPUnit_Framework_TestCase -{ - protected function getTests($directory, $fileExtension) { - $it = new RecursiveDirectoryIterator($directory); - $it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::LEAVES_ONLY); - $it = new RegexIterator($it, '(\.' . preg_quote($fileExtension) . '$)'); - - $tests = array(); - foreach ($it as $file) { - // read file - $fileContents = file_get_contents($file); - - // evaluate @@{expr}@@ expressions - $fileContents = preg_replace_callback( - '/@@\{(.*?)\}@@/', - array($this, 'evalCallback'), - $fileContents - ); - - // parse sections - $parts = array_map('trim', explode('-----', $fileContents)); - - // first part is the name - $name = array_shift($parts); - - // multiple sections possible with always two forming a pair - foreach (array_chunk($parts, 2) as $chunk) { - $tests[] = array($name, $chunk[0], $chunk[1]); - } - } - - return $tests; - } - - protected function evalCallback($matches) { - return eval('return ' . $matches[1] . ';'); - } - - protected function canonicalize($str) { - // trim from both sides - $str = trim($str); - - // normalize EOL to \n - $str = str_replace(array("\r\n", "\r"), "\n", $str); - - // trim right side of all lines - return implode("\n", array_map('rtrim', explode("\n", $str))); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/test/PHPParser/Tests/CommentTest.php ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/test/PHPParser/Tests/CommentTest.php b/vendor/nikic/php-parser/test/PHPParser/Tests/CommentTest.php deleted file mode 100644 index 5147f73..0000000 --- a/vendor/nikic/php-parser/test/PHPParser/Tests/CommentTest.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php - -class PHPParser_Tests_CommentTest extends PHPUnit_Framework_TestCase -{ - public function testGetSet() { - $comment = new PHPParser_Comment('/* Some comment */', 1); - - $this->assertEquals('/* Some comment */', $comment->getText()); - $this->assertEquals('/* Some comment */', (string) $comment); - $this->assertEquals(1, $comment->getLine()); - - $comment->setText('/* Some other comment */'); - $comment->setLine(10); - - $this->assertEquals('/* Some other comment */', $comment->getText()); - $this->assertEquals('/* Some other comment */', (string) $comment); - $this->assertEquals(10, $comment->getLine()); - } - - /** - * @dataProvider provideTestReformatting - */ - public function testReformatting($commentText, $reformattedText) { - $comment = new PHPParser_Comment($commentText); - $this->assertEquals($reformattedText, $comment->getReformattedText()); - } - - public function provideTestReformatting() { - return array( - array('// Some text' . "\n", '// Some text'), - array('/* Some text */', '/* Some text */'), - array( - '/** - * Some text. - * Some more text. - */', - '/** - * Some text. - * Some more text. - */' - ), - array( - '/* - Some text. - Some more text. - */', - '/* - Some text. - Some more text. -*/' - ), - array( - '/* Some text. - More text. - Even more text. */', - '/* Some text. - More text. - Even more text. */' - ), - // invalid comment -> no reformatting - array( - 'hallo - world', - 'hallo - world', - ), - ); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/test/PHPParser/Tests/ErrorTest.php ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/test/PHPParser/Tests/ErrorTest.php b/vendor/nikic/php-parser/test/PHPParser/Tests/ErrorTest.php deleted file mode 100644 index de21cdd..0000000 --- a/vendor/nikic/php-parser/test/PHPParser/Tests/ErrorTest.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php - -class PHPParser_Tests_ErrorTest extends PHPUnit_Framework_TestCase -{ - public function testConstruct() { - $error = new PHPParser_Error('Some error', 10); - - $this->assertEquals('Some error', $error->getRawMessage()); - $this->assertEquals(10, $error->getRawLine()); - $this->assertEquals('Some error on line 10', $error->getMessage()); - - return $error; - } - - /** - * @depends testConstruct - */ - public function testSetMessageAndLine(PHPParser_Error $error) { - $error->setRawMessage('Some other error'); - $error->setRawLine(15); - - $this->assertEquals('Some other error', $error->getRawMessage()); - $this->assertEquals(15, $error->getRawLine()); - $this->assertEquals('Some other error on line 15', $error->getMessage()); - } - - public function testUnknownLine() { - $error = new PHPParser_Error('Some error'); - - $this->assertEquals(-1, $error->getRawLine()); - $this->assertEquals('Some error on unknown line', $error->getMessage()); - } -} \ No newline at end of file
