/** * Adds a binding to this map, overwriting the existing one if there is a * conflict. * * @param ParameterBinding $binding * The binding to add. */ public function addBinding(ParameterBinding $binding) { $value = $binding->getValue(); // The binding will return a PathComponent if it expects to be physically // represented in the path, whether or not it already is. if ($value instanceof PathComponent) { if ($binding->inPath()) { $key = $binding->getArgument(); } else { $key = $this->path->indexOf($value); if ($key === FALSE) { $key = $this->_length++; } } } else { $key = $binding->getParameter()->getName(); } $this->set($key, $binding); if (!isset($this->bindings[$key])) { $this->bindings[$key] = []; } array_unshift($this->bindings[$key], $binding); }
public function testGetValueNoArgumentNoDefaultvalue() { $path = new PathUtility('foo/%node'); $binding = new ParameterBinding($path, $this->parameter); $this->assertNull($binding->getValue()); }