/** * Get installed package versions. * * @throws \Vinkla\Climb\ClimbException * * @return array */ public function getInstalledPackages() { $packages = []; $content = $this->getFileContent('composer.lock'); foreach (['packages', 'packages-dev'] as $key) { if (isset($content[$key])) { foreach ($content[$key] as $package) { $packages[$package['name']] = Version::normalize($package['version']); } } } if (empty($packages)) { throw new ClimbException('We couldn\'t find any installed packages.'); } return $packages; }