Esempio n. 1
0
 /**
  * Makes the resolver.
  *
  * @return TemplateResolver The resolver
  */
 public static function make()
 {
     $resolver = new TemplateResolver();
     $services = Provider::getServices();
     $config = $services->get('Config');
     if (isset($config['error']['html']['templates'])) {
         $templates = (array) $config['error']['html']['templates'];
         foreach ($templates as $template => $path) {
             $resolver->setTemplate($template, $path);
         }
     }
     return $resolver;
 }
 /**
  * Makes the error listener.
  *
  * @return \Es\Error\ErrorListener The error listener
  */
 public static function make()
 {
     $services = Provider::getServices();
     $config = $services->get('Config');
     $strategies = [];
     if (isset($config['error']['strategies'])) {
         $strategies = (array) $config['error']['strategies'];
     }
     $listener = new ErrorListener();
     foreach ($strategies as $name) {
         $strategy = $services->get($name);
         $listener->attachErrorStrategy($strategy);
     }
     return $listener;
 }
 /**
  * Gets the view resolver.
  *
  * @return \Es\View\Resolver The view resolver
  */
 public function getResolver()
 {
     return Provider::getServices()->get('ViewResolver');
 }
Esempio n. 4
0
 /**
  * Gets router.
  *
  * @return \Es\Router\RouterInterface The router
  */
 public function getRouter()
 {
     return Provider::getServices()->get('Router');
 }
Esempio n. 5
0
 /**
  * Gets the modules.
  *
  * @return ModulesInterface $modules The modules
  */
 public function getModules()
 {
     return Provider::getServices()->get('Modules');
 }
 /**
  * Gets the plugins.
  *
  * @return \Es\Mvc\ControllerPluginsInterface The plugins
  */
 public function getPlugins()
 {
     return Provider::getServices()->get('ControllerPlugins');
 }
 /**
  * Gets the class loader.
  *
  * @return \Es\Loader\ClassLoader The class loader
  */
 public function getLoader()
 {
     return Provider::getServices()->get('ClassLoader');
 }
Esempio n. 8
0
 /**
  * Gets the renderer.
  *
  * @return Renderer The renderer
  */
 public function getRenderer()
 {
     return Provider::getServices()->get('DefaultTemplateRenderer');
 }
Esempio n. 9
0
 /**
  * Gets the view.
  *
  * @return \Es\Mvc\ViewInterface The view
  */
 public function getView()
 {
     return Provider::getServices()->get('View');
 }
 /**
  * Gets the controllers.
  *
  * @return \Es\Mvc\ControllersInterface The controllers
  */
 public function getControllers()
 {
     return Provider::getServices()->get('Controllers');
 }
 /**
  * Gets the view helpers.
  *
  * @return \Es\Mvc\ViewHelpersInterface The view helpers
  */
 public function getHelpers()
 {
     return Provider::getServices()->get('ViewHelpers');
 }
Esempio n. 12
0
 public function testSetServices()
 {
     $services = new Services();
     Provider::setServices($services);
     $this->assertSame(Provider::getServices(), $services);
 }
Esempio n. 13
0
 /**
  * Gets the listeners.
  *
  * @return ListenersInterface The listeners
  */
 public function getListeners()
 {
     return Provider::getServices()->get('Listeners');
 }
Esempio n. 14
0
 /**
  * Gets the system.
  *
  * @return SystemInterface The system
  */
 public function getSystem()
 {
     return Provider::getServices()->get('System');
 }
Esempio n. 15
0
 /**
  * Gets the resolver of error templates.
  *
  * @return TemplateResolverInterface The resolver
  */
 public function getResolver()
 {
     return Provider::getServices()->get('ErrorTemplateResolver');
 }
Esempio n. 16
0
 /**
  * Gets the system configuration.
  *
  * @return ConfigInterface The system configuration
  */
 public function getConfig()
 {
     return Provider::getServices()->get('Config');
 }