@@ 79-93 (lines=15) @@ | ||
76 | * |
|
77 | * @return int -1, 0, 1 Lower, equal, higher |
|
78 | */ |
|
79 | public function compare(AbstractCG $group): int |
|
80 | { |
|
81 | // Equal character group types - return length comparison |
|
82 | if ($this->isSameType($group)) { |
|
83 | // Variable character groups with longer length has higher priority |
|
84 | return $this->compareLength($group); |
|
85 | } |
|
86 | ||
87 | /** |
|
88 | * Character groups are different: |
|
89 | * Fixed character groups has higher priority, |
|
90 | * variable character groups has lower priority |
|
91 | */ |
|
92 | return $this->isFixed() ? 1 : -1; |
|
93 | } |
|
94 | ||
95 | /** |
|
96 | * Check if compared character group has same type. |
@@ 44-62 (lines=19) @@ | ||
41 | /** |
|
42 | * @inheritdoc |
|
43 | */ |
|
44 | public function compare(AbstractCG $group): int |
|
45 | { |
|
46 | // Equal character group types - return length comparison |
|
47 | if ($this->isSameType($group)) { |
|
48 | // Variable character groups with longer length has higher priority |
|
49 | return $this->compareLength($group); |
|
50 | } |
|
51 | ||
52 | // Fixed character group has higher priority |
|
53 | if ($group->isFixed()) { |
|
54 | return -1; |
|
55 | } |
|
56 | ||
57 | /** |
|
58 | * VariableFixed character group has higher priority than regular |
|
59 | * variable character group. |
|
60 | */ |
|
61 | return 1; |
|
62 | } |
|
63 | ||
64 | /** |
|
65 | * @inheritdoc |