Passed
Pull Request — master (#18)
by
unknown
06:50
created

AppProvider::register()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 8
ccs 5
cts 5
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Gewaer\Providers;
4
5
use Phalcon\Di\ServiceProviderInterface;
6
use Phalcon\DiInterface;
7
use Gewaer\Models\Apps;
8
9
class AppProvider implements ServiceProviderInterface
10
{
11
    /**
12
     * @param DiInterface $container
13
     */
14 17
    public function register(DiInterface $container)
15
    {
16 17
        $config = $container->getShared('config');
17
18 17
        $container->setShared(
19 17
            'app',
20
            function () use ($config) {
21 3
                return Apps::findFirst($config->app->id);
22 17
            }
23
        );
24 17
    }
25
}
26