ScoreService::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 1
eloc 10
nc 1
nop 5
1
<?php namespace GolfLeague\Services;
2
3
use GolfLeague\Storage\Match\MatchRepository;
4
use GolfLeague\Storage\HoleScore\HoleScoreRepository as HoleScoreRepo;
5
use \Player;
6
use \Match;
7
use Illuminate\Events\Dispatcher;
8
9
/**
10
* ScoreService, containing all useful methods for business logic for scoring a round
11
*/
12
class ScoreService
13
{
14
15
    // Containing our matchRepository to make all our database calls
16
    protected $matchRepo;
17
18
    /**
19
    * Loads our $matchRepo
20
    *
21
    * @param MatchRepository $matchRepo
22
    * @return MatchService
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
23
    */
24
    public function __construct(MatchRepository $matchRepo,
25
                                HoleScoreRepo $holeScoreRepo,
26
                                Player $player,
27
                                Match $match,
28
                                Dispatcher $events)
29
    {
30
        $this->matchRepo = $matchRepo;
31
        $this->holeScoreRepo = $holeScoreRepo;
0 ignored issues
show
Bug introduced by
The property holeScoreRepo does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
32
        $this->player = $player;
0 ignored issues
show
Bug introduced by
The property player does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
33
        $this->match = $match;
0 ignored issues
show
Bug introduced by
The property match does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
34
        $this->events = $events;
0 ignored issues
show
Bug introduced by
The property events does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
35
    }
36
37
    public function update($id, $score)
38
    {
39
        $this->holeScoreRepo->update($id, $score);
40
    }
41
}
42