VersionPreference::execute()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 8
rs 10
1
<?php
2
3
namespace MagentoHackathon\Service;
4
5
/**
6
 * @package MagentoHackathon\Service
7
 */
8
class VersionPreference
9
{
10
    /**
11
     * @param $filePath
12
     * @return array
13
     * @throws \Exception
14
     */
15
    public function execute($filePath): array
16
    {
17
        if (!file_exists($filePath)) {
18
            throw new \Exception(sprintf('File %s not found or readable.', $filePath));
19
        }
20
21
        $fileContent = file_get_contents($filePath);
22
        return (array)json_decode($fileContent, true);
23
    }
24
}
25