You are here

class crumbs_DIC_ServiceContainer in Crumbs, the Breadcrumbs suite 7.2

Little brother of a dependency injection container (DIC)

@property crumbs_BreadcrumbBuilder $breadcrumbBuilder @property crumbs_TrailFinder $trailFinder @property crumbs_ParentFinder $parentFinder @property crumbs_PluginSystem_PluginBag $pluginBag @property crumbs_PluginSystem_PluginEngine $pluginEngine @property crumbs_CallbackRestoration $callbackRestoration @property crumbs_PluginSystem_PluginInfo $pluginInfo @property crumbs_CurrentPageInfo $page @property crumbs_TrailCache $trails @property crumbs_Router $router

Hierarchy

Expanded class hierarchy of crumbs_DIC_ServiceContainer

File

lib/DIC/ServiceContainer.php, line 17

View source
class crumbs_DIC_ServiceContainer extends crumbs_DIC_AbstractServiceContainer {

  /**
   * A service that can build a breadcrumb from a trail.
   *
   * @return crumbs_BreadcrumbBuilder
   *
   * @see crumbs_DIC_ServiceContainer::$breadcrumbBuilder
   */
  protected function breadcrumbBuilder() {
    return new crumbs_BreadcrumbBuilder($this->pluginEngine);
  }

  /**
   * A service that can build a trail for a given path.
   *
   * @return crumbs_TrailFinder
   *
   * @see crumbs_DIC_ServiceContainer::$trailFinder
   */
  protected function trailFinder() {
    return new crumbs_TrailFinder($this->parentFinder, $this->router);
  }

  /**
   * A service that attempts to find a parent path for a given path.
   *
   * @return crumbs_ParentFinder
   *
   * @see crumbs_DIC_ServiceContainer::$parentFinder
   */
  protected function parentFinder() {
    return new crumbs_ParentFinder($this->pluginEngine, $this->router);
  }

  /**
   * @return crumbs_PluginSystem_PluginBag
   *
   * @see crumbs_DIC_ServiceContainer::$pluginBag
   */
  protected function pluginBag() {
    $pluginInfo = $this->pluginInfo;
    return new crumbs_PluginSystem_PluginBag($pluginInfo->plugins, $pluginInfo->routelessPluginMethods, $pluginInfo->routePluginMethods);
  }

  /**
   * A service that knows all plugins and their configuration/weights,
   * and can run plugin operations on those plugins.
   *
   * @return crumbs_PluginSystem_PluginEngine
   *
   * @see crumbs_DIC_ServiceContainer::$pluginEngine
   */
  protected function pluginEngine() {
    return new crumbs_PluginSystem_PluginEngine($this->pluginBag, $this->router, $this->pluginInfo->weightMap);
  }

  /**
   * @return crumbs_CallbackRestoration
   *
   * @see crumbs_DIC_ServiceContainer::$callbackRestoration
   */
  protected function callbackRestoration() {
    return new crumbs_CallbackRestoration();
  }

  /**
   * A service that knows all plugins and their configuration/weights.
   *
   * @return crumbs_PluginSystem_PluginInfo
   *
   * @see crumbs_DIC_ServiceContainer::$pluginInfo
   */
  protected function pluginInfo() {
    return new crumbs_PluginSystem_PluginInfo();
  }

  /**
   * Service that can provide information related to the current page.
   *
   * @return crumbs_CurrentPageInfo
   *
   * @see crumbs_DIC_ServiceContainer::$page
   */
  protected function page() {
    return new crumbs_CurrentPageInfo($this->trails, $this->breadcrumbBuilder, $this->router);
  }

  /**
   * Service that can provide/calculate trails for different paths.
   *
   * @return crumbs_TrailCache
   *
   * @see crumbs_DIC_ServiceContainer::$trails
   */
  protected function trails() {
    return new crumbs_TrailCache($this->trailFinder);
  }

  /**
   * Wrapper for routing-related Drupal core functions.
   *
   * @return crumbs_Router
   *
   * @see crumbs_DIC_ServiceContainer::$router
   */
  protected function router() {
    return new crumbs_Router();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
crumbs_DIC_AbstractServiceContainer::$services private property
crumbs_DIC_AbstractServiceContainer::createService private function
crumbs_DIC_AbstractServiceContainer::__get function Magic method that is triggered when someone calls $container->$name.
crumbs_DIC_ServiceContainer::breadcrumbBuilder protected function A service that can build a breadcrumb from a trail.
crumbs_DIC_ServiceContainer::callbackRestoration protected function
crumbs_DIC_ServiceContainer::page protected function Service that can provide information related to the current page.
crumbs_DIC_ServiceContainer::parentFinder protected function A service that attempts to find a parent path for a given path.
crumbs_DIC_ServiceContainer::pluginBag protected function
crumbs_DIC_ServiceContainer::pluginEngine protected function A service that knows all plugins and their configuration/weights, and can run plugin operations on those plugins.
crumbs_DIC_ServiceContainer::pluginInfo protected function A service that knows all plugins and their configuration/weights.
crumbs_DIC_ServiceContainer::router protected function Wrapper for routing-related Drupal core functions.
crumbs_DIC_ServiceContainer::trailFinder protected function A service that can build a trail for a given path.
crumbs_DIC_ServiceContainer::trails protected function Service that can provide/calculate trails for different paths.