public function collect()
    {
        if ($this->value) {
            return $this->value;
        }

        if (!file_exists($this->lockFile)) {
            throw new Exception\ComposerLockFileNotFoundException($this->lockFile);
        }

        $packages = [];
        $rootAliases = [];
        $lockData = json_decode(file_get_contents($this->lockFile), true);
        foreach ($lockData['aliases'] as $alias) {
            $rootAliases[$alias['package']] = $alias['alias'];
        }

        // For PHP 5.6, add variable locally to be able to use isset() on it.
        $stabilities = self::STABILITIES;
        foreach ($lockData['packages'] as $packageData) {
            $package = new Value\ComposerPackage([
                'name' => $packageData['name'],
                'branch' => $packageData['version'],
                'dateTime' => isset($packageData['time']) ? new \DateTime($packageData['time']) : null,
                'homepage' => isset($packageData['homepage']) ? $packageData['homepage'] : '',
                'reference' => isset($packageData['source']) ? $packageData['source']['reference'] : null,
                'license' => isset($packageData['license'][0]) ? $packageData['license'][0] : null,
            ]);

            if (isset($lockData['stability-flags'][$package->name])) {
                $stabilityFlag = (int)$lockData['stability-flags'][$package->name];

                if (isset($stabilities[$stabilityFlag])) {
                    $package->stability = $stabilities[$stabilityFlag];
                }
            }

            if (isset($rootAliases[$package->name])) {
                $package->alias = $rootAliases[$package->name];
            } elseif (isset($packageData['extra']['branch-alias'][$package->branch])) {
                $package->alias = $packageData['extra']['branch-alias'][$package->branch];
            }

            self::setNormalizedVersion($package);

            $packages[$packageData['name']] = $package;
        }

        ksort($packages, SORT_FLAG_CASE | SORT_STRING);

        return $this->value = new Value\ComposerSystemInfo([
            'packages' => $packages,
            'minimumStability' => isset($lockData['minimum-stability']) ? $lockData['minimum-stability'] : null,
        ]);
    }