src/Environment/Detector.php
public function getListenerInstance(EventDispatcher $eventDispatcher = null, StreamableInterface $stream = null)
    {
        //instantiate the key matcher object
        $reflection = new \ReflectionClass('\\Iber\\Phkey\\Environment\\' . $this->getEnvironment() . '\\Matcher');
        $matcher = $reflection->newInstance();

        $reflection = new \ReflectionClass('\\Iber\\Phkey\\Environment\\' . $this->getEnvironment() . '\\Listener');

        if (null === $eventDispatcher) {
            $eventDispatcher = new EventDispatcher();
        }

        if (null === $stream) {
            $stream = new Stream();
        }

        $listener = $reflection->newInstance($matcher, $eventDispatcher, $stream);

        return $listener;
    }
public function getListenerInstance(EventDispatcher $eventDispatcher = null, StreamableInterface $stream = null)
    {
        //instantiate the key matcher object
        $reflection = new \ReflectionClass('\\Iber\\Phkey\\Environment\\' . $this->getEnvironment() . '\\Matcher');
        $matcher = $reflection->newInstance();

        $reflection = new \ReflectionClass('\\Iber\\Phkey\\Environment\\' . $this->getEnvironment() . '\\Listener');

        if (null === $eventDispatcher) {
            $eventDispatcher = new EventDispatcher();
        }

        if (null === $stream) {
            $stream = new Stream();
        }

        $listener = $reflection->newInstance($matcher, $eventDispatcher, $stream);

        return $listener;
    }
Automatically instantiates the listener object with dependencies
based on environment

@param EventDispatcher|null $eventDispatcher
@param StreamableInterface|null $stream

@return \Iber\Phkey\Contracts\ListenableInterface