Passed
Push — master ( ebaa0d...c158b7 )
by Thierry
03:41
created

CallableObject::getCallableMethods()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 13
rs 10
cc 2
nc 1
nop 1
1
<?php
2
3
/**
4
 * CallableObject.php
5
 *
6
 * Jaxon callable object
7
 *
8
 * This class stores a reference to an object whose methods can be called from
9
 * the client via a Jaxon request
10
 *
11
 * The Jaxon plugin manager will call <CallableObject->getClientScript> so that
12
 * stub functions can be generated and sent to the browser.
13
 *
14
 * @package jaxon-core
0 ignored issues
show
Coding Style introduced by
Package name "jaxon-core" is not valid; consider "Jaxoncore" instead
Loading history...
15
 * @author Jared White
0 ignored issues
show
Coding Style introduced by
Content of the @author tag must be in the form "Display Name <[email protected]>"
Loading history...
16
 * @author J. Max Wilson
0 ignored issues
show
Coding Style introduced by
Content of the @author tag must be in the form "Display Name <[email protected]>"
Loading history...
17
 * @author Joseph Woolley
0 ignored issues
show
Coding Style introduced by
Content of the @author tag must be in the form "Display Name <[email protected]>"
Loading history...
18
 * @author Steffen Konerow
0 ignored issues
show
Coding Style introduced by
Content of the @author tag must be in the form "Display Name <[email protected]>"
Loading history...
19
 * @author Thierry Feuzeu <[email protected]>
20
 * @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson
0 ignored issues
show
Coding Style introduced by
@copyright tag must contain a year and the name of the copyright holder
Loading history...
21
 * @copyright Copyright (c) 2008-2010 by Joseph Woolley, Steffen Konerow, Jared White  & J. Max Wilson
0 ignored issues
show
Coding Style introduced by
@copyright tag must contain a year and the name of the copyright holder
Loading history...
22
 * @copyright 2016 Thierry Feuzeu <[email protected]>
23
 * @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
24
 * @link https://github.com/jaxon-php/jaxon-core
25
 */
