Completed
Push — master ( 69bbac...c6a45b )
by Dragos
03:11
created

Workout::author()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace SportTrackerConnector\Core\Workout;
6
7
/**
8
 * A workout.
9
 */
10
class Workout
11
{
12
    /**
13
     * The author of a workout.
14
     *
15
     * @var Author
16
     */
17
    protected $author;
18
19
    /**
20
     * The tracks of the workout.
21
     *
22
     * @var Track[]
23
     */
24
    protected $tracks = array();
25
26
    /**
27
     * Set the author of a workout.
28
     *
29
     * @param Author $author The author.
30
     */
31
    public function setAuthor(Author $author)
32
    {
33
        $this->author = $author;
34
    }
35
36
    /**
37
     * Get the author of the workout.
38
     *
39
     * @return Author
40
     */
41
    public function author()
42
    {
43
        return $this->author;
44
    }
45
46
    /**
47
     * Add a track.
48
     *
49
     * @param Track $track The track to add.
50
     */
51
    public function addTrack(Track $track)
52
    {
53
        $this->tracks[] = $track;
54
    }
55
56
    /**
57
     * Set the tracks.
58
     *
59
     * @param Track[] $tracks The tracks to set.
60
     */
61
    public function setTracks(array $tracks)
62
    {
63
        $this->tracks = array();
64
65
        foreach ($tracks as $track) {
66
            $this->addTrack($track);
67
        }
68
    }
69
70
    /**
71
     * Get the tracks.
72
     *
73
     * @return Track[]
74
     */
75
    public function tracks()
76
    {
77
        return $this->tracks;
78
    }
79
}
80