yii\base\Module::defaultVersion PHP 메소드

defaultVersion() 보호된 메소드

Child class may override this method to provide more specific version detection.
부터: 2.0.11
protected defaultVersion ( ) : string
리턴 string the version of this module.
    protected function defaultVersion()
    {
        if ($this->module === null) {
            return '1.0';
        }
        return $this->module->getVersion();
    }

Usage Example

예제 #1
0
파일: Module.php 프로젝트: yiisoft/yii2-gii
 /**
  * @inheritdoc
  * @since 2.0.6
  */
 protected function defaultVersion()
 {
     $packageInfo = Json::decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'composer.json'));
     $extensionName = $packageInfo['name'];
     if (isset(Yii::$app->extensions[$extensionName])) {
         return Yii::$app->extensions[$extensionName]['version'];
     }
     return parent::defaultVersion();
 }