# acymailing/10.11.1/back/Libraries/Sabberworm/CSS/src/Property/Charset.php

AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress, version 10.11.1. 75 lines.

- Page: https://pluginprobe.com/plugins/acymailing/10.11.1/code/back/Libraries/Sabberworm/CSS/src/Property/Charset.php
- Raw: https://pluginprobe.com/plugins/acymailing/10.11.1/raw/back/Libraries/Sabberworm/CSS/src/Property/Charset.php
- Modified: 2026-06-09T07:53:26+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/acymailing/10.11.1/code/back/Libraries/Sabberworm/CSS/src/Property/Charset.php#L10-L20`.

```php
<?php

declare(strict_types=1);

namespace AcyMailing\Libraries\Sabberworm\CSS\Property;

use AcyMailing\Libraries\Sabberworm\CSS\Comment\CommentContainer;
use AcyMailing\Libraries\Sabberworm\CSS\OutputFormat;
use AcyMailing\Libraries\Sabberworm\CSS\Position\Position;
use AcyMailing\Libraries\Sabberworm\CSS\Position\Positionable;
use AcyMailing\Libraries\Sabberworm\CSS\Value\CSSString;

/**
 * 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.
 */
class Charset implements AtRule, Positionable
{
    use CommentContainer;
    use Position;

    /**
     * @var CSSString
     */
    private $charset;

    /**
     * @param int<1, max>|null $lineNumber
     */
    public function __construct(CSSString $charset, ?int $lineNumber = null)
    {
        $this->charset = $charset;
        $this->setPosition($lineNumber);
    }

    /**
     * @param string|CSSString $charset
     */
    public function setCharset($charset): void
    {
        $charset = $charset instanceof CSSString ? $charset : new CSSString($charset);
        $this->charset = $charset;
    }

    public function getCharset(): string
    {
        return $this->charset->getString();
    }

    /**
     * @return non-empty-string
     */
    public function render(OutputFormat $outputFormat): string
    {
        return "{$outputFormat->getFormatter()->comments($this)}@charset {$this->charset->render($outputFormat)};";
    }

    /**
     * @return non-empty-string
     */
    public function atRuleName(): string
    {
        return 'charset';
    }

    public function atRuleArgs(): CSSString
    {
        return $this->charset;
    }
}

```
