| Total Complexity | 7 |
| Total Lines | 56 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | final class FileControlGroupRepository implements ControlGroupRepository |
||
| 6 | { |
||
| 7 | const ALLOWED_OS = 'Linux'; |
||
| 8 | const PATH = '/proc/self/cgroup'; |
||
| 9 | |||
| 10 | /** |
||
| 11 | * @return ControlGroup[] |
||
| 12 | */ |
||
| 13 | public function findAll() |
||
| 14 | { |
||
| 15 | if (false === $this->isAllowedOperatingSystem()) { |
||
| 16 | return []; |
||
| 17 | } |
||
| 18 | |||
| 19 | return $this->deserializeFile(self::PATH); |
||
| 20 | } |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @return bool |
||
| 24 | */ |
||
| 25 | private function isAllowedOperatingSystem() |
||
| 26 | { |
||
| 27 | return self::ALLOWED_OS === PHP_OS; |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @param string $path |
||
| 32 | * |
||
| 33 | * @return ControlGroup[] |
||
| 34 | */ |
||
| 35 | private function deserializeFile($path) |
||
| 61 | } |
||
| 62 | } |
||
| 63 |