Passed
Branch bigRefactor (c260a1)
by Julien
34:53
created

PlayOffCompetitorTreeGen   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 30
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getFighters() 0 4 1
A syncGroup() 0 6 1
A createByeFighter() 0 4 1
1
<?php
2
3
namespace Xoco70\KendoTournaments\TreeGen;
4
5
use Illuminate\Support\Collection;
6
use Xoco70\KendoTournaments\Models\Competitor;
7
use Xoco70\KendoTournaments\Models\FightersGroup;
8
9
class PlayOffCompetitorTreeGen extends PlayOffTreeGen
10
{
11
12
13
    /**
14
     * Fighter is the name for competitor or team, depending on the case
15
     * @return Collection
16
     */
17
    protected function getFighters()
18
    {
19
        return $this->championship->competitors;
20
    }
21
22
    /**
23
     * @param $group
24
     * @param $fighters
25
     * @return FightersGroup
26
     */
27
    public function syncGroup($group, $fighters)
28
    {
29
        // Add all competitors to Pivot Table
30
        $group->syncCompetitors($fighters);
31
        return $group;
32
    }
33
34
    protected function createByeFighter()
35
    {
36
        return new Competitor();
37
    }
38
}
39