Having::having()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Sirius\Sql\Clause;
5
6
use Sirius\Sql\Component\Conditions;
7
8
trait Having
9
{
10
    /**
11
     * @var Conditions
12
     */
13
    protected $having;
14
15 1
    public function having(string $condition, ...$bindInline)
16
    {
17 1
        $this->having->andSprintf($condition, ...$bindInline);
18
19 1
        return $this;
20
    }
21
22 1
    public function orHaving(string $condition, ...$bindInline)
23
    {
24 1
        $this->having->orSprintf($condition, ...$bindInline);
25
26 1
        return $this;
27
    }
28
29 17
    public function resetHaving()
30
    {
31 17
        $this->having = new Conditions($this->bindings, 'HAVING');
0 ignored issues
show
Bug introduced by
The property bindings does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
32
33 17
        return $this;
34
    }
35
}
36