These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /** |
||
4 | * Author: mickael Louzet @micklouzet |
||
5 | * File: RegistrationController.php |
||
6 | * Created: 05/12/2019 |
||
7 | */ |
||
8 | |||
9 | declare(strict_types=1); |
||
10 | |||
11 | namespace Louzet\ComposerLockFileParser; |
||
12 | |||
13 | use Louzet\ComposerLockFileParser\ParserCollection; |
||
14 | |||
15 | class FileParser implements FileParserInterface |
||
0 ignored issues
–
show
|
|||
16 | { |
||
17 | /** |
||
18 | * {@inheritDoc} |
||
19 | */ |
||
20 | public static function parse(string $filePath): ParserCollection |
||
21 | { |
||
22 | if (!\is_file($filePath)) { |
||
23 | return []; |
||
24 | } |
||
25 | |||
26 | if (!$json = \file_get_contents($filePath)) { |
||
27 | return []; |
||
28 | } |
||
29 | |||
30 | $data = \json_decode($json, true); |
||
31 | |||
32 | $components = []; |
||
33 | |||
34 | if (!$data || !isset($data['packages'])) { |
||
35 | return []; |
||
36 | } |
||
37 | foreach ($data['packages'] as $package) { |
||
38 | $components[] = [ |
||
39 | 'name' => $package['name'], |
||
40 | 'version' => $package['version'], |
||
41 | 'source' => $package['source'], |
||
42 | 'require' => $package['require'] ?? [], |
||
43 | 'description' => $package['description'], |
||
44 | 'keywords' => $package['keywords'], |
||
45 | 'time' => $package['time'], |
||
46 | ]; |
||
47 | } |
||
48 | return new ParserCollection($components); |
||
49 | } |
||
50 | |||
51 | // public function byVendor(string $vendor) |
||
52 | // { |
||
53 | // if (0 !== \strpos($package['name'], "vendor/")) { |
||
54 | // continue; |
||
55 | // } |
||
56 | // } |
||
57 | } |
||
58 |
This check examines a number of code elements and verifies that they conform to the given naming conventions.
You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.