Exemple #1
0
 /**
  * Constructs a string scalar node.
  *
  * @param string      $value      Value of the string
  * @param int         $line       Line
  * @param null|string $docComment Nearest doc comment
  */
 public function __construct($value = '', $string_type, $line = -1, $docComment = null)
 {
     if ($string_type === "'") {
         $value = preg_replace_callback("#[^\\\\][']+?#Uis", 'phpparser_node_scalar_string_replace_single', $value);
     } elseif ($string_type === '"') {
         $value = preg_replace_callback('#[^\\\\]"+?#Uis', 'phpparser_node_scalar_string_replace_double', $value);
     } else {
         throw new Exception("Unsupported string type.");
     }
     parent::__construct(array('value' => $value, 'string_type' => $string_type), $line, $docComment);
 }
Exemple #2
0
 /**
  * Constructs an encapsed string node.
  *
  * @param array $parts      Encaps list
  * @param array $attributes Additional attributes
  */
 public function __construct(array $parts = array(), array $attributes = array())
 {
     parent::__construct(array('parts' => $parts), $attributes);
 }
 /**
  * Constructs a __FILE__ const node
  *
  * @param array $attributes Additional attributes
  */
 public function __construct(array $attributes = array())
 {
     parent::__construct(array(), $attributes);
 }
 /**
  * Constructs a string scalar node.
  *
  * @param string $value      Value of the string
  * @param array  $attributes Additional attributes
  */
 public function __construct($value = '', array $attributes = array())
 {
     parent::__construct(array('value' => $value), $attributes);
 }
 /**
  * Constructs a __METHOD__ const node
  *
  * @param int         $line       Line
  * @param null|string $docComment Nearest doc comment
  */
 public function __construct($line = -1, $docComment = null)
 {
     parent::__construct(array(), $line, $docComment);
 }
 /**
  * Constructs an integer number scalar node.
  *
  * @param int         $value      Value of the number
  * @param int         $line       Line
  * @param null|string $docComment Nearest doc comment
  */
 public function __construct($value = 0, $line = -1, $docComment = null)
 {
     parent::__construct(array('value' => $value), $line, $docComment);
 }
 /**
  * Constructs an encapsed string node.
  *
  * @param array       $parts      Encaps list
  * @param int         $line       Line
  * @param null|string $docComment Nearest doc comment
  */
 public function __construct(array $parts = array(), $line = -1, $docComment = null)
 {
     parent::__construct(array('parts' => $parts), $line, $docComment);
 }