Overview

Namespaces

  • Deimos
    • Flow
      • Extension
        • TBlock
        • TFor
        • TForeach
        • TIF
        • TLiteral
        • TPHP
        • TSimple
        • TTry
        • TWhile
      • Traits
  • PHP

Classes

  • Deimos\Flow\Block
  • Deimos\Flow\Configure
  • Deimos\Flow\DefaultConfig
  • Deimos\Flow\DefaultContainer
  • Deimos\Flow\Extension\TBlock\TBlockStart
  • Deimos\Flow\Extension\TBlock\TEndBlock
  • Deimos\Flow\Extension\TFor\TEndFor
  • Deimos\Flow\Extension\TFor\TFor
  • Deimos\Flow\Extension\TForeach\TElseForeach
  • Deimos\Flow\Extension\TForeach\TEndForeach
  • Deimos\Flow\Extension\TForeach\TForeach
  • Deimos\Flow\Extension\TIF\TELSE
  • Deimos\Flow\Extension\TIF\TELSEIF
  • Deimos\Flow\Extension\TIF\TEndIF
  • Deimos\Flow\Extension\TIF\TIF
  • Deimos\Flow\Extension\TLiteral\TLiteral
  • Deimos\Flow\Extension\TPHP\TEndPHP
  • Deimos\Flow\Extension\TPHP\TPHP
  • Deimos\Flow\Extension\TSimple\TAssign
  • Deimos\Flow\Extension\TSimple\TBreak
  • Deimos\Flow\Extension\TSimple\TContinue
  • Deimos\Flow\Extension\TSimple\TExtends
  • Deimos\Flow\Extension\TSimple\TInclude
  • Deimos\Flow\Extension\TSimple\TPartial
  • Deimos\Flow\Extension\TSimple\TVariable
  • Deimos\Flow\Extension\TTry\TCatch
  • Deimos\Flow\Extension\TTry\TEndTry
  • Deimos\Flow\Extension\TTry\TFinally
  • Deimos\Flow\Extension\TTry\TTry
  • Deimos\Flow\Extension\TWhile\TEndWhile
  • Deimos\Flow\Extension\TWhile\TWhile
  • Deimos\Flow\Flow
  • Deimos\Flow\FlowForeach
  • Deimos\Flow\FlowFunction
  • Deimos\Flow\ForeachState
  • Deimos\Flow\Lexer
  • Deimos\Flow\LexerConst
  • Deimos\Flow\Tokenizer

Interfaces

  • Throwable

Traits

  • Deimos\Flow\Traits\Block
  • Deimos\Flow\Traits\FileSystem
  • Deimos\Flow\Traits\Tokenizer

Exceptions

  • BadFunctionCallException
  • Exception
  • InvalidArgumentException
  • LogicException
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
 1: <?php
 2: 
 3: namespace Deimos\Flow;
 4: 
 5: use Deimos\Builder\Builder;
 6: use Deimos\DI\DI;
 7: use Deimos\Helper\Helper;
 8: 
 9: class DefaultContainer extends DI
10: {
11: 
12:     /**
13:      * @var \Deimos\Helper\Helper
14:      */
15:     protected $helper;
16: 
17:     /**
18:      * @var DefaultConfig
19:      */
20:     protected $config;
21: 
22:     /**
23:      * DefaultContainer constructor.
24:      *
25:      * @param DefaultConfig $config
26:      * @param Helper|null   $helper
27:      */
28:     public function __construct(DefaultConfig $config = null, Helper $helper = null)
29:     {
30:         if (!$helper)
31:         {
32:             $builder      = new Builder();
33:             $this->helper = new Helper($builder);
34:         }
35:         else
36:         {
37:             $this->helper = $helper;
38:         }
39: 
40:         $this->config = $config ?: new DefaultConfig();
41: 
42:         parent::__construct();
43:     }
44: 
45:     /**
46:      * configure
47:      */
48:     protected function configure()
49:     {
50:         foreach ($this->config->configStorage() as $callbackName => $callable)
51:         {
52:             $this->addCallback($callbackName, $callable);
53:         }
54: 
55:         $this->addCallback('json_encode', function (array $storage = null)
56:         {
57:             if (!$storage)
58:             {
59:                 $storage = [];
60:             }
61: 
62:             return $this->json()->encode($storage);
63:         });
64: 
65:         $this->build('arr', function ()
66:         {
67:             return $this->helper->arr();
68:         });
69: 
70:         $this->build('str', function ()
71:         {
72:             return $this->helper->str();
73:         });
74: 
75:         $this->build('json', function ()
76:         {
77:             return $this->helper->json();
78:         });
79:     }
80: 
81: }
API documentation generated by ApiGen