Overview

Namespaces

  • Charcoal
    • App
      • Action
      • Config
      • Handler
      • Middleware
      • Module
      • Route
      • Script
      • ServiceProvider
      • Template

Classes

  • Charcoal\App\Action\AbstractAction
  • Charcoal\App\App
  • Charcoal\App\AppConfig
  • Charcoal\App\AppContainer
  • Charcoal\App\Config\CacheConfig
  • Charcoal\App\Config\DatabaseConfig
  • Charcoal\App\Config\FilesystemConfig
  • Charcoal\App\Config\LoggerConfig
  • Charcoal\App\Config\MemcacheCacheConfig
  • Charcoal\App\Config\MemcacheCacheServerConfig
  • Charcoal\App\Handler\AbstractHandler
  • Charcoal\App\Handler\Error
  • Charcoal\App\Handler\HandlerConfig
  • Charcoal\App\Handler\NotAllowed
  • Charcoal\App\Handler\NotFound
  • Charcoal\App\Handler\PhpError
  • Charcoal\App\Handler\Shutdown
  • Charcoal\App\Middleware\CacheMiddleware
  • Charcoal\App\Module\AbstractModule
  • Charcoal\App\Module\ModuleConfig
  • Charcoal\App\Module\ModuleManager
  • Charcoal\App\Route\ActionRoute
  • Charcoal\App\Route\ActionRouteConfig
  • Charcoal\App\Route\RouteConfig
  • Charcoal\App\Route\RouteManager
  • Charcoal\App\Route\ScriptRoute
  • Charcoal\App\Route\ScriptRouteConfig
  • Charcoal\App\Route\TemplateRoute
  • Charcoal\App\Route\TemplateRouteConfig
  • Charcoal\App\Script\AbstractScript
  • Charcoal\App\ServiceProvider\AppServiceProvider
  • Charcoal\App\ServiceProvider\CacheServiceProvider
  • Charcoal\App\ServiceProvider\DatabaseServiceProvider
  • Charcoal\App\ServiceProvider\FilesystemServiceProvider
  • Charcoal\App\ServiceProvider\LoggerServiceProvider
  • Charcoal\App\ServiceProvider\ViewServiceProvider
  • Charcoal\App\Template\AbstractTemplate
  • Charcoal\App\Template\AbstractWidget
  • Charcoal\App\Template\WidgetBuilder

Interfaces

  • Charcoal\App\Action\ActionInterface
  • Charcoal\App\AppAwareInterface
  • Charcoal\App\Handler\HandlerInterface
  • Charcoal\App\Module\ModuleInterface
  • Charcoal\App\Route\RouteInterface
  • Charcoal\App\Script\CronScriptInterface
  • Charcoal\App\Script\ScriptInterface
  • Charcoal\App\Template\TemplateInterface
  • Charcoal\App\Template\WidgetInterface

Traits

  • Charcoal\App\AppAwareTrait
  • Charcoal\App\CallableResolverAwareTrait
  • Charcoal\App\Script\ArgScriptTrait
  • Charcoal\App\Script\CronScriptTrait
  • Charcoal\App\Script\PathScriptTrait
  • Overview
  • Namespace
  • Class
 1: <?php
 2: 
 3: namespace Charcoal\App\Template;
 4: 
 5: // PSR-3 (logger) dependencies
 6: use \Psr\Log\LoggerAwareInterface;
 7: use \Psr\Log\LoggerAwareTrait;
 8: 
 9: // Dependencies from `Pimple`
10: use \Pimple\Container;
11: 
12: // Module `charcoal-config` dependencies
13: use \Charcoal\Config\AbstractEntity;
14: 
15: // Module `charcoal-view` dependencies
16: use \Charcoal\View\ViewableInterface;
17: use \Charcoal\View\ViewableTrait;
18: 
19: // Local namespace dependencies
20: use \Charcoal\App\Template\WidgetInterface;
21: 
22: /**
23:  *
24:  */
25: abstract class AbstractWidget extends AbstractEntity implements
26:     WidgetInterface,
27:     LoggerAwareInterface,
28:     ViewableInterface
29: {
30:     use LoggerAwareTrait;
31:     use ViewableTrait;
32: 
33:     /**
34:      * @var boolean $active
35:      */
36:     private $active = true;
37: 
38:     /**
39:      * @param array|\ArrayAccess $data Optional dependencies.
40:      */
41:     public function __construct($data = null)
42:     {
43:         $this->setLogger($data['logger']);
44: 
45:         if (isset($data['container'])) {
46:             $this->setDependencies($data['container']);
47:         }
48:     }
49: 
50:     /**
51:      * Give an opportunity to children classes to inject dependencies from a Pimple Container.
52:      *
53:      * Does nothing by default, reimplement in children classes.
54:      *
55:      * The `$container` DI-container (from `Pimple`) should not be saved or passed around, only to be used to
56:      * inject dependencies (typically via setters).
57:      *
58:      * @param Container $container A dependencies container instance.
59:      * @return void
60:      */
61:     public function setDependencies(Container $container)
62:     {
63:         // This method is a stub. Reimplement in children template classes.
64:     }
65: 
66: 
67:     /**
68:      * @param boolean $active The active flag.
69:      * @return AbstractWidget Chainable
70:      */
71:     public function setActive($active)
72:     {
73:         $this->active = !!$active;
74:         return $this;
75:     }
76: 
77:     /**
78:      * @return boolean
79:      */
80:     public function active()
81:     {
82:         return $this->active;
83:     }
84: }
85: 
API documentation generated by ApiGen