src/server/Server.php
public function getHandler(string $handler): Handler
    {
        if (!isset($this->handlers[$handler])) {
            if (!class_exists($handler) || !class_implements($handler, Handler::class)) {
                throw new \RuntimeException("No handler found for '$handler'.");
            }

            $instance = new $handler();
            $this->handlers[$handler] = $instance;
        } else {
            $instance = $this->handlers[$handler];
        }

        return $instance;
    }
public function getHandler(string $handler): Handler
    {
        if (!isset($this->handlers[$handler])) {
            if (!class_exists($handler) || !class_implements($handler, Handler::class)) {
                throw new \RuntimeException("No handler found for '$handler'.");
            }

            $instance = new $handler();
            $this->handlers[$handler] = $instance;
        } else {
            $instance = $this->handlers[$handler];
        }

        return $instance;
    }
public function getHandler ( string $ handler ) : Handler { if ( ! isset ( $ this -> handlers [ $ handler ] ) ) { if ( ! class_exists ( $ handler ) || ! class_implements ( $ handler , Handler :: class ) ) { throw new \ RuntimeException ( "No handler found for '$handler'." ) ; } $ instance = new $ handler ( ) ; $ this -> handlers [ $ handler ] = $ instance ; } else { $ instance = $ this -> handlers [ $ handler ] ; } return $ instance ; }
Gets a command handler instance.

Handler instances are lazy-instantiated.
Gets a command handler instance .