Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/CSSList/AtRuleBlockList.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Sabberworm\CSS\CSSList;

use Sabberworm\CSS\OutputFormat;
use Sabberworm\CSS\Property\AtRule;

/**
Expand Down Expand Up @@ -49,13 +50,13 @@ public function atRuleArgs()

public function __toString()
{
return $this->render(new \Sabberworm\CSS\OutputFormat());
return $this->render(new OutputFormat());
}

/**
* @return string
*/
public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat)
public function render(OutputFormat $oOutputFormat)
{
$sArgs = $this->sArgs;
if ($sArgs) {
Expand Down
5 changes: 3 additions & 2 deletions src/CSSList/CSSList.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Sabberworm\CSS\CSSList;

use Sabberworm\CSS\Comment\Commentable;
use Sabberworm\CSS\OutputFormat;
use Sabberworm\CSS\Parsing\ParserState;
use Sabberworm\CSS\Parsing\SourceException;
use Sabberworm\CSS\Parsing\UnexpectedTokenException;
Expand Down Expand Up @@ -353,13 +354,13 @@ public function removeDeclarationBlockBySelector($mSelector, $bRemoveAll = false

public function __toString()
{
return $this->render(new \Sabberworm\CSS\OutputFormat());
return $this->render(new OutputFormat());
}

/**
* @return string
*/
public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat)
public function render(OutputFormat $oOutputFormat)
{
$sResult = '';
$bIsFirst = true;
Expand Down
10 changes: 6 additions & 4 deletions src/CSSList/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace Sabberworm\CSS\CSSList;

use Sabberworm\CSS\OutputFormat;
use Sabberworm\CSS\Parsing\ParserState;
use Sabberworm\CSS\Parsing\SourceException;

/**
* The root CSSList of a parsed file. Contains all top-level css contents, mostly declaration blocks,
Expand All @@ -25,7 +27,7 @@ public function __construct($iLineNo = 0)
*
* @return Document
*
* @throws \Sabberworm\CSS\Parsing\SourceException
* @throws SourceException
*/
public static function parse(ParserState $oParserState)
{
Expand Down Expand Up @@ -127,14 +129,14 @@ public function createShorthands()
/**
* Override render() to make format argument optional
*
* @param \Sabberworm\CSS\OutputFormat|null $oOutputFormat
* @param OutputFormat|null $oOutputFormat
*
* @return string
*/
public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat = null)
public function render(OutputFormat $oOutputFormat = null)
{
if ($oOutputFormat === null) {
$oOutputFormat = new \Sabberworm\CSS\OutputFormat();
$oOutputFormat = new OutputFormat();
}
return parent::render($oOutputFormat);
}
Expand Down
7 changes: 4 additions & 3 deletions src/CSSList/KeyFrame.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Sabberworm\CSS\CSSList;

use Sabberworm\CSS\OutputFormat;
use Sabberworm\CSS\Property\AtRule;

class KeyFrame extends CSSList implements AtRule
Expand Down Expand Up @@ -45,15 +46,15 @@ public function getAnimationName()

public function __toString()
{
return $this->render(new \Sabberworm\CSS\OutputFormat());
return $this->render(new OutputFormat());
}

/**
* @param \Sabberworm\CSS\OutputFormat $oOutputFormat
* @param OutputFormat $oOutputFormat
*
* @return string
*/
public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat)
public function render(OutputFormat $oOutputFormat)
{
$sResult = "@{$this->vendorKeyFrame} {$this->animationName}{$oOutputFormat->spaceBeforeOpeningBrace()}{";
$sResult .= parent::render($oOutputFormat);
Expand Down
5 changes: 3 additions & 2 deletions src/Comment/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Sabberworm\CSS\Comment;

use Sabberworm\CSS\OutputFormat;
use Sabberworm\CSS\Renderable;

class Comment implements Renderable
Expand Down Expand Up @@ -45,13 +46,13 @@ public function setComment($sComment)
*/
public function __toString()
{
return $this->render(new \Sabberworm\CSS\OutputFormat());
return $this->render(new OutputFormat());
}

/**
* @return string
*/
public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat)
public function render(OutputFormat $oOutputFormat)
{
return '/*' . $this->sComment . '*/';
}
Expand Down
2 changes: 1 addition & 1 deletion src/OutputFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function implode($sSeparator, array $aValues, $bIncreaseLevel = false)
} else {
$sResult .= $sSeparator;
}
if ($mValue instanceof \Sabberworm\CSS\Renderable) {
if ($mValue instanceof Renderable) {
$sResult .= $mValue->render($oFormat);
} else {
$sResult .= $mValue;
Expand Down
8 changes: 5 additions & 3 deletions src/Property/CSSNamespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Sabberworm\CSS\Property;

use Sabberworm\CSS\OutputFormat;

/**
* CSSNamespace represents an @namespace rule.
*/
Expand Down Expand Up @@ -33,15 +35,15 @@ public function getLineNo()

public function __toString()
{
return $this->render(new \Sabberworm\CSS\OutputFormat());
return $this->render(new OutputFormat());
}

/**
* @param \Sabberworm\CSS\OutputFormat $oOutputFormat
* @param OutputFormat $oOutputFormat
*
* @return string
*/
public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat)
public function render(OutputFormat $oOutputFormat)
{
return '@namespace ' . ($this->sPrefix === null ? '' : $this->sPrefix . ' ')
. $this->mUrl->render($oOutputFormat) . ';';
Expand Down
8 changes: 5 additions & 3 deletions src/Property/Charset.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Sabberworm\CSS\Property;

use Sabberworm\CSS\OutputFormat;

/**
* Class representing an @charset rule.
* The following restrictions apply:
Expand Down Expand Up @@ -57,15 +59,15 @@ public function getCharset()

public function __toString()
{
return $this->render(new \Sabberworm\CSS\OutputFormat());
return $this->render(new OutputFormat());
}

/**
* @param \Sabberworm\CSS\OutputFormat $oOutputFormat
* @param OutputFormat $oOutputFormat
*
* @return string
*/
public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat)
public function render(OutputFormat $oOutputFormat)
{
return "@charset {$this->sCharset->render($oOutputFormat)};";
}
Expand Down
7 changes: 4 additions & 3 deletions src/Property/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Sabberworm\CSS\Property;

use Sabberworm\CSS\OutputFormat;
use Sabberworm\CSS\Value\URL;

/**
Expand Down Expand Up @@ -62,15 +63,15 @@ public function getLocation()

public function __toString()
{
return $this->render(new \Sabberworm\CSS\OutputFormat());
return $this->render(new OutputFormat());
}

/**
* @param \Sabberworm\CSS\OutputFormat $oOutputFormat
* @param OutputFormat $oOutputFormat
*
* @return string
*/
public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat)
public function render(OutputFormat $oOutputFormat)
{
return "@import " . $this->oLocation->render($oOutputFormat)
. ($this->sMediaQuery === null ? '' : ' ' . $this->sMediaQuery) . ';';
Expand Down
2 changes: 1 addition & 1 deletion src/Renderable.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function __toString();
*
* @return string
*/
public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat);
public function render(OutputFormat $oOutputFormat);

public function getLineNo();
}
7 changes: 4 additions & 3 deletions src/Rule/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Sabberworm\CSS\Rule;

