diff --git a/lib/Sabberworm/CSS/CSSList/AtRuleBlockList.php b/lib/Sabberworm/CSS/CSSList/AtRuleBlockList.php index 70b9c402..19775acc 100644 --- a/lib/Sabberworm/CSS/CSSList/AtRuleBlockList.php +++ b/lib/Sabberworm/CSS/CSSList/AtRuleBlockList.php @@ -9,8 +9,8 @@ */ class AtRuleBlockList extends CSSBlockList implements AtRule { - private $sType; - private $sArgs; + protected $sType; + protected $sArgs; public function __construct($sType, $sArgs = '') { parent::__construct(); diff --git a/lib/Sabberworm/CSS/CSSList/KeyFrame.php b/lib/Sabberworm/CSS/CSSList/KeyFrame.php index 3faf2e3f..80099d9f 100644 --- a/lib/Sabberworm/CSS/CSSList/KeyFrame.php +++ b/lib/Sabberworm/CSS/CSSList/KeyFrame.php @@ -6,8 +6,8 @@ class KeyFrame extends CSSList implements AtRule { - private $vendorKeyFrame; - private $animationName; + protected $vendorKeyFrame; + protected $animationName; public function __construct() { parent::__construct(); diff --git a/lib/Sabberworm/CSS/OutputFormat.php b/lib/Sabberworm/CSS/OutputFormat.php index 1b179840..0b14e307 100644 --- a/lib/Sabberworm/CSS/OutputFormat.php +++ b/lib/Sabberworm/CSS/OutputFormat.php @@ -56,9 +56,9 @@ class OutputFormat { public $bIgnoreExceptions = false; - private $oFormatter = null; - private $oNextLevelFormat = null; - private $iIndentationLevel = 0; + protected $oFormatter = null; + protected $oNextLevelFormat = null; + protected $iIndentationLevel = 0; public function __construct() { } @@ -156,7 +156,7 @@ public static function createPretty() { } class OutputFormatter { - private $oFormat; + protected $oFormat; public function __construct(OutputFormat $oFormat) { $this->oFormat = $oFormat; @@ -279,11 +279,11 @@ public function removeLastSemicolon($sString) { return implode(';', $sString); } - private function prepareSpace($sSpaceString) { + protected function prepareSpace($sSpaceString) { return str_replace("\n", "\n".$this->indent(), $sSpaceString); } - private function indent() { + protected function indent() { return str_repeat($this->oFormat->sIndentation, $this->oFormat->level()); } } \ No newline at end of file diff --git a/lib/Sabberworm/CSS/Parser.php b/lib/Sabberworm/CSS/Parser.php index c1b5ca27..3feb8bd0 100644 --- a/lib/Sabberworm/CSS/Parser.php +++ b/lib/Sabberworm/CSS/Parser.php @@ -26,14 +26,14 @@ */ class Parser { - private $sText; - private $iCurrentPosition; - private $oParserSettings; - private $sCharset; - private $iLength; - private $peekCache = null; - private $blockRules; - private $aSizeUnits; + protected $sText; + protected $iCurrentPosition; + protected $oParserSettings; + protected $sCharset; + protected $iLength; + protected $peekCache = null; + protected $blockRules; + protected $aSizeUnits; public function __construct($sText, Settings $oParserSettings = null) { $this->sText = $sText; @@ -70,12 +70,12 @@ public function parse() { return $oResult; } - private function parseDocument(Document $oDocument) { + protected function parseDocument(Document $oDocument) { $this->consumeWhiteSpace(); $this->parseList($oDocument, true); } - private function parseList(CSSList $oList, $bIsRoot = false) { + protected function parseList(CSSList $oList, $bIsRoot = false) { while (!$this->isEnd()) { if ($this->comes('@')) { $oList->append($this->parseAtRule()); @@ -102,7 +102,7 @@ private function parseList(CSSList $oList, $bIsRoot = false) { } } - private function parseAtRule() { + protected function parseAtRule() { $this->consume('@'); $sIdentifier = $this->parseIdentifier(); $this->consumeWhiteSpace(); @@ -165,7 +165,7 @@ private function parseAtRule() { } } - private function parseIdentifier($bAllowFunctions = true, $bIgnoreCase = true) { + protected function parseIdentifier($bAllowFunctions = true, $bIgnoreCase = true) { $sResult = $this->parseCharacter(true); if ($sResult === null) { throw new UnexpectedTokenException($sResult, $this->peek(5), 'identifier'); @@ -186,7 +186,7 @@ private function parseIdentifier($bAllowFunctions = true, $bIgnoreCase = true) { return $sResult; } - private function parseStringValue() { + protected function parseStringValue() { $sBegin = $this->peek(); $sQuote = null; if ($sBegin === "'") { @@ -217,7 +217,7 @@ private function parseStringValue() { return new String($sResult); } - private function parseCharacter($bIsForIdentifier) { + protected function parseCharacter($bIsForIdentifier) { if ($this->peek() === '\\') { $this->consume('\\'); if ($this->comes('\n') || $this->comes('\r')) { @@ -262,7 +262,7 @@ private function parseCharacter($bIsForIdentifier) { return null; } - private function parseSelector() { + protected function parseSelector() { $oResult = new DeclarationBlock(); $oResult->setSelector($this->consumeUntil('{', false, true)); $this->consumeWhiteSpace(); @@ -270,7 +270,7 @@ private function parseSelector() { return $oResult; } - private function parseRuleSet($oRuleSet) { + protected function parseRuleSet($oRuleSet) { while ($this->comes(';')) { $this->consume(';'); $this->consumeWhiteSpace(); @@ -309,7 +309,7 @@ private function parseRuleSet($oRuleSet) { $this->consume('}'); } - private function parseRule() { + protected function parseRule() { $oRule = new Rule($this->parseIdentifier()); $this->consumeWhiteSpace(); $this->consume(':'); @@ -328,7 +328,7 @@ private function parseRule() { return $oRule; } - private function parseValue($aListDelimiters) { + protected function parseValue($aListDelimiters) { $aStack = array(); $this->consumeWhiteSpace(); //Build a list of delimiters and parsed values @@ -374,14 +374,14 @@ private function parseValue($aListDelimiters) { return $aStack[0]; } - private static function listDelimiterForRule($sRule) { + protected static function listDelimiterForRule($sRule) { if (preg_match('/^font($|-)/', $sRule)) { return array(',', '/', ' '); } return array(',', ' ', '/'); } - private function parsePrimitiveValue() { + protected function parsePrimitiveValue() { $oValue = null; $this->consumeWhiteSpace(); if (is_numeric($this->peek()) || ($this->comes('-.') && is_numeric($this->peek(1, 2))) || (($this->comes('-') || $this->comes('.')) && is_numeric($this->peek(1, 1)))) { @@ -399,7 +399,7 @@ private function parsePrimitiveValue() { return $oValue; } - private function parseNumericValue($bForColor = false) { + protected function parseNumericValue($bForColor = false) { $sSize = ''; if ($this->comes('-')) { $sSize .= $this->consume('-'); @@ -422,7 +422,7 @@ private function parseNumericValue($bForColor = false) { return new Size(floatval($sSize), $sUnit, $bForColor); } - private function parseColorValue() { + protected function parseColorValue() { $aColor = array(); if ($this->comes('#')) { $this->consume('#'); @@ -449,7 +449,7 @@ private function parseColorValue() { return new Color($aColor); } - private function parseURLValue() { + protected function parseURLValue() { $bUseUrl = $this->comes('url', true); if ($bUseUrl) { $this->consume('url'); @@ -468,19 +468,19 @@ private function parseURLValue() { /** * Tests an identifier for a given value. Since identifiers are all keywords, they can be vendor-prefixed. We need to check for these versions too. */ - private function identifierIs($sIdentifier, $sMatch) { + protected function identifierIs($sIdentifier, $sMatch) { return (strcasecmp($sIdentifier, $sMatch) === 0) ?: preg_match("/^(-\\w+-)?$sMatch$/i", $sIdentifier) === 1; } - private function comes($sString, $bCaseInsensitive = false) { + protected function comes($sString, $bCaseInsensitive = false) { $sPeek = $this->peek(strlen($sString)); return ($sPeek == '') ? false : $this->streql($sPeek, $sString, $bCaseInsensitive); } - private function peek($iLength = 1, $iOffset = 0) { + protected function peek($iLength = 1, $iOffset = 0) { if (($peek = (!$iOffset && ($iLength === 1))) && !is_null($this->peekCache)) { return $this->peekCache; @@ -497,7 +497,7 @@ private function peek($iLength = 1, $iOffset = 0) { return $out; } - private function consume($mValue = 1) { + protected function consume($mValue = 1) { if (is_string($mValue)) { $iLength = $this->strlen($mValue); if (!$this->streql($this->substr($this->sText, $this->iCurrentPosition, $iLength), $mValue)) { @@ -517,7 +517,7 @@ private function consume($mValue = 1) { } } - private function consumeExpression($mExpression) { + protected function consumeExpression($mExpression) { $aMatches = null; if (preg_match($mExpression, $this->inputLeft(), $aMatches, PREG_OFFSET_CAPTURE) === 1) { return $this->consume($aMatches[0][0]); @@ -525,7 +525,7 @@ private function consumeExpression($mExpression) { throw new UnexpectedTokenException($mExpression, $this->peek(5), 'expression'); } - private function consumeWhiteSpace() { + protected function consumeWhiteSpace() { do { while (preg_match('/\\s/isSu', $this->peek()) === 1) { $this->consume(1); @@ -544,7 +544,7 @@ private function consumeWhiteSpace() { } while($bHasComment); } - private function consumeComment() { + protected function consumeComment() { if ($this->comes('/*')) { $this->consume(1); while ($this->consume(1) !== '') { @@ -557,11 +557,11 @@ private function consumeComment() { return false; } - private function isEnd() { + protected function isEnd() { return $this->iCurrentPosition >= $this->iLength; } - private function consumeUntil($aEnd, $bIncludeEnd = false, $consumeEnd = false) { + protected function consumeUntil($aEnd, $bIncludeEnd = false, $consumeEnd = false) { $aEnd = is_array($aEnd) ? $aEnd : array($aEnd); $out = ''; $start = $this->iCurrentPosition; @@ -583,11 +583,11 @@ private function consumeUntil($aEnd, $bIncludeEnd = false, $consumeEnd = false) throw new UnexpectedTokenException('One of ("'.implode('","', $aEnd).'")', $this->peek(5), 'search'); } - private function inputLeft() { + protected function inputLeft() { return $this->substr($this->sText, $this->iCurrentPosition, -1); } - private function substr($sString, $iStart, $iLength) { + protected function substr($sString, $iStart, $iLength) { if ($this->oParserSettings->bMultibyteSupport) { return mb_substr($sString, $iStart, $iLength, $this->sCharset); } else { @@ -595,7 +595,7 @@ private function substr($sString, $iStart, $iLength) { } } - private function strlen($sString) { + protected function strlen($sString) { if ($this->oParserSettings->bMultibyteSupport) { return mb_strlen($sString, $this->sCharset); } else { @@ -603,7 +603,7 @@ private function strlen($sString) { } } - private function streql($sString1, $sString2, $bCaseInsensitive = true) { + protected function streql($sString1, $sString2, $bCaseInsensitive = true) { if($bCaseInsensitive) { return $this->strtolower($sString1) === $this->strtolower($sString2); } else { @@ -611,7 +611,7 @@ private function streql($sString1, $sString2, $bCaseInsensitive = true) { } } - private function strtolower($sString) { + protected function strtolower($sString) { if ($this->oParserSettings->bMultibyteSupport) { return mb_strtolower($sString, $this->sCharset); } else { @@ -619,7 +619,7 @@ private function strtolower($sString) { } } - private function strpos($sString, $sNeedle, $iOffset) { + protected function strpos($sString, $sNeedle, $iOffset) { if ($this->oParserSettings->bMultibyteSupport) { return mb_strpos($sString, $sNeedle, $iOffset, $this->sCharset); } else { diff --git a/lib/Sabberworm/CSS/Parsing/UnexpectedTokenException.php b/lib/Sabberworm/CSS/Parsing/UnexpectedTokenException.php index 410f5de3..1e6ea0c9 100644 --- a/lib/Sabberworm/CSS/Parsing/UnexpectedTokenException.php +++ b/lib/Sabberworm/CSS/Parsing/UnexpectedTokenException.php @@ -6,10 +6,10 @@ * Thrown if the CSS parsers encounters a token it did not expect */ class UnexpectedTokenException extends \Exception { - private $sExpected; - private $sFound; + protected $sExpected; + protected $sFound; // Possible values: literal, identifier, count, expression, search - private $sMatchType; + protected $sMatchType; public function __construct($sExpected, $sFound, $sMatchType = 'literal') { $this->sExpected = $sExpected; diff --git a/lib/Sabberworm/CSS/Property/CSSNamespace.php b/lib/Sabberworm/CSS/Property/CSSNamespace.php index 3d5a80d1..6f715f72 100644 --- a/lib/Sabberworm/CSS/Property/CSSNamespace.php +++ b/lib/Sabberworm/CSS/Property/CSSNamespace.php @@ -6,8 +6,8 @@ * CSSNamespace represents an @namespace rule. */ class CSSNamespace implements AtRule { - private $mUrl; - private $sPrefix; + protected $mUrl; + protected $sPrefix; public function __construct($mUrl, $sPrefix = null) { $this->mUrl = $mUrl; diff --git a/lib/Sabberworm/CSS/Property/Charset.php b/lib/Sabberworm/CSS/Property/Charset.php index 69604220..ca6ab19d 100644 --- a/lib/Sabberworm/CSS/Property/Charset.php +++ b/lib/Sabberworm/CSS/Property/Charset.php @@ -11,7 +11,7 @@ */ class Charset implements AtRule { - private $sCharset; + protected $sCharset; public function __construct($sCharset) { $this->sCharset = $sCharset; diff --git a/lib/Sabberworm/CSS/Property/Import.php b/lib/Sabberworm/CSS/Property/Import.php index 4fd08b1c..3e7b4627 100644 --- a/lib/Sabberworm/CSS/Property/Import.php +++ b/lib/Sabberworm/CSS/Property/Import.php @@ -8,8 +8,8 @@ * Class representing an @import rule. */ class Import implements AtRule { - private $oLocation; - private $sMediaQuery; + protected $oLocation; + protected $sMediaQuery; public function __construct(URL $oLocation, $sMediaQuery) { $this->oLocation = $oLocation; diff --git a/lib/Sabberworm/CSS/Property/Selector.php b/lib/Sabberworm/CSS/Property/Selector.php index d84171f5..a4c647fe 100644 --- a/lib/Sabberworm/CSS/Property/Selector.php +++ b/lib/Sabberworm/CSS/Property/Selector.php @@ -35,8 +35,8 @@ class Selector { )) /ix'; - private $sSelector; - private $iSpecificity; + protected $sSelector; + protected $iSpecificity; public function __construct($sSelector, $bCalculateSpecificity = false) { $this->setSelector($sSelector); diff --git a/lib/Sabberworm/CSS/Rule/Rule.php b/lib/Sabberworm/CSS/Rule/Rule.php index 79967278..49507ec2 100644 --- a/lib/Sabberworm/CSS/Rule/Rule.php +++ b/lib/Sabberworm/CSS/Rule/Rule.php @@ -11,9 +11,9 @@ */ class Rule { - private $sRule; - private $mValue; - private $bIsImportant; + protected $sRule; + protected $mValue; + protected $bIsImportant; public function __construct($sRule) { $this->sRule = $sRule; diff --git a/lib/Sabberworm/CSS/RuleSet/AtRuleSet.php b/lib/Sabberworm/CSS/RuleSet/AtRuleSet.php index a21737dc..2ce5ac28 100644 --- a/lib/Sabberworm/CSS/RuleSet/AtRuleSet.php +++ b/lib/Sabberworm/CSS/RuleSet/AtRuleSet.php @@ -9,8 +9,8 @@ */ class AtRuleSet extends RuleSet implements AtRule { - private $sType; - private $sArgs; + protected $sType; + protected $sArgs; public function __construct($sType, $sArgs = '') { parent::__construct(); diff --git a/lib/Sabberworm/CSS/RuleSet/DeclarationBlock.php b/lib/Sabberworm/CSS/RuleSet/DeclarationBlock.php index c59e601d..fff708fd 100644 --- a/lib/Sabberworm/CSS/RuleSet/DeclarationBlock.php +++ b/lib/Sabberworm/CSS/RuleSet/DeclarationBlock.php @@ -17,7 +17,7 @@ */ class DeclarationBlock extends RuleSet { - private $aSelectors; + protected $aSelectors; public function __construct() { parent::__construct(); diff --git a/lib/Sabberworm/CSS/RuleSet/RuleSet.php b/lib/Sabberworm/CSS/RuleSet/RuleSet.php index d33f9cde..2d3b7473 100644 --- a/lib/Sabberworm/CSS/RuleSet/RuleSet.php +++ b/lib/Sabberworm/CSS/RuleSet/RuleSet.php @@ -11,7 +11,7 @@ */ abstract class RuleSet implements Renderable { - private $aRules; + protected $aRules; public function __construct() { $this->aRules = array(); diff --git a/lib/Sabberworm/CSS/Settings.php b/lib/Sabberworm/CSS/Settings.php index cb89a863..0db5d071 100644 --- a/lib/Sabberworm/CSS/Settings.php +++ b/lib/Sabberworm/CSS/Settings.php @@ -25,7 +25,7 @@ class Settings { */ public $bLenientParsing = true; - private function __construct() { + protected function __construct() { $this->bMultibyteSupport = extension_loaded('mbstring'); } diff --git a/lib/Sabberworm/CSS/Value/CSSFunction.php b/lib/Sabberworm/CSS/Value/CSSFunction.php index 29c43748..92bb8b0f 100644 --- a/lib/Sabberworm/CSS/Value/CSSFunction.php +++ b/lib/Sabberworm/CSS/Value/CSSFunction.php @@ -4,7 +4,7 @@ class CSSFunction extends ValueList { - private $sName; + protected $sName; public function __construct($sName, $aArguments, $sSeparator = ',') { if($aArguments instanceof RuleValueList) { diff --git a/lib/Sabberworm/CSS/Value/Size.php b/lib/Sabberworm/CSS/Value/Size.php index 6d995a06..84085823 100644 --- a/lib/Sabberworm/CSS/Value/Size.php +++ b/lib/Sabberworm/CSS/Value/Size.php @@ -8,9 +8,9 @@ class Size extends PrimitiveValue { const RELATIVE_SIZE_UNITS = '%/em/ex/ch/fr'; const NON_SIZE_UNITS = 'deg/grad/rad/s/ms/turns/Hz/kHz'; - private $fSize; - private $sUnit; - private $bIsColorComponent; + protected $fSize; + protected $sUnit; + protected $bIsColorComponent; public function __construct($fSize, $sUnit = null, $bIsColorComponent = false) { $this->fSize = floatval($fSize); diff --git a/lib/Sabberworm/CSS/Value/String.php b/lib/Sabberworm/CSS/Value/String.php index c68847e5..2c34c72c 100644 --- a/lib/Sabberworm/CSS/Value/String.php +++ b/lib/Sabberworm/CSS/Value/String.php @@ -4,7 +4,7 @@ class String extends PrimitiveValue { - private $sString; + protected $sString; public function __construct($sString) { $this->sString = $sString; diff --git a/lib/Sabberworm/CSS/Value/URL.php b/lib/Sabberworm/CSS/Value/URL.php index 62de1029..7a4cf7cb 100644 --- a/lib/Sabberworm/CSS/Value/URL.php +++ b/lib/Sabberworm/CSS/Value/URL.php @@ -5,7 +5,7 @@ class URL extends PrimitiveValue { - private $oURL; + protected $oURL; public function __construct(String $oURL) { $this->oURL = $oURL;