1 | <?php |
||
8 | class DeviceList |
||
9 | { |
||
10 | private $config; |
||
11 | private $yamlFilepath; |
||
12 | private $devices = array(); |
||
13 | |||
14 | /** |
||
15 | * @param \SSpkS\Config $config Config object |
||
16 | * @throws \Exception if file is not found or parsing error. |
||
17 | */ |
||
18 | 5 | public function __construct(\SSpkS\Config $config) |
|
31 | |||
32 | /** |
||
33 | * Parse Yaml file with device data. |
||
34 | * |
||
35 | * @throws \Exception if Yaml couldn't be parsed. |
||
36 | */ |
||
37 | 4 | private function parseYaml() |
|
62 | |||
63 | /** |
||
64 | * Returns the architecture family for given $arch |
||
65 | * |
||
66 | * @param string $arch Architecture |
||
67 | * @return string Family or $arch if not found |
||
68 | */ |
||
69 | 1 | public function getFamily($arch) |
|
70 | { |
||
71 | 1 | foreach ($this->devices as $d) { |
|
72 | 1 | if ($d['arch'] == $arch) { |
|
73 | return $d['family']; |
||
74 | } |
||
75 | 1 | } |
|
76 | 1 | return $arch; |
|
77 | } |
||
78 | |||
79 | /** |
||
80 | * Returns the list of devices and their architectures. |
||
81 | * |
||
82 | * @return array List of devices and architectures. |
||
83 | */ |
||
84 | 2 | public function getDevices() |
|
88 | } |
||
89 |