DryRunConnector   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 20
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A exec() 0 7 1
1
<?php
2
3
namespace Tonysm\LaravelParatest\Database;
4
5
use PDO;
6
7
class DryRunConnector implements Connector
8
{
9
    public function __construct($output)
10
    {
11
        $this->output = $output;
0 ignored issues
show
Bug introduced by
The property output 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...
12
    }
13
14
    /**
15
     * @param string $sql
16
     *
17
     * @return mixed whatever the actual implementation returns, depending on the connector
18
     */
19
    public function exec(string $sql)
20
    {
21
        return $this->output->writeln(sprintf(
22
            '<info>[DRY RUN] %s</info>',
23
            $sql
24
        ));
25
    }
26
}
27
28