Iber\Generator\Utilities\VariableConversion::convertBooleanToString PHP Метод

convertBooleanToString() публичный статический Метод

Convert a boolean into a string.
public static convertBooleanToString ( $boolean ) : string
$boolean
Результат string true|false
    public static function convertBooleanToString($boolean)
    {
        $string = $boolean ? 'true' : 'false';
        return $string;
    }

Usage Example

 /**
  * Replace all stub tokens with properties.
  *
  * @param $name
  * @param $table
  *
  * @return mixed|string
  */
 protected function replaceTokens($name, $table)
 {
     $class = $this->buildClass($name);
     $properties = $this->getTableProperties($table);
     $namespace = $this->getAppNamespace();
     $class = str_replace('{{namespace}}', $namespace, $class);
     $class = str_replace('{{class}}', $name, $class);
     $class = str_replace('{{extends}}', $this->option('extends'), $class);
     $class = str_replace('{{fillable}}', 'protected $fillable = ' . VariableConversion::convertArrayToString($properties['fillable']) . ';', $class);
     $class = str_replace('{{guarded}}', 'protected $guarded = ' . VariableConversion::convertArrayToString($properties['guarded']) . ';', $class);
     $class = str_replace('{{timestamps}}', 'public $timestamps = ' . VariableConversion::convertBooleanToString($properties['timestamps']) . ';', $class);
     $class = str_replace('{{table}}', 'public $table = "' . $table . '";', $class);
     if ($this->option("getset")) {
         $class = $this->replaceTokensWithSetGetFunctions($properties, $class);
     } else {
         $class = str_replace(["{{setters}}\n\n", "{{getters}}\n\n"], '', $class);
     }
     return $class;
 }
All Usage Examples Of Iber\Generator\Utilities\VariableConversion::convertBooleanToString