for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Thinktomorrow\Vine\Branch;
use Thinktomorrow\Vine\VineException;
/**
* Class Branch
*
* @property string $key
* @property string $value
* @property string $label
* @property array $branches
*/
class Branch
{
private $key;
private $value;
private $label;
private $branches;
public function __construct($key, $value, $label, BranchCollection $branches = null)
$this->key = $key;
$this->value = $value;
$this->label = $label;
$this->branches = $branches?: new BranchCollection();
}
public function hasBranches()
return ($this->branches->hasBranches());
public function push(Branch $branch)
$this->branches[] = $branch;
return $this;
public function __get($key)
if(isset($this->$key)) return $this->$key;
throw VineException::unknownBranchAttribute($key);