Passed
Push — feature/0.7.0 ( cbd99f...49f0a6 )
by Ryuichi
42:21
created

AnnotationDelegator::readModule()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 2
dl 0
loc 20
rs 9.4285
c 0
b 0
f 0
1
<?php
2
namespace WebStream\Delegate;
3
4
use WebStream\Core\CoreInterface;
5
use WebStream\Core\CoreController;
6
use WebStream\Core\CoreService;
7
use WebStream\Core\CoreModel;
8
use WebStream\Core\CoreView;
9
use WebStream\Core\CoreHelper;
10
use WebStream\Container\Container;
11
use WebStream\Annotation\Attributes\Alias;
12
use WebStream\Annotation\Attributes\Database;
13
use WebStream\Annotation\Attributes\ExceptionHandler;
14
use WebStream\Annotation\Attributes\Filter;
15
use WebStream\Annotation\Attributes\Header;
16
use WebStream\Annotation\Attributes\Query;
17
use WebStream\Annotation\Attributes\Template;
18
use WebStream\Annotation\Attributes\Validate;
19
use WebStream\Annotation\Base\IAnnotatable;
20
use WebStream\Annotation\Reader\AnnotationReader;
21
use WebStream\Annotation\Reader\Extend\FilterExtendReader;
22
use WebStream\Annotation\Reader\Extend\QueryExtendReader;
23
use WebStream\Annotation\Container\AnnotationContainer;
24
use WebStream\Template\Basic;
25
use WebStream\Template\Twig;
26
27
/**
28
 * AnnotationDelegator
29
 * @author Ryuichi TANAKA.
30
 * @since 2015/02/11
31
 * @version 0.4
32
 */
