VersionPreference   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 15
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 8 2
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