Passed
Pull Request — master (#25)
by Chito
01:27
created

LampagerBehavior::table()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 7
rs 10
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