PHPSA\Variable::__construct PHP Method

__construct() public method

Creates a variable.
public __construct ( string $name, mixed $defaultValue = null, integer $type = CompiledExpression::UNKNOWN, integer | string $branch = self::BRANCH_ROOT )
$name string
$defaultValue mixed
$type integer
$branch integer | string
    public function __construct($name, $defaultValue = null, $type = CompiledExpression::UNKNOWN, $branch = self::BRANCH_ROOT)
    {
        $this->name = $name;
        if (!is_null($defaultValue)) {
            $this->sets++;
            $this->value = $defaultValue;
        }
        $this->type = (int) $type;
        $this->branch = $branch;
    }

Usage Example

Example #1
0
 /**
  * @param string $name
  * @param null $defaultValue
  * @param int $type
  * @param bool|false $referenced
  */
 public function __construct($name, $defaultValue = null, $type = CompiledExpression::UNKNOWN, $referenced = false)
 {
     parent::__construct($name, $defaultValue, $type);
     $this->referenced = $referenced;
 }
All Usage Examples Of PHPSA\Variable::__construct