1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44:
<?php
namespace CzProject\PhpCli\Outputs;
use CzProject\PhpCli\IOutputProvider;
abstract class BaseOutput implements IOutputProvider
{
protected $newLineCharacter = "\n";
public function __construct()
{
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$this->newLineCharacter = "\r\n";
}
}
public function output($str)
{
if (!is_array($str)) {
$str = func_get_args();
}
echo implode('', $str);
return $this;
}
public function nl()
{
echo $this->newLineCharacter;
return $this;
}
}