1 | <?php |
||
48 | class ContactObjectMutator extends AbstractObjectMutator |
||
49 | { |
||
50 | /** |
||
51 | * Initialize the article |
||
52 | * |
||
53 | * @param ObjectInterface $object Article |
||
54 | * @return ObjectInterface Article |
||
55 | */ |
||
56 | public function initialize(ObjectInterface $object) |
||
86 | |||
87 | /** |
||
88 | * Mutate the article |
||
89 | * |
||
90 | * @param ObjectInterface $object Article |
||
91 | * @return ObjectInterface Article |
||
92 | */ |
||
93 | public function mutate(ObjectInterface $object) |
||
106 | |||
107 | /** |
||
108 | * Set the article title |
||
109 | * |
||
110 | * @param ObjectInterface $object Article |
||
111 | * @return ObjectInterface $object Article |
||
112 | */ |
||
113 | protected function setTitle(ObjectInterface $object) |
||
117 | /** |
||
118 | * Set the article description |
||
119 | * |
||
120 | * @param ObjectInterface $object Article |
||
121 | * @return ObjectInterface $object Article |
||
122 | */ |
||
123 | protected function setDescription(ObjectInterface $object) |
||
127 | |||
128 | /** |
||
129 | * Set the article abstract |
||
130 | * |
||
131 | * @param ObjectInterface $object Article |
||
132 | * @return ObjectInterface $object Article |
||
133 | */ |
||
134 | protected function setAbstract(ObjectInterface $object) |
||
138 | |||
139 | /** |
||
140 | * Set the article keywords |
||
141 | * |
||
142 | * @param ObjectInterface $object Article |
||
143 | * @return ObjectInterface $object Article |
||
144 | */ |
||
145 | protected function setKeywords(ObjectInterface $object) |
||
149 | |||
150 | /** |
||
151 | * Set the article categories |
||
152 | * |
||
153 | * @param ObjectInterface $object Article |
||
154 | * @return ObjectInterface $object Article |
||
155 | */ |
||
156 | protected function setCategories(ObjectInterface $object) |
||
160 | |||
161 | /** |
||
162 | * Set the article authors |
||
163 | * |
||
164 | * @param ObjectInterface $object Article |
||
165 | * @return ObjectInterface $object Article |
||
166 | */ |
||
167 | protected function setAuthors(ObjectInterface $object) |
||
171 | } |
||
172 |
PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.
Let’s take a look at an example:
If we look at the
getEmail()
method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:On the hand, if we look at the
setEmail()
, this method _has_ side-effects. In the following case, we could not remove the method call: