Test Failed
Push — master ( c45d3f...e7eea4 )
by Julien
05:30
created

ServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 7
c 1
b 0
f 0
dl 0
loc 16
ccs 0
cts 6
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 12 1
1
<?php
2
3
/**
4
 * This file is part of the Zemit Framework.
5
 *
6
 * (c) Zemit Team <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE.txt
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Zemit\Provider\Models;
13
14
use Phalcon\Di\DiInterface;
15
use Zemit\Config\ConfigInterface;
16
use Zemit\Provider\AbstractServiceProvider;
17
use Zemit\Support\Models;
18
19
class ServiceProvider extends AbstractServiceProvider
20
{
21
    protected string $serviceName = 'models';
22
    
23
    public function register(DiInterface $di): void
24
    {
25
        $di->setShared($this->getName(), function () use ($di) {
26
    
27
            // config
28
            $config = $di->get('config');
29
            assert($config instanceof ConfigInterface);
30
            
31
            // models config (mapping)
32
            $options = $config->pathToArray('models', []);
33
            
34
            return new Models($options);
35
        });
36
    }
37
}
38