Total Complexity | 12 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
4 | class ChangeReverser |
||
5 | { |
||
6 | private $driver; |
||
7 | |||
8 | public function setDriver($driver) |
||
11 | } |
||
12 | |||
13 | public function call($method, $arguments) |
||
18 | } |
||
19 | |||
20 | private function reverseMethod($method) |
||
21 | { |
||
22 | return preg_replace_callback( |
||
23 | "/^(?<action>add|drop|reverse|execute|insert)/", |
||
24 | function($matches){ |
||
25 | switch($matches['action']) |
||
26 | { |
||
27 | case 'add': return 'drop'; |
||
28 | case 'drop': return 'add'; |
||
29 | case 'reverse': return 'execute'; |
||
30 | case 'execute': return 'reverse'; |
||
31 | case 'insert': return 'delete'; |
||
32 | case 'delete': return 'insert'; |
||
33 | } |
||
34 | }, $method |
||
35 | ); |
||
36 | } |
||
37 | |||
38 | private function reverseArguments($arguments) |
||
50 | } |
||
51 | } |
||
53 |