|
@@ -5,16 +5,10 @@ namespace Fgm\ComposerCheck;
|
|
/**
|
|
/**
|
|
* Class LockLoader loads a composer.lock file.
|
|
* Class LockLoader loads a composer.lock file.
|
|
*/
|
|
*/
|
|
-class LockLoader implements LoaderInterface {
|
|
|
|
-
|
|
|
|
- protected $file;
|
|
|
|
|
|
+class LockLoader extends LoaderBase implements LoaderInterface {
|
|
|
|
|
|
protected $platform = [];
|
|
protected $platform = [];
|
|
|
|
|
|
- protected $dev = [];
|
|
|
|
-
|
|
|
|
- protected $run = [];
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* {@inheritdoc}
|
|
* {@inheritdoc}
|
|
*/
|
|
*/
|
|
@@ -22,29 +16,11 @@ class LockLoader implements LoaderInterface {
|
|
$this->file = realpath("${directory}/composer.lock");
|
|
$this->file = realpath("${directory}/composer.lock");
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * {@inheritdoc}
|
|
|
|
- */
|
|
|
|
- public function getDev() {
|
|
|
|
- return $this->dev;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * {@inheritdoc}
|
|
|
|
- */
|
|
|
|
- public function getRun() {
|
|
|
|
- return $this->run;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * {@inheritdoc}
|
|
|
|
- */
|
|
|
|
- public function load() {
|
|
|
|
- $lockFile = json_decode(file_get_contents($this->file), TRUE);
|
|
|
|
- $lockPackages = $lockFile['packages'];
|
|
|
|
- $lockDevPackages = $lockFile['packages-dev'];
|
|
|
|
|
|
+ public function parse() {
|
|
|
|
+ $lockPackages = $this->contents['packages'];
|
|
|
|
+ $lockDevPackages = $this->contents['packages-dev'];
|
|
|
|
|
|
- $lockPlatform = $lockFile['platform'];
|
|
|
|
|
|
+ $lockPlatform = $this->contents['platform'];
|
|
array_walk($lockPlatform, function (&$requirement, $component) {
|
|
array_walk($lockPlatform, function (&$requirement, $component) {
|
|
$requirement = [
|
|
$requirement = [
|
|
'name' => $component,
|
|
'name' => $component,
|