mikehaertl\shellcommand\Command::getOutput PHP Method

getOutput() public method

public getOutput ( boolean $trim = true ) : string
$trim boolean whether to `trim()` the return value. The default is `true`.
return string the command output (stdout). Empty if none.
    public function getOutput($trim = true)
    {
        return $trim ? trim($this->_stdOut) : $this->_stdOut;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Displays application version from git describe and writes it to `version`
  */
 public function actionVersion($alias = '@app/version')
 {
     echo "Application Version\n";
     $cmd = new Command("git describe --dirty");
     if ($cmd->execute()) {
         echo $cmd->getOutput();
         file_put_contents(\Yii::getAlias($alias), $cmd->getOutput());
     } else {
         echo $cmd->getOutput();
         echo $cmd->getStdErr();
         echo $cmd->getError();
     }
     echo "\n";
 }
All Usage Examples Of mikehaertl\shellcommand\Command::getOutput