Code Duplication    Length = 16-16 lines in 2 locations

src/models/Fight.php 1 location

@@ 127-142 (lines=16) @@
124
     * Returns the parent field that need to be updated
125
     * @return null|string
126
     */
127
    public function getParentFighterToUpdate()
128
    {
129
        $childrenGroup = $this->group->parent->children;
130
        foreach ($childrenGroup as $key => $children) {
131
            $childFight = $children->fights->get(0);
132
            if ($childFight->id == $this->id) {
133
                if ($key % 2 == 0) {
134
                    return "c1";
135
                }
136
                if ($key % 2 == 1) {
137
                    return "c2";
138
                }
139
            }
140
        }
141
        return null;
142
    }
143
144
    /**
145
     * In the original fight ( child ) return the field that contains data to copy to parent

src/TreeGen/DirectEliminationTreeGen.php 1 location

@@ 120-135 (lines=16) @@
117
     * Returns the parent field that need to be updated
118
     * @return null|string
119
     */
120
    public function getParentFighterToUpdate()
121
    {
122
        $childrenGroup = $this->group->parent->children;
123
        foreach ($childrenGroup as $key => $children) {
124
            $childFight = $children->fights->get(0);
125
            if ($childFight->id == $this->id) {
126
                if ($key % 2 == 0) {
127
                    return "c1";
128
                }
129
                if ($key % 2 == 1) {
130
                    return "c2";
131
                }
132
            }
133
        }
134
        return null;
135
    }
136
137
    /**
138
     * In the original fight ( child ) return the field that contains data to copy to parent