Passed
Push — sudav3 ( 2e4700...db4431 )
by 世昌
02:26
created

DataAccess::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
namespace suda\application\database;
3
4
use suda\orm\DataSource;
5
use suda\application\Application;
6
7
/**
8
 * 数据表抽象对象
9
 *
10
 * 用于提供对数据表的操作
11
 *
12
 */
13
class DataAccess extends \suda\orm\DataAccess
14
{
15
    
16
17
    /**
18
     * 应用引用
19
     *
20
     * @var Application
21
     */
22
    protected static $application;
23
24
25
    /**
26
     * 创建对数据的操作
27
     *
28
     * @param string $object
29
     * @param Middleware|null $middleware
30
     */
31
    public function __construct(string $object, ?Middleware $middleware = null)
0 ignored issues
show
Bug introduced by
The type suda\application\database\Middleware 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...
32
    {
33
        parent::__construct($object, static::$application->getDataSource(), $middleware);
34
    }
35
36
    /**
37
     * 从应用创建表
38
     *
39
     * @param \suda\application\Application $application
40
     * @return void
41
     */
42
    public static function load(Application $application)
43
    {
44
        static::$application = $application;
45
    }
46
47
    /**
48
     * Get 应用引用
49
     *
50
     * @return  Application
51
     */
52
    public static function application()
53
    {
54
        return static::$application;
55
    }
56
}
57