Passed
Push — develop-3.3.x ( f10cd4...39fc1a )
by Mario
04:31
created

ext_manager   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 37
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A get_ext_meta() 0 3 2
A load_metadata() 0 14 2
1
<?php
2
/**
3
 *
4
 * PayPal Donation extension for the phpBB Forum Software package.
5
 *
6
 * @copyright (c) 2015-2020 Skouat
7
 * @license GNU General Public License, version 2 (GPL-2.0)
8
 *
9
 */
10
11
namespace skouat\ppde\controller;
12
13
class ext_manager extends \phpbb\extension\manager
14
{
15
	/** Extension name  */
16
	protected const EXT_NAME = 'skouat/ppde';
17
	protected $ext_meta;
18
19
	/**
20
	 * Get extension metadata
21
	 *
22
	 * @return array
23
	 * @access public
24
	 */
25
	public function get_ext_meta(): array
26
	{
27
		return empty($this->ext_meta) ? $this->load_metadata() : $this->ext_meta;
28
	}
29
30
	/**
31
	 * Load metadata for this extension
32
	 *
33
	 * @return array
34
	 * @access private
35
	 */
36
	private function load_metadata(): array
37
	{
38
		$md_manager = $this->create_extension_metadata_manager(self::EXT_NAME);
39
40
		try
41
		{
42
			$this->ext_meta = $md_manager->get_metadata('all');
43
		}
44
		catch (\phpbb\extension\exception $e)
45
		{
46
			trigger_error($e, E_USER_WARNING);
47
		}
48
49
		return $this->ext_meta;
50
	}
51
}
52