This repository has been archived by the owner on Jan 28, 2022. It is now read-only.
/
Primarchs.php
53 lines (48 loc) · 2.51 KB
/
Primarchs.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
namespace PhroznPlugin\Provider;
class Primarchs
extends \Phrozn\Provider\Base
implements \Phrozn\Provider
{
private $primarchs = array(
array("Lion El'Jonson", "Dark Angels", "Loyal"),
array("Fulgrim", "Emperor's Children", "Traitor"),
array("Perturabo", "Iron Warriors", "Traitor"),
array("Jaghatai Khan", "White Scars", "Loyal"),
array("Leman Russ", "Space Wolves", "Loyal"),
array("Rogal Dorn", "Imperial Fists", "Loyal"),
array("Night Haunter", "Night Lords", "Traitor"),
array("Sanguinius", "Blood Angels", "Loyal"),
array("Ferrus Manus", "Iron Hands", "Loyal"),
array("Angron", "World Eaters", "Traitor"),
array("Roboute Guilliman", "Ultramarines", "Loyal"),
array("Mortarion", "Death Guard", "Traitor"),
array("Magnus the Red", "Thousand Sons", "Traitor"),
array("Horus", "Luna Wolves/Sons of Horus", "Traitor"),
array("Lorgar", "Word Bearers", "Traitor"),
array("Vulkan", "Salamanders", "Loyal"),
array("Corax", "Raven Guard", "Loyal"),
array("Alpharius1 & Omegeon2", "Alpha Legion", "Complicated"),
);
public function get()
{
// get reference to configuration object (it holds passed vars, if any)
$config = $this->getConfig();
// form list, replacing numeric keys with associative
// you can get rid of this by updating original array
$primarchs = array_map(function ($item) {
return array(
'name' => $item[0],
'legion' => $item[1],
'allegiance' => $item[2],
);
}, $this->primarchs);
// apply allegiance filter
if (isset($config['allegiance']) && $allegiance = $config['allegiance']) {
$primarchs = array_filter($primarchs, function ($primarch) use ($allegiance) {
return $allegiance === $primarch['allegiance'];
});
}
return $primarchs;
}
}