1 | <?php |
||
22 | abstract class AbstractRepository |
||
23 | { |
||
24 | /** |
||
25 | * @var EntityManager |
||
26 | */ |
||
27 | protected $em; |
||
28 | |||
29 | /** |
||
30 | * @var APIGuzzleAdapter |
||
31 | */ |
||
32 | private $adapter; |
||
33 | |||
34 | /** |
||
35 | * @param EntityManager $em |
||
36 | * @param APIGuzzleAdapter $adapter |
||
37 | */ |
||
38 | 85 | public function __construct(EntityManager $em, APIGuzzleAdapter $adapter = null) |
|
43 | |||
44 | /** |
||
45 | * @return APIGuzzleAdapter |
||
46 | */ |
||
47 | 68 | private function getAdapter() |
|
51 | |||
52 | /** |
||
53 | * Query the API |
||
54 | * |
||
55 | * @param string $method HTTP method type (POST, GET ...) |
||
56 | * @param string $path The requested path (/path/to/ressource/1) |
||
57 | * @param array $query An array of query parameters |
||
58 | * @param array $postFields An array of request parameters |
||
59 | * @param array $headers |
||
60 | * |
||
61 | * @return APIResponse |
||
62 | * @throws NotFoundException |
||
63 | * @throws UnauthorizedException |
||
64 | */ |
||
65 | 68 | protected function query($method, $path, $query = array(), $postFields = array(), array $headers = array()) |
|
85 | } |
||
86 |
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.
Unreachable code is most often the result of
return
,die
orexit
statements that have been added for debug purposes.In the above example, the last
return false
will never be executed, because a return statement has already been met in every possible execution path.