These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * @author Pierre-Henry Soria <[email protected]> |
||
4 | * @copyright (c) 2015-2017, Pierre-Henry Soria. All Rights Reserved. |
||
5 | * @license GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory. |
||
6 | * @package PH7 / App / System / Module / Api / Controller |
||
7 | * @link http://ph7cms.com |
||
8 | * @link http://github.com/pH7Software/pH7CMS-HTTP-REST-Push-Data |
||
9 | */ |
||
10 | namespace PH7; |
||
11 | |||
12 | use PH7\Framework\Http\Rest\Rest; |
||
13 | |||
14 | class MainController extends Controller |
||
0 ignored issues
–
show
|
|||
15 | { |
||
16 | |||
17 | use Framework\Api\Api; // Import the Api Trait |
||
18 | |||
19 | protected $oRest; |
||
20 | |||
21 | public function __construct() |
||
22 | { |
||
23 | parent::__construct(); |
||
24 | |||
25 | $this->oRest = new Rest; |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * Test if the API works well. |
||
30 | */ |
||
31 | public function test() |
||
32 | { |
||
33 | if ($this->oRest->getRequestMethod() != 'POST') |
||
34 | $this->oRest->response('', 406); |
||
35 | else |
||
36 | $this->oRest->response($this->set(array('return' => 'It Works!'))); |
||
0 ignored issues
–
show
The method
set() does not seem to exist on object<PH7\MainController> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
37 | } |
||
38 | |||
39 | } |
This check looks for classes that have been defined more than once.
If you can, we would recommend to use standard object-oriented programming techniques. For example, to avoid multiple types, it might make sense to create a common interface, and then multiple, different implementations for that interface.
This also has the side-effect of providing you with better IDE auto-completion, static analysis and also better OPCode caching from PHP.