当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPParser_Node_Stmt::__construct方法代码示例

本文整理汇总了PHP中PHPParser_Node_Stmt::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPParser_Node_Stmt::__construct方法的具体用法?PHP PHPParser_Node_Stmt::__construct怎么用?PHP PHPParser_Node_Stmt::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPParser_Node_Stmt的用法示例。


在下文中一共展示了PHPParser_Node_Stmt::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Constructs a try catch node.
  *
  * @param PHPParser_Node[]            $stmts        Statements
  * @param PHPParser_Node_Stmt_Catch[] $catches      Catches
  * @param PHPParser_Node[]            $finallyStmts Finally statements (null means no finally clause)
  * @param array|null                  $attributes   Additional attributes
  */
 public function __construct(array $stmts, array $catches, array $finallyStmts = null, array $attributes = array())
 {
     if (empty($catches) && null === $finallyStmts) {
         throw new PHPParser_Error('Cannot use try without catch or finally');
     }
     parent::__construct(array('stmts' => $stmts, 'catches' => $catches, 'finallyStmts' => $finallyStmts), $attributes);
 }
开发者ID:GeorgeBroadley,项目名称:caffeine-vendor,代码行数:15,代码来源:TryCatch.php

示例2: __construct

 /**
  * Constructs a class method node.
  *
  * @param string      $name       Name
  * @param array       $subNodes   Array of the following optional subnodes:
  *                                'type'   => MODIFIER_PUBLIC: Type
  *                                'byRef'  => false          : Whether to return by reference
  *                                'params' => array()        : Parameters
  *                                'stmts'  => array()        : Statements
  * @param int         $line       Line
  * @param null|string $docComment Nearest doc comment
  */
 public function __construct($name, array $subNodes = array(), $line = -1, $docComment = null)
 {
     parent::__construct($subNodes + array('type' => PHPParser_Node_Stmt_Class::MODIFIER_PUBLIC, 'byRef' => false, 'params' => array(), 'stmts' => array()), $line, $docComment);
     $this->name = $name;
     if ($this->type & PHPParser_Node_Stmt_Class::MODIFIER_STATIC && ('__construct' == $this->name || '__destruct' == $this->name || '__clone' == $this->name)) {
         throw new PHPParser_Error(sprintf('"%s" method cannot be static', $this->name));
     }
 }
开发者ID:hosttor,项目名称:BusinessUSA-OpenSource,代码行数:20,代码来源:ClassMethod.php

示例3: __construct

 /**
  * Constructs an alias (use) node.
  *
  * @param PHPParser_Node_Name $name       Namespace/Class to alias
  * @param null|string         $alias      Alias
  * @param array               $attributes Additional attributes
  */
 public function __construct(PHPParser_Node_Name $name, $alias = null, array $attributes = array())
 {
     if (null === $alias) {
         $alias = $name->getLast();
     }
     if ('self' == $alias || 'parent' == $alias) {
         throw new PHPParser_Error(sprintf('Cannot use "%s" as "%s" because "%2$s" is a special class name', $name, $alias));
     }
     parent::__construct(array('name' => $name, 'alias' => $alias), $attributes);
 }
开发者ID:ningcaichen,项目名称:laravel-4.1-quick-start-cn,代码行数:17,代码来源:UseUse.php

示例4: __construct

 /**
  * Constructs a class node.
  *
  * @param string $name       Name
  * @param array  $subNodes   Array of the following optional subnodes:
  *                           'extends' => array(): Name of extended interfaces
  *                           'stmts'   => array(): Statements
  * @param array  $attributes Additional attributes
  */
 public function __construct($name, array $subNodes = array(), array $attributes = array())
 {
     parent::__construct($subNodes + array('extends' => array(), 'stmts' => array()), $attributes);
     $this->name = $name;
     if (isset(self::$specialNames[(string) $this->name])) {
         throw new PHPParser_Error(sprintf('Cannot use "%s" as interface name as it is reserved', $this->name));
     }
     foreach ($this->extends as $interface) {
         if (isset(self::$specialNames[(string) $interface])) {
             throw new PHPParser_Error(sprintf('Cannot use "%s" as interface name as it is reserved', $interface));
         }
     }
 }
开发者ID:dlpc,项目名称:O2OMobile_PHP,代码行数:22,代码来源:Interface.php

