LFT
  • Namespace
  • Class
  • Tree

Namespaces

  • Docoflow
    • Contracts
    • Entity
    • Facades
    • Models
    • Traits
  • Docolight
    • Agno
      • Traits
    • Container
    • Http
      • Contracts
    • Rest
      • Handler
      • Http
    • Support
      • Debug
      • Traits
  • Docotory
    • Traits
  • None

Classes

  • Docoflow\Docoflow
  • Docoflow\Entity\Group
  • Docoflow\Entity\Step
  • Docoflow\Entity\Verificator
  • Docoflow\Facades\Action
  • Docoflow\Facades\Activity
  • Docoflow\Facades\Flo
  • Docoflow\Facades\StateActivity
  • Docoflow\Flo
  • Docoflow\Models\Workflow
  • Docoflow\Models\WorkflowAction
  • Docoflow\Models\WorkflowActivity
  • Docoflow\Models\WorkflowGroups
  • Docoflow\Models\WorkflowNotification
  • Docoflow\Models\WorkflowState
  • Docoflow\Models\WorkflowStateActivity
  • Docoflow\Models\WorkflowStep
  • Docoflow\Models\WorkflowVerificator
  • Docolight
  • Docolight\Agno\AgnoModule
  • Docolight\Container\Container
  • Docolight\Http\Headers
  • Docolight\Http\JsonResponse
  • Docolight\Http\MimeResponse
  • Docolight\Http\Response
  • Docolight\Http\ResponseFactory
  • Docolight\Rest\Handler\RestfulErrorHandler
  • Docolight\Rest\Http\RestFulController
  • Docolight\Support\ActiveRecordWrapper
  • Docolight\Support\Arr
  • Docolight\Support\Carbonate
  • Docolight\Support\ClassLoader
  • Docolight\Support\Collection
  • Docolight\Support\CollectionDataProvider
  • Docolight\Support\Debug\Dumper
  • Docolight\Support\Debug\HtmlDumper
  • Docolight\Support\Facade
  • Docolight\Support\Factory
  • Docolight\Support\Fluent
  • Docolight\Support\Html
  • Docolight\Support\IterablePager
  • Docolight\Support\Repository
  • Docolight\Support\Set
  • Docolight\Support\Str
  • Docotory\Factory

Interfaces

  • Docoflow\Contracts\DocoflowContract
  • Docoflow\Contracts\ValidationStatus
  • Docolight\Http\Contracts\Arrayable

Traits

  • Docoflow\Traits\BulkValidator
  • Docoflow\Traits\Entity
  • Docoflow\Traits\HasMutator
  • Docoflow\Traits\Validable
  • Docolight\Agno\Traits\HasAssetsUrl
  • Docolight\Agno\Traits\HasAutoload
  • Docolight\Support\Traits\Macroable
  • Docotory\Traits\HasFactories

Exceptions

  • Docolight\Container\BindingResolutionException
  • Docotory\ResolvingTypeException

Functions

  • array_add
  • array_build
  • array_collapse
  • array_divide
  • array_dot
  • array_except
  • array_first
  • array_flatten
  • array_forget
  • array_get
  • array_has
  • array_last
  • array_only
  • array_pluck
  • array_pull
  • array_replace_value
  • array_set
  • array_sort
  • array_sort_recursive
  • array_where
  • cache
  • camel_case
  • class_basename
  • class_uses_recursive
  • collect
  • container
  • data_get
  • dd
  • def
  • dump
  • e
  • ends_with
  • fluent
  • get
  • head
  • input
  • last
  • object_get
  • preg_replace_sub
  • request
  • response
  • session
  • snake_case
  • starts_with
  • str_contains
  • str_finish
  • str_is
  • str_limit
  • str_random
  • str_replace_array
  • str_slug
  • studly_case
  • title_case
  • trait_uses_recursive
  • transaction
  • trimtolower
  • value
  • with
  1 <?php
  2 
  3 namespace Docolight\Agno;
  4 
  5 use Yii;
  6 use CWebModule;
  7 use Docotory\Traits\HasFactories;
  8 use Docolight\Agno\Traits\HasAutoload;
  9 use Docolight\Agno\Traits\HasAssetsUrl;
 10 
 11 /**
 12  * Make your module can be accessible via facade method.
 13  *
 14  * @todo Call static could not be implemented yet, because this class is behind the facade.
 15  */
 16 abstract class AgnoModule extends CWebModule
 17 {
 18     use HasFactories, HasAssetsUrl, HasAutoload;
 19 
 20     /**
 21      * Available factories
 22      *
 23      * @var array
 24      */
 25     public $availableFactories = [];
 26 
 27     /**
 28      * Interface / Alias / Class bindings
 29      *
 30      * @var array
 31      */
 32     public $bindings = [];
 33 
 34     /**
 35      * If you override init method in your module, make sure you called parent::init() to make the Facade itself be accessible.
 36      */
 37     public function init()
 38     {
 39         parent::init();
 40 
 41         $this->loadPsr();
 42         $this->loadAutoload();
 43         $this->registerBindings();
 44         $this->registerFacadeAccessor();
 45         $this->registerAvailableFactories();
 46     }
 47 
 48     /**
 49      * Register all bindings
 50      *
 51      * @return void
 52      */
 53     public function registerBindings()
 54     {
 55         foreach ($this->bindings as $binding) {
 56             list($definition, $concrete) = $binding;
 57 
 58             Yii::app()->container->singleton($definition, $concrete);
 59         }
 60     }
 61 
 62     /**
 63      * Register your facade accessor.
 64      */
 65     protected function registerFacadeAccessor()
 66     {
 67         // Hack API facade, so any components / controllers / models / views / child modules
 68         // on this module can access the facade too
 69         $that = $this;
 70 
 71         Yii::app()->container->singleton($this->getFacadeAccessor(), function ($container) use ($that) {
 72             return $that;
 73         });
 74         // End of facade hack
 75     }
 76 
 77     /**
 78      * Register available factories
 79      */
 80     protected function registerAvailableFactories()
 81     {
 82         if ($this->availableFactories) {
 83             // Factory singleton
 84             foreach ($this->availableFactories as $alias => $factory) {
 85                 Yii::app()->container->singleton($alias, $factory);
 86             }
 87 
 88             // Inject factories to this implementation
 89             $this->registerFactories($this->availableFactories);
 90         }
 91     }
 92 
 93     /**
 94      * Unique facade accessor
 95      *
 96      * @return string
 97      */
 98     protected function getFacadeAccessor()
 99     {
100         return $this->getId();
101     }
102 
103     /**
104      * If an attribute of this class called
105      *
106      * @param string $type
107      *
108      * @return mixed
109      */
110     public function __get($type)
111     {
112         if ($this->hasFactory($type)) {
113             return $this->factory($type);
114         }
115 
116         return parent::__get($type);
117     }
118 
119     /**
120      * Handle method not found. Let's search in base factory first.
121      *
122      * @param string $method
123      * @param array  $arguments
124      *
125      * @return mixed
126      */
127     public function __call($name, $parameters)
128     {
129         if ($this->hasFactory('base')) {
130             $base = $this->factory('base');
131 
132             if (method_exists($base, $name)) {
133                 return call_user_func_array([$base, $name], $parameters);
134             }
135         }
136     }
137 }
138 
LFT API documentation generated by ApiGen