SQLExecutor::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * SQL executor
4
 * User: moyo
5
 * Date: 02/11/2017
6
 * Time: 6:00 PM
7
 */
8
9
namespace Carno\Database\Chips;
10
11
use Carno\Database\Results\Created;
12
use Carno\Database\Results\Selected;
13
use Carno\Database\Results\Updated;
14
use Carno\Pool\Wrapper\SAR;
15
use Carno\Pool\Wrapper\SRD;
16
17
trait SQLExecutor
18
{
19
    use SAR, SRD;
20
21
    /**
22
     * @param string $sql
23
     * @param array $bind
24
     * @return Created|Updated|Selected
25
     */
26
    public function execute(string $sql, array $bind = [])
27
    {
28
        return $this->sarRun($this->assigned($sql), 'execute', [$sql, $bind]);
0 ignored issues
show
Bug introduced by
It seems like assigned() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

28
        return $this->sarRun($this->/** @scrutinizer ignore-call */ assigned($sql), 'execute', [$sql, $bind]);
Loading history...
Bug Best Practice introduced by
The expression return $this->sarRun($th...e', array($sql, $bind)) returns the type Generator which is incompatible with the documented return type Carno\Database\Results\C...atabase\Results\Updated.
Loading history...
29
    }
30
31
    /**
32
     * @deprecated
33
     * @param string $data
34
     * @return string
35
     */
36
    public function escape(string $data) : string
37
    {
38
        return $this->rndRun($this->assigned(), 'escape', [$data]);
0 ignored issues
show
Deprecated Code introduced by
The function Carno\Database\Chips\SQLExecutor::rndRun() has been deprecated. ( Ignorable by Annotation )

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

38
        return /** @scrutinizer ignore-deprecated */ $this->rndRun($this->assigned(), 'escape', [$data]);
Loading history...
39
    }
40
}
41