SimpleDataService::getMetadataProvider()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
namespace POData;
3
4
use POData\BaseService;
5
use POData\Configuration\IServiceConfiguration;
0 ignored issues
show
Bug introduced by
The type POData\Configuration\IServiceConfiguration 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 POData\Configuration\ServiceConfiguration;
7
use POData\Configuration\EntitySetRights;
8
use POData\IService;
9
use POData\Providers\Metadata\IMetadataProvider;
10
use POData\Providers\Query\IQueryProvider;
11
use POData\Providers\Metadata\SimpleMetadataProvider;
12
/**
13
 * DataService that implements IServiceProvider.
14
 **/
15
class SimpleDataService extends BaseService implements IService
16
{
17
    /**
18
     * @var IMetadataProvider
19
     */
20
    protected $metaProvider;
21
    /**
22
     * @var IQueryProvider
23
     */
24
    protected $queryProvider;
25
    public $maxPageSize = 200;
26
  
27
    public function __construct($db, SimpleMetadataProvider $metaProvider) {
28
        $this->metaProvider = $metaProvider;
29
        if (!empty($db->queryProviderClassName)) {
30
            $queryProviderClassName = $db->queryProviderClassName;
31
            $this->queryProvider = new $queryProviderClassName($db);
32
        } else {
33
            $this->queryProvider = new QueryProvider($db);
0 ignored issues
show
Bug introduced by
The type POData\QueryProvider 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...
34
        }
35
    }
36
    public function initialize(ServiceConfiguration $config)
37
    {
38
        $config->setEntitySetPageSize('*', $this->maxPageSize);
39
        $config->setEntitySetAccessRule('*', EntitySetRights::ALL);
40
        $config->setAcceptCountRequests(true);
41
        $config->setAcceptProjectionRequests(true);
42
    }
43
    /**
44
     * @return IQueryProvider
45
     */
46
    public function getQueryProvider()
47
    {
48
        return $this->queryProvider;
49
    }
50
    /**
51
     * @return IMetadataProvider
52
     */
53
    public function getMetadataProvider()
54
    { 
55
        return $this->metaProvider;
56
    }
57
    /**
58
     * @return PODataProvidersStreamIStreamProvider
0 ignored issues
show
Bug introduced by
The type POData\PODataProvidersStreamIStreamProvider 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...
59
     */
60
    public function getStreamProviderX()
61
    { 
62
        // TODO: Implement getStreamProviderX() method. 
63
    }
64
    /**
65
     * This method is called only once to initialize service-wide policies.
66
     *    
67
     * @param IServiceConfiguration $config data service configuration
68
     *
69
     * @return void
70
     */
71
    public function initializeService(IServiceConfiguration $config)
72
    {
73
        $config->setEntitySetAccessRule('*', EntitySetRights::ALL);
74
    }
75
}