GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

AdjacencyTrait   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 62
rs 10
wmc 6

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getChildren() 0 11 3
A hasChildren() 0 13 3
1
<?php
2
/**
3
 * This file is part of the O2System PHP Framework package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @author         Steeve Andrian Salim
9
 * @copyright      Copyright (c) Steeve Andrian Salim
10
 */
11
12
// ------------------------------------------------------------------------
13
14
namespace O2System\Reactor\Models\Sql\Traits;
15
16
// ------------------------------------------------------------------------
17
18
/**
19
 * Class AdjacencyTrait
20
 *
21
 * @package O2System\Reactor\Models\Sql\Traits
22
 */
23
trait AdjacencyTrait
24
{
25
    /**
26
     * Parent Key Field
27
     *
28
     * @access  public
29
     * @type    string
30
     */
31
    public $parentKey = 'id_parent';
32
33
    /**
34
     * Adjacency Enabled Flag
35
     *
36
     * @access  protected
37
     * @type    bool
38
     */
39
    protected $isUseAdjacency = true;
40
41
    /**
42
     * Get Children
43
     *
44
     * @param int         $id_parent
45
     * @param string|null $table
46
     *
47
     * @access  public
48
     * @return  mixed
49
     */
50
    public function getChildren($id_parent, $table = null)
51
    {
52
        $table = isset($table) ? $table : $this->table;
53
54
        $result = $this->qb->table($table)->getWhere([$this->parentKey => $id_parent]);
55
56
        if ($result->count() > 0) {
57
            return $result;
58
        }
59
60
        return false;
61
    }
62
63
    /**
64
     * Has Children
65
     *
66
     * @param int         $id_parent
67
     * @param string|null $table
68
     *
69
     * @access  public
70
     * @return  bool
71
     */
72
    public function hasChildren($id_parent, $table = null)
73
    {
74
        $table = isset($table) ? $table : $this->table;
75
76
        $result = $this->qb->select('id')->table($table)->getWhere([$this->parentKey => $id_parent]);
77
78
        print_out($this->db->getLastQuery());
0 ignored issues
show
Bug introduced by
The function print_out was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

78
        /** @scrutinizer ignore-call */ 
79
        print_out($this->db->getLastQuery());
Loading history...
79
80
        if ($result->count() > 0) {
81
            return true;
82
        }
83
84
        return false;
85
    }
86
}