Completed
Push — master ( d65f51...5b82a8 )
by Oscar
02:16
created

Select   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 31
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A buildFoundRows() 0 4 1
A getFoundRows() 0 17 4
1
<?php
2
3
namespace SimpleCrud\Queries\Sqlite;
4
5
use SimpleCrud\Queries\Mysql\Select as BaseSelect;
6
7
/**
8
 * Manages a database select query in Sqlite databases.
9
 */
10
class Select extends BaseSelect
11
{
12
	/**
13
     * {@inheritdoc}
14
     */
15
    protected static function buildFoundRows()
16
    {
17
        return '';
18
    }
19
20
    /**
21
     * {@inheritdoc}
22
     */
23
    protected function getFoundRows() {
24
    	$query = $this->table->count();
0 ignored issues
show
Documentation Bug introduced by
The method count does not exist on object<SimpleCrud\Table>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
25
26
    	$query->marks($this->marks);
27
28
    	foreach ($this->where as $k => $where) {
29
    		if ($k === 'or') {
30
    			foreach ($where as $condition) {
31
    				$query->orWhere($condition);
32
    			}
33
    		} else {
34
    			$query->where($where);
35
    		}
36
    	}
37
38
        return $query->run();
39
    }
40
}
41