Changeset 28176
- Timestamp:
- 02/22/10 12:00:09 (3 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/2.0/src/Symfony/Components/Yaml/Parser.php
r27919 r28176 20 20 class Parser 21 21 { 22 protected $value = '';23 22 protected $offset = 0; 24 23 protected $lines = array(); … … 48 47 public function parse($value) 49 48 { 50 $this->value = $this->cleanup($value);51 49 $this->currentLineNb = -1; 52 50 $this->currentLine = ''; 53 $this->lines = explode("\n", $this-> value);51 $this->lines = explode("\n", $this->cleanup($value)); 54 52 55 53 $data = array(); … … 192 190 else 193 191 { 194 // one liner? 195 if (1 == count(explode("\n", rtrim($this->value, "\n")))) 192 if (1 == count($this->lines)) 196 193 { 197 194 $value = Inline::load($this->lines[0]); … … 544 541 $value = str_replace(array("\r\n", "\r"), "\n", $value); 545 542 546 if (!preg_match("#\n$#", $value)) 547 { 548 $value .= "\n"; 549 } 543 // remove trailing newlines 544 $value = rtrim($value, "\n"); 550 545 551 546 // strip YAML header