ErrorHandlerProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 90.91%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 28
ccs 10
cts 11
cp 0.9091
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 21 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Canvas\Providers;
6
7
use Monolog\Logger;
0 ignored issues
show
Bug introduced by
The type Monolog\Logger was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Canvas\ErrorHandler;
9
use Phalcon\Config;
10
use Phalcon\Di\ServiceProviderInterface;
0 ignored issues
show
Bug introduced by
The type Phalcon\Di\ServiceProviderInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Phalcon\DiInterface;
0 ignored issues
show
Bug introduced by
The type Phalcon\DiInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use Canvas\Constants\Flags;
13
14
class ErrorHandlerProvider implements ServiceProviderInterface
15
{
16
    /**
17
     * {@inheritdoc}
18
     *
19
     * @param DiInterface $container
20
     */
21 1
    public function register(DiInterface $container)
22
    {
23
        /** @var Logger $logger */
24 1
        $logger = $container->getShared('log');
25
        /** @var Config $registry */
26 1
        $config = $container->getShared('config');
27
28 1
        date_default_timezone_set($config->path('app.timezone'));
29
30
        //if production?
31 1
        if (strtolower($config->app->env) == Flags::PRODUCTION) {
32
            ini_set('display_errors', 'Off');
33
        }
34
35 1
        error_reporting(E_ALL);
36
37 1
        $handler = new ErrorHandler($logger, $config);
38 1
        set_error_handler([$handler, 'handle']);
39
40 1
        if (strtolower($config->app->env) != Flags::PRODUCTION) {
41 1
            register_shutdown_function([$handler, 'shutdown']);
42
        }
43 1
    }
44
}
45