Conditions | 3 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
37 | 24 | public function compare($value, $comparativeValue): int |
|
38 | { |
||
39 | try { |
||
40 | 24 | $compared = $this->collator->compare( |
|
41 | 24 | $this->callAccessor($value), |
|
42 | 24 | $this->callAccessor($comparativeValue) |
|
43 | ); |
||
44 | |||
45 | 22 | if ($this->collator->getErrorCode() !== 0) { |
|
46 | 22 | throw IntlSortException::errorOnSort($this->collator->getErrorMessage()); |
|
47 | } |
||
48 | 4 | } catch (\IntlException $e) { |
|
49 | 2 | throw IntlSortException::errorOnSort($e->getMessage()); |
|
50 | } |
||
51 | |||
52 | 20 | return $compared; |
|
53 | } |
||
63 | } |