11 use \Magento\Framework\Composer\ComposerJsonFinder;
12 use \Magento\Framework\App\Filesystem\DirectoryList;
13 use \Magento\Framework\Composer\ComposerInformation;
47 private $composerInformation;
64 if (!$this->version) {
65 if (!($this->version = $this->getSystemPackageVersion())) {
66 if ($this->getComposerInformation()->isMagentoRoot()) {
67 $this->version = $this->getComposerInformation()->getRootPackage()->getPrettyVersion();
69 $this->version =
'UNKNOWN';
102 private function getSystemPackageVersion()
104 $packages = $this->getComposerInformation()->getSystemPackages();
105 foreach ($packages as $package) {
106 if (isset($package[
'name']) && isset($package[
'version'])) {
107 return $package[
'version'];
119 private function getComposerInformation()
121 if (!$this->composerInformation) {
122 $directoryList =
new DirectoryList(
BP);
123 $composerFactory =
new ComposerFactory($directoryList, $this->composerJsonFinder);
124 $this->composerInformation =
new ComposerInformation($composerFactory);
126 return $this->composerInformation;