1 | <?php |
||
15 | class BaseFraud |
||
16 | { |
||
17 | /** |
||
18 | * User agent |
||
19 | * |
||
20 | * @var string|array |
||
21 | **/ |
||
22 | protected $agent; |
||
23 | |||
24 | /** |
||
25 | * check except methods in class |
||
26 | * |
||
27 | * @var array |
||
28 | **/ |
||
29 | protected $except = []; |
||
30 | |||
31 | /** |
||
32 | * Bots list |
||
33 | * |
||
34 | * @var array |
||
35 | */ |
||
36 | private $bots = [ |
||
37 | 'crawler', |
||
38 | 'spider' |
||
39 | ]; |
||
40 | |||
41 | /** |
||
42 | * BaseFraud constructor. |
||
43 | */ |
||
44 | public function __construct(Request $request) |
||
62 | |||
63 | /** |
||
64 | * Check user agent has browser |
||
65 | * |
||
66 | * @return bool |
||
67 | */ |
||
68 | public function isUserAgent() |
||
84 | |||
85 | /** |
||
86 | * Check user is curl |
||
87 | * |
||
88 | * @author Alireza Josheghani <[email protected]> |
||
89 | * @since 25 Oct , 2016 |
||
90 | * @return boolean |
||
91 | */ |
||
92 | public function isCurl() |
||
100 | |||
101 | /** |
||
102 | * Check user is httpie |
||
103 | * |
||
104 | * @author Alireza Josheghani <[email protected]> |
||
105 | * @since 27 Oct , 2016 |
||
106 | * @return boolean |
||
107 | */ |
||
108 | public function isHttpie() |
||
116 | |||
117 | /** |
||
118 | * Check user is robot |
||
119 | * |
||
120 | * @author Alireza Josheghani <[email protected]> |
||
121 | * @since 25 Oct , 2016 |
||
122 | */ |
||
123 | public function isRobot() |
||
133 | |||
134 | /** |
||
135 | * Check except methods array |
||
136 | * |
||
137 | * @author Alireza Josheghani <[email protected]> |
||
138 | * @since 28 Oct 2016 |
||
139 | * @param $method |
||
140 | * @return bool |
||
141 | */ |
||
142 | public function checkExcept($method) |
||
154 | |||
155 | /** |
||
156 | * Get all fraud methods |
||
157 | * |
||
158 | * @author Alireza Josheghani <[email protected]> |
||
159 | * @since 28 Oct 2016 |
||
160 | * @param $class |
||
161 | * @return array |
||
162 | */ |
||
163 | public function methods() |
||
175 | |||
176 | } |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.