示例5: __construct

 /**
  * Constructs a class property list node.
  *
  * @param array                                  $tree     Tree
  * @param int                                    $line       Line
  * @param null|string                            $docComment Nearest doc comment
  */
 public function __construct(array $tree, $line = -1, $docComment = null)
 {
     $modifier = 0;
     while (is_array($tree[1])) {
         PHPParser_Node_Stmt_Class::verifyModifier($modifier, $tree[0]);
         $modifier |= $tree[0];
         $tree = $tree[1];
     }
     if (is_int($tree[0])) {
         PHPParser_Node_Stmt_Class::verifyModifier($modifier, $tree[0]);
         $modifier |= $tree[0];
     }
     parent::__construct(array('modifier' => $modifier, 'stmts' => isset($tree[1]->stmts) ? $tree[1]->stmts : array($tree)), $line, $docComment);
 }
开发者ID:rgp,项目名称:snowscript,代码行数:21,代码来源:PropertyDeclarations.php

示例6: __construct

 /**
  * Constructs a namespace node.
  *
  * @param null|PHPParser_Node_Name $name       Name
  * @param PHPParser_Node[]         $stmts      Statements
  * @param int                      $line       Line
  * @param null|string              $docComment Nearest doc comment
  */
 public function __construct(PHPParser_Node_Name $name = null, $stmts = array(), $line = -1, $docComment = null)
 {
     parent::__construct(array('name' => $name, 'stmts' => $stmts), $line, $docComment);
     if (isset(self::$specialNames[(string) $this->name])) {
         throw new PHPParser_Error(sprintf('Cannot use "%s" as namespace name as it is reserved', $this->name));
     }
     if (null !== $this->stmts) {
         foreach ($this->stmts as $stmt) {
             if ($stmt instanceof PHPParser_Node_Stmt_Namespace) {
                 throw new PHPParser_Error('Namespace declarations cannot be nested', $stmt->getLine());
             }
         }
     }
 }
开发者ID:hosttor,项目名称:BusinessUSA-OpenSource,代码行数:22,代码来源:Namespace.php

