Passed
Push — master ( 9e24a0...84ec6e )
by Matt
03:38 queued 01:13
created

ext::version_check()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 0
cp 0
crap 2
rs 10
1
<?php
2
/**
3
 *
4
 * Topic Preview
5
 *
6
 * @copyright (c) 2015 Matt Friedman
7
 * @license GNU General Public License, version 2 (GPL-2.0)
8
 *
9
 */
10
11
namespace vse\topicpreview;
12
13
/**
14
 * Extension class for custom enable/disable/purge actions
15
 */
16
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...
17
{
18
	/** @var string Require 3.2.0 due to updated INCLUDECSS and ordered services */
19
	const PHPBB_MIN_VERSION = '3.2.0';
20
21
	/**
22
	 * Enable extension if phpBB minimum version requirement is met
23
	 * (check database and filesystem)
24
	 *
25
	 * @return bool
26 3
	 */
27
	public function is_enableable()
28 3
	{
29 3
		$config = $this->container->get('config');
30
		return $this->version_check($config['version']) && $this->version_check(PHPBB_VERSION);
0 ignored issues
show
Bug introduced by
The constant vse\topicpreview\PHPBB_VERSION was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
31
	}
32
33
	/**
34
	 * Enable version check
35
	 *
36
	 * @param string|int $version The version to check
37
	 * @return bool
38
	 */
39
	protected function version_check($version)
40
	{
41
		return phpbb_version_compare($version, self::PHPBB_MIN_VERSION, '>=');
0 ignored issues
show
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

41
		return /** @scrutinizer ignore-call */ phpbb_version_compare($version, self::PHPBB_MIN_VERSION, '>=');
Loading history...
42
	}
43
}
44