1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Lenevor Framework |
5
|
|
|
* |
6
|
|
|
* LICENSE |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the new BSD license that is bundled |
9
|
|
|
* with this package in the file license.md. |
10
|
|
|
* It is also available through the world-wide-web at this URL: |
11
|
|
|
* https://lenevor.com/license |
12
|
|
|
* If you did not receive a copy of the license and are unable to |
13
|
|
|
* obtain it through the world-wide-web, please send an email |
14
|
|
|
* to [email protected] so we can send you a copy immediately. |
15
|
|
|
* |
16
|
|
|
* @package Lenevor |
17
|
|
|
* @subpackage Base |
18
|
|
|
* @link https://lenevor.com |
19
|
|
|
* @copyright Copyright (c) 2019 - 2021 Alexander Campo <[email protected]> |
20
|
|
|
* @license https://opensource.org/licenses/BSD-3-Clause New BSD license or see https://lenevor.com/license or see /license.md |
21
|
|
|
*/ |
22
|
|
|
|
23
|
|
|
namespace Syscodes\Controller; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* This class allows to include or exclude methods of a given class |
27
|
|
|
* to executed middlewares. |
28
|
|
|
* |
29
|
|
|
* @author Alexander Campo <[email protected]> |
30
|
|
|
*/ |
31
|
|
|
class ControllerMiddlewareOptions |
32
|
|
|
{ |
33
|
|
|
/** |
34
|
|
|
* The middleware options. |
35
|
|
|
* |
36
|
|
|
* @var array $options |
37
|
|
|
*/ |
38
|
|
|
protected $options; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Constructor. Create a new middleware option instance. |
42
|
|
|
* |
43
|
|
|
* @param array $options |
44
|
|
|
* |
45
|
|
|
* @return void |
46
|
|
|
*/ |
47
|
|
|
public function __construct(array &$options) |
48
|
|
|
{ |
49
|
|
|
$this->options = &$options; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Set the controller methods the middleware should apply to. |
54
|
|
|
* |
55
|
|
|
* @param array|string|dynamic $methods |
|
|
|
|
56
|
|
|
* |
57
|
|
|
* @return $this |
58
|
|
|
*/ |
59
|
|
|
public function only($methods) |
60
|
|
|
{ |
61
|
|
|
$this->options['only'] = is_array($methods) ? $methods : func_get_args(); |
62
|
|
|
|
63
|
|
|
return $this; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Set the controller methods the middleware should exclude. |
68
|
|
|
* |
69
|
|
|
* @param array|string|dynamic $methods |
70
|
|
|
* |
71
|
|
|
* @return $this |
72
|
|
|
*/ |
73
|
|
|
public function except($methods) |
74
|
|
|
{ |
75
|
|
|
$this->options['except'] = is_array($methods) ? $methods : func_get_args(); |
76
|
|
|
|
77
|
|
|
return $this; |
78
|
|
|
} |
79
|
|
|
} |
80
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths