Gets an instance of this class.

@param string $name Name of the Event Dispatcher instance to get, if does not
exists a new instance will be created and registered
@return \CMS\Event\EventDispatcher
491018
public static function instance($name = 'default')
    {
        if (!isset(static::$_instances[$name])) {
            static::$_instances[$name] = new EventDispatcher();
        }

        return static::$_instances[$name];
    }
85658
public static function create($name)
    {
        $class = App::className($name, 'Middleware/UnauthorizedHandler', 'Handler');
        if (!$class) {
            $message = sprintf('Handler `%s` does not exist.', $name);
            throw new RuntimeException($message);
        }

        $instance = new $class();
        if (!$instance instanceof HandlerInterface) {
            $message = sprintf('Handler should implement `%s`, got `%s`.', HandlerInterface::class, get_class($instance));
            throw new RuntimeException($message);
        }

        return $instance;
    }
349472
public static function getInstance($name, ...$args)
    {
        if (empty(static::$instances[$name])) {
            static::$instances[$name] = new static(...$args);
        }

        return static::$instances[$name];
    }
1111610
public function get(string $name)
    {
        if ($this->isSingleton($name)) {
            /*
             * Object is instantiated as
             * singleton already. Just fetch it.
             */
            return $this->singletonObjects[$name];
        } elseif ($this->isDefined($name)) {
            /*
             * Creates a new instance
             * using map information.
             */
            return $this->build($name);
        } elseif (class_exists($name)) {
            /*
             * Class exists but it is
             * not mapped yet.
             */
            $this->set(
                $name,
                method_exists($name, '__construct') ?
                    $this->generateArgumentsMap($name) : []
            );

            return $this->get($name);
        }

        throw new \Exception("Couldn't create '$name'");
    }
370905
public function getInstance($name)
    {
        if(!isset($this->data[$name]))
        {
            $this->data[$name] = new \SplQueue;
        }
        return $this->data[$name];
    }
1062839
public function &getAppInstance(string $name)
    {
        if (empty($name)) {
            Throw new AppHandlerException('AppHandler::getAppInstance() method needs a camelized appname.');
        }

        $string = new CamelCase($name);
        $name = $string->camelize();

        // App instances are singletons!
        if (!array_key_exists($name, $this->instances)) {

            // Create class name
            $class = '\AppHandler\\' . $name . '\\' . $name;

            //
            $filename = BASEDIR . str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php';

            if (!file_exists($filename)) {
                Throw new AppHandlerException(sprintf('AppHandler could not find an app classfile "%s" for app "%s"', $name, $filename));
            }

            // Default arguments for each app instance
            $args = [
                $name,
                $this,
                $this->config->getStorage($name),
                'core.page',
                'core.di'
            ];

            $instance = $this->di->instance($class, $args);

            if (!$instance instanceof AbstractApp) {
                Throw new AppHandlerException('AppHandler must be an instance of AbstractApp class!');
            }

            $instance->setName($name);

            $this->instances[$name] = $instance;
        }

        return $this->instances[$name];
    }
137271
public function getProvider($name)
    {
        if (!array_key_exists($name, $this->providers)) {
            throw new RuntimeException(sprintf('Provider "%s" doesm\'t exist.', (string)$name));
        }

        return $this->providers[$name];
    }
1102665
public static function getInstance( $name )
    {
        if (! isset( self::$instances[$name] ) )
            self::$instances[$name] = new self( $name );

        return self::$instances[$name];
    }
287061
public static function get($class, $name)
    {
        $class = ObjectHelper::getClass($class);
        return !empty(static::$events[$class][$name]) ? static::$events[$class][$name] : null;
    }
930137
public static function getInstance($name)
	{
		$model = sprintf('\\%sAdmin', Str::studly($name));
		$model = new $model;

		return $model;
	}
81678
public function getEventDispatcher()
    {
        if (null === $this->eventDispatcher) {
            $this->eventDispatcher = new Dispatcher\ResourceEventDispatcher();
            $this->eventDispatcher->setConfigurationRegistry($this->getConfigurationRegistry());
            $this->eventDispatcher->setEventQueue($this->getEventQueue());
        }

        return $this->eventDispatcher;
    }
1033103
public static function getLogger($name)
    {
        return Registry::hasLogger($name) ? Registry::getInstance($name) : self::createLogger($name);
    }
485934
public function get($name)
    {
        if (isset($this->container[$name])) {
            return $this->container[$name];
        } else {
            return new Iterator([]);
        }
    }
277824
public function get($name, $default = null)
    {
        if (array_key_exists($name, $this->eventData)) {
            return $this->eventData[$name];
        }

        return $default;
    }
559309
public function getEvent($name)
    {
        if (!isset($this->events[$name])) {
            throw new \LogicException(sprintf('Event "%s" is not known.', $name));
        }

        return $this->events[$name];
    }
59924
public function get(string $name = null)
    {
        return $this->requestParser->parseInto(
                $this->injector->getInstance(
                        $this->userInputClass,
                        'stubbles.console.input.instance'
                ),
                $name
        );
    }
1345611
protected function getClass($name)
    {
        if (empty($this->adapters[$name])) {
            throw new \RuntimeException(sprintf(
                'Adapter "%s" has not been registered',
                $name
            ));
        }

        return $this->adapters[$name];
    }