SM\Factory\AbstractFactory::get PHP Method

get() public method

{@inheritDoc}
public get ( $object, $graph = 'default' )
    public function get($object, $graph = 'default')
    {
        $hash = spl_object_hash($object);
        if (isset($this->stateMachines[$hash][$graph])) {
            return $this->stateMachines[$hash][$graph];
        }
        foreach ($this->configs as $config) {
            if ($config['graph'] === $graph && $object instanceof $config['class']) {
                return $this->stateMachines[$hash][$graph] = $this->createStateMachine($object, $config);
            }
        }
        throw new SMException(sprintf('Cannot create a state machine because the configuration for object "%s" with graph "%s" does not exist.', get_class($object), $graph));
    }