1 | <?php |
||||
2 | /** |
||||
3 | * |
||||
4 | * VigLink extension for the phpBB Forum Software package. |
||||
5 | * |
||||
6 | * @copyright (c) 2014 phpBB Limited <https://www.phpbb.com> |
||||
7 | * @license GNU General Public License, version 2 (GPL-2.0) |
||||
8 | * |
||||
9 | */ |
||||
10 | |||||
11 | namespace phpbb\viglink; |
||||
12 | |||||
13 | /** |
||||
14 | * Extension class for custom enable/disable/purge actions |
||||
15 | */ |
||||
16 | class ext extends \phpbb\extension\base |
||||
17 | { |
||||
18 | /** |
||||
19 | * Check whether the extension can be enabled. |
||||
20 | * The current phpBB version should meet or exceed |
||||
21 | * the minimum version required by this extension: |
||||
22 | * |
||||
23 | * Requires phpBB 3.2.0-b1 or greater |
||||
24 | * |
||||
25 | * @return bool |
||||
26 | */ |
||||
27 | public function is_enableable() |
||||
28 | { |
||||
29 | return phpbb_version_compare(PHPBB_VERSION, '3.2.0-b1', '>='); |
||||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||||
30 | } |
||||
31 | |||||
32 | /** |
||||
33 | * Check phpBB's VigLink switches and set them during install |
||||
34 | * |
||||
35 | * @param mixed $old_state The return value of the previous call |
||||
36 | * of this method, or false on the first call |
||||
37 | * |
||||
38 | * @return mixed Returns false after last step, otherwise |
||||
39 | * temporary state which is passed as an |
||||
40 | * argument to the next step |
||||
41 | */ |
||||
42 | public function enable_step($old_state) |
||||
43 | { |
||||
44 | if ($old_state === false) |
||||
45 | { |
||||
46 | $viglink_helper = new \phpbb\viglink\acp\viglink_helper( |
||||
47 | $this->container->get('cache.driver'), |
||||
0 ignored issues
–
show
It seems like
$this->container->get('cache.driver') can also be of type null ; however, parameter $cache of phpbb\viglink\acp\viglink_helper::__construct() does only seem to accept phpbb\cache\driver\driver_interface , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
48 | $this->container->get('config'), |
||||
0 ignored issues
–
show
It seems like
$this->container->get('config') can also be of type null ; however, parameter $config of phpbb\viglink\acp\viglink_helper::__construct() does only seem to accept phpbb\config\config , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
49 | $this->container->get('file_downloader'), |
||||
0 ignored issues
–
show
It seems like
$this->container->get('file_downloader') can also be of type null ; however, parameter $file_downloader of phpbb\viglink\acp\viglink_helper::__construct() does only seem to accept phpbb\file_downloader , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
50 | $this->container->get('language'), |
||||
0 ignored issues
–
show
It seems like
$this->container->get('language') can also be of type null ; however, parameter $language of phpbb\viglink\acp\viglink_helper::__construct() does only seem to accept phpbb\language\language , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
51 | $this->container->get('log'), |
||||
0 ignored issues
–
show
It seems like
$this->container->get('log') can also be of type null ; however, parameter $log of phpbb\viglink\acp\viglink_helper::__construct() does only seem to accept phpbb\log\log , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
52 | $this->container->get('user') |
||||
0 ignored issues
–
show
It seems like
$this->container->get('user') can also be of type null ; however, parameter $user of phpbb\viglink\acp\viglink_helper::__construct() does only seem to accept phpbb\user , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
53 | ); |
||||
54 | |||||
55 | try |
||||
56 | { |
||||
57 | $viglink_helper->set_viglink_services(); |
||||
58 | } |
||||
59 | catch (\RuntimeException $e) |
||||
60 | { |
||||
61 | $viglink_helper->log_viglink_error($e->getMessage()); |
||||
62 | } |
||||
63 | |||||
64 | return 'viglink'; |
||||
65 | } |
||||
66 | |||||
67 | return parent::enable_step($old_state); |
||||
68 | } |
||||
69 | } |
||||
70 |