runCommand() protected method

Runs a command to convert asset files.
protected runCommand ( string $command, string $basePath, string $asset, string $result ) : boolean
$command string the command to run. If prefixed with an `@` it will be treated as a path alias.
$basePath string asset base path and command working directory
$asset string the name of the asset file
$result string the name of the file to be generated by the converter command
return boolean true on success, false on failure. Failures will be logged.
コード例 #1
0
 /**
  * {@inheritdoc}
  */
 protected function runCommand($command, $basePath, $asset, $result)
 {
     if ($command === 'render') {
         $res = Yii::$app->getView()->renderFile("{$basePath}/{$asset}");
         file_put_contents("{$basePath}/{$result}", $res);
     } else {
         return parent::runCommand($command, $basePath, $asset, $result);
     }
 }