/** * 2016-06-26 * The method can be used not only for the custom packages, * but for the standard Magento packages too. * «How to programmatically get an extension's version from its composer.json file?» * https://mage2.pro/t/1798 * @param string $name [optional] * @return string|null */ function df_package_version($name) { /** @var P|IP|null $package */ $package = df_package($name); /** * 2016-07-01 * By analogy with * @see \Magento\Framework\Composer\ComposerInformation::getInstalledMagentoPackages() * https://mage2.pro/t/1796 */ return !$package ? null : $package->getPrettyVersion(); }
/** * 2016-07-01 * @return CP|P|IP */ private function package() { return df_package($this->_name); }