27 lines
1.6 KiB
YAML
27 lines
1.6 KiB
YAML
name: Specificity
|
|
class_comment: "# * Represents a node specificity.\n# *\n# * This component is a port\
|
|
\ of the Python cssselect library,\n# * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.\n\
|
|
# *\n# * @see http://www.w3.org/TR/selectors/#specificity\n# *\n# * @author Jean-Fran\xE7\
|
|
ois Simon <jeanfrancois.simon@sensiolabs.com>\n# *\n# * @internal"
|
|
dependencies: []
|
|
properties: []
|
|
methods:
|
|
- name: compareTo
|
|
visibility: public
|
|
parameters:
|
|
- name: specificity
|
|
comment: "# * Represents a node specificity.\n# *\n# * This component is a port\
|
|
\ of the Python cssselect library,\n# * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.\n\
|
|
# *\n# * @see http://www.w3.org/TR/selectors/#specificity\n# *\n# * @author Jean-Fran\xE7\
|
|
ois Simon <jeanfrancois.simon@sensiolabs.com>\n# *\n# * @internal\n# */\n# class\
|
|
\ Specificity\n# {\n# public const A_FACTOR = 100;\n# public const B_FACTOR =\
|
|
\ 10;\n# public const C_FACTOR = 1;\n# \n# public function __construct(\n# private\
|
|
\ int $a,\n# private int $b,\n# private int $c,\n# ) {\n# }\n# \n# public function\
|
|
\ plus(self $specificity): self\n# {\n# return new self($this->a + $specificity->a,\
|
|
\ $this->b + $specificity->b, $this->c + $specificity->c);\n# }\n# \n# public\
|
|
\ function getValue(): int\n# {\n# return $this->a * self::A_FACTOR + $this->b\
|
|
\ * self::B_FACTOR + $this->c * self::C_FACTOR;\n# }\n# \n# /**\n# * Returns -1\
|
|
\ if the object specificity is lower than the argument,\n# * 0 if they are equal,\
|
|
\ and 1 if the argument is lower."
|
|
traits: []
|
|
interfaces: []
|