1 | <?php |
||
7 | class Operations { |
||
8 | |||
9 | private $wrapper; |
||
10 | |||
11 | /** |
||
12 | * |
||
13 | * @var \ntentan\nibii\DriverAdapter |
||
14 | */ |
||
15 | private $adapter; |
||
16 | private $queryOperations; |
||
17 | private $dataOperations; |
||
18 | private $queryOperationMethods = [ |
||
19 | 'fetch', 'fetchFirst', 'filter', 'query', 'fields', |
||
20 | 'cover', 'limit', 'offset', 'filterBy', 'sortBy', |
||
21 | 'delete', 'count', 'update', 'with' |
||
22 | ]; |
||
23 | private $dataOperationMethods = [ |
||
24 | 'save', 'validate' |
||
25 | ]; |
||
26 | |||
27 | 1 | public function __construct(Container $container, RecordWrapper $wrapper, DriverAdapter $adapter, $table) { |
|
33 | |||
34 | 1 | public function perform($name, $arguments) { |
|
35 | //@todo Think of using a hash here in future |
||
36 | 1 | if (array_search($name, $this->queryOperationMethods) !== false) { |
|
37 | 1 | return call_user_func_array([$this->queryOperations, "do$name"], $arguments); |
|
38 | } else if (array_search($name, $this->dataOperationMethods) !== false) { |
||
39 | return call_user_func_array([$this->dataOperations, "do$name"], $arguments); |
||
40 | } else if ($this->queryOperations->initDynamicMethod($name)) { |
||
41 | return $this->queryOperations->runDynamicMethod($arguments); |
||
42 | } else { |
||
43 | throw new NibiiException("Method {$name} not found"); |
||
44 | } |
||
45 | } |
||
46 | |||
47 | public function getData() { |
||
50 | |||
51 | public function getInvalidFields() { |
||
54 | |||
55 | } |
||
56 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.