This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php declare(strict_types=1); |
||
2 | /** |
||
3 | * Anime List Client |
||
4 | * |
||
5 | * An API client for Kitsu and MyAnimeList to manage anime and manga watch lists |
||
6 | * |
||
7 | * PHP version 7 |
||
8 | * |
||
9 | * @package AnimeListClient |
||
10 | * @author Timothy J. Warren <[email protected]> |
||
11 | * @copyright 2015 - 2017 Timothy J. Warren |
||
12 | * @license http://www.opensource.org/licenses/mit-license.html MIT License |
||
13 | * @version 4.0 |
||
14 | * @link https://github.com/timw4mail/HummingBirdAnimeClient |
||
15 | */ |
||
16 | |||
17 | namespace Aviat\AnimeClient; |
||
18 | |||
19 | use Aura\Html\HelperLocatorFactory; |
||
20 | use Aura\Router\RouterContainer; |
||
21 | use Aura\Session\SessionFactory; |
||
22 | use Aviat\AnimeClient\API\{Kitsu, MAL}; |
||
23 | use Aviat\AnimeClient\API\Kitsu\KitsuRequestBuilder; |
||
24 | use Aviat\AnimeClient\API\MAL\MALRequestBuilder; |
||
25 | use Aviat\AnimeClient\Model; |
||
26 | use Aviat\Banker\Pool; |
||
27 | use Aviat\Ion\Config; |
||
28 | use Aviat\Ion\Di\Container; |
||
29 | use Monolog\Handler\RotatingFileHandler; |
||
30 | use Monolog\Logger; |
||
31 | use Zend\Diactoros\{Response, ServerRequestFactory}; |
||
32 | |||
33 | // ----------------------------------------------------------------------------- |
||
34 | // Setup DI container |
||
35 | // ----------------------------------------------------------------------------- |
||
36 | return function(array $config_array = []) { |
||
37 | $container = new Container(); |
||
38 | |||
39 | // ------------------------------------------------------------------------- |
||
40 | // Logging |
||
41 | // ------------------------------------------------------------------------- |
||
42 | |||
43 | $app_logger = new Logger('animeclient'); |
||
44 | $app_logger->pushHandler(new RotatingFileHandler(__DIR__ . '/logs/app.log', Logger::NOTICE)); |
||
45 | $kitsu_request_logger = new Logger('kitsu-request'); |
||
46 | $kitsu_request_logger->pushHandler(new RotatingFileHandler(__DIR__ . '/logs/kitsu_request.log', Logger::NOTICE)); |
||
47 | $mal_request_logger = new Logger('mal-request'); |
||
48 | $mal_request_logger->pushHandler(new RotatingFileHandler(__DIR__ . '/logs/mal_request.log', Logger::NOTICE)); |
||
49 | $container->setLogger($app_logger, 'default'); |
||
50 | $container->setLogger($kitsu_request_logger, 'kitsu-request'); |
||
51 | $container->setLogger($mal_request_logger, 'mal-request'); |
||
52 | |||
53 | // ------------------------------------------------------------------------- |
||
54 | // Injected Objects |
||
55 | // ------------------------------------------------------------------------- |
||
56 | |||
57 | // Create Config Object |
||
58 | $container->set('config', function() use ($config_array) { |
||
59 | return new Config($config_array); |
||
60 | }); |
||
61 | |||
62 | // Create Cache Object |
||
63 | View Code Duplication | $container->set('cache', function($container) { |
|
64 | $logger = $container->getLogger(); |
||
65 | $config = $container->get('config')->get('cache'); |
||
66 | return new Pool($config, $logger); |
||
67 | }); |
||
68 | |||
69 | // Create Aura Router Object |
||
70 | $container->set('aura-router', function() { |
||
71 | return new RouterContainer; |
||
72 | }); |
||
73 | |||
74 | // Create Html helper Object |
||
75 | $container->set('html-helper', function($container) { |
||
76 | $html_helper = (new HelperLocatorFactory)->newInstance(); |
||
77 | $html_helper->set('menu', function() use ($container) { |
||
78 | $menu_helper = new Helper\Menu(); |
||
79 | $menu_helper->setContainer($container); |
||
80 | return $menu_helper; |
||
81 | }); |
||
82 | |||
83 | return $html_helper; |
||
84 | }); |
||
85 | |||
86 | // Create Request/Response Objects |
||
87 | $container->set('request', function() { |
||
88 | return ServerRequestFactory::fromGlobals( |
||
89 | $_SERVER, |
||
90 | $_GET, |
||
91 | $_POST, |
||
92 | $_COOKIE, |
||
93 | $_FILES |
||
94 | ); |
||
95 | }); |
||
96 | $container->set('response', function() { |
||
97 | return new Response; |
||
98 | }); |
||
99 | |||
100 | // Create session Object |
||
101 | $container->set('session', function() { |
||
102 | return (new SessionFactory())->newInstance($_COOKIE); |
||
103 | }); |
||
104 | |||
105 | // Miscellaneous helper methods |
||
106 | $container->set('util', function($container) { |
||
107 | return new Util($container); |
||
108 | }); |
||
109 | |||
110 | // Models |
||
111 | $container->set('kitsu-model', function($container) { |
||
112 | $requestBuilder = new KitsuRequestBuilder(); |
||
113 | $requestBuilder->setLogger($container->getLogger('kitsu-request')); |
||
114 | |||
115 | $listItem = new Kitsu\ListItem(); |
||
116 | $listItem->setContainer($container); |
||
117 | $listItem->setRequestBuilder($requestBuilder); |
||
118 | |||
119 | $model = new Kitsu\Model($listItem); |
||
120 | $model->setContainer($container); |
||
121 | $model->setRequestBuilder($requestBuilder); |
||
122 | |||
123 | $cache = $container->get('cache'); |
||
124 | $model->setCache($cache); |
||
125 | return $model; |
||
126 | }); |
||
127 | $container->set('mal-model', function($container) { |
||
128 | $requestBuilder = new MALRequestBuilder(); |
||
129 | $requestBuilder->setLogger($container->getLogger('mal-request')); |
||
130 | |||
131 | $listItem = new MAL\ListItem(); |
||
132 | $listItem->setContainer($container); |
||
133 | $listItem->setRequestBuilder($requestBuilder); |
||
0 ignored issues
–
show
|
|||
134 | |||
135 | $model = new MAL\Model($listItem); |
||
136 | $model->setContainer($container); |
||
137 | $model->setRequestBuilder($requestBuilder); |
||
0 ignored issues
–
show
$requestBuilder is of type object<Aviat\AnimeClient...\MAL\MALRequestBuilder> , but the function expects a object<Aviat\AnimeClient\API\MALRequestBuilder> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
138 | return $model; |
||
139 | }); |
||
140 | |||
141 | $container->set('api-model', function($container) { |
||
142 | return new Model\API($container); |
||
143 | }); |
||
144 | $container->set('anime-model', function($container) { |
||
145 | return new Model\Anime($container); |
||
146 | }); |
||
147 | $container->set('manga-model', function($container) { |
||
148 | return new Model\Manga($container); |
||
149 | }); |
||
150 | $container->set('anime-collection-model', function($container) { |
||
151 | return new Model\AnimeCollection($container); |
||
152 | }); |
||
153 | |||
154 | // Miscellaneous Classes |
||
155 | $container->set('auth', function($container) { |
||
156 | return new Kitsu\Auth($container); |
||
157 | }); |
||
158 | $container->set('url-generator', function($container) { |
||
159 | return new UrlGenerator($container); |
||
160 | }); |
||
161 | |||
162 | // ------------------------------------------------------------------------- |
||
163 | // Dispatcher |
||
164 | // ------------------------------------------------------------------------- |
||
165 | $container->set('dispatcher', function($container) { |
||
166 | return new Dispatcher($container); |
||
167 | }); |
||
168 | |||
169 | return $container; |
||
170 | }; |
||
171 | |||
172 | // End of bootstrap.php |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: