Completed
Branchmaster (d2c4e1)
created

Subset::process()   A

↳ Parent: Subset

Complexity

Conditions 3
Paths 3

Duplication

Lines 0
Ratio 0 %

Size

Total Lines 15
Code Lines 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 15
rs 9.4285
c 1
b 0
f 0
cc 3
eloc 6
nc 3
nop 0
1
<?php
2
namespace Redaxscript\Template\Helper;
3
4
/**
5
 * helper class to provide a subset helper
6
 *
7
 * @since 3.0.0
8
 *
9
 * @package Redaxscript
10
 * @category Template
11
 * @author Henry Ruhs
12
 */
13
14
class Subset extends HelperAbstract
15
{
16
	/**
17
	 * default subset
18
	 *
19
	 * @var string
20
	 */
21
22
	protected $_subset = 'latin';
23
24
	/**
25
	 * array of subsets
26
	 *
27
	 * @var array
28
	 */
29
30
	protected $_subsetArray =
31
	[
32
		'cyrillic' =>
33
		[
34
			'bg',
35
			'ru'
36
		],
37
		'vietnamese' =>
38
		[
39
			'vi'
40
		]
41
	];
42
43
	/**
44
	 * process
45
	 *
46
	 * @since 3.0.0
47
	 *
48
	 * @return string
49
	 */
50
51
	public function process()
52
	{
53
		$language = $this->_registry->get('language');
54
55
		/* process subset */
56
57
		foreach ($this->_subsetArray as $subset => $valueArray)
58
		{
59
			if (in_array($language, $valueArray))
60
			{
61
				return $subset;
62
			}
63
		}
64
		return $this->_subset;
65
	}
66
}
67