| Conditions | 3 |
| Paths | 3 |
| Total Lines | 11 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php namespace Tarsana\Command\Config; |
||
| 37 | protected function decode(string $path) : array { |
||
| 38 | if (! $this->fs->isFile($path)) |
||
| 39 | return []; |
||
| 40 | $file = $this->fs->file($path); |
||
| 41 | $ext = $file->extension(); |
||
| 42 | if (! array_key_exists($ext, static::$decoders)) |
||
| 43 | throw new \Exception("Unknown configuration file extension '{$ext}'"); |
||
| 44 | $decoderClass = static::$decoders[$ext]; |
||
| 45 | $decoder = new $decoderClass; |
||
| 46 | return $decoder->decode($file->content()); |
||
| 47 | } |
||
| 48 | } |
||
| 49 |