Permalink
Browse files

[Yaml] moved most protected methods and properties to private

  • Loading branch information...
1 parent 687f8a7 commit a0f73ddc69c0b90af5b71a075f27dec5ee8cce56 @fabpot fabpot committed Mar 8, 2011
Showing with 25 additions and 25 deletions.
  1. +6 −6 Inline.php
  2. +17 −17 Parser.php
  3. +1 −1 Unescaper.php
  4. +1 −1 Yaml.php
View
12 Inline.php
@@ -114,7 +114,7 @@ static public function dump($value)
*
* @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 @@ static public function parseScalar($scalar, $delimiters = null, $stringDelimiter
*
* @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 @@ static protected function parseQuotedScalar($scalar, &$i)
*
* @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 @@ static protected function parseSequence($sequence, &$i = 0)
*
* @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 @@ static protected function parseMapping($mapping, &$i = 0)
*
* @return string A YAML string
*/
- static protected function evaluateScalar($scalar)
+ static private function evaluateScalar($scalar)
{
$scalar = trim($scalar);
@@ -383,7 +383,7 @@ static protected function evaluateScalar($scalar)
*
* @return string The regular expression
*/
- static protected function getTimestampRegex()
+ static private function getTimestampRegex()
{
return <<<EOF
~^
View
34 Parser.php
@@ -17,11 +17,11 @@
*/
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 @@ public function parse($value)
*
* @return integer The current line number
*/
- protected function getRealCurrentLineNb()
+ private function getRealCurrentLineNb()
{
return $this->currentLineNb + $this->offset;
}
@@ -233,7 +233,7 @@ protected function getRealCurrentLineNb()
*
* @return integer The current line indentation
*/
- protected function getCurrentLineIndentation()
+ private function getCurrentLineIndentation()
{
return strlen($this->currentLine) - strlen(ltrim($this->currentLine, ' '));
}
@@ -247,7 +247,7 @@ protected function getCurrentLineIndentation()
*
* @throws ParserException When indentation problem are detected
*/
- protected function getNextEmbedBlock($indentation = null)
+ private function getNextEmbedBlock($indentation = null)
{
$this->moveToNextLine();
@@ -296,7 +296,7 @@ protected function getNextEmbedBlock($indentation = null)
*
* @return Boolean
*/
- protected function moveToNextLine()
+ private function moveToNextLine()
{
if ($this->currentLineNb >= count($this->lines) - 1) {
return false;
@@ -310,7 +310,7 @@ protected function moveToNextLine()
/**
* Moves the parser to the previous line.
*/
- protected function moveToPreviousLine()
+ private function moveToPreviousLine()
{
$this->currentLine = $this->lines[--$this->currentLineNb];
}
@@ -324,7 +324,7 @@ protected function moveToPreviousLine()
*
* @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 @@ protected function parseValue($value)
*
* @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 @@ protected function parseFoldedScalar($separator, $indicator = '', $indentation =
*
* @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 @@ protected function isNextLineIndented()
*
* @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 @@ protected function isCurrentLineEmpty()
*
* @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 @@ protected function isCurrentLineBlank()
*
* @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 @@ protected function isCurrentLineComment()
*
* @return string A cleaned up YAML string
*/
- protected function cleanup($value)
+ private function cleanup($value)
{
$value = str_replace(array("\r\n", "\r"), "\n", $value);
View
2 Unescaper.php
@@ -129,7 +129,7 @@ public function unescapeCharacter($value)
*
* @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);
View
2 Yaml.php
@@ -18,7 +18,7 @@
*/
class Yaml
{
- static protected $spec = '1.2';
+ static private $spec = '1.2';
/**
* Sets the YAML specification version to use.

0 comments on commit a0f73dd

Please sign in to comment.