symfony/symfony — pull request #11404 by barryvdh (2014-07-17 07:42:25+00:00)
Title: [CssSelector] Add compare method to Specificity

| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #11400
| License | MIT
| Doc PR | -

TODO:
- [ ] Add some tests

Add compare method to Specificity class, so we can compare the specificity without using the value, so it doesn't matter if the base isn't high enough (for example, 1,0,0 should be higher then 0,11,0. Currently with using values, this wouldn't be possible (100 vs 110).
As discussed in #11400, the getValue() isn't completely correct for every case, see the spec http://www.w3.org/TR/selectors/#specificity

Use case would, for example, be sorting an array of multiple properties.