Development

Changeset 28178

You must first sign up to be able to contribute.

Changeset 28178

Show
Ignore:
Timestamp:
02/22/10 12:08:22 (4 years ago)
Author:
FabianLange
Message:

[yaml] removed the unused value property from Parser. Tweaked one-line
check to be self explaining (closes #8264)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • components/yaml/branches/1.0/lib/sfYamlParser.php

    r24527 r28178  
    2727{ 
    2828  protected 
    29     $value         = '', 
    3029    $offset        = 0, 
    3130    $lines         = array(), 
     
    5554  public function parse($value) 
    5655  { 
    57     $this->value = $this->cleanup($value); 
    5856    $this->currentLineNb = -1; 
    5957    $this->currentLine = ''; 
    60     $this->lines = explode("\n", $this->value); 
     58    $this->lines = explode("\n", $this->cleanup($value)); 
    6159 
    6260    $data = array(); 
     
    199197      else 
    200198      { 
    201         // one liner? 
    202         if (1 == count(explode("\n", rtrim($this->value, "\n")))) 
     199        if (1 == count($this->lines)) 
    203200        { 
    204201          $value = sfYamlInline::load($this->lines[0]); 
     
    551548    $value = str_replace(array("\r\n", "\r"), "\n", $value); 
    552549 
    553     if (!preg_match("#\n$#", $value)) 
    554     { 
    555       $value .= "\n"; 
    556     } 
     550    // remove trailing newlines 
     551    $value = rtrim($value, "\n"); 
    557552 
    558553    // strip YAML header