Trismegiste\Mondrian\Visitor\VisitorGateway::getNodeFor PHP Method

getNodeFor() public method

public getNodeFor ( $stateKey )
    public function getNodeFor($stateKey)
    {
        foreach ($this->stateStack as $assoc) {
            if ($assoc['key'] === $stateKey) {
                return $assoc['node'];
            }
        }
        throw new \InvalidArgumentException("{$stateKey} is not a currently stacked state");
    }

Usage Example

 /**
  * @expectedException \InvalidArgumentException
  */
 public function testNoNodeFound()
 {
     $this->buildVisitorUnique();
     $this->sut->getNodeFor('fddbfgb');
 }