Author: FabianLange
Date: 2010-02-22 12:08:22 +0100 (Mon, 22 Feb 2010)
New Revision: 28178

Modified:
   components/yaml/branches/1.0/lib/sfYamlParser.php
Log:
[yaml] removed the unused value property from Parser. Tweaked one-line 
check to be self explaining (closes #8264)

Modified: components/yaml/branches/1.0/lib/sfYamlParser.php
===================================================================
--- components/yaml/branches/1.0/lib/sfYamlParser.php   2010-02-22 11:06:09 UTC 
(rev 28177)
+++ components/yaml/branches/1.0/lib/sfYamlParser.php   2010-02-22 11:08:22 UTC 
(rev 28178)
@@ -26,7 +26,6 @@
 class sfYamlParser
 {
   protected
-    $value         = '',
     $offset        = 0,
     $lines         = array(),
     $currentLineNb = -1,
@@ -54,10 +53,9 @@
    */
   public function parse($value)
   {
-    $this->value = $this->cleanup($value);
     $this->currentLineNb = -1;
     $this->currentLine = '';
-    $this->lines = explode("\n", $this->value);
+    $this->lines = explode("\n", $this->cleanup($value));
 
     $data = array();
     while ($this->moveToNextLine())
@@ -198,8 +196,7 @@
       }
       else
       {
-        // one liner?
-        if (1 == count(explode("\n", rtrim($this->value, "\n"))))
+        if (1 == count($this->lines))
         {
           $value = sfYamlInline::load($this->lines[0]);
           if (is_array($value))
@@ -550,10 +547,8 @@
   {
     $value = str_replace(array("\r\n", "\r"), "\n", $value);
 
-    if (!preg_match("#\n$#", $value))
-    {
-      $value .= "\n";
-    }
+    // remove trailing newlines
+    $value = rtrim($value, "\n");
 
     // strip YAML header
     preg_replace('#^\%YAML[: ][\d\.]+.*\n#s', '', $value);

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to