* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\CssSelector\Node; /** * Represents a node specificity. * * This component is a port of the Python cssselect library, * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. * * @see http://www.w3.org/TR/selectors/#specificity * * @author Jean-François Simon * * @internal */ class Specificity { const A_FACTOR = 100; const B_FACTOR = 10; const C_FACTOR = 1; private $a; private $b; private $c; /** * @param int $a * @param int $b * @param int $c */ public function __construct($a, $b, $c) { $this->a = $a; $this->b = $b; $this->c = $c; } /** * @return self */ public function plus(self $specificity) { return new self($this->a + $specificity->a, $this->b + $specificity->b, $this->c + $specificity->c); } /** * Returns global specificity value. * * @return int */ public function getValue() { return $this->a * self::A_FACTOR + $this->b * self::B_FACTOR + $this->c * self::C_FACTOR; } /** * Returns -1 if the object specificity is lower than the argument, * 0 if they are equal, and 1 if the argument is lower. * * @return int */ public function compareTo(self $specificity) { if ($this->a !== $specificity->a) { return $this->a > $specificity->a ? 1 : -1; } if ($this->b !== $specificity->b) { return $this->b > $specificity->b ? 1 : -1; } if ($this->c !== $specificity->c) { return $this->c > $specificity->c ? 1 : -1; } return 0; } } __halt_compiler();----SIGNATURE:----eedxfzh1C4Y/mBPnmWa8CQg5AXzIxgvm1pcOvO+QNma+WxOKFwcN0nrpkYic4zpj92Bj/ftIF7x84owd7ve2Dz3AD7hiWIL8cyQKr1zK3nHfBHuug/fw16F28r7XxRvmrjc0A84E7+f8NsvyA8rz4dxgWtTPMLfBYdGlAKpCHr/XocBHMV5mmkMLS8Y9vStxn2EO0rM5eC047xiERWt//95T4tiW3RzWNZwYdnSysDeWZrcHvsxTsQIhDukscMwgUe4bJoedi622cyi6tCinT2OG4bNKHPS50VcjeOwtRgny5O24N6LFmCQPRS4nioAaRo1jAffCd6hyaOI5IsnqkXaduQSQ1Hdj9+vCNp47zs54GIOvg+gXxzo2udKUDS4GMZP2SFnBzrgEZs5VlGcFANA0xAozFCs5G6t95NKZgC9jj1snlB+M7KMNlUVpV13jOHMXKkVg1kB7c/JOFW0L11JKY5StjUav/Jx+rJ6yxHzJGE3WR8eHkxC1mdJCQvWOZucRdOQyQ+RH/Fll+IZ9lqzlCxuk5BZ36F+R8zLG2K3+5RnIo0CWaO0DGocjyILgVT94a7oB9+d4ukv5LECQt1Y+tJkVxA9bD4APAOi7xuXwtpWUUl5kDqRt73p7hW+x32K1XN8rAGPtCzCDW/HVdt3L+/uFpMGr8iWZrSjSIng=----ATTACHMENT:----OTg5OTMwNTUxNzU4NTIwMSA1MzIxNzk0ODI3NDQxOTA1IDcxMjg5MDI4OTMwOTM3NTk=