33
class AnnotationDelegator
34
{
35
    /**
36
     * @var Container 依存コンテナ
37
     */
38
    private $container;
39
40
    /**
41
     * @var Container アノテーションコンテナ
42
     */
43
    private $annotationContainer;
44
45
    /**
46
     * @var Logger ロガー
0 ignored issues
show
Bug introduced by
The type WebStream\Delegate\Logger was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
47
     */
48
    private $logger;
49
50
    /**
51
     * Constructor
52
     * @param CoreInterface インスタンス
53
     * @param Container DIContainer
54
     */
0 ignored issues
show
Documentation Bug introduced by
The doc comment インスタンス at position 0 could not be parsed: Unknown type name 'インスタンス' at position 0 in インスタンス.
Loading history...
55
    public function __construct(Container $container)
56
    {
57
        $this->container = $container;
58
        $this->annotationContainer = new Container(false);
59
        $this->logger = $container->logger;
0 ignored issues
show
Bug Best Practice introduced by
The property logger does not exist on WebStream\Container\Container. Since you implemented __get, consider adding a @property annotation.
Loading history...
Documentation Bug introduced by
It seems like $container->logger can also be of type string. However, the property $logger is declared as type WebStream\Delegate\Logger. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
60
    }
61
62
    /**
63
     * Destructor
64
     */
65
    public function __destruct()
66
    {
67
        $this->logger->debug("AnnotationDelegator container is clear.");
68
    }
69
70
    /**
71
     * アノテーション情報をロードする
72
     * @param object インスタンス
73
     * @param string メソッド
74
     * @return Container コンテナ
75
     */
0 ignored issues
show
Documentation Bug introduced by
The doc comment インスタンス at position 0 could not be parsed: Unknown type name 'インスタンス' at position 0 in インスタンス.
Loading history...
76
    public function read($instance, $method = null)
77
    {
78
        if (!$instance instanceof IAnnotatable) {
79
            $this->logger->warn("Annotation is not available this class: " . get_class($instance));
80
            return;
81
        }
82
83
        $this->container->executeMethod = $method ?: "";
0 ignored issues
show
Bug Best Practice introduced by
The property executeMethod does not exist on WebStream\Container\Container. Since you implemented __set, consider adding a @property annotation.
Loading history...
84
        $annotationContainer = null;
85
86
        if ($instance instanceof CoreController) {
87
            if ($this->annotationContainer->controller === null) {
0 ignored issues
show
Bug Best Practice introduced by
The property controller does not exist on WebStream\Container\Container. Since you implemented __get, consider adding a @property annotation.
Loading history...
88
                $this->annotationContainer->controller = $this->readController($instance);
0 ignored issues
show
Bug Best Practice introduced by
The property controller does not exist on WebStream\Container\Container. Since you implemented __set, consider adding a @property annotation.
Loading history...
89
            }
90
            $annotationContainer = $this->annotationContainer->controller;
91
        } elseif ($instance instanceof CoreService) {
92
            if ($this->annotationContainer->service === null) {
0 ignored issues
show
Bug Best Practice introduced by
The property service does not exist on WebStream\Container\Container. Since you implemented __get, consider adding a @property annotation.
Loading history...
93
                $this->annotationContainer->service = $this->readService($instance);
0 ignored issues
show
Bug Best Practice introduced by
The property service does not exist on WebStream\Container\Container. Since you implemented __set, consider adding a @property annotation.
Loading history...
94
            }
95
            $annotationContainer = $this->annotationContainer->service;
96
        } elseif ($instance instanceof CoreModel) {
97
            if ($this->annotationContainer->model === null) {
0 ignored issues
show
Bug Best Practice introduced by
The property model does not exist on WebStream\Container\Container. Since you implemented __get, consider adding a @property annotation.
Loading history...
98
                $this->annotationContainer->model = $this->readModel($instance);
0 ignored issues
show
Bug Best Practice introduced by
The property model does not exist on WebStream\Container\Container. Since you implemented __set, consider adding a @property annotation.
Loading history...
99
            }
100
            $annotationContainer = $this->annotationContainer->model;
101
        } elseif ($instance instanceof CoreView) {
102
            if ($this->annotationContainer->view === null) {
0 ignored issues
show
Bug Best Practice introduced by
The property view does not exist on WebStream\Container\Container. Since you implemented __get, consider adding a @property annotation.
Loading history...
103
                $this->annotationContainer->view = $this->readView($instance);
0 ignored issues
show
Bug Best Practice introduced by
The property view does not exist on WebStream\Container\Container. Since you implemented __set, consider adding a @property annotation.
Loading history...
104
            }
105
            $annotationContainer = $this->annotationContainer->model;
106
        } elseif ($instance instanceof CoreHelper) {
107
            if ($this->annotationContainer->helper === null) {
0 ignored issues
show
Bug Best Practice introduced by
The property helper does not exist on WebStream\Container\Container. Since you implemented __get, consider adding a @property annotation.
Loading history...
108
                $this->annotationContainer->helper = $this->readHelper($instance);
0 ignored issues
show
Bug Best Practice introduced by
The property helper does not exist on WebStream\Container\Container. Since you implemented __set, consider adding a @property annotation.
Loading history...
109
            }
110
            $annotationContainer = $this->annotationContainer->helper;
111
        }
112
113
        return $annotationContainer;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $annotationContainer also could return the type string which is incompatible with the documented return type WebStream\Container\Container.
Loading history...
114
    }
115
116
    /**
117
     * Controllerのアノテーション情報をロードする
118
     * @param CoreController インスタンス
119
     * @return Container コンテナ
120
     */
0 ignored issues
show
Documentation Bug introduced by
The doc comment インスタンス at position 0 could not be parsed: Unknown type name 'インスタンス' at position 0 in インスタンス.
Loading history...
121
    private function readController(CoreController $instance)
122
    {
123
        $reader = new AnnotationReader($instance);
124
        $reader->inject('defaultContainer', $this->container);
125
        $reader->setActionMethod($this->container->executeMethod);
0 ignored issues
show
Bug Best Practice introduced by
The property executeMethod does not exist on WebStream\Container\Container. Since you implemented __get, consider adding a @property annotation.
Loading history...
Bug introduced by
It seems like $this->container->executeMethod can also be of type null; however, parameter $actionMethod of WebStream\Annotation\Rea...ader::setActionMethod() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

125
        $reader->setActionMethod(/** @scrutinizer ignore-type */ $this->container->executeMethod);
Loading history...
126
127
        // @Header
128
        $container = new Container();
129
        $container->requestMethod = $this->container->request->requestMethod;
0 ignored issues
show
Bug Best Practice introduced by
The property requestMethod does not exist on WebStream\Container\Container. Since you implemented __set, consider adding a @property annotation.
Loading history...
Bug Best Practice introduced by
The property request does not exist on WebStream\Container\Container. Since you implemented __get, consider adding a @property annotation.
Loading history...
Bug introduced by
The property requestMethod does not exist on string.
Loading history...
130
        $container->contentType = 'html';
0 ignored issues
show
Bug Best Practice introduced by
The property contentType does not exist on WebStream\Container\Container. Since you implemented __set, consider adding a @property annotation.
Loading history...
131
        $container->logger = $this->container->logger;
0 ignored issues
show
Bug Best Practice introduced by
The property logger does not exist on WebStream\Container\Container. Since you implemented __get, consider adding a @property annotation.
Loading history...
Bug Best Practice introduced by
The property logger does not exist on WebStream\Container\Container. Since you implemented __set, consider adding a @property annotation.
Loading history...
132
        $reader->readable(Header::class, $container);
133
134
        // @Filter
135
        $container = new Container();
136
        $container->action = $this->container->executeMethod;
0 ignored issues
show
Bug Best Practice introduced by
The property action does not exist on WebStream\Container\Container. Since you implemented __set, consider adding a @property annotation.
Loading history...
137
        $container->logger = $this->container->logger;
138
        $reader->readable(Filter::class, $container);
139
        $reader->useExtendReader(Filter::class, FilterExtendReader::class);
140
141
        // @Template
142
        $container = new Container();
143
        $container->action = $this->container->executeMethod;
144
        $container->engine = [
0 ignored issues
show
Bug Best Practice introduced by
The property engine does not exist on WebStream\Container\Container. Since you implemented __set, consider adding a @property annotation.
Loading history...
145
            'basic' => Basic::class,
146
            'twig' => Twig::class
147
        ];
148
        $container->logger = $this->container->logger;
149
        $reader->readable(Template::class, $container);
150
151
        // @Validate
152
        $container = new Container();
153
        $requestMethod = $this->container->request->requestMethod;
154
        $container->request = new Container(false);
0 ignored issues
show
Bug Best Practice introduced by
The property request does not exist on WebStream\Container\Container. Since you implemented __set, consider adding a @property annotation.
Loading history...
155
        $container->request->requestMethod = $requestMethod;
156
        $requestMethod = mb_strtolower($requestMethod);
157
        $container->request->{$requestMethod} = $this->container->request->{$requestMethod};
158
        $container->applicationInfo = new Container(false);
0 ignored issues
show
Bug Best Practice introduced by
The property applicationInfo does not exist on WebStream\Container\Container. Since you implemented __set, consider adding a @property annotation.
Loading history...
159
        $container->applicationInfo = $this->container->applicationInfo;
0 ignored issues
show
Bug Best Practice introduced by
The property applicationInfo does not exist on WebStream\Container\Container. Since you implemented __get, consider adding a @property annotation.
Loading history...
160
        $container->logger = $this->container->logger;
161
        $reader->readable(Validate::class, $container);
162
163
        // @ExceptionHandler
164
        $container = new Container();
165
        $container->logger = $this->container->logger;
166
        $reader->readable(ExceptionHandler::class, $container);
167
168
        // @Alias
169
        $container = new Container();
170
        $container->action = $this->container->executeMethod;
171
        $container->logger = $this->container->logger;
172
        $reader->readable(Alias::class, $container);
173
174
        $reader->readMethod();
175
176
        $annotationContainer = new AnnotationContainer();
177
        $annotationContainer->annotationInfoList = $reader->getAnnotationInfoList();
0 ignored issues
show
Bug Best Practice introduced by
The property annotationInfoList does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
178
        $annotationContainer->exception = $reader->getException();
0 ignored issues
show
Bug Best Practice introduced by
The property exception does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
179
        $annotationContainer->customAnnotationInfoList = array_filter($annotationContainer->annotationInfoList, function ($key) {
0 ignored issues
show
Bug Best Practice introduced by
The property annotationInfoList does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __get, consider adding a @property annotation.
Loading history...
Bug Best Practice introduced by
The property customAnnotationInfoList does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
180
            return !in_array($key, [Filter::class, Header::class, ExceptionHandler::class, Template::class, Alias::class], true);
181
        }, ARRAY_FILTER_USE_KEY);
182
183
        return $annotationContainer;
184
    }
185
186
    /**
187
     * Serviceのアノテーション情報をロードする
188
     * @param CoreService インスタンス
189
     * @return Container コンテナ
190
     */
0 ignored issues
show
Documentation Bug introduced by
The doc comment インスタンス at position 0 could not be parsed: Unknown type name 'インスタンス' at position 0 in インスタンス.
Loading history...
191
    private function readService(CoreService $instance)
192
    {
193
        $reader = new AnnotationReader($instance);
194
        $reader->setActionMethod($this->container->executeMethod);
0 ignored issues
show
Bug Best Practice introduced by
The property executeMethod does not exist on WebStream\Container\Container. Since you implemented __get, consider adding a @property annotation.
Loading history...
Bug introduced by
It seems like $this->container->executeMethod can also be of type null; however, parameter $actionMethod of WebStream\Annotation\Rea...ader::setActionMethod() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

194
        $reader->setActionMethod(/** @scrutinizer ignore-type */ $this->container->executeMethod);
Loading history...
195
196
        // @Filter
197
        $container = new Container();
198
        $container->action = $this->container->executeMethod;
0 ignored issues
show
Bug Best Practice introduced by
The property action does not exist on WebStream\Container\Container. Since you implemented __set, consider adding a @property annotation.
Loading history...
199
        $container->logger = $this->container->logger;
0 ignored issues
show
Bug Best Practice introduced by
The property logger does not exist on WebStream\Container\Container. Since you implemented __get, consider adding a @property annotation.
Loading history...
Bug Best Practice introduced by
The property logger does not exist on WebStream\Container\Container. Since you implemented __set, consider adding a @property annotation.
Loading history...
200
        $reader->readable(Filter::class, $container);
201
        $reader->useExtendReader(Filter::class, FilterExtendReader::class);
202
203
        // @ExceptionHandler
204
        $container = new Container();
205
        $container->logger = $this->container->logger;
206
        $reader->readable(ExceptionHandler::class, $container);
207
208
        // @Alias
209
        $container = new Container();
210
        $container->action = $this->container->executeMethod;
211
        $container->logger = $this->container->logger;
212
        $reader->readable(Alias::class, $container);
213
214
        $reader->readMethod();
215
216
        $annotationContainer = new AnnotationContainer();
217
        $annotationContainer->annotationInfoList = $reader->getAnnotationInfoList();
0 ignored issues
show
Bug Best Practice introduced by
The property annotationInfoList does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
218
        $annotationContainer->exception = $reader->getException();
0 ignored issues
show
Bug Best Practice introduced by
The property exception does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
219
        $annotationContainer->customAnnotationInfoList = array_filter($annotationContainer->annotationInfoList, function ($key) {
0 ignored issues
show
Bug Best Practice introduced by
The property annotationInfoList does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __get, consider adding a @property annotation.
Loading history...
Bug Best Practice introduced by
The property customAnnotationInfoList does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
220
            return !in_array($key, [Filter::class, ExceptionHandler::class, Alias::class], true);
221
        }, ARRAY_FILTER_USE_KEY);
222
223
224
        return $annotationContainer;
225
    }
226
227
    /**
228
     * Modelのアノテーション情報をロードする
229
     * @param CoreModel インスタンス
230
     * @return Container コンテナ
231
     */
0 ignored issues
show
Documentation Bug introduced by
The doc comment インスタンス at position 0 could not be parsed: Unknown type name 'インスタンス' at position 0 in インスタンス.
Loading history...
232
    private function readModel(CoreModel $instance)
233
    {
234
        $reader = new AnnotationReader($instance);
235
        $reader->setActionMethod($this->container->executeMethod);
0 ignored issues
show
Bug Best Practice introduced by
The property executeMethod does not exist on WebStream\Container\Container. Since you implemented __get, consider adding a @property annotation.
Loading history...
Bug introduced by
It seems like $this->container->executeMethod can also be of type null; however, parameter $actionMethod of WebStream\Annotation\Rea...ader::setActionMethod() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

235
        $reader->setActionMethod(/** @scrutinizer ignore-type */ $this->container->executeMethod);
Loading history...
236
237
        // @Filter
238
        $container = new Container();
239
        $container->action = $this->container->executeMethod;
0 ignored issues
show
Bug Best Practice introduced by
The property action does not exist on WebStream\Container\Container. Since you implemented __set, consider adding a @property annotation.
Loading history...
240
        $container->logger = $this->container->logger;
0 ignored issues
show
Bug Best Practice introduced by
The property logger does not exist on WebStream\Container\Container. Since you implemented __get, consider adding a @property annotation.
Loading history...
Bug Best Practice introduced by
The property logger does not exist on WebStream\Container\Container. Since you implemented __set, consider adding a @property annotation.
Loading history...
241
        $reader->readable(Filter::class, $container);
242
        $reader->useExtendReader(Filter::class, FilterExtendReader::class);
243
244
        // @ExceptionHandler
245
        $container = new Container();
246
        $container->logger = $this->container->logger;
247
        $reader->readable(ExceptionHandler::class, $container);
248
249
        // @Database
250
        $container = new Container();
251
        $container->rootPath = $this->container->applicationInfo->applicationRoot;
0 ignored issues
show
Bug Best Practice introduced by
The property rootPath does not exist on WebStream\Container\Container. Since you implemented __set, consider adding a @property annotation.
Loading history...
Bug introduced by
The property applicationRoot does not exist on string.
Loading history...
Bug Best Practice introduced by
The property applicationInfo does not exist on WebStream\Container\Container. Since you implemented __get, consider adding a @property annotation.
Loading history...
252
        $container->logger = $this->container->logger;
253
        $reader->readable(Database::class, $container);
254
255
        // @Query
256
        $container = new Container();
257
        $container->rootPath = $this->container->applicationInfo->applicationRoot;
258
        $container->logger = $this->container->logger;
259
        $reader->readable(Query::class, $container);
260
        $reader->useExtendReader(Query::class, QueryExtendReader::class);
261
262
        // @Alias
263
        $container = new Container();
264
        $container->action = $this->container->executeMethod;
265
        $container->logger = $this->container->logger;
266
        $reader->readable(Alias::class, $container);
267
268
        $reader->readClass();
269
        $reader->readMethod();
270
271
        $annotationContainer = new AnnotationContainer();
272
        $annotationContainer->annotationInfoList = $reader->getAnnotationInfoList();
0 ignored issues
show
Bug Best Practice introduced by
The property annotationInfoList does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
273
        $annotationContainer->exception = $reader->getException();
0 ignored issues
show
Bug Best Practice introduced by
The property exception does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
274
        $annotationContainer->customAnnotationInfoList = array_filter($annotationContainer->annotationInfoList, function ($key) {
0 ignored issues
show
Bug Best Practice introduced by
The property annotationInfoList does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __get, consider adding a @property annotation.
Loading history...
Bug Best Practice introduced by
The property customAnnotationInfoList does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
275
            return !in_array($key, [Filter::class, ExceptionHandler::class, Database::class, Query::class, Alias::class], true);
276
        }, ARRAY_FILTER_USE_KEY);
277
278
        return $annotationContainer;
279
    }
280
281
    /**
282
     * Viewのアノテーション情報をロードする
283
     * @param CoreView インスタンス
284
     * @return Container コンテナ
285
     */
0 ignored issues
show
Documentation Bug introduced by
The doc comment インスタンス at position 0 could not be parsed: Unknown type name 'インスタンス' at position 0 in インスタンス.
Loading history...
286
    private function readView(CoreView $instance)
287
    {
288
        $reader = new AnnotationReader($instance);
289
290
        // @Filter
291
        $container = new Container();
292
        $container->action = $this->container->executeMethod;
0 ignored issues
show
Bug Best Practice introduced by
The property executeMethod does not exist on WebStream\Container\Container. Since you implemented __get, consider adding a @property annotation.
Loading history...
Bug Best Practice introduced by
The property action does not exist on WebStream\Container\Container. Since you implemented __set, consider adding a @property annotation.
Loading history...
293
        $container->logger = $this->container->logger;
0 ignored issues
show
Bug Best Practice introduced by
The property logger does not exist on WebStream\Container\Container. Since you implemented __set, consider adding a @property annotation.
Loading history...
Bug Best Practice introduced by
The property logger does not exist on WebStream\Container\Container. Since you implemented __get, consider adding a @property annotation.
Loading history...
294
        $reader->readable(Filter::class, $container);
295
        $reader->useExtendReader(Filter::class, FilterExtendReader::class);
296
297
        $reader->readMethod();
298
299
        $annotationContainer = new AnnotationContainer();
300
        $annotationContainer->annotationInfoList = $reader->getAnnotationInfoList();
0 ignored issues
show
Bug Best Practice introduced by
The property annotationInfoList does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
301
        $annotationContainer->exception = $reader->getException();
0 ignored issues
show
Bug Best Practice introduced by
The property exception does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
302
303
        return $annotationContainer;
304
    }
305
306
    /**
307
     * Helperのアノテーション情報をロードする
308
     * @param CoreHelper インスタンス
309
     * @return Container コンテナ
310
     */
0 ignored issues
show
Documentation Bug introduced by
The doc comment インスタンス at position 0 could not be parsed: Unknown type name 'インスタンス' at position 0 in インスタンス.
Loading history...
311
    private function readHelper(CoreHelper $instance)
312
    {
313
        $reader = new AnnotationReader($instance);
314
        $reader->setActionMethod($this->container->executeMethod);
0 ignored issues
show
Bug introduced by
It seems like $this->container->executeMethod can also be of type null; however, parameter $actionMethod of WebStream\Annotation\Rea...ader::setActionMethod() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

314
        $reader->setActionMethod(/** @scrutinizer ignore-type */ $this->container->executeMethod);
Loading history...
Bug Best Practice introduced by
The property executeMethod does not exist on WebStream\Container\Container. Since you implemented __get, consider adding a @property annotation.
Loading history...
315
316
        // @Filter
317
        $container = new Container();
318
        $container->action = $this->container->executeMethod;
0 ignored issues
show
Bug Best Practice introduced by
The property action does not exist on WebStream\Container\Container. Since you implemented __set, consider adding a @property annotation.
Loading history...
319
        $container->logger = $this->container->logger;
0 ignored issues
show
Bug Best Practice introduced by
The property logger does not exist on WebStream\Container\Container. Since you implemented __set, consider adding a @property annotation.
Loading history...
Bug Best Practice introduced by
The property logger does not exist on WebStream\Container\Container. Since you implemented __get, consider adding a @property annotation.
Loading history...
320
        $reader->readable(Filter::class, $container);
321
        $reader->useExtendReader(Filter::class, FilterExtendReader::class);
322
323
        // @ExceptionHandler
324
        $container = new Container();
325
        $container->logger = $this->container->logger;
326
        $reader->readable(ExceptionHandler::class, $container);
327
328
        // @Alias
329
        $container = new Container();
330
        $container->action = $this->container->executeMethod;
331
        $container->logger = $this->container->logger;
332
        $reader->readable(Alias::class, $container);
333
334
        $reader->readMethod();
335
336
        $annotationContainer = new AnnotationContainer();
337
        $annotationContainer->annotationInfoList = $reader->getAnnotationInfoList();
0 ignored issues
show
Bug Best Practice introduced by
The property annotationInfoList does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
338
        $annotationContainer->exception = $reader->getException();
0 ignored issues
show
Bug Best Practice introduced by
The property exception does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
339
        $annotationContainer->customAnnotationInfoList = array_filter($annotationContainer->annotationInfoList, function ($key) {
0 ignored issues
show
Bug Best Practice introduced by
The property customAnnotationInfoList does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
Bug Best Practice introduced by
The property annotationInfoList does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __get, consider adding a @property annotation.
Loading history...
340
            return !in_array($key, [Filter::class, ExceptionHandler::class, Alias::class], true);
341
        }, ARRAY_FILTER_USE_KEY);
342
343
        return $annotationContainer;
344
    }
345
}
346