I18n   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 25%

Importance

Changes 0
Metric Value
dl 0
loc 51
c 0
b 0
f 0
wmc 3
lcom 1
cbo 0
ccs 4
cts 16
cp 0.25
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A load_plugin_textdomain() 0 7 1
A action_hooks() 0 8 1
1
<?php
2
namespace Intraxia\Jaxion\Core;
3
4
use Intraxia\Jaxion\Contract\Core\HasActions;
5
use Intraxia\Jaxion\Contract\Core\I18n as I18nContract;
6
7
/**
8
 * Class I18n
9
 *
10
 * @package    Intraxia\Jaxion
11
 * @subpackage Core
12
 */
13
class I18n implements I18nContract, HasActions {
14
	/**
15
	 * Plugin basename
16
	 *
17
	 * @var string
18
	 */
19
	private $basename;
20
21
	/**
22
	 * Plugin path.
23
	 *
24
	 * @var string
25
	 */
26
	private $path;
27
28
	/**
29
	 * I18n constructor.
30
	 *
31
	 * @param string $basename Plugin basename.
32
	 * @param string $path     Plugin path.
33
	 */
34 9
	public function __construct( $basename, $path ) {
35 9
		$this->basename = $basename;
36 9
		$this->path = $path;
37 9
	}
38
39
	/**
40
	 * {@inheritdoc}
41
	 */
42
	public function load_plugin_textdomain() {
43
		load_plugin_textdomain(
44
			$this->basename,
45
			false,
46
			basename( $this->path ) . '/languages/'
47
		);
48
	}
49
50
	/**
51
	 * {@inheritDoc}
52
	 *
53
	 * @return array
54
	 */
55
	public function action_hooks() {
56
		return array(
57
			array(
58
				'hook'   => 'init',
59
				'method' => 'load_plugin_textdomain',
60
			),
61
		);
62
	}
63
}
64