Code Duplication    Length = 15-19 lines in 2 locations

src/string/AbstractCG.php 1 location

@@ 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.

src/string/VariableFixedCG.php 1 location

@@ 68-86 (lines=19) @@
65
    /**
66
     * @inheritdoc
67
     */
68
    public function compare(AbstractCG $group): int
69
    {
70
        // Equal character group types - return length comparison
71
        if ($this->isSameType($group)) {
72
            // Variable character groups with longer length has higher priority
73
            return $this->compareLength($group);
74
        }
75
76
        // Fixed character group has higher priority
77
        if ($group->isFixed()) {
78
            return -1;
79
        }
80
81
        /**
82
         * VariableFixed character group has higher priority than regular
83
         * variable character group.
84
         */
85
        return 1;
86
    }
87
88
    /**
89
     * @inheritdoc