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

ext   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 4
c 3
b 0
f 0
lcom 0
cbo 0
dl 0
loc 34
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A is_enableable() 0 4 2
A phpbb_version_is_valid() 0 4 1
A s9e_mediamebed_installed() 0 4 1
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