D7Adapter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 43
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getClassName() 0 4 1
A __call() 0 6 1
1
<?php
2
3
namespace Arrilot\BitrixModels\Adapters;
4
5
/**
6
 * Class D7Adapter
7
 *
8
 * @method \Bitrix\Main\DB\Result getList(array $parameters = [])
9
 * @method int getCount(array $filter = [])
10
 * @method \Bitrix\Main\Entity\UpdateResult update(int $id, array $fields)
11
 * @method \Bitrix\Main\Entity\DeleteResult delete(int $id)
12
 * @method \Bitrix\Main\Entity\AddResult add(array $fields)
13
 */
14
class D7Adapter
15
{
16
    /**
17
     * Bitrix Class FQCN.
18
     *
19
     * @var string
20
     */
21
    protected $className;
22
    
23
    /**
24
     * D7Adapter constructor.
25
     *
26
     * @param $className
27
     */
28
    public function __construct($className)
29
    {
30
        $this->className = $className;
31
    }
32
33
    /**
34
     * Getter for class name.
35
     *
36
     * @return string
37
     */
38
    public function getClassName()
39
    {
40
        return $this->className;
41
    }
42
43
    /**
44
     * Handle dynamic method calls into a static calls on bitrix entity class.
45
     *
46
     * @param  string  $method
47
     * @param  array  $parameters
48
     * @return mixed
49
     */
50
    public function __call($method, $parameters)
51
    {
52
        $className = $this->className;
53
54
        return $className::$method(...$parameters);
55
    }
56
}
57