__construct() public method

Creates a Node.
public __construct ( array $attributes = [] )
$attributes array Array of attributes
Exemplo n.º 1
0
Arquivo: Arg.php Projeto: saj696/pipe
 /**
  * Constructs a function call argument node.
  *
  * @param Expr $value Value to pass
  * @param bool $byRef Whether to pass by ref
  * @param bool $unpack Whether to unpack the argument
  * @param array $attributes Additional attributes
  */
 public function __construct(Expr $value, $byRef = false, $unpack = false, array $attributes = array())
 {
     parent::__construct($attributes);
     $this->value = $value;
     $this->byRef = $byRef;
     $this->unpack = $unpack;
 }
Exemplo n.º 2
0
 /**
  * Constructs a parameter node.
  *
  * @param string           $name       Name
  * @param null|Expr        $default    Default value
  * @param null|string|Name $type       Typehint
  * @param bool             $byRef      Whether is passed by reference
  * @param bool             $variadic   Whether this is a variadic argument
  * @param array            $attributes Additional attributes
  */
 public function __construct($name, $default = null, $type = null, $byRef = false, $variadic = false, array $attributes = array())
 {
     parent::__construct(array('type' => $type, 'byRef' => $byRef, 'variadic' => $variadic, 'name' => $name, 'default' => $default), $attributes);
     if ($variadic && null !== $default) {
         throw new Error('Variadic parameter cannot have a default value');
     }
 }
Exemplo n.º 3
0
 /**
  * Constructs a name node.
  *
  * @param string|array $parts      Parts of the name (or name as string)
  * @param array        $attributes Additional attributes
  */
 public function __construct($parts, array $attributes = array())
 {
     if (!is_array($parts)) {
         $parts = explode('\\', $parts);
     }
     parent::__construct(array('parts' => $parts), $attributes);
 }
Exemplo n.º 4
0
 /**
  * Constructs a parameter node.
  *
  * @param string                        $name       Name
  * @param null|Expr                     $default    Default value
  * @param null|string|Name|NullableType $type       Typehint
  * @param bool                          $byRef      Whether is passed by reference
  * @param bool                          $variadic   Whether this is a variadic argument
  * @param array                         $attributes Additional attributes
  */
 public function __construct($name, Expr $default = null, $type = null, $byRef = false, $variadic = false, array $attributes = array()) {
     parent::__construct($attributes);
     $this->type = $type;
     $this->byRef = $byRef;
     $this->variadic = $variadic;
     $this->name = $name;
     $this->default = $default;
 }
Exemplo n.º 5
0
 /**
  * Constructs a name node.
  *
  * @param string|array $parts Parts of the name (or name as string)
  * @param array $attributes Additional attributes
  */
 public function __construct($parts, array $attributes = array())
 {
     if (!is_array($parts)) {
         $parts = explode('\\', $parts);
     }
     parent::__construct($attributes);
     $this->parts = $parts;
 }
Exemplo n.º 6
0
 /**
  * Constructs a parameter node.
  *
  * @param string           $name       Name
  * @param null|Expr        $default    Default value
  * @param null|string|Name $type       Typehint
  * @param bool             $byRef      Whether is passed by reference
  * @param bool             $variadic   Whether this is a variadic argument
  * @param array            $attributes Additional attributes
  */
 public function __construct($name, Expr $default = null, $type = null, $byRef = false, $variadic = false, array $attributes = array())
 {
     parent::__construct(null, $attributes);
     $this->type = $type;
     $this->byRef = $byRef;
     $this->variadic = $variadic;
     $this->name = $name;
     $this->default = $default;
     if ($variadic && null !== $default) {
         throw new Error('Variadic parameter cannot have a default value', $default->getAttributes());
     }
 }
Exemplo n.º 7
0
 /**
  * Constructs a name node.
  *
  * @param string|array|self $name       Name as string, part array or Name instance (copy ctor)
  * @param array             $attributes Additional attributes
  */
 public function __construct($name, array $attributes = array())
 {
     parent::__construct($attributes);
     $this->parts = self::prepareName($name);
 }
Exemplo n.º 8
0
 /**
  * Constructs a const node for use in class const and const statements.
  *
  * @param string  $name       Name
  * @param Expr    $value      Value
  * @param array   $attributes Additional attributes
  */
 public function __construct($name, Expr $value, array $attributes = array())
 {
     parent::__construct(null, $attributes);
     $this->name = $name;
     $this->value = $value;
 }
Exemplo n.º 9
0
 /**
  * Constructs a const node for use in class const and const statements.
  *
  * @param string  $name       Name
  * @param Expr    $value      Value
  * @param array   $attributes Additional attributes
  */
 public function __construct($name, Expr $value, array $attributes = array())
 {
     parent::__construct(array('name' => $name, 'value' => $value), $attributes);
 }
Exemplo n.º 10
0
 public function __construct($value, array $attributes = array())
 {
     parent::__construct($attributes);
 }
Exemplo n.º 11
0
 /**
  * Constructs a function call argument node.
  *
  * @param Expr  $value      Value to pass
  * @param bool  $byRef      Whether to pass by ref
  * @param bool  $unpack     Whether to unpack the argument
  * @param array $attributes Additional attributes
  */
 public function __construct(Expr $value, $byRef = false, $unpack = false, array $attributes = array())
 {
     parent::__construct(array('value' => $value, 'byRef' => $byRef, 'unpack' => $unpack), $attributes);
 }
Exemplo n.º 12
0
 /**
  * Constructs a nullable type (wrapping another type).
  *
  * @param string|Name $type       Type
  * @param array       $attributes Additional attributes
  */
 public function __construct($type, array $attributes = array())
 {
     parent::__construct($attributes);
     $this->type = $type;
 }
Exemplo n.º 13
0
 public function __construct(Comment $comment)
 {
     parent::__construct(['startLine' => $comment->getLine(), 'endLine' => $comment->getLine()]);
 }