Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
16 / 16
100.00% covered (success)
100.00%
11 / 11
CRAP
100.00% covered (success)
100.00%
1 / 1
incomplete
100.00% covered (success)
100.00%
16 / 16
100.00% covered (success)
100.00%
11 / 11
11
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 is_available
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 get_generator_class
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 get_name
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 init
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 execute_demo
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 execute
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 get_demo_template
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 get_template
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
 validate
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 is_solved
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
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
14namespace phpbb\captcha\plugins;
15
16use phpbb\config\config;
17use phpbb\exception\runtime_exception;
18use phpbb\template\template;
19
20class incomplete extends captcha_abstract
21{
22    /**
23     * Constructor for incomplete captcha
24     *
25     * @param config $config
26     * @param template $template
27     * @param string $phpbb_root_path
28     * @param string $phpEx
29     */
30    public function __construct(protected config $config, protected template $template,
31                                protected string $phpbb_root_path, protected string $phpEx)
32    {}
33
34    /**
35     * @return bool True if captcha is available, false if not
36     */
37    public function is_available(): bool
38    {
39        return true;
40    }
41
42    /**
43     * Dummy implementation, not supported by this captcha
44     *
45     * @throws runtime_exception
46     * @return void
47     */
48    public function get_generator_class(): void
49    {
50        throw new runtime_exception('NO_GENERATOR_CLASS');
51    }
52
53    /**
54     * Get CAPTCHA name language variable
55     *
56     * @return string Language variable
57     */
58    public static function get_name(): string
59    {
60        return 'CAPTCHA_INCOMPLETE';
61    }
62
63    /**
64     * Init CAPTCHA
65     *
66     * @param int $type CAPTCHA type
67     * @return void
68     */
69    public function init($type)
70    {
71    }
72
73    /**
74     * Execute demo
75     *
76     * @return void
77     */
78    public function execute_demo()
79    {
80    }
81
82    /**
83     * Execute CAPTCHA
84     *
85     * @return void
86     */
87    public function execute()
88    {
89    }
90
91    /**
92     * Get template data for demo
93     *
94     * @param int|string $id ACP module ID
95     *
96     * @return string Demo template file name
97     */
98    public function get_demo_template($id): string
99    {
100        return '';
101    }
102
103    /**
104     * Get template data for CAPTCHA
105     *
106     * @return string CAPTCHA template file name
107     */
108    public function get_template(): string
109    {
110        $contact_link = phpbb_get_board_contact_link($this->config, $this->phpbb_root_path, $this->phpEx);
111
112        $this->template->assign_vars([
113            'CONFIRM_LANG'    => 'CONFIRM_INCOMPLETE',
114            'CONTACT_LINK'    => $contact_link,
115        ]);
116
117        return 'captcha_incomplete.html';
118    }
119
120    /**
121     * Validate CAPTCHA
122     *
123     * @return false Incomplete CAPTCHA will never validate
124     */
125    public function validate(): bool
126    {
127        return false;
128    }
129
130    /**
131     * Check whether CAPTCHA is solved
132     *
133     * @return false Incomplete CAPTCHA will never be solved
134     */
135    public function is_solved(): bool
136    {
137        return false;
138    }
139}