Completed
Pull Request — master (#23)
by Evan
05:23 queued 02:55
created

Builder::setModel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 6
rs 9.4285
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