Преглед на файлове

[Yaml] moved most protected methods and properties to private

Fabien Potencier преди 14 години
родител
ревизия
94c445957c
променени са 4 файла, в които са добавени 25 реда и са изтрити 25 реда
  1. 6 6
      src/Symfony/Component/Yaml/Inline.php
  2. 17 17
      src/Symfony/Component/Yaml/Parser.php
  3. 1 1
      src/Symfony/Component/Yaml/Unescaper.php
  4. 1 1
      src/Symfony/Component/Yaml/Yaml.php

+ 6 - 6
src/Symfony/Component/Yaml/Inline.php

@@ -114,7 +114,7 @@ class Inline
      *
      * @return string The YAML string representing the PHP array
      */
-    static protected function dumpArray($value)
+    static private function dumpArray($value)
     {
         // array
         $keys = array_keys($value);
@@ -189,7 +189,7 @@ class Inline
      *
      * @throws ParserException When malformed inline YAML string is parsed
      */
-    static protected function parseQuotedScalar($scalar, &$i)
+    static private function parseQuotedScalar($scalar, &$i)
     {
         if (!preg_match('/'.self::REGEX_QUOTED_STRING.'/Au', substr($scalar, $i), $match)) {
             throw new ParserException(sprintf('Malformed inline YAML string (%s).', substr($scalar, $i)));
@@ -219,7 +219,7 @@ class Inline
      *
      * @throws ParserException When malformed inline YAML string is parsed
      */
-    static protected function parseSequence($sequence, &$i = 0)
+    static private function parseSequence($sequence, &$i = 0)
     {
         $output = array();
         $len = strlen($sequence);
@@ -275,7 +275,7 @@ class Inline
      *
      * @throws ParserException When malformed inline YAML string is parsed
      */
-    static protected function parseMapping($mapping, &$i = 0)
+    static private function parseMapping($mapping, &$i = 0)
     {
         $output = array();
         $len = strlen($mapping);
@@ -336,7 +336,7 @@ class Inline
      *
      * @return string A YAML string
      */
-    static protected function evaluateScalar($scalar)
+    static private function evaluateScalar($scalar)
     {
         $scalar = trim($scalar);
 
@@ -383,7 +383,7 @@ class Inline
      *
      * @return string The regular expression
      */
-    static protected function getTimestampRegex()
+    static private function getTimestampRegex()
     {
         return <<<EOF
         ~^

+ 17 - 17
src/Symfony/Component/Yaml/Parser.php

@@ -17,11 +17,11 @@ namespace Symfony\Component\Yaml;
  */
 class Parser
 {
-    protected $offset         = 0;
-    protected $lines          = array();
-    protected $currentLineNb  = -1;
-    protected $currentLine    = '';
-    protected $refs           = array();
+    private $offset         = 0;
+    private $lines          = array();
+    private $currentLineNb  = -1;
+    private $currentLine    = '';
+    private $refs           = array();
 
     /**
      * Constructor
@@ -223,7 +223,7 @@ class Parser
      *
      * @return integer The current line number
      */
-    protected function getRealCurrentLineNb()
+    private function getRealCurrentLineNb()
     {
         return $this->currentLineNb + $this->offset;
     }
@@ -233,7 +233,7 @@ class Parser
      *
      * @return integer The current line indentation
      */
-    protected function getCurrentLineIndentation()
+    private function getCurrentLineIndentation()
     {
         return strlen($this->currentLine) - strlen(ltrim($this->currentLine, ' '));
     }
@@ -247,7 +247,7 @@ class Parser
      *
      * @throws ParserException When indentation problem are detected
      */
-    protected function getNextEmbedBlock($indentation = null)
+    private function getNextEmbedBlock($indentation = null)
     {
         $this->moveToNextLine();
 
@@ -296,7 +296,7 @@ class Parser
      *
      * @return Boolean
      */
-    protected function moveToNextLine()
+    private function moveToNextLine()
     {
         if ($this->currentLineNb >= count($this->lines) - 1) {
             return false;
@@ -310,7 +310,7 @@ class Parser
     /**
      * Moves the parser to the previous line.
      */
-    protected function moveToPreviousLine()
+    private function moveToPreviousLine()
     {
         $this->currentLine = $this->lines[--$this->currentLineNb];
     }
@@ -324,7 +324,7 @@ class Parser
      *
      * @throws ParserException When reference does not exist
      */
-    protected function parseValue($value)
+    private function parseValue($value)
     {
         if ('*' === substr($value, 0, 1)) {
             if (false !== $pos = strpos($value, '#')) {
@@ -357,7 +357,7 @@ class Parser
      *
      * @return string  The text value
      */
-    protected function parseFoldedScalar($separator, $indicator = '', $indentation = 0)
+    private function parseFoldedScalar($separator, $indicator = '', $indentation = 0)
     {
         $separator = '|' == $separator ? "\n" : ' ';
         $text = '';
@@ -427,7 +427,7 @@ class Parser
      *
      * @return Boolean Returns true if the next line is indented, false otherwise
      */
-    protected function isNextLineIndented()
+    private function isNextLineIndented()
     {
         $currentIndentation = $this->getCurrentLineIndentation();
         $notEOF = $this->moveToNextLine();
@@ -455,7 +455,7 @@ class Parser
      *
      * @return Boolean Returns true if the current line is empty or if it is a comment line, false otherwise
      */
-    protected function isCurrentLineEmpty()
+    private function isCurrentLineEmpty()
     {
         return $this->isCurrentLineBlank() || $this->isCurrentLineComment();
     }
@@ -465,7 +465,7 @@ class Parser
      *
      * @return Boolean Returns true if the current line is blank, false otherwise
      */
-    protected function isCurrentLineBlank()
+    private function isCurrentLineBlank()
     {
         return '' == trim($this->currentLine, ' ');
     }
@@ -475,7 +475,7 @@ class Parser
      *
      * @return Boolean Returns true if the current line is a comment line, false otherwise
      */
-    protected function isCurrentLineComment()
+    private function isCurrentLineComment()
     {
         //checking explicitly the first char of the trim is faster than loops or strpos
         $ltrimmedLine = ltrim($this->currentLine, ' ');
@@ -489,7 +489,7 @@ class Parser
      *
      * @return string A cleaned up YAML string
      */
-    protected function cleanup($value)
+    private function cleanup($value)
     {
         $value = str_replace(array("\r\n", "\r"), "\n", $value);
 

+ 1 - 1
src/Symfony/Component/Yaml/Unescaper.php

@@ -129,7 +129,7 @@ class Unescaper
      *
      * @throws \RuntimeException if no suitable encoding function is found (iconv or mbstring)
      */
-    protected function convertEncoding($value, $to, $from)
+    private function convertEncoding($value, $to, $from)
     {
         if (function_exists('iconv')) {
             return iconv($from, $to, $value);

+ 1 - 1
src/Symfony/Component/Yaml/Yaml.php

@@ -18,7 +18,7 @@ namespace Symfony\Component\Yaml;
  */
 class Yaml
 {
-    static protected $spec = '1.2';
+    static private $spec = '1.2';
 
     /**
      * Sets the YAML specification version to use.