Completed
Push — master ( 5bff48...0eeb04 )
by Oscar
02:44
created

BaseQuery::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace SimpleCrud\Queries;
4
5
use SimpleCrud\Entity;
6
use SimpleCrud\QueryInterface;
7
8
/**
9
 * Base class used by all queries.
10
 */
11
abstract class BaseQuery implements QueryInterface
12
{
13
    protected $entity;
14
15
    /**
16
     * Constructor.
17
     *
18
     * @param Entity $entity
19
     */
20
    public function __construct(Entity $entity)
21
    {
22
        $this->entity = $entity;
23
    }
24
25
    /**
26
     * Executes the query and returns true if it's ok
27
     * 
28
     * @return bool
29
     */
30
    public function run()
31
    {
32
        $this->__invoke();
33
34
        return true;
35
    }
36
}
37