Test Failed
Pull Request — master (#135)
by Rafael
06:12
created

AppProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 17
ccs 4
cts 8
cp 0.5
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 12 2
1
<?php
2
3
namespace Canvas\Providers;
4
5
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...
6
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...
7
use Canvas\Models\Apps;
8
use Canvas\Exception\ServerErrorHttpException;
9
10
class AppProvider implements ServiceProviderInterface
11
{
12
    /**
13
     * @param DiInterface $container
14
     */
15 1
    public function register(DiInterface $container)
16
    {
17 1
        $config = $container->getShared('config');
18
19 1
        $container->setShared(
20 1
            'app',
21
            function () use ($config) {
22
                $app = Apps::findFirstByKey($config->app->id);
23
                if (!$app) {
24
                    throw new ServerErrorHttpException('No App configure with this key ' . $config->app->id);
25
                }
26
                return $app;
27 1
            }
28
        );
29 1
    }
30
}
31