1 | <?php |
||
25 | class CheckLockFile implements Action |
||
26 | { |
||
27 | /** |
||
28 | * Composer configuration keys that are relevant for the 'content-hash' creation. |
||
29 | * |
||
30 | * @var array |
||
31 | */ |
||
32 | private $relevantKeys = [ |
||
33 | 'name', |
||
34 | 'version', |
||
35 | 'require', |
||
36 | 'require-dev', |
||
37 | 'conflict', |
||
38 | 'replace', |
||
39 | 'provide', |
||
40 | 'minimum-stability', |
||
41 | 'prefer-stable', |
||
42 | 'repositories', |
||
43 | 'extra', |
||
44 | ]; |
||
45 | |||
46 | /** |
||
47 | * Executes the action. |
||
48 | * |
||
49 | * @param \SebastianFeldmann\CaptainHook\Config $config |
||
50 | * @param \SebastianFeldmann\CaptainHook\Console\IO $io |
||
51 | * @param \SebastianFeldmann\Git\Repository $repository |
||
52 | * @param \SebastianFeldmann\CaptainHook\Config\Action $action |
||
53 | * @throws \Exception |
||
54 | */ |
||
55 | 4 | public function execute(Config $config, IO $io, Repository $repository, Config\Action $action) |
|
67 | |||
68 | /** |
||
69 | * Read the composer.lock file and extract the composer.json hash. |
||
70 | * |
||
71 | * @param string $path |
||
72 | * @return string |
||
73 | * @throws \Exception |
||
74 | */ |
||
75 | 4 | private function getLockFileHash(string $path) : string |
|
86 | |||
87 | /** |
||
88 | * Read the composer.json file and create a md5 hash on its relevant content. |
||
89 | * This more or less is composer internal code to generate the content-hash |
||
90 | * |
||
91 | * @param string $path |
||
92 | * @return string |
||
93 | */ |
||
94 | 2 | private function getConfigFileHash(string $path) : string |
|
109 | |||
110 | /** |
||
111 | * Load a composer file. |
||
112 | * |
||
113 | * @param string $file |
||
114 | * @return string |
||
115 | * @throws \Exception |
||
116 | */ |
||
117 | 4 | private function loadFile(string $file) : string |
|
124 | } |
||
125 |