EloquentPlayerRepository::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php namespace GolfLeague\Storage\Player;
2
3
use \Player as Player;
4
5
class EloquentPlayerRepository implements PlayerRepository
6
{
7
  /*Return Score collections that include:
8
   * Player Name
9
   * Date
10
   * Total
11
   * Course
12
   * Multideminsional Array of Hole Numbers and scores   *
13
   **/
14
	public function __construct(Player $player)
15
    {
16
		$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...
17
    }
18
19
    public function all()
20
    {
21
        return $this->player->orderBy('handicap','asc')->get();
22
    }
23
24
    //Find Player by Player Id
25
    public function find($playerId)
26
    {
27
        return $this->player->find($playerId);
28
    }
29
30
    public function create($name, $handicap)
31
    {
32
		$this->player->name = $name;
33
		$this->player->handicap = $handicap;
34
		$this->player->save();
35
    }
36
37
}
38