Completed
Push — develop-3.2 ( ec81a5...eb42f9 )
by Matt
32:34
created

bbcodes_migration_base::get_bbcodes_installer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 13
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
/**
3
 *
4
 * Advanced BBCode Box
5
 *
6
 * @copyright (c) 2015 Matt Friedman
7
 * @license GNU General Public License, version 2 (GPL-2.0)
8
 *
9
 */
10
11
namespace vse\abbc3\migrations;
12
13
use \phpbb\db\migration\container_aware_migration;
14
15
/**
16
 * Class wrapper for installing/updating bbcodes in migrations.
17
 * This class must be kept outside of the migrations directory
18
 * since this is not a migration file. It's just a wrapper that
19
 * can be extended by multiple migration files.
20
 */
21
abstract class bbcodes_migration_base extends container_aware_migration
22
{
23
	/**
24
	 * @var array An array of bbcodes data to install
25
	 */
26
	protected static $bbcode_data;
27
28
	/**
29
	 * Get the bbcodes installer object
30
	 *
31
	 * @return \vse\abbc3\core\bbcodes_installer
32
	 */
33
	public function get_bbcodes_installer()
34
	{
35
		/** @var \phpbb\group\helper $group_helper */
36
		$group_helper = $this->container->get('group_helper');
37
38
		/** @var \phpbb\language\language $language */
39
		$language = $this->container->get('language');
40
41
		/** @var \phpbb\request\request $request */
42
		$request = $this->container->get('request');
43
44
		return new \vse\abbc3\core\bbcodes_installer($this->db, $group_helper, $language, $request, $this->phpbb_root_path, $this->php_ext);
45
	}
46
47
	/**
48
	 * Wrapper for installing bbcodes in migrations
49
	 */
50
	public function install_abbc3_bbcodes()
51
	{
52
		$this->get_bbcodes_installer()->install_bbcodes(static::$bbcode_data);
53
	}
54
55
	/**
56
	 * Wrapper for deleting bbcodes in migrations
57
	 */
58
	public function delete_abbc3_bbcodes()
59
	{
60
		$this->get_bbcodes_installer()->delete_bbcodes(static::$bbcode_data);
61
	}
62
}
63