1 | <?php |
||
10 | class CaptchaMiddleware |
||
11 | { |
||
12 | |||
13 | /** |
||
14 | * @var Captcha |
||
15 | */ |
||
16 | protected $captcha; |
||
17 | |||
18 | |||
19 | public function __construct(Captcha $captcha) |
||
23 | |||
24 | /** |
||
25 | * @param Request $request |
||
26 | * @param Closure $next |
||
27 | * @return mixed |
||
28 | * @throws InvalidCaptcha |
||
29 | */ |
||
30 | public function handle(Request $request, Closure $next) |
||
40 | |||
41 | /** |
||
42 | * 抛出验证码错误的异常 |
||
43 | * |
||
44 | * @throws InvalidCaptcha |
||
45 | */ |
||
46 | protected function throwInvalidException() |
||
51 | |||
52 | /** |
||
53 | * 验证 |
||
54 | * |
||
55 | * @param string $input |
||
56 | * @return bool |
||
57 | */ |
||
58 | protected function check($input) |
||
62 | |||
63 | /** |
||
64 | * 返回用户输入的验证码 |
||
65 | * |
||
66 | * @param Request $request |
||
67 | * @return string |
||
68 | */ |
||
69 | protected function getCaptcha(Request $request) |
||
73 | } |
This check examines a number of code elements and verifies that they conform to the given naming conventions.
You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.