Completed
Push — master ( a4b03a...366fbf )
by Rafael
02:33
created

Game::__populate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 5
nc 1
nop 2
1
<?php
2
3
/**
4
 * LICENSE: This file is subject to the terms and conditions defined in
5
 * file 'LICENSE', which is part of this source code package.
6
 *
7
 * @copyright 2016 Copyright(c) - All rights reserved.
8
 */
9
10
namespace Rafrsr\LibArray2Object\Tests\Fixtures;
11
12
use Rafrsr\LibArray2Object\Array2Object;
13
use Rafrsr\LibArray2Object\Array2ObjectInterface;
14
15
class Game implements Array2ObjectInterface
16
{
17
18
    protected $stadiumName;
19
20
    protected $date;
21
22
    protected $homeClub;
23
24
    protected $visitor;
25
26
    /**
27
     * @return mixed
28
     */
29
    public function getStadiumName()
30
    {
31
        return $this->stadiumName;
32
    }
33
34
    /**
35
     * @param mixed $stadiumName
36
     *
37
     * @return $this
38
     */
39
    public function setStadiumName($stadiumName)
40
    {
41
        $this->stadiumName = $stadiumName;
42
43
        return $this;
44
    }
45
46
    /**
47
     * @return \DateTime
48
     */
49
    public function getDate()
50
    {
51
        return $this->date;
52
    }
53
54
    /**
55
     * @param \DateTime $date
56
     *
57
     * @return $this
58
     */
59
    public function setDate($date)
60
    {
61
        $this->date = $date;
62
63
        return $this;
64
    }
65
66
    /**
67
     * @return Team
68
     */
69
    public function getHomeClub()
70
    {
71
        return $this->homeClub;
72
    }
73
74
    /**
75
     * @param Team $homeClub
76
     *
77
     * @return $this
78
     */
79
    public function setHomeClub($homeClub)
80
    {
81
        $this->homeClub = $homeClub;
82
83
        return $this;
84
    }
85
86
    /**
87
     * @return Team
88
     */
89
    public function getVisitor()
90
    {
91
        return $this->visitor;
92
    }
93
94
    /**
95
     * @param Team $visitor
96
     *
97
     * @return $this
98
     */
99
    public function setVisitor($visitor)
100
    {
101
        $this->visitor = $visitor;
102
103
        return $this;
104
    }
105
106
    /**
107
     * @inheritDoc
108
     */
109
    public function __populate(Array2Object $array2Object, array $data)
110
    {
111
        $this->setDate(new \DateTime($data['date']));
112
        $this->setStadiumName($data['stadium']);
113
        $this->setHomeClub($array2Object->createObject(Team::class, $data['homeClub']));
114
        $this->setVisitor($array2Object->createObject(Team::class, $data['visitor']));
115
    }
116
}