Completed
Push — feature/EVO-8294-file-upload-r... ( ebbdfa )
by
unknown
63:34
created

Archive::setLinks()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
/**
3
 * document class for Graviton\ArchiveBundle\Document\Archive
4
 */
5
6
namespace Graviton\ArchiveBundle\Document;
7
8
use Doctrine\Common\Collections\ArrayCollection;
9
10
/**
11
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
12
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
13
 * @link     http://swisscom.ch
14
 */
15
class Archive
16
{
17
    /**
18
     * @var mixed $id
19
     */
20
    protected $id;
21
22
    /**
23
     * @var ArchiveMetadata $metadata
24
     */
25
    protected $metadata;
26
27
    /**
28
     * @var ArchiveLinks $links
29
     */
30
    protected $links;
31
32
    /**
33
     * @var \DateTime $deletedDate
34
     */
35
    protected $deletedDate;
36
37
    /**
38
     * constructor
39
     *
40
     * @return self
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
41
     */
42
    public function __construct()
43
    {
44
        $this->links = new ArrayCollection();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \Doctrine\Common\Collections\ArrayCollection() of type object<Doctrine\Common\C...ctions\ArrayCollection> is incompatible with the declared type object<Graviton\ArchiveB...\Document\ArchiveLinks> of property $links.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
45
    }
46
47
    /**
48
     * Get id
49
     *
50
     * @return string $id
51
     */
52
    public function getId()
53
    {
54
        return $this->id;
55
    }
56
57
    /**
58
     * Set id
59
     *
60
     * @param mixed $id id
61
     *
62
     * @return void
63
     */
64
    public function setId($id)
65
    {
66
        $this->id = $id;
67
    }
68
69
    /**
70
     * Get links
71
     *
72
     * @return ArrayCollection[ArchiveLinks] $links
0 ignored issues
show
Documentation introduced by
The doc-type ArrayCollection[ArchiveLinks] could not be parsed: Expected "]" at position 2, but found "ArchiveLinks". (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
73
     */
74
    public function getLinks()
75
    {
76
        return $this->links;
77
    }
78
79
    /**
80
     * Set links
81
     *
82
     * @param ArchiveLinks[] $links object for links
83
     *
84
     * @return self
85
     */
86
    public function setLinks($links)
87
    {
88
        $this->links = new ArrayCollection($links);
0 ignored issues
show
Documentation Bug introduced by
It seems like new \Doctrine\Common\Col...ArrayCollection($links) of type object<Doctrine\Common\C...ctions\ArrayCollection> is incompatible with the declared type object<Graviton\ArchiveB...\Document\ArchiveLinks> of property $links.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
89
90
        return $this;
91
    }
92
93
    /**
94
     * add element to links
95
     *
96
     * @param ArchiveLinks $link value to add to links
97
     *
98
     * @return void
99
     */
100
    public function addLink(ArchiveLinks $link)
101
    {
102
        $this->links[] = $link;
103
    }
104
105
    /**
106
     * remove element from links
107
     *
108
     * @param ArchiveLinks $link value to remove from links
109
     *
110
     * @return self
111
     */
112
    public function removeLink(ArchiveLinks $link)
113
    {
114
        $this->links->removeElement($link);
0 ignored issues
show
Bug introduced by
The method removeElement() does not seem to exist on object<Graviton\ArchiveB...\Document\ArchiveLinks>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
115
116
        return $this;
117
    }
118
119
    /**
120
     * @return ArchiveMetadata
121
     */
122
    public function getMetadata()
123
    {
124
        return $this->metadata;
125
    }
126
127
    /**
128
     * @param ArchiveMetadata $metadata
129
     */
130
    public function setMetadata($metadata)
131
    {
132
        $this->metadata = $metadata;
133
    }
134
135
}