Flitch\Rule\Line\Separator::setEolStyle PHP Метод

setEolStyle() публичный Метод

Valid values are windows, unix and mac.
public setEolStyle ( string $style ) : Separator
$style string
Результат Separator
    public function setEolStyle($style)
    {
        $style = strtolower($style);
        switch ($style) {
            case 'windows':
                $this->eolChar = "\r\n";
                $this->eolName = '\\r\\n';
                break;
            case 'unix':
                $this->eolChar = "\n";
                $this->eolName = '\\n';
                break;
            case 'mac':
                $this->eolChar = "\r";
                $this->eolName = '\\r';
                break;
        }
        return $this;
    }

Usage Example

Пример #1
0
 public function testOnlyAllowWindows()
 {
     $rule = new Separator();
     $rule->setEolStyle('windows');
     $rule->visitFile($this->file);
     $this->assertRuleViolations($this->file, array(array('line' => 2, 'column' => 0, 'message' => 'Line must end with "\\r\\n", found "\\r"', 'source' => 'Flitch\\Line\\Separator'), array('line' => 3, 'column' => 0, 'message' => 'Line must end with "\\r\\n", found "\\n"', 'source' => 'Flitch\\Line\\Separator')));
 }