Completed
Push — master ( 08ac9c...63e3ab )
by Michael
13s
created

ext::is_enableable()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 4
rs 10
cc 2
eloc 2
nc 2
nop 0
1
<?php
2
/**
3
 *
4
 * phpBB Media Embed PlugIn extension for the phpBB Forum Software package.
5
 *
6
 * @copyright (c) 2016 phpBB Limited <https://www.phpbb.com>
7
 * @license GNU General Public License, version 2 (GPL-2.0)
8
 *
9
 */
10
11
namespace phpbb\mediaembed;
12
13
class ext extends \phpbb\extension\base
14
{
15
	/**
16
	 * {@inheritDoc}
17
	 */
18
	public function is_enableable()
19
	{
20
		return $this->phpbb_version_is_valid() && !$this->s9e_mediamebed_installed();
21
	}
22
23
	/**
24
	 * Check the installed phpBB version meets this
25
	 * extension's requirements.
26
	 *
27
	 * Requires phpBB 3.2.0-rc2 and TextFormatter 0.8.1
28
	 *
29
	 * @return bool
30
	 */
31
	public function phpbb_version_is_valid()
32
	{
33
		return phpbb_version_compare(PHPBB_VERSION, '3.2.0-rc2', '>=');
34
	}
35
36
	/**
37
	 * Check if s9e MediaEmbed extension for phpBB is installed
38
	 * (it must NOT be to enable this extension).
39
	 *
40
	 * @return bool
41
	 */
42
	public function s9e_mediamebed_installed()
43
	{
44
		return class_exists('\s9e\mediaembed\ext');
45
	}
46
}
47