0 ignored issues
show
Coding Style introduced by
PHP version not specified
Loading history...
Coding Style introduced by
Missing @category tag in file comment
Loading history...
26
27
namespace Jaxon\Plugin\Request\CallableClass;
28
29
use Jaxon\App\CallableClass;
30
use Jaxon\Di\Container;
31
use Jaxon\Exception\SetupException;
32
use Jaxon\Request\Target;
33
use Jaxon\Response\ResponseInterface;
34
35
use ReflectionClass;
36
use ReflectionException;
37
use ReflectionMethod;
38
use ReflectionProperty;
39
40
use function array_filter;
41
use function array_map;
42
use function array_merge;
43
use function array_unique;
44
use function call_user_func;
45
use function in_array;
46
use function is_array;
47
use function is_string;
48
use function json_encode;
49
use function str_replace;
50
use function substr;
51
52
class CallableObject
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class CallableObject
Loading history...
53
{
54
    /**
55
     * The DI container
56
     *
57
     * @var Container
58
     */
59
    protected $di;
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line(s) before first member var; 0 found
Loading history...
60
61
    /**
62
     * The reflection class of the user registered callable object
63
     *
64
     * @var ReflectionClass
65
     */
66
    private $xReflectionClass;
67
68
    /**
69
     * A list of methods of the user registered callable object the library must not export to javascript
70
     *
71
     * @var array
72
     */
73
    private $aProtectedMethods = [];
74
75
    /**
76
     * A list of methods to call before processing the request
77
     *
78
     * @var array
79
     */
80
    private $aBeforeMethods = [];
81
82
    /**
83
     * A list of methods to call after processing the request
84
     *
85
     * @var array
86
     */
87
    private $aAfterMethods = [];
88
89
    /**
90
     * The callable object options
91
     *
92
     * @var array
93
     */
94
    private $aOptions = [];
95
96
    /**
97
     * The character to use as separator in javascript class names
98
     *
99
     * @var string
100
     */
101
    private $sSeparator = '.';
102
103
    /**
104
     * Check if the js code for this object must be generated
105
     *
106
     * @var bool
0 ignored issues
show
Bug introduced by
Expected "boolean" but found "bool" for @var tag in member variable comment
Loading history...
107
     */
108
    private $bExcluded = false;
109
110
    /**
111
     * The user registered callable object
112
     *
113
     * @var object
114
     */
115
    private $xRegisteredObject = null;
116
117
    /**
118
     * The attributes to inject in the user registered callable object
119
     *
120
     * @var array
121
     */
122
    private $aAttributes = [];
123
124
    /**
125
     * The target of the Jaxon call
126
     *
127
     * @var Target
128
     */
129
    private $xTarget;
130
131
    /**
132
     * The class constructor
133
     *
134
     * @param Container  $di
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 7 spaces after parameter type; 2 found
Loading history...
135
     * @param ReflectionClass $xReflectionClass    The reflection class
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter name; 4 found
Loading history...
136
     *
137
     */
138
    public function __construct(Container $di, ReflectionClass $xReflectionClass)
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
139
    {
140
        $this->di = $di;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 15 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
141
        $this->xReflectionClass = $xReflectionClass;
142
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
143
144
    /**
145
     * Get callable object options
146
     *
147
     * @return array
148
     */
149
    public function getOptions(): array
150
    {
151
        return $this->aOptions;
152
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
153
154
    /**
155
     * Check if the js code for this object must be generated
156
     *
157
     * @return bool
158
     */
159
    public function excluded(): bool
160
    {
161
        return $this->bExcluded;
162
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
163
164
    /**
165
     * Set callable object options
166
     *
167
     * @param array  $aOptions
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
168
     *
169
     * @return void
170
     */
171
    public function setOptions(array $aOptions)
172
    {
173
        $this->aOptions = $aOptions;
174
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
175
176
    /**
177
     * Get the name of the corresponding javascript class
178
     *
179
     * @return string
180
     */
181
    public function getJsName(): string
182
    {
183
        return str_replace('\\', $this->sSeparator, $this->xReflectionClass->getName());
184
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
185
186
    /**
187
     * Set hook methods
188
     *
189
     * @param array $aHookMethods    The array of hook methods
0 ignored issues
show
Coding Style introduced by
Expected 8 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 4 found
Loading history...
190
     * @param string|array $xValue    The value of the configuration option
0 ignored issues
show
Coding Style introduced by
Expected 7 spaces after parameter name; 4 found
Loading history...
191
     *
192
     * @return void
193
     */
194
    private function setHookMethods(array &$aHookMethods, $xValue)
195
    {
196
        foreach($xValue as $sCalledMethod => $xMethodToCall)
197
        {
198
            if(is_array($xMethodToCall))
199
            {
200
                $aHookMethods[$sCalledMethod] = $xMethodToCall;
201
            }
202
            elseif(is_string($xMethodToCall))
203
            {
204
                $aHookMethods[$sCalledMethod] = [$xMethodToCall];
205
            }
206
        }
207
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
208
209
    /**
210
     * Set configuration options / call options for each method
211
     *
212
     * @param string $sName    The name of the configuration option
0 ignored issues
show
Coding Style introduced by
Expected 7 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter name; 4 found
Loading history...
213
     * @param string|array $xValue    The value of the configuration option
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter name; 4 found
Loading history...
214
     *
215
     * @return void
216
     */
217
    public function configure(string $sName, $xValue)
218
    {
219
        switch($sName)
220
        {
221
        // Set the separator
222
        case 'separator':
223
            if($xValue === '_' || $xValue === '.')
224
            {
225
                $this->sSeparator = $xValue;
226
            }
227
            break;
228
        // Set the protected methods
229
        case 'protected':
230
            if(is_array($xValue))
231
            {
232
                $this->aProtectedMethods = array_merge($this->aProtectedMethods, $xValue);
233
            }
234
            break;
235
        // Set the methods to call before processing the request
236
        case '__before':
237
            $this->setHookMethods($this->aBeforeMethods, $xValue);
238
            break;
239
        // Set the methods to call after processing the request
240
        case '__after':
241
            $this->setHookMethods($this->aAfterMethods, $xValue);
242
            break;
243
        // Set the attributes to inject in the callable object
244
        case '__di':
245
            $this->aAttributes = array_merge($this->aAttributes, $xValue);
0 ignored issues
show
Bug introduced by
It seems like $xValue can also be of type string; however, parameter $arrays of array_merge() does only seem to accept array, 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

245
            $this->aAttributes = array_merge($this->aAttributes, /** @scrutinizer ignore-type */ $xValue);
Loading history...
246
            break;
247
        case 'excluded':
248
            $this->bExcluded = (bool)$xValue;
249
            break;
250
        default:
251
            break;
252
        }
253
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
254
255
    /**
256
     * Get the public and protected attributes of the callable object
257
     *
258
     * @return array
259
     */
260
    public function getProperties(): array
261
    {
262
        return array_map(function($xProperty) {
263
            return $xProperty->getName();
264
        }, $this->xReflectionClass->getProperties(ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_PROTECTED));
265
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
266
267
    /**
268
     * Get the public methods of the callable object
269
     *
270
     * @param array $aProtectedMethods    The protected methods
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter name; 4 found
Loading history...
271
     *
272
     * @return array
273
     */
274
    public function getPublicMethods(array $aProtectedMethods = []): array
275
    {
276
        $aMethods = array_map(function($xMethod) {
277
            return $xMethod->getShortName();
278
        }, $this->xReflectionClass->getMethods(ReflectionMethod::IS_PUBLIC));
279
280
        return array_filter($aMethods, function($sMethodName) use($aProtectedMethods) {
281
            // Don't take magic __call, __construct, __destruct methods
282
            // Don't take protected methods
283
            return substr($sMethodName, 0, 2) !== '__' &&
284
                !in_array($sMethodName, $aProtectedMethods) &&
285
                !in_array($sMethodName, $this->aProtectedMethods);
286
        });
287
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
288
289
    /**
0 ignored issues
show
Coding Style introduced by
Parameter $sOptionName should have a doc-comment as per coding-style.
Loading history...
290
     * @param array $aCommonOptions
0 ignored issues
show
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Missing parameter comment
Loading history...
291
     * @param array $aMethodOptions
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
292
     * @param string $sMethodName
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Doc comment for parameter $sMethodName does not match actual variable name $sOptionName
Loading history...
293
     *
294
     * @return mixed
295
     */
296
    private function getOptionValue(array $aCommonOptions, array $aMethodOptions, string $sOptionName)
297
    {
298
        if(!isset($aCommonOptions[$sOptionName]))
299
        {
300
            return $aMethodOptions[$sOptionName];
301
        }
302
        if(!isset($aMethodOptions[$sOptionName]))
303
        {
304
            return $aCommonOptions[$sOptionName];
305
        }
306
        // If both are not arrays, return the latest.
307
        if(!is_array($aCommonOptions[$sOptionName]) && !is_array($aMethodOptions[$sOptionName]))
308
        {
309
            return $aMethodOptions[$sOptionName];
310
        }
311
312
        // Merge the options.
313
        $_aCommonOptions = is_array($aCommonOptions[$sOptionName]) ?
0 ignored issues
show
Coding Style introduced by
Expected 1 space after "?"; newline found
Loading history...
314
            $aCommonOptions[$sOptionName] : [$aCommonOptions[$sOptionName]];
315
        $_aMethodOptions = is_array($aMethodOptions[$sOptionName]) ?
0 ignored issues
show
Coding Style introduced by
Expected 1 space after "?"; newline found
Loading history...
316
            $aMethodOptions[$sOptionName] : [$aMethodOptions[$sOptionName]];
317
        return array_merge($_aCommonOptions, $_aMethodOptions);
318
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
319
320
    /**
321
     * @param string $sMethodName
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
322
     *
323
     * @return array
324
     */
325
    private function getMethodOptions(string $sMethodName): array
326
    {
327
        $aCommonOptions = isset($this->aOptions['*']) ? $this->aOptions['*'] : [];
328
        $aMethodOptions = isset($this->aOptions[$sMethodName]) ? $this->aOptions[$sMethodName] : [];
329
        $aOptionNames = array_unique(array_merge(array_keys($aCommonOptions), array_keys($aMethodOptions)));
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
330
        $aOptions = [];
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
331
        foreach($aOptionNames as $sOptionName)
332
        {
333
            $aOptions[$sOptionName] = $this->getOptionValue($aCommonOptions, $aMethodOptions, $sOptionName);
334
        }
335
        return $aOptions;
336
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
337
338
    /**
339
     * Return a list of methods of the callable object to export to javascript
340
     *
341
     * @param array $aProtectedMethods    The protected methods
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter name; 4 found
Loading history...
342
     *
343
     * @return array
344
     */
345
    public function getCallableMethods(array $aProtectedMethods): array
346
    {
347
        // Convert an option to a string to be displayed in the js script template.
348
        $fConvertOption = function($xOption) {
349
            return is_array($xOption) ? json_encode($xOption) : $xOption;
350
        };
351
352
        return array_map(function($sMethodName) use($fConvertOption) {
353
            return [
354
                'name' => $sMethodName,
355
                'config' => array_map($fConvertOption, $this->getMethodOptions($sMethodName)),
356
            ];
357
        }, $this->getPublicMethods($aProtectedMethods));
358
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
359
360
    /**
361
     * Get the registered callable object
362
     *
363
     * @return null|object
364
     */
365
    public function getRegisteredObject()
366
    {
367
        return $this->di->g($this->xReflectionClass->getName());
368
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
369
370
    /**
371
     * Check if the specified method name is one of the methods of the registered callable object
372
     *
373
     * @param string $sMethod    The name of the method to check
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter name; 4 found
Loading history...
374
     *
375
     * @return bool
376
     */
377
    public function hasMethod(string $sMethod): bool
378
    {
379
        return $this->xReflectionClass->hasMethod($sMethod);
380
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
381
382
    /**
383
     * Call the specified method of the registered callable object using the specified array of arguments
384
     *
385
     * @param string $sMethod    The method name
0 ignored issues
show
Coding Style introduced by
Expected 5 spaces after parameter name; 4 found
Loading history...
386
     * @param array $aArgs    The method arguments
0 ignored issues
show
Coding Style introduced by
Expected 7 spaces after parameter name; 4 found
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
387
     * @param bool $bAccessible    If false, only calls to public method are allowed
0 ignored issues
show
Coding Style introduced by
Expected 3 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 4 found
Loading history...
388
     *
389
     * @return mixed
390
     * @throws ReflectionException
391
     */
392
    private function callMethod(string $sMethod, array $aArgs, bool $bAccessible)
393
    {
394
        $reflectionMethod = $this->xReflectionClass->getMethod($sMethod);
395
        $reflectionMethod->setAccessible($bAccessible); // Make it possible to call protected methods
396
        return $reflectionMethod->invokeArgs($this->xRegisteredObject, $aArgs);
397
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
398
399
    /**
400
     * Call the specified method of the registered callable object using the specified array of arguments
401
     *
402
     * @param array $aHookMethods    The method config options
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter name; 4 found
Loading history...
403
     *
404
     * @return void
405
     * @throws ReflectionException
406
     */
407
    private function callHookMethods(array $aHookMethods)
408
    {
409
        $sMethod = $this->xTarget->getMethodName();
410
        $aArgs = $this->xTarget->getMethodArgs();
0 ignored issues
show
Unused Code introduced by
The assignment to $aArgs is dead and can be removed.
Loading history...
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
411
        // The hooks defined at method level override those defined at class level.
412
        // $aMethods = $aHookMethods[$sMethod] ?? $aHookMethods['*'] ?? [];
413
        // The hooks defined at method level are merged with those defined at class level.
414
        $aMethods = array_merge($aHookMethods['*'] ?? [], $aHookMethods[$sMethod] ?? []);
415
        foreach($aMethods as $xKey => $xValue)
416
        {
417
            $sHookName = $xValue;
418
            $aHookArgs = [];
419
            if(is_string($xKey))
420
            {
421
                $sHookName = $xKey;
422
                $aHookArgs = is_array($xValue) ? $xValue : [$xValue];
423
                // The name and arguments of the method can be passed to the hooks.
424
                /*$aHookArgs = array_map(function($xHookArg) use($sMethod, $aArgs) {
0 ignored issues
show
Coding Style introduced by
Block comment text must start on a new line
Loading history...
425
                    switch($xHookArg)
426
                    {
427
                    case '__method__':
428
                        return $sMethod;
429
                    case '__args__':
430
                        return $aArgs;
431
                    default:
432
                        return $xHookArg;
433
                    }
434
                }, $aHookArgs);*/
435
            }
436
            $this->callMethod($sHookName, $aHookArgs, true);
437
        }
438
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
439
440
    /**
441
     * Call the specified method of the registered callable object using the specified array of arguments
442
     *
443
     * @param Target $xTarget The target of the Jaxon call
444
     *
445
     * @return null|ResponseInterface
446
     * @throws ReflectionException
447
     * @throws SetupException
448
     */
449
    public function call(Target $xTarget): ?ResponseInterface
450
    {
451
        $this->xRegisteredObject = $this->getRegisteredObject();
452
        $this->xTarget = $xTarget;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 11 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
453
        $sMethod = $xTarget->getMethodName();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 17 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
454
455
        // Set attributes from the DI container
456
        // The attributes defined at method level override those defined at class level.
457
        // $aAttributes = $this->aAttributes[$sMethod] ?? $this->aAttributes['*'] ?? [];
458
        // The attributes defined at method level are merged with those defined at class level.
459
        $aAttributes = array_merge($this->aAttributes['*'] ?? [], $this->aAttributes[$sMethod] ?? []);
460
        foreach($aAttributes as $sName => $sClass)
461
        {
462
            // Set the protected attributes of the object
463
            $cSetter = function($c) use($sName, $sClass) {
464
                // Warning: dynamic properties will be deprecated in PHP8.2.
465
                $this->$sName = $c->get($sClass);
466
            };
467
            // Can now access protected attributes
468
            call_user_func($cSetter->bindTo($this->xRegisteredObject, $this->xRegisteredObject), $this->di);
469
        }
470
471
        // Set the Jaxon request target in the helper
472
        if($this->xRegisteredObject instanceof CallableClass)
473
        {
474
            // Set the protected attributes of the object
475
            $cSetter = function() use($xTarget) {
476
                $this->xCallableClassHelper->xTarget = $xTarget;
0 ignored issues
show
Bug Best Practice introduced by
The property xCallableClassHelper does not exist on Jaxon\Plugin\Request\CallableClass\CallableObject. Did you maybe forget to declare it?
Loading history...
477
            };
478
            // Can now access protected attributes
479
            call_user_func($cSetter->bindTo($this->xRegisteredObject, $this->xRegisteredObject));
480
        }
481
482
        // Methods to call before processing the request
483
        $this->callHookMethods($this->aBeforeMethods);
484
485
        // Call the request method
486
        $xResponse = $this->callMethod($sMethod, $this->xTarget->getMethodArgs(), false);
487
488
        // Methods to call after processing the request
489
        $this->callHookMethods($this->aAfterMethods);
490
        return $xResponse;
491
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
492
}
493