for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* For licensing information, please see the LICENSE file accompanied with this file.
*
* @author Gerard van Helden <[email protected]>
* @copyright 2012 Gerard van Helden <http://melp.nl>
*/
namespace Zicht\Tool\Script\Node\Task;
use Zicht\Tool\Script\Buffer;
use Zicht\Tool\Script\Node\Branch;
use Zicht\Tool\Util;
* A node for the "args" section of a task
class SetNode extends Branch
{
* Constructor.
* @param string $name
* @param \Zicht\Tool\Script\Node\Node $expr
public function __construct($name, $expr)
parent::__construct();
$this->nodes[0] = $expr;
$this->name = $name;
name
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
}
* Compiles the arg node.
* @param \Zicht\Tool\Script\Buffer $buffer
* @return void
public function compile(Buffer $buffer)
$name = explode('.', $this->name);
$phpName = Util::toPhp($name);
$buffer->write('$z->set(')->raw($phpName)->raw(', ');
$buffer->raw('$z->value(');
$this->nodes[0]->compile($buffer);
$buffer->raw('));')->eol();
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: