These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * Webino (http://webino.sk) |
||
4 | * |
||
5 | * @link https://github.com/webino/WebinoDraw for the canonical source repository |
||
6 | * @copyright Copyright (c) 2012-2017 Webino, s. r. o. (http://webino.sk) |
||
7 | * @author Peter Bačinský <[email protected]> |
||
8 | * @license BSD-3-Clause |
||
9 | */ |
||
10 | |||
11 | namespace WebinoDraw\Factory; |
||
12 | |||
13 | use WebinoDraw\View\Strategy\DrawStrategy; |
||
14 | use WebinoDraw\View\Strategy\DrawAjaxHtmlStrategy; |
||
15 | use WebinoDraw\View\Strategy\DrawAjaxJsonStrategy; |
||
16 | use Zend\Http\Request as HttpRequest; |
||
17 | use Zend\ServiceManager\FactoryInterface; |
||
18 | use Zend\ServiceManager\ServiceLocatorInterface; |
||
19 | |||
20 | /** |
||
21 | * Class DrawStrategyFactory |
||
22 | */ |
||
23 | class DrawStrategyFactory implements FactoryInterface |
||
24 | { |
||
25 | /** |
||
26 | * @param ServiceLocatorInterface $services |
||
27 | * @return \WebinoDraw\View\Strategy\AbstractDrawStrategy |
||
28 | */ |
||
29 | public function createService(ServiceLocatorInterface $services) |
||
30 | { |
||
31 | /* @var $request HttpRequest */ |
||
32 | $request = $services->get('Request'); |
||
33 | /* @var $service \WebinoDraw\Service\DrawService */ |
||
34 | $service = $services->get('WebinoDraw'); |
||
35 | |||
36 | if (($request instanceof HttpRequest) && $request->isXmlHttpRequest()) { |
||
0 ignored issues
–
show
|
|||
37 | |||
38 | $acceptHeaders = $request->getHeader('accept')->getPrioritized(); |
||
39 | if ('application/json' === $acceptHeaders[0]->getRaw()) { |
||
40 | return new DrawAjaxJsonStrategy($service); |
||
41 | } |
||
42 | |||
43 | return new DrawAjaxHtmlStrategy($service); |
||
44 | } |
||
45 | |||
46 | return new DrawStrategy($service); |
||
47 | } |
||
48 | } |
||
49 |
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.json
file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.json
to be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
require
orrequire-dev
section?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceof
checks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.