Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
1 | <?php |
2 | /** |
3 | * |
4 | * This file is part of the phpBB Forum Software package. |
5 | * |
6 | * @copyright (c) phpBB Limited <https://www.phpbb.com> |
7 | * @license GNU General Public License, version 2 (GPL-2.0) |
8 | * |
9 | * For full copyright and license information, please see |
10 | * the docs/CREDITS.txt file. |
11 | * |
12 | */ |
13 | |
14 | namespace phpbb\captcha\plugins; |
15 | |
16 | interface plugin_interface |
17 | { |
18 | /** |
19 | * Check if the plugin is available |
20 | * |
21 | * @return bool True if the plugin is available, false if not |
22 | */ |
23 | public function is_available(): bool; |
24 | |
25 | /** |
26 | * Check if the plugin has a configuration |
27 | * |
28 | * @return bool True if the plugin has a configuration, false if not |
29 | */ |
30 | public function has_config(): bool; |
31 | |
32 | /** |
33 | * Get the name of the plugin, should be language variable |
34 | * |
35 | * @return string |
36 | */ |
37 | public function get_name(): string; |
38 | |
39 | /** |
40 | * Set the service name of the plugin |
41 | * |
42 | * @param string $name |
43 | */ |
44 | public function set_name(string $name): void; |
45 | |
46 | /** |
47 | * Display the captcha for the specified type |
48 | * |
49 | * @param confirm_type $type Type of captcha, should be one of the CONFIRMATION_* constants |
50 | * @return void |
51 | */ |
52 | public function init(confirm_type $type): void; |
53 | |
54 | /** |
55 | * Get hidden form fields for this captcha plugin |
56 | * |
57 | * @return array Hidden form fields |
58 | */ |
59 | public function get_hidden_fields(): array; |
60 | |
61 | /** |
62 | * Validate the captcha with the given request data |
63 | * |
64 | * @return bool True if request data was valid captcha reply, false if not |
65 | */ |
66 | public function validate(): bool; |
67 | |
68 | /** |
69 | * Get error string from captcha |
70 | * |
71 | * @return string Error string, empty string if there is no error |
72 | */ |
73 | public function get_error(): string; |
74 | |
75 | /** |
76 | * Return whether captcha was solved |
77 | * |
78 | * @return bool True if captcha was solved, false if not |
79 | */ |
80 | public function is_solved(): bool; |
81 | |
82 | /** |
83 | * Reset captcha state, e.g. after checking if it's valid |
84 | * |
85 | * @return void |
86 | */ |
87 | public function reset(): void; |
88 | |
89 | /** |
90 | * Get attempt count for this captcha and user |
91 | * |
92 | * @return int Number of attempts |
93 | */ |
94 | public function get_attempt_count(): int; |
95 | |
96 | /** |
97 | * Get template filename for captcha |
98 | * |
99 | * @return string Template file name |
100 | */ |
101 | public function get_template(): string; |
102 | |
103 | /** |
104 | * Get template filename for demo |
105 | * |
106 | * @return string Demo template file name |
107 | */ |
108 | public function get_demo_template(): string; |
109 | |
110 | /** |
111 | * Garbage collect captcha plugin |
112 | * |
113 | * @param confirm_type $confirm_type Confirm type to garbage collect, defaults to all (0) |
114 | * @return void |
115 | */ |
116 | public function garbage_collect(confirm_type $confirm_type = confirm_type::UNDEFINED): void; |
117 | |
118 | /** |
119 | * Display acp page |
120 | * |
121 | * @param mixed $id ACP module id |
122 | * @param mixed $module ACP module name |
123 | * @return void |
124 | */ |
125 | public function acp_page(mixed $id, mixed $module): void; |
126 | } |