Passed
Push — develop ( e8da8c...ba4456 )
by Matt
06:47
created

ext::is_enableable()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 3
eloc 7
c 2
b 0
f 0
nc 2
nop 0
dl 0
loc 13
rs 10
1
<?php
2
/**
3
 *
4
 * Precise Similar Topics
5
 *
6
 * @copyright (c) 2018 Matt Friedman
7
 * @license GNU General Public License, version 2 (GPL-2.0)
8
 *
9
 */
10
11
namespace vse\similartopics;
12
13
class ext extends \phpbb\extension\base
0 ignored issues
show
Bug introduced by
The type phpbb\extension\base was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
{
15
	public function is_enableable()
16
	{
17
		$db = $this->container->get('dbal.conn');
18
		$enableable = in_array($db->get_sql_layer(), array('mysqli', 'mysql4', 'postgres'));
19
20
		if (!$enableable && phpbb_version_compare(PHPBB_VERSION, '3.3.0-b1', '>='))
0 ignored issues
show
Bug introduced by
The constant vse\similartopics\PHPBB_VERSION was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
Bug introduced by
The function phpbb_version_compare was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
		if (!$enableable && /** @scrutinizer ignore-call */ phpbb_version_compare(PHPBB_VERSION, '3.3.0-b1', '>='))
Loading history...
21
		{
22
			$lang = $this->container->get('language');
23
			$lang->add_lang('acp_similar_topics', 'vse/similartopics');
24
			return array($lang->lang('PST_NO_COMPAT'));
25
		}
26
27
		return $enableable;
28
	}
29
}
30