ModelsMetadataProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 25
ccs 0
cts 18
cp 0
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 20 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Canvas\Providers;
6
7
use function Canvas\Core\envValue;
8
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...
9
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...
10
use Phalcon\Mvc\Model\Metadata\Memory as MemoryMetaDataAdapter;
0 ignored issues
show
Bug introduced by
The type Phalcon\Mvc\Model\Metadata\Memory 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\Mvc\Model\MetaData\Redis;
0 ignored issues
show
Bug introduced by
The type Phalcon\Mvc\Model\MetaData\Redis 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 ModelsMetadataProvider implements ServiceProviderInterface
15
{
16
    /**
17
     * @param DiInterface $container
18
     */
19
    public function register(DiInterface $container)
20
    {
21
        $config = $container->getShared('config');
22
        $app = envValue('GEWAER_APP_ID', 1);
23
24
        $container->setShared(
25
            'modelsMetadata',
26
            function () use ($config, $app) {
27
                if (strtolower($config->app->env) != Flags::PRODUCTION) {
28
                    return new MemoryMetaDataAdapter();
29
                }
30
31
                return new Redis(
32
                    [
33
                        'host' => envValue('REDIS_HOST', '127.0.0.1'),
34
                        'port' => (int) envValue('REDIS_PORT', 6379),
35
                        'prefix' => $app,
36
                        'persistent' => 0,
37
                        "statsKey"   => "_PHCM_MM",
38
                        'lifetime' => 172800,
39
                    ]
40
                );
41
            }
42
        );
43
    }
44
}
45