Completed
Push — master ( 7ee34d...c3ef57 )
by Oleg
03:16
created

Micro::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 11
Ratio 100 %

Importance

Changes 9
Bugs 1 Features 2
Metric Value
c 9
b 1
f 2
dl 11
loc 11
rs 9.4285
cc 2
eloc 6
nc 2
nop 2
1
<?php /** Micro */
2
3
namespace Micro;
4
5
use Micro\base\Autoload;
6
use Micro\base\Container;
7
use Micro\base\Dispatcher;
8
use Micro\base\IContainer;
9
use Micro\cli\DefaultConsoleCommand;
10
use Micro\resolver\ConsoleResolver;
11
use Micro\resolver\HMVCResolver;
12
use Micro\web\IOutput;
13
use Micro\web\IRequest;
14
use Micro\web\Response;
15
16
/**
17
 * Micro class file.
18
 *
19
 * Base class for initialize MicroPHP, used as bootstrap framework.
20
 *
21
 * @author Oleg Lunegov <[email protected]>
22
 * @link https://github.com/lugnsk/micro
23
 * @copyright Copyright &copy; 2013 Oleg Lunegov
24
 * @license /LICENSE
25
 * @package micro
26
 * @version 1.0
27
 * @since 1.0
28
 */
29
class Micro
30
{
31
    /** @const string VERSION Version framework */
32
    const VERSION = '1.1';
33
34
35
    /** @var string $environment Application environment */
36
    protected $environment = 'devel';
37
    /** @var bool $debug Debug-mode flag */
38
    protected $debug = true;
39
    /** @var float $startTime Time of start framework */
40
    protected $startTime;
41
    /** @var bool $loaded Micro loaded flag */
42
    protected $loaded;
43
    /** @var IContainer $container Container is a container for components and options */
44
    protected $container;
45
46
47
    /**
48
     * Initialize framework
49
     *
50
     * @access public
51
     *
52
     * @param string $environment Application environment: devel , prod , test
53
     * @param bool $debug Debug-mode flag
54
     *
55
     * @result void
56
     */
57 View Code Duplication
    public function __construct($environment = 'devel', $debug = true)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
58
    {
59
        $this->environment = $environment;
60
        $this->debug = (bool)$debug;
61
62
        $this->loaded = false;
63
64
          if ($this->debug) {
65
            $this->startTime = microtime(true);
66
        }
67
    }
68
69
    /**
70
     * Clone application
71
     *
72
     * @access public
73
     *
74
     * @return void
75
     */
76 View Code Duplication
    public function __clone()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
77
    {
78
        if ($this->debug) {
79
            $this->startTime = microtime(true);
80
        }
81
82
        $this->loaded = false;
83
        $this->container = null;
84
    }
85
86
    /**
87
     * Default config path
88
     *
89
     * @return string
90
     */
91
    protected function getConfig()
92
    {
93
        return false;
94
    }
95
96
    /**
97
     * Running application
98
     *
99
     * @access public
100
     *
101
     * @param IRequest $request Request object
102
     * @param string $configPath Path to config file
0 ignored issues
show
Bug introduced by
There is no parameter named $configPath. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
103
     *
104
     * @return Response
105
     * @throws \Exception
106
     */
107
    public function run(IRequest $request)
108
    {
109
        if (!$this->loaded) {
110
            $this->loader();
111
        }
112
113
        $this->container->request = $request;
0 ignored issues
show
Bug introduced by
Accessing request on the interface Micro\Base\IContainer suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
114
115
        try {
116
            return $this->doRun();
117
        } catch (\Exception $e) {
118
            if ($this->debug) {
119
                $this->container->dispatcher->signal('kernel.stopped', ['exception' => $e]);
0 ignored issues
show
Bug introduced by
Accessing dispatcher on the interface Micro\Base\IContainer suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
120
                throw $e;
121
            }
122
123
            return $this->doException($e);
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->doException($e); of type Micro\cli\DefaultConsoleCommand|Micro\Web\Response adds the type Micro\cli\DefaultConsoleCommand to the return on line 123 which is incompatible with the return type documented by Micro\Micro::run of type Micro\Web\Response.
Loading history...
124
        }
125
    }
126
127
    /**
128
     * Boot Loader
129
     *
130
     * @access public
131
     *
132
     * @return void
133
     */
134
    public function loader()
135
    {
136
        if (true === $this->loaded) {
137
            return;
138
        }
139
140
        $this->initContainer();
141
142
        $this->loaded = true;
143
    }
144
145
    /**
146
     * Initialize container
147
     *
148
     * @access public
149
     *
150
     * @param string $configPath Path to configure Container
0 ignored issues
show
Bug introduced by
There is no parameter named $configPath. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
151
     *
152
     * @return void
153
     */
154
    public function initContainer()
155
    {
156
        $this->container = new Container;
157
        $this->container->kernel = $this;
158
159
        $this->container->load($this->getConfig());
0 ignored issues
show
Documentation introduced by
$this->getConfig() is of type boolean, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
160
161
        if (false === $this->container->dispatcher) {
162
            $this->container->dispatcher = new Dispatcher($this->container);
0 ignored issues
show
Unused Code introduced by
The call to Dispatcher::__construct() has too many arguments starting with $this->container.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
163
        }
164
    }
165
166
    /**
167
     * Starting ...
168
     *
169
     * @access public
170
     *
171
     * @return \Micro\web\IResponse
172
     * @throws \Micro\base\Exception
173
     */
174
    private function doRun()
175
    {
176
        $resolver = $this->getResolver();
177
        $this->container->dispatcher->signal('kernel.router', ['resolver' => $resolver]);
0 ignored issues
show
Bug introduced by
Accessing dispatcher on the interface Micro\Base\IContainer suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
178
179
        $app = $resolver->getApplication();
180
        $this->container->dispatcher->signal('kernel.controller', ['application' => $app]);
0 ignored issues
show
Bug introduced by
Accessing dispatcher on the interface Micro\Base\IContainer suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
181
182
        $output = $app->action($resolver->getAction());
183
        if (!$output instanceof IOutput) {
184
            $response = $this->container->response ?: new Response;
0 ignored issues
show
Bug introduced by
Accessing response on the interface Micro\Base\IContainer suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
185
            $response->setBody($output);
186
            $output = $response;
187
        }
188
        $this->container->dispatcher->signal('kernel.response', ['output' => $output]);
0 ignored issues
show
Bug introduced by
Accessing dispatcher on the interface Micro\Base\IContainer suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
189
190
        return $output;
191
    }
192
193
    /**
194
     * Get resolver
195
     *
196
     * @access public
197
     *
198
     * @param bool|false $isCli CLI or Web
0 ignored issues
show
Bug introduced by
There is no parameter named $isCli. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
199
     *
200
     * @return ConsoleResolver|HMVCResolver
201
     */
202
    public function getResolver()
203
    {
204
        if ($this->container->request->isCli()) {
0 ignored issues
show
Bug introduced by
Accessing request on the interface Micro\Base\IContainer suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
205
            return new ConsoleResolver($this->container);
206
        }
207
208
        return new HMVCResolver($this->container);
209
    }
210
211
    // Methods for components
212
213
    /**
214
     * Do exception
215
     *
216
     * @access private
217
     *
218
     * @param \Exception $e Exception
219
     *
220
     * @return IOutput
221
     * @throws \Micro\base\Exception
222
     */
223
    private function doException(\Exception $e)
224
    {
225
        $this->container->dispatcher->signal('kernel.exception', ['exception' => $e]);
0 ignored issues
show
Bug introduced by
Accessing dispatcher on the interface Micro\Base\IContainer suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
226
227
        $output = $this->container->request->isCli() ? new DefaultConsoleCommand([]) : new Response();
0 ignored issues
show
Bug introduced by
Accessing request on the interface Micro\Base\IContainer suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
228
229
        if ($this->container->request->isCli()) {
0 ignored issues
show
Bug introduced by
Accessing request on the interface Micro\Base\IContainer suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
230
            $output->data = '"Error #' . $e->getCode() . ' - ' . $e->getMessage() . '"';
231
            $output->execute();
0 ignored issues
show
Bug introduced by
The method execute() does not seem to exist on object<Micro\Web\Response>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
232
233
            return $output;
234
        }
235
236
        if (!$this->container->errorController) {
0 ignored issues
show
Bug introduced by
Accessing errorController on the interface Micro\Base\IContainer suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
237
            $output->setBody('Option `errorController` not configured');
238
239
            return $output;
240
        }
241
        if (!$this->container->errorAction) {
0 ignored issues
show
Bug introduced by
Accessing errorAction on the interface Micro\Base\IContainer suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
242
            $output->setBody('Option `errorAction` not configured');
243
244
            return $output;
245
        }
246
247
        $controller = $this->container->errorController;
0 ignored issues
show
Bug introduced by
Accessing errorController on the interface Micro\Base\IContainer suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
248
        $action = $this->container->errorAction;
0 ignored issues
show
Bug introduced by
Accessing errorAction on the interface Micro\Base\IContainer suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
249
250
        $this->container->request->setPost('error', $e);
0 ignored issues
show
Bug introduced by
Accessing request on the interface Micro\Base\IContainer suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
251
252
        /** @var \Micro\mvc\controllers\IController $result */
253
        $result = new $controller($this->container, false);
254
        $result = $result->action($action);
255
256
        if ($result instanceof IOutput) {
257
            return $result;
258
        }
259
260
        $output->setBody($result);
0 ignored issues
show
Bug introduced by
It seems like $result defined by $result->action($action) on line 254 can also be of type object<Micro\Web\IResponse>; however, Micro\Web\Response::setBody() does only seem to accept string, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
261
262
        return $output;
263
    }
264
265
    /**
266
     * Terminate application
267
     *
268
     * @access public
269
     *
270
     * @return void
271
     */
272
    public function terminate()
273
    {
274
        $this->container->dispatcher->signal('kernel.terminate', []);
0 ignored issues
show
Bug introduced by
Accessing dispatcher on the interface Micro\Base\IContainer suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
275
276
        if ($this->isDebug() && !$this->container->request->isCli()) {
0 ignored issues
show
Bug introduced by
Accessing request on the interface Micro\Base\IContainer suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
277
            // Add timer into page
278
            echo '<div class=debug_timer>', (microtime(true) - $this->getStartTime()), '</div>';
279
        }
280
281
        $this->unloader();
282
    }
283
284
    /**
285
     * Get start time
286
     *
287
     * @access public
288
     *
289
     * @return float|null
290
     */
291
    public function getStartTime()
292
    {
293
        return $this->isDebug() ? $this->startTime : null;
294
    }
295
296
    /**
297
     * Unloader subsystem
298
     *
299
     * @access public
300
     *
301
     * @return void
302
     */
303
    public function unloader()
304
    {
305
        if (false === $this->loaded) {
306
            return;
307
        }
308
309
        $this->container = null;
310
        $this->loaded = false;
311
    }
312
313
    // Methods helpers
314
315
    /**
316
     * Get status of debug
317
     *
318
     * @access public
319
     *
320
     * @return bool
321
     */
322
    public function isDebug()
323
    {
324
        return $this->debug;
325
    }
326
327
    /**
328
     * Get character set
329
     *
330
     * @access public
331
     *
332
     * @return string
333
     */
334
    public function getCharset()
335
    {
336
        return 'UTF-8';
337
    }
338
339
    /**
340
     * Get environment name
341
     *
342
     * @access public
343
     *
344
     * @return string
345
     */
346
    public function getEnvironment()
347
    {
348
        return $this->environment;
349
    }
350
351
    /**
352
     * Get components container
353
     *
354
     * @access public
355
     *
356
     * @return IContainer
357
     */
358
    public function getContainer()
359
    {
360
        return $this->container;
361
    }
362
363
    public function getAppDir()
364
    {
365
        return Autoload::getAlias('App')[0];
366
    }
367
}
368