/** * Add a node. * * @param string $name Node's name. If null, will be * set to name of `$node`. * @param \Hoa\Protocol\Protocol $node Node to add. * @return \Hoa\Protocol\Protocol * @throws \Hoa\Protocol\Exception */ public function offsetSet($name, $node) { if (!$node instanceof self) { throw new Protocol\Exception('Protocol node must extend %s.', 0, __CLASS__); } if (empty($name)) { $name = $node->getName(); } if (empty($name)) { throw new Protocol\Exception('Cannot add a node to the `hoa://` protocol without a name.', 1); } $this->_children[$name] = $node; return; }
public function case_resolve_unfold_to_non_existing_resources() { $this->given($parentHoaDirectory = dirname(dirname(dirname(dirname(__DIR__)))), $protocol = SUT::getInstance())->when($result = $protocol->resolve('hoa://Library', false, true))->then->array($result)->isEqualTo([$parentHoaDirectory . DS . 'Hoathis', $parentHoaDirectory . DS . 'Hoa']); }
<?php if (true === file_exists(__DIR__ . '/vendor/autoload.php')) { require __DIR__ . '/vendor/autoload.php'; } elseif (true === file_exists(__DIR__ . '/../../autoload.php')) { require __DIR__ . '/../../autoload.php'; } else { die('Cannot find Composer autoloader.'); } use Hoa\Protocol; $hoaProtocol = Protocol\Protocol::getInstance(); $hoaProtocol[] = new Protocol\Node('Jekxyl', __DIR__ . DS);