use Sabberworm\CSS\Comment\Commentable;
use Sabberworm\CSS\OutputFormat;
use Sabberworm\CSS\Parsing\ParserState;
use Sabberworm\CSS\Renderable;
use Sabberworm\CSS\Value\RuleValueList;
Expand Down Expand Up @@ -238,15 +239,15 @@ public function getIsImportant()

public function __toString()
{
return $this->render(new \Sabberworm\CSS\OutputFormat());
return $this->render(new OutputFormat());
}

/**
* @param \Sabberworm\CSS\OutputFormat $oOutputFormat
* @param OutputFormat $oOutputFormat
*
* @return string
*/
public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat)
public function render(OutputFormat $oOutputFormat)
{
$sResult = "{$this->sRule}:{$oOutputFormat->spaceAfterRuleName()}";
if ($this->mValue instanceof Value) { //Can also be a ValueList
Expand Down
7 changes: 4 additions & 3 deletions src/RuleSet/AtRuleSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Sabberworm\CSS\RuleSet;

use Sabberworm\CSS\OutputFormat;
use Sabberworm\CSS\Property\AtRule;

/**
Expand Down Expand Up @@ -49,15 +50,15 @@ public function atRuleArgs()

public function __toString()
{
return $this->render(new \Sabberworm\CSS\OutputFormat());
return $this->render(new OutputFormat());
}

/**
* @param \Sabberworm\CSS\OutputFormat $oOutputFormat
* @param OutputFormat $oOutputFormat
*
* @return string
*/
public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat)
public function render(OutputFormat $oOutputFormat)
{
$sArgs = $this->sArgs;
if ($sArgs) {
Expand Down
7 changes: 4 additions & 3 deletions src/RuleSet/DeclarationBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Sabberworm\CSS\RuleSet;

use Sabberworm\CSS\CSSList\KeyFrame;
use Sabberworm\CSS\OutputFormat;
use Sabberworm\CSS\Parsing\OutputException;
use Sabberworm\CSS\Parsing\ParserState;
use Sabberworm\CSS\Parsing\UnexpectedTokenException;
Expand Down Expand Up @@ -728,17 +729,17 @@ public function createFontShorthand()

public function __toString()
{
return $this->render(new \Sabberworm\CSS\OutputFormat());
return $this->render(new OutputFormat());
}

/**
* @param \Sabberworm\CSS\OutputFormat $oOutputFormat
* @param OutputFormat $oOutputFormat
*
* @return string
*
* @throws OutputException
*/
public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat)
public function render(OutputFormat $oOutputFormat)
{
if (count($this->aSelectors) === 0) {
// If all the selectors have been removed, this declaration block becomes invalid
Expand Down
7 changes: 4 additions & 3 deletions src/RuleSet/RuleSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Sabberworm\CSS\RuleSet;

use Sabberworm\CSS\Comment\Commentable;
use Sabberworm\CSS\OutputFormat;
use Sabberworm\CSS\Parsing\ParserState;
use Sabberworm\CSS\Parsing\UnexpectedTokenException;
use Sabberworm\CSS\Renderable;
Expand Down Expand Up @@ -225,15 +226,15 @@ public function removeRule($mRule)

public function __toString()
{
return $this->render(new \Sabberworm\CSS\OutputFormat());
return $this->render(new OutputFormat());
}

/**
* @param \Sabberworm\CSS\OutputFormat $oOutputFormat
* @param OutputFormat $oOutputFormat
*
* @return string
*/
public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat)
public function render(OutputFormat $oOutputFormat)
{
$sResult = '';
$bIsFirst = true;
Expand Down
8 changes: 5 additions & 3 deletions src/Value/CSSFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Sabberworm\CSS\Value;

use Sabberworm\CSS\OutputFormat;

class CSSFunction extends ValueList
{
protected $sName;
Expand Down Expand Up @@ -37,15 +39,15 @@ public function getArguments()

public function __toString()
{
return $this->render(new \Sabberworm\CSS\OutputFormat());
return $this->render(new OutputFormat());
}

/**
* @param \Sabberworm\CSS\OutputFormat $oOutputFormat
* @param OutputFormat $oOutputFormat
*
* @return string
*/
public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat)
public function render(OutputFormat $oOutputFormat)
{
$aArguments = parent::render($oOutputFormat);
return "{$this->sName}({$aArguments})";
Expand Down
Loading