Passed
Pull Request — master (#182)
by Alex
07:12
created

LaravelBaseQuery   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 7
c 1
b 0
f 0
dl 0
loc 25
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getMetadataProvider() 0 3 1
A getAuth() 0 3 1
A __construct() 0 4 2
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: alex
5
 * Date: 29/09/19
6
 * Time: 4:55 PM
7
 */
8
9
namespace AlgoWeb\PODataLaravel\Query;
10
11
use AlgoWeb\PODataLaravel\Auth\NullAuthProvider;
12
use AlgoWeb\PODataLaravel\Interfaces\AuthInterface;
13
use AlgoWeb\PODataLaravel\Providers\MetadataProvider;
14
use Illuminate\Support\Facades\App;
15
16
abstract class LaravelBaseQuery
17
{
18
    /** @var AuthInterface */
19
    protected $auth;
20
    protected $metadataProvider;
21
22
    public function __construct(AuthInterface $auth = null)
23
    {
24
        $this->auth = isset($auth) ? $auth : new NullAuthProvider();
25
        $this->metadataProvider = new MetadataProvider(App::make('app'));
26
    }
27
28
    /**
29
     * Dig out local copy of POData-Laravel metadata provider.
30
     *
31
     * @return MetadataProvider
32
     */
33
    public function getMetadataProvider()
34
    {
35
        return $this->metadataProvider;
36
    }
37
38
    protected function getAuth()
39
    {
40
        return $this->auth;
41
    }
42
}
43