This class seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
15
{
16
/**
17
* @param mixed $data
18
*
19
* @return Contact|ContactCollection
20
* @throws MailxpertSDKException
21
*/
22
public static function parse($data)
23
{
24
return parent::parse($data);
25
}
26
27
/**
28
* @param $data
29
*
30
* @return ContactCollection
31
*/
32
protected static function buildCollection($data)
33
{
34
$contacts = new ContactCollection();
35
36
foreach ($data as $contactData) {
37
$contact = static::buildElement($contactData);
38
$contacts->add($contact);
39
}
40
41
return $contacts;
42
}
43
44
/**
45
* @param $data
46
*
47
* @return Contact
48
*/
49
protected static function buildElement($data)
50
{
51
$contact = new Contact($data['email'], $data['id']);
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.