Completed
Pull Request — master (#23)
by Evan
02:24
created

Builder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setModel() 0 6 1
A getModel() 0 4 1
1
<?php
2
3
namespace Silk\Query;
4
5
use Silk\Type\Model;
6
use Silk\Contracts\BuildsQueries;
7
8
abstract class Builder implements BuildsQueries
9
{
10
    /**
11
     * Set the model for this query.
12
     *
13
     * @param Model $model
14
     *
15
     * @return $this
16
     */
17
    public function setModel(Model $model)
18
    {
19
        $this->model = $model;
0 ignored issues
show
Bug introduced by
The property model 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...
20
21
        return $this;
22
    }
23
24
    /**
25
     * Get the model
26
     *
27
     * @return Model
28
     */
29
    public function getModel()
30
    {
31
        return $this->model;
32
    }
33
}
34