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

BaseQuery   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A run() 0 6 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