Completed
Push — sdk ( 5a9985...c7ab5a )
by Aymen
07:04
created

Applications::addApplication()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
dl 6
loc 6
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
/**
3
 * This file is part of the fnayou/instapush-php project.
4
 *
5
 * Copyright (c) 2017. Aymen FNAYOU <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Fnayou\InstapushPHP\Model;
12
13
use Doctrine\Common\Collections\ArrayCollection;
14
15
/**
16
 * Model Applications.
17
 */
18 View Code Duplication
class Applications extends ArrayCollection implements FromArrayInterface
1 ignored issue
show
Duplication introduced by
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...
19
{
20
    /**
21
     * @param Application $application
22
     *
23
     * @return $this
24
     */
25
    public function addApplication(Application $application)
26
    {
27
        $this->add($application);
28
29
        return $this;
30
    }
31
32
    /**
33
     * @param Application $application
34
     */
35
    public function removeApplication(Application $application)
36
    {
37
        $this->removeElement($application);
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public static function fromArray(array $data)
44
    {
45
        $applications = [];
46
47
        foreach ($data as $datum) {
48
            $applications[] = Application::fromArray($datum);
49
        }
50
51
        return new static($applications);
52
    }
53
}
54