1 | <?php |
||
20 | class Command |
||
21 | { |
||
22 | |||
23 | /** |
||
24 | * Hook class instance |
||
25 | * @var \gplcart\core\Hook $hook |
||
26 | */ |
||
27 | protected $hook; |
||
28 | |||
29 | /** |
||
30 | * @param Hook $hook |
||
31 | */ |
||
32 | public function __construct(Hook $hook) |
||
36 | |||
37 | /** |
||
38 | * Returns an array of supported commands |
||
39 | * @return array |
||
40 | */ |
||
41 | public function getHandlers() |
||
58 | |||
59 | /** |
||
60 | * Returns a single command |
||
61 | * @param string $command |
||
62 | * @return array |
||
63 | */ |
||
64 | public function get($command) |
||
69 | |||
70 | /** |
||
71 | * Returns an array of allowed commands for the given file |
||
72 | * @param SplFileInfo|array $file |
||
73 | * @return array |
||
74 | */ |
||
75 | public function getAllowed($file) |
||
87 | |||
88 | /** |
||
89 | * Whether the command is allowed for the file |
||
90 | * @param array $command |
||
91 | * @param SplFileInfo $file |
||
92 | * @return boolean |
||
93 | */ |
||
94 | public function isAllowed(array $command, $file) |
||
104 | |||
105 | /** |
||
106 | * Call a command handler |
||
107 | * @param array $command |
||
108 | * @param string $method |
||
109 | * @param array $args |
||
110 | * @return mixed |
||
111 | */ |
||
112 | public function callHandler(array $command, $method, $args = array()) |
||
121 | |||
122 | /** |
||
123 | * Submit a command |
||
124 | * @param array $command |
||
125 | * @param array $args |
||
126 | * @return array |
||
127 | */ |
||
128 | public function submit(array $command, array $args) |
||
134 | |||
135 | /** |
||
136 | * Returns an array of data used to display the command |
||
137 | * @param array $command |
||
138 | * @param array $args |
||
139 | * @return array |
||
140 | */ |
||
141 | public function getView(array $command, array $args) |
||
145 | |||
146 | } |
||
147 |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.