示例7: __construct

 /**
  * Constructs a class method node.
  *
  * @param string $name            Name
  * @param array  $subNodes        Array of the following optional subnodes:
  *                                'type'   => MODIFIER_PUBLIC: Type
  *                                'byRef'  => false          : Whether to return by reference
  *                                'params' => array()        : Parameters
  *                                'stmts'  => array()        : Statements
  * @param array  $attributes      Additional attributes
  */
 public function __construct($name, array $subNodes = array(), array $attributes = array())
 {
     parent::__construct($subNodes + array('type' => PHPParser_Node_Stmt_Class::MODIFIER_PUBLIC, 'byRef' => false, 'params' => array(), 'stmts' => array()), $attributes);
     $this->name = $name;
     if ($this->type & PHPParser_Node_Stmt_Class::MODIFIER_STATIC) {
         switch (strtolower($this->name)) {
             case '__construct':
                 throw new PHPParser_Error(sprintf('Constructor %s() cannot be static', $this->name));
             case '__destruct':
                 throw new PHPParser_Error(sprintf('Destructor %s() cannot be static', $this->name));
             case '__clone':
                 throw new PHPParser_Error(sprintf('Clone method %s() cannot be static', $this->name));
         }
     }
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:26,代码来源:ClassMethod.php

示例8: __construct

 /**
  * Constructs a class node.
  *
  * @param string      $name       Name
  * @param array       $subNodes   Array of the following optional subnodes:
  *                                'type'       => 0      : Type
  *                                'extends'    => null   : Name of extended class
  *                                'implements' => array(): Names of implemented interfaces
  *                                'stmts'      => array(): Statements
  * @param int         $line       Line
  * @param null|string $docComment Nearest doc comment
  */
 public function __construct($name, array $subNodes = array(), $line = -1, $docComment = null)
 {
     parent::__construct($subNodes + array('type' => 0, 'extends' => null, 'implements' => array(), 'stmts' => array()), $line, $docComment);
     $this->name = $name;
     if (isset(self::$specialNames[(string) $this->name])) {
         throw new PHPParser_Error(sprintf('Cannot use "%s" as class name as it is reserved', $this->name));
     }
     if (isset(self::$specialNames[(string) $this->extends])) {
         throw new PHPParser_Error(sprintf('Cannot use "%s" as class name as it is reserved', $this->extends));
     }
     foreach ($this->implements as $interface) {
         if (isset(self::$specialNames[(string) $interface])) {
             throw new PHPParser_Error(sprintf('Cannot use "%s" as interface name as it is reserved', $interface));
         }
     }
 }
开发者ID:hosttor,项目名称:BusinessUSA-OpenSource,代码行数:28,代码来源:Class.php

示例9: __construct

 /**
  * Constructs an alias (use) list node.
  *
  * @param PHPParser_Node_Stmt_UseUse[] $uses       Aliases
  * @param array                        $attributes Additional attributes
  */
 public function __construct(array $uses, array $attributes = array())
 {
     parent::__construct(array('uses' => $uses), $attributes);
 }
开发者ID:rodrigopbel,项目名称:ong,代码行数:10,代码来源:Use.php

示例10: __construct

 /**
  * Constructs a class property list node.
  *
  * @param int                                    $type       Modifiers
  * @param PHPParser_Node_Stmt_PropertyProperty[] $props      Properties
  * @param array                                  $attributes Additional attributes
  */
 public function __construct($type, array $props, array $attributes = array())
 {
     parent::__construct(array('type' => $type, 'props' => $props), $attributes);
 }
开发者ID:rodrigopbel,项目名称:ong,代码行数:11,代码来源:Property.php

示例11: __construct

 /**
  * Constructs an if node.
  *
  * @param PHPParser_Node_Expr $cond       Condition
  * @param array               $subNodes   Array of the following optional subnodes:
  *                                        'stmts'   => array(): Statements
  *                                        'elseifs' => array(): Elseif clauses
  *                                        'else'    => null   : Else clause
  * @param array               $attributes Additional attributes
  */
 public function __construct(PHPParser_Node_Expr $cond, array $subNodes = array(), array $attributes = array())
 {
     parent::__construct($subNodes + array('stmts' => array(), 'elseifs' => array(), 'else' => null), $attributes);
     $this->cond = $cond;
 }
开发者ID:GeorgeBroadley,项目名称:caffeine-vendor,代码行数:15,代码来源:If.php

示例12: __construct

 /**
  * Constructs an unset node.
  *
  * @param PHPParser_Node_Expr[] $vars       Variables to unset
  * @param int                   $line       Line
  * @param null|string           $docComment Nearest doc comment
  */
 public function __construct(array $vars, $line = -1, $docComment = null)
 {
     parent::__construct(array('vars' => $vars), $line, $docComment);
 }
开发者ID:hosttor,项目名称:BusinessUSA-OpenSource,代码行数:11,代码来源:Unset.php

示例13: __construct

 /**
  * Constructs a function node.
  *
  * @param string $name       Name
  * @param array  $subNodes   Array of the following optional subnodes:
  *                           'byRef'  => false  : Whether to return by reference
  *                           'params' => array(): Parameters
  *                           'stmts'  => array(): Statements
  * @param array  $attributes Additional attributes
  */
 public function __construct($name, array $subNodes = array(), array $attributes = array())
 {
     parent::__construct($subNodes + array('byRef' => false, 'params' => array(), 'stmts' => array()), $attributes);
     $this->name = $name;
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:15,代码来源:Function.php

示例14: __construct

 /**
  * Constructs a class property list node.
  *
  * @param int                                    $type       Modifiers
  * @param PHPParser_Node_Stmt_PropertyProperty[] $props      Properties
  * @param int                                    $line       Line
  * @param null|string                            $docComment Nearest doc comment
  */
 public function __construct($stmts, $line = -1, $docComment = null)
 {
     parent::__construct(array('stmts' => $stmts), $line, $docComment);
 }
开发者ID:rgp,项目名称:snowscript,代码行数:12,代码来源:Property.php

示例15: __construct

 /**
  * Constructs an inline HTML node.
  *
  * @param string $value      String
  * @param array  $attributes Additional attributes
  */
 public function __construct($value, array $attributes = array())
 {
     parent::__construct(array('value' => $value), $attributes);
 }
开发者ID:rodrigopbel,项目名称:ong,代码行数:10,代码来源:InlineHTML.php


注:本文中的PHPParser_Node_Stmt::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。