Selector
in package
implements
ArrayAccess, Countable, IteratorAggregate
Uses
CommentTrait
Pop CSS selector class
Tags
Table of Contents
Interfaces
- ArrayAccess
- Countable
- IteratorAggregate
Properties
- $comments : array<string|int, mixed>
- Comments
- $isClass : bool
- Is class selector flag
- $isId : bool
- Is ID selector flag
- $minify : bool
- Minify flag
- $name : string|null
- Selector name
- $properties : array<string|int, mixed>
- Properties
- $tabSize : int
- Tab size
Methods
- __construct() : mixed
- Constructor
- __get() : mixed
- Magic method to return the value of $this->properties[$name]
- __isset() : bool
- Magic method to return the isset value of $this->properties[$name]
- __set() : void
- Magic method to set the property to the value of $this->properties[$name]
- __toString() : string
- To string method
- __unset() : void
- Magic method to unset $this->properties[$name]
- addComment() : static
- Add CSS comment
- count() : int
- Method to get the count of properties
- getComments() : array<string|int, mixed>
- Get CSS comments
- getIterator() : ArrayIterator
- Method to iterate over the properties
- getName() : string|null
- Get name
- getProperties() : array<string|int, mixed>
- Get properties
- getProperty() : string|null
- Get property
- getTabSize() : int
- Get tab size
- hasComments() : bool
- Has CSS comments
- hasDescendant() : bool
- Check if selector has a descendant
- hasProperty() : bool
- Check if selector has property
- isClassSelector() : bool
- Check if is class selector
- isElementSelector() : bool
- Check if is element selector
- isIdSelector() : bool
- Check if is ID selector
- isMinified() : bool
- Check if minify flag is set
- isMultipleSelector() : bool
- Check if is multiple selector
- minify() : Selector
- Set minify flag
- offsetExists() : bool
- ArrayAccess offsetExists
- offsetGet() : mixed
- ArrayAccess offsetGet
- offsetSet() : void
- ArrayAccess offsetSet
- offsetUnset() : void
- ArrayAccess offsetUnset
- removeProperty() : Selector
- Remove property
- render() : string
- Method to render the selector CSS
- setName() : Selector
- Set name
- setProperties() : Selector
- Set properties
- setProperty() : Selector
- Set property
- setTabSize() : Selector
- Set tab size
Properties
$comments
Comments
protected
array<string|int, mixed>
$comments
= []
$isClass
Is class selector flag
protected
bool
$isClass
= false
$isId
Is ID selector flag
protected
bool
$isId
= false
$minify
Minify flag
protected
bool
$minify
= false
$name
Selector name
protected
string|null
$name
= null
$properties
Properties
protected
array<string|int, mixed>
$properties
= []
$tabSize
Tab size
protected
int
$tabSize
= 4
Methods
__construct()
Constructor
public
__construct([string|null $name = null ][, int $tabSize = 4 ]) : mixed
Instantiate the CSS selector object
Parameters
- $name : string|null = null
- $tabSize : int = 4
__get()
Magic method to return the value of $this->properties[$name]
public
__get(string $name) : mixed
Parameters
- $name : string
__isset()
Magic method to return the isset value of $this->properties[$name]
public
__isset(string $name) : bool
Parameters
- $name : string
Return values
bool__set()
Magic method to set the property to the value of $this->properties[$name]
public
__set(string $name, mixed $value) : void
Parameters
- $name : string
- $value : mixed
__toString()
To string method
public
__toString() : string
Return values
string__unset()
Magic method to unset $this->properties[$name]
public
__unset(string $name) : void
Parameters
- $name : string
addComment()
Add CSS comment
public
addComment(Comment|string $comment[, int $wrap = 80 ][, bool $trailingNewLine = false ]) : static
Parameters
- $comment : Comment|string
- $wrap : int = 80
- $trailingNewLine : bool = false
Return values
staticcount()
Method to get the count of properties
public
count() : int
Return values
intgetComments()
Get CSS comments
public
getComments() : array<string|int, mixed>
Return values
array<string|int, mixed>getIterator()
Method to iterate over the properties
public
getIterator() : ArrayIterator
Return values
ArrayIteratorgetName()
Get name
public
getName() : string|null
Return values
string|nullgetProperties()
Get properties
public
getProperties() : array<string|int, mixed>
Return values
array<string|int, mixed>getProperty()
Get property
public
getProperty(string $property) : string|null
Parameters
- $property : string
Return values
string|nullgetTabSize()
Get tab size
public
getTabSize() : int
Return values
inthasComments()
Has CSS comments
public
hasComments() : bool
Return values
boolhasDescendant()
Check if selector has a descendant
public
hasDescendant() : bool
Return values
boolhasProperty()
Check if selector has property
public
hasProperty(string $property) : bool
Parameters
- $property : string
Return values
boolisClassSelector()
Check if is class selector
public
isClassSelector() : bool
Return values
boolisElementSelector()
Check if is element selector
public
isElementSelector() : bool
Return values
boolisIdSelector()
Check if is ID selector
public
isIdSelector() : bool
Return values
boolisMinified()
Check if minify flag is set
public
isMinified() : bool
Return values
boolisMultipleSelector()
Check if is multiple selector
public
isMultipleSelector() : bool
Return values
boolminify()
Set minify flag
public
minify([bool $minify = true ]) : Selector
Parameters
- $minify : bool = true
Return values
SelectoroffsetExists()
ArrayAccess offsetExists
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Return values
booloffsetGet()
ArrayAccess offsetGet
public
offsetGet(mixed $offset) : mixed
Parameters
- $offset : mixed
offsetSet()
ArrayAccess offsetSet
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
- $value : mixed
offsetUnset()
ArrayAccess offsetUnset
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
removeProperty()
Remove property
public
removeProperty(string $property) : Selector
Parameters
- $property : string
Return values
Selectorrender()
Method to render the selector CSS
public
render() : string
Return values
stringsetName()
Set name
public
setName(string $name) : Selector
Parameters
- $name : string
Return values
SelectorsetProperties()
Set properties
public
setProperties(array<string|int, mixed> $properties) : Selector
Parameters
- $properties : array<string|int, mixed>
Return values
SelectorsetProperty()
Set property
public
setProperty(string $property, string $value) : Selector
Parameters
- $property : string
- $value : string
Return values
SelectorsetTabSize()
Set tab size
public
setTabSize(int $tabSize) : Selector
Parameters
- $tabSize : int