Index

Emitter

MMO\client\scs · 1 symbol · generated 5 Oct 2026

class

Emitter

Emitter.php:14

Collects the generated CssRule and turns them into css: resolves @order, groups the rules of a same at-rule (@media, @supports, @keyframes) together and formats the output.

class MMO\client\scs\Emitter
Namespace
MMO\client\scs
See
SourceMap record where each selector and each declaration came from, as they are emitted.
Wrapped rules are always emitted after the unwrapped ones, so a media query never loses to the rule it is meant to override (`the` spec, 21 and 46). The css is written through [`write`](https://mcp.mmoframework.fr/documentation/mmo.client/php/scs/Emitter.md#emitter-write), which keeps the current line and column: that is what lets a

Index

column
line
map
outthe css being written, and where the next character will land in it
rules
sequence
mark($location)Record that what is about to be written comes from this source position.
next()
rule($selectors, $wrappers, $order, $location)Create and register a rule.
rules()
toCss($indent, $minify, $optimize, $map)
write($text)Append css, keeping track of where the next character lands -- the source map is built from these positions.
writeGroup($wrappers, $rules, $indent, $minify)
writeRule($rule, $indent, $minify, $depth)

Properties6

column

protected int $column = 0
Type
int

line

protected int $line = 0
Type
int

map

protected ?MMO\client\scs\SourceMap $map = null
Type
null | SourceMap

out

the css being written, and where the next character will land in it

protected string $out = ''
Type
string

rules

protected array $rules = []
Type
array

sequence

protected int $sequence = 0
Type
int

Methods8

mark($location)

Emitter.php:111

Record that what is about to be written comes from this source position.

protected function mark(?MMO\client\scs\SourceLocation $location): void
$locationnull | SourceLocation
returnsvoid

next()

Emitter.php:39
function next(): int
returnsintthe next emission rank, used to keep the source order

rule($selectors, $wrappers, $order, $location)

Emitter.php:32

Create and register a rule.

function rule( array $selectors, array $wrappers = [], int $order = 0, ?MMO\client\scs\SourceLocation $location = null ): MMO\client\scs\CssRule
$selectorsarray
$wrappers = []array
$order = 0int
$location = nullnull | SourceLocation
returnsCssRule

rules()

Emitter.php:42
function rules(): array
returnsarrayevery registered rule, empty ones included

toCss($indent, $minify, $optimize, $map)

Emitter.php:51
function toCss( string $indent = ' ', bool $minify = false, bool $optimize = false, ?MMO\client\scs\SourceMap $map = null ): string
$indent = ' 'stringthe indentation of one level
$minify = falsebooltrue to emit compact css
$optimize = falsebooltrue to merge duplicated selectors and drop overridden declarations
$map = nullnull | SourceMapfilled, while emitting, with where each selector and declaration came from
returnsstringthe generated css

write($text)

Emitter.php:95

Append css, keeping track of where the next character lands -- the source map is built from these positions.

protected function write(string $text): void
$textstring
returnsvoid

writeGroup($wrappers, $rules, $indent, $minify)

Emitter.php:119
protected function writeGroup(array $wrappers, array $rules, string $indent, bool $minify): void
$wrappersarray
$rulesarray
$indentstring
$minifybool
returnsvoid

writeRule($rule, $indent, $minify, $depth)

Emitter.php:142
protected function writeRule(MMO\client\scs\CssRule $rule, string $indent, bool $minify, int $depth): void
$ruleCssRule
$indentstring
$minifybool
$depthint
returnsvoid