Passed
Pull Request — master (#25)
by Chito
06:28
created

LampagerBehavior   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 7
c 2
b 0
f 0
dl 0
loc 20
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A table() 0 7 2
A lampager() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Lampager\Cake\Model\Behavior;
6
7
use Cake\ORM\Behavior;
8
use Cake\ORM\Table;
9
use Lampager\Cake\ORM\Query;
10
11
class LampagerBehavior extends Behavior
12
{
13
    public function lampager(): Query
14
    {
15
        $query = new Query($this->table()->getConnection(), $this->table());
16
        $query->select();
17
18
        return $query;
19
    }
20
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function table(): Table
25
    {
26
        if (is_callable('parent::' . __FUNCTION__)) {
27
            return parent::table();
28
        }
29
30
        return $this->getTable();
31
    }
32
}
33