Ejemplo n.º 1
0
 /**
  * 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($attributes);
     $this->name = $name;
     $this->extends = isset($subNodes['extends']) ? $subNodes['extends'] : array();
     $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array();
 }
Ejemplo n.º 2
0
 /**
  * Constructs a class node.
  *
  * @param string|null $name       Name
  * @param array       $subNodes   Array of the following optional subnodes:
  *                                'flags'      => 0      : Flags
  *                                'extends'    => null   : Name of extended class
  *                                'implements' => array(): Names of implemented interfaces
  *                                'stmts'      => array(): Statements
  * @param array       $attributes Additional attributes
  */
 public function __construct($name, array $subNodes = array(), array $attributes = array())
 {
     parent::__construct($attributes);
     $this->flags = isset($subNodes['flags']) ? $subNodes['flags'] : (isset($subNodes['type']) ? $subNodes['type'] : 0);
     $this->type = $this->flags;
     $this->name = $name;
     $this->extends = isset($subNodes['extends']) ? $subNodes['extends'] : null;
     $this->implements = isset($subNodes['implements']) ? $subNodes['implements'] : array();
     $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array();
 }
Ejemplo n.º 3
0
 /**
  * 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(array('name' => $name, 'extends' => isset($subNodes['extends']) ? $subNodes['extends'] : array(), 'stmts' => isset($subNodes['stmts']) ? $subNodes['stmts'] : array()), $attributes);
     if (isset(self::$specialNames[(string) $this->name])) {
         throw new Error(sprintf('Cannot use \'%s\' as class name as it is reserved', $this->name));
     }
     foreach ($this->extends as $interface) {
         if (isset(self::$specialNames[(string) $interface])) {
             throw new Error(sprintf('Cannot use \'%s\' as interface name as it is reserved', $interface));
         }
     }
 }
Ejemplo n.º 4
0
 /**
  * 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($attributes);
     $this->name = $name;
     $this->extends = isset($subNodes['extends']) ? $subNodes['extends'] : array();
     $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array();
     if (isset(self::$specialNames[strtolower($this->name)])) {
         throw new Error(sprintf('Cannot use \'%s\' as class name as it is reserved', $this->name));
     }
     foreach ($this->extends as $interface) {
         if (isset(self::$specialNames[strtolower($interface)])) {
             throw new Error(sprintf('Cannot use \'%s\' as interface name as it is reserved', $interface), $interface->getAttributes());
         }
     }
 }
Ejemplo n.º 5
0
 /**
  * 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 array       $attributes Additional attributes
  */
 public function __construct($name, array $subNodes = array(), array $attributes = array())
 {
     parent::__construct(null, $attributes);
     $this->type = isset($subNodes['type']) ? $subNodes['type'] : 0;
     $this->name = $name;
     $this->extends = isset($subNodes['extends']) ? $subNodes['extends'] : null;
     $this->implements = isset($subNodes['implements']) ? $subNodes['implements'] : array();
     $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array();
     if (isset(self::$specialNames[(string) $this->name])) {
         throw new Error(sprintf('Cannot use \'%s\' as class name as it is reserved', $this->name));
     }
     if (isset(self::$specialNames[(string) $this->extends])) {
         throw new 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 Error(sprintf('Cannot use \'%s\' as interface name as it is reserved', $interface));
         }
     }
 }
Ejemplo n.º 6
0
 /**
  * Constructs a trait node.
  *
  * @param string $name
  *        	Name
  * @param Node[] $stmts
  *        	Statements
  * @param array $attributes
  *        	Additional attributes
  */
 public function __construct($name, array $stmts = array(), array $attributes = array())
 {
     parent::__construct($attributes);
     $this->name = $name;
     $this->stmts = $stmts;
 }
Ejemplo n.º 7
0
 /**
  * Constructs a trait node.
  *
  * @param string $name       Name
  * @param Node[] $stmts      Statements
  * @param array  $attributes Additional attributes
  */
 public function __construct($name, array $stmts = array(), array $attributes = array())
 {
     parent::__construct(array('name' => $name, 'stmts' => $stmts), $attributes);
 }