Skip to content

Commit

Permalink
[Yaml] moved most protected methods and properties to private
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Mar 8, 2011
1 parent 4f0e0a6 commit 94c4459
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
12 changes: 6 additions & 6 deletions src/Symfony/Component/Yaml/Inline.php
Expand Up @@ -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);
Expand Down Expand Up @@ -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)));
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -383,7 +383,7 @@ static protected function evaluateScalar($scalar)
*
* @return string The regular expression
*/
static protected function getTimestampRegex()
static private function getTimestampRegex()
{
return <<<EOF
~^
Expand Down
34 changes: 17 additions & 17 deletions src/Symfony/Component/Yaml/Parser.php
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand All @@ -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, ' '));
}
Expand All @@ -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();

Expand Down Expand Up @@ -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;
Expand All @@ -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];
}
Expand All @@ -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, '#')) {
Expand Down Expand Up @@ -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 = '';
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
}
Expand All @@ -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, ' ');
}
Expand All @@ -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, ' ');
Expand All @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Yaml/Unescaper.php
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Yaml/Yaml.php
Expand Up @@ -18,7 +18,7 @@
*/
class Yaml
{
static protected $spec = '1.2';
static private $spec = '1.2';

/**
* Sets the YAML specification version to use.
Expand Down

0 comments on commit 94c4459

Please sign in to comment.