1
|
|
|
<?php |
2
|
|
|
namespace Pbxg33k\MusicInfo\Service\MusicBrainz\Endpoint; |
3
|
|
|
|
4
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
5
|
|
|
use MusicBrainz\Filters\RecordingFilter; |
6
|
|
|
use Pbxg33k\MusicInfo\Model\BaseModel; |
7
|
|
|
use Pbxg33k\MusicInfo\Model\Song as SongModel; |
8
|
|
|
use Pbxg33k\MusicInfo\Model\IMusicServiceEndpoint; |
9
|
|
|
use Pbxg33k\MusicInfo\Service\MusicBrainz\Service; |
10
|
|
|
|
11
|
|
|
class Song implements IMusicServiceEndpoint |
12
|
|
|
{ |
13
|
|
|
protected $parent; |
14
|
|
|
|
15
|
|
|
public function __construct($parent) |
16
|
|
|
{ |
17
|
|
|
$this->parent = $parent; |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @param $apiService |
22
|
|
|
* |
23
|
|
|
* @return mixed |
24
|
|
|
*/ |
25
|
|
|
public function setParent($apiService) |
26
|
|
|
{ |
27
|
|
|
$this->parent = $apiService; |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Transform single item to model |
32
|
|
|
* |
33
|
|
|
* @param $raw |
34
|
|
|
* |
35
|
|
|
* @return BaseModel |
36
|
|
|
*/ |
37
|
|
|
public function transformSingle($raw) |
38
|
|
|
{ |
39
|
|
|
$object = new SongModel(); |
40
|
|
|
$object |
41
|
|
|
->setId($raw->id) |
42
|
|
|
->setTitle($raw->title) |
43
|
|
|
->setDuration($raw->length) |
44
|
|
|
->setIsrc($raw->isrc); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Transform collection to models |
49
|
|
|
* |
50
|
|
|
* @param $raw |
51
|
|
|
* |
52
|
|
|
* @return ArrayCollection |
53
|
|
|
*/ |
54
|
|
|
public function transformCollection($raw) |
55
|
|
|
{ |
56
|
|
|
// TODO: Implement transformCollection() method. |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Transform to models |
61
|
|
|
* |
62
|
|
|
* @param $raw |
63
|
|
|
* |
64
|
|
|
* @return ArrayCollection |
65
|
|
|
*/ |
66
|
|
|
public function transform($raw) |
67
|
|
|
{ |
68
|
|
|
// TODO: Implement transform() method. |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @return mixed |
73
|
|
|
*/ |
74
|
|
|
public function getParent() |
75
|
|
|
{ |
76
|
|
|
// TODO: Implement getParent() method. |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @param $arguments |
81
|
|
|
* |
82
|
|
|
* @return mixed |
83
|
|
|
*/ |
84
|
|
|
public function get($arguments) |
85
|
|
|
{ |
86
|
|
|
// TODO: Implement get() method. |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @param $arguments |
91
|
|
|
* |
92
|
|
|
* @return mixed |
93
|
|
|
*/ |
94
|
|
|
public function getComplete($arguments) |
95
|
|
|
{ |
96
|
|
|
// TODO: Implement getComplete() method. |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @param $id |
101
|
|
|
* |
102
|
|
|
* @return mixed |
103
|
|
|
*/ |
104
|
|
|
public function getById($id) |
105
|
|
|
{ |
106
|
|
|
// TODO: Implement getById() method. |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @param $name |
111
|
|
|
* |
112
|
|
|
* @return mixed |
113
|
|
|
*/ |
114
|
|
|
public function getByName($name) |
115
|
|
|
{ |
116
|
|
|
// TODO: Implement getByName() method. |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* @param $guid |
121
|
|
|
* |
122
|
|
|
* @return mixed |
123
|
|
|
*/ |
124
|
|
|
public function getByGuid($guid) |
125
|
|
|
{ |
126
|
|
|
// TODO: Implement getByGuid() method. |
127
|
|
|
} |
128
|
|
|
} |