Skip to content
Merged
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
36 changes: 31 additions & 5 deletions src/Property/Charset.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

namespace Sabberworm\CSS\Property;

use Sabberworm\CSS\Comment\Comment;
use Sabberworm\CSS\OutputFormat;

/**
* Class representing an @charset rule.
* Class representing an `@charset` rule.
*
* The following restrictions apply:
* May not be found in any CSSList other than the Document.
* May only appear at the very top of a Document’s contents.
* Must not appear more than once.
* - May not be found in any CSSList other than the Document.
* - May only appear at the very top of a Document’s contents.
* - Must not appear more than once.
*/
class Charset implements AtRule
{
Expand All @@ -24,7 +26,7 @@ class Charset implements AtRule
protected $iLineNo;

/**
* @var array
* @var array<array-key, Comment>
*/
protected $aComments;

Expand All @@ -47,16 +49,27 @@ public function getLineNo()
return $this->iLineNo;
}

/**
* @param string $sCharset
*
* @return void
*/
public function setCharset($sCharset)
{
$this->sCharset = $sCharset;
}

/**
* @return string
*/
public function getCharset()
{
return $this->sCharset;
}

/**
* @return string
*/
public function __toString()
{
return $this->render(new OutputFormat());
Expand Down Expand Up @@ -88,16 +101,29 @@ public function atRuleArgs()
return $this->sCharset;
}

/**
* @param array<array-key, Comment> $aComments
*
* @return void
*/
public function addComments(array $aComments)
{
$this->aComments = array_merge($this->aComments, $aComments);
}

/**
* @return array<array-key, Comment>
*/
public function getComments()
{
return $this->aComments;
}

/**
* @param array<array-key, Comment> $aComments
*
* @return void
*/
public function setComments(array $aComments)
{
$this->aComments = $aComments;
Expand Down