Completed
Push — master ( 85e358...cf3219 )
by Rakesh
04:24 queued 10s
created

Zend_Gdata_Kind_EventEntry::getDOM()   F

Complexity

Conditions 18
Paths 4096

Size

Total Lines 53
Code Lines 31

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 18
eloc 31
c 1
b 0
f 1
nc 4096
nop 3
dl 0
loc 53
rs 0.7

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/**
3
 * Zend Framework
4
 *
5
 * LICENSE
6
 *
7
 * This source file is subject to the new BSD license that is bundled
8
 * with this package in the file LICENSE.txt.
9
 * It is also available through the world-wide-web at this URL:
10
 * http://framework.zend.com/license/new-bsd
11
 * If you did not receive a copy of the license and are unable to
12
 * obtain it through the world-wide-web, please send an email
13
 * to [email protected] so we can send you a copy immediately.
14
 *
15
 * @category   Zend
16
 * @package    Zend_Gdata
17
 * @subpackage Gdata
18
 * @copyright  Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
19
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
20
 * @version    $Id$
21
 */
22
23
/**
24
 * @see Zend_Gdata_Entry
25
 */
26
require_once 'Zend/Gdata/Entry.php';
27
28
/**
29
 * @see Zend_Gdata_App_Extension
30
 */
31
require_once 'Zend/Gdata/App/Extension.php';
32
33
/**
34
 * @see Zend_Gdata_Extension_Where
35
 */
36
require_once 'Zend/Gdata/Extension/Where.php';
37
38
/**
39
 * @see Zend_Gdata_Extension_When
40
 */
41
require_once 'Zend/Gdata/Extension/When.php';
42
43
/**
44
 * @see Zend_Gdata_Extension_Who
45
 */
46
require_once 'Zend/Gdata/Extension/Who.php';
47
48
/**
49
 * @see Zend_Gdata_Extension_Recurrence
50
 */
51
require_once 'Zend/Gdata/Extension/Recurrence.php';
52
53
/**
54
 * @see Zend_Gdata_Extension_EventStatus
55
 */
56
require_once 'Zend/Gdata/Extension/EventStatus.php';
57
58
/**
59
 * @see Zend_Gdata_Extension_Comments
60
 */
61
require_once 'Zend/Gdata/Extension/Comments.php';
62
63
/**
64
 * @see Zend_Gdata_Extension_Transparency
65
 */
66
require_once 'Zend/Gdata/Extension/Transparency.php';
67
68
/**
69
 * @see Zend_Gdata_Extension_Visibility
70
 */
71
require_once 'Zend/Gdata/Extension/Visibility.php';
72
73
/**
74
 * @see Zend_Gdata_Extension_ExtendedProperty
75
 */
76
require_once 'Zend/Gdata/Extension/ExtendedProperty.php';
77
78
/**
79
 * @see Zend_Gdata_Extension_OriginalEvent
80
 */
81
require_once 'Zend/Gdata/Extension/OriginalEvent.php';
82
83
/**
84
 * @see Zend_Gdata_Extension_EntryLink
85
 */
86
require_once 'Zend/Gdata/Extension/EntryLink.php';
87
88
/**
89
 * Data model for the Gdata Event "Kind".  Google Calendar has a separate
90
 * EventEntry class which extends this.
91
 *
92
 * @category   Zend
93
 * @package    Zend_Gdata
94
 * @subpackage Gdata
95
 * @copyright  Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
96
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
97
 */
98
class Zend_Gdata_Kind_EventEntry extends Zend_Gdata_Entry
99
{
100
    protected $_who = array();
101
    protected $_when = array();
102
    protected $_where = array();
103
    protected $_recurrence = null;
104
    protected $_eventStatus = null;
105
    protected $_comments = null;
106
    protected $_transparency = null;
107
    protected $_visibility = null;
108
    protected $_recurrenceException = array();
109
    protected $_extendedProperty = array();
110
    protected $_originalEvent = null;
111
    protected $_entryLink = null;
112
113
    public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
114
    {
115
        $element = parent::getDOM($doc, $majorVersion, $minorVersion);
116
        if ($this->_who != null) {
117
            foreach ($this->_who as $who) {
118
                $element->appendChild($who->getDOM($element->ownerDocument));
119
            }
120
        }
121
        if ($this->_when != null) {
122
            foreach ($this->_when as $when) {
123
                $element->appendChild($when->getDOM($element->ownerDocument));
124
            }
125
        }
126
        if ($this->_where != null) {
127
            foreach ($this->_where as $where) {
128
                $element->appendChild($where->getDOM($element->ownerDocument));
129
            }
130
        }
131
        if ($this->_recurrenceException != null) {
132
            foreach ($this->_recurrenceException as $recurrenceException) {
133
                $element->appendChild($recurrenceException->getDOM($element->ownerDocument));
134
            }
135
        }
136
        if ($this->_extendedProperty != null) {
137
            foreach ($this->_extendedProperty as $extProp) {
138
                $element->appendChild($extProp->getDOM($element->ownerDocument));
139
            }
140
        }
141
142
        if ($this->_recurrence != null) {
143
            $element->appendChild($this->_recurrence->getDOM($element->ownerDocument));
144
        }
145
        if ($this->_eventStatus != null) {
146
            $element->appendChild($this->_eventStatus->getDOM($element->ownerDocument));
147
        }
148
        if ($this->_comments != null) {
149
            $element->appendChild($this->_comments->getDOM($element->ownerDocument));
150
        }
151
        if ($this->_transparency != null) {
152
            $element->appendChild($this->_transparency->getDOM($element->ownerDocument));
153
        }
154
        if ($this->_visibility != null) {
155
            $element->appendChild($this->_visibility->getDOM($element->ownerDocument));
156
        }
157
        if ($this->_originalEvent != null) {
158
            $element->appendChild($this->_originalEvent->getDOM($element->ownerDocument));
159
        }
160
        if ($this->_entryLink != null) {
161
            $element->appendChild($this->_entryLink->getDOM($element->ownerDocument));
162
        }
163
164
165
        return $element;
166
    }
167
168
    protected function takeChildFromDOM($child)
169
    {
170
        $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
171
        switch ($absoluteNodeName) {
172
        case $this->lookupNamespace('gd') . ':' . 'where';
173
            $where = new Zend_Gdata_Extension_Where();
174
            $where->transferFromDOM($child);
175
            $this->_where[] = $where;
176
            break;
177
        case $this->lookupNamespace('gd') . ':' . 'when';
178
            $when = new Zend_Gdata_Extension_When();
179
            $when->transferFromDOM($child);
180
            $this->_when[] = $when;
181
            break;
182
        case $this->lookupNamespace('gd') . ':' . 'who';
183
            $who = new Zend_Gdata_Extension_Who();
184
            $who ->transferFromDOM($child);
185
            $this->_who[] = $who;
186
            break;
187
        case $this->lookupNamespace('gd') . ':' . 'recurrence';
188
            $recurrence = new Zend_Gdata_Extension_Recurrence();
189
            $recurrence->transferFromDOM($child);
190
            $this->_recurrence = $recurrence;
191
            break;
192
        case $this->lookupNamespace('gd') . ':' . 'eventStatus';
193
            $eventStatus = new Zend_Gdata_Extension_EventStatus();
194
            $eventStatus->transferFromDOM($child);
195
            $this->_eventStatus = $eventStatus;
196
            break;
197
        case $this->lookupNamespace('gd') . ':' . 'comments';
198
            $comments = new Zend_Gdata_Extension_Comments();
199
            $comments->transferFromDOM($child);
200
            $this->_comments = $comments;
201
            break;
202
        case $this->lookupNamespace('gd') . ':' . 'transparency';
203
            $transparency = new Zend_Gdata_Extension_Transparency();
204
            $transparency ->transferFromDOM($child);
205
            $this->_transparency = $transparency;
206
            break;
207
        case $this->lookupNamespace('gd') . ':' . 'visibility';
208
            $visiblity = new Zend_Gdata_Extension_Visibility();
209
            $visiblity ->transferFromDOM($child);
210
            $this->_visibility = $visiblity;
211
            break;
212
        case $this->lookupNamespace('gd') . ':' . 'recurrenceException';
213
            require_once 'Zend/Gdata/Extension/RecurrenceException.php';
214
            $recurrenceException = new Zend_Gdata_Extension_RecurrenceException();
215
            $recurrenceException ->transferFromDOM($child);
216
            $this->_recurrenceException[] = $recurrenceException;
217
            break;
218
        case $this->lookupNamespace('gd') . ':' . 'originalEvent';
219
            $originalEvent = new Zend_Gdata_Extension_OriginalEvent();
220
            $originalEvent ->transferFromDOM($child);
221
            $this->_originalEvent = $originalEvent;
222
            break;
223
        case $this->lookupNamespace('gd') . ':' . 'extendedProperty';
224
            $extProp = new Zend_Gdata_Extension_ExtendedProperty();
225
            $extProp->transferFromDOM($child);
226
            $this->_extendedProperty[] = $extProp;
227
            break;
228
        case $this->lookupNamespace('gd') . ':' . 'entryLink':
229
            $entryLink = new Zend_Gdata_Extension_EntryLink();
230
            $entryLink->transferFromDOM($child);
231
            $this->_entryLink = $entryLink;
232
            break;
233
234
        default:
235
            parent::takeChildFromDOM($child);
236
            break;
237
        }
238
    }
239
240
    public function getWhen()
241
    {
242
        return $this->_when;
243
    }
244
245
    /**
246
     * @param array $value
247
     * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface
248
     */
249
    public function setWhen($value)
250
    {
251
        $this->_when = $value;
252
        return $this;
253
    }
254
255
    public function getWhere()
256
    {
257
        return $this->_where;
258
    }
259
260
    /**
261
     * @param array $value
262
     * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface
263
     */
264
    public function setWhere($value)
265
    {
266
        $this->_where = $value;
267
        return $this;
268
    }
269
270
    public function getWho()
271
    {
272
        return $this->_who;
273
    }
274
275
    /**
276
     * @param array $value
277
     * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface
278
     */
279
    public function setWho($value)
280
    {
281
        $this->_who = $value;
282
        return $this;
283
    }
284
285
    public function getRecurrence()
286
    {
287
        return $this->_recurrence;
288
    }
289
290
    /**
291
     * @param array $value
292
     * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface
293
     */
294
    public function setRecurrence($value)
295
    {
296
        $this->_recurrence = $value;
297
        return $this;
298
    }
299
300
    public function getEventStatus()
301
    {
302
        return $this->_eventStatus;
303
    }
304
305
    /**
306
     * @param array $value
307
     * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface
308
     */
309
    public function setEventStatus($value)
310
    {
311
        $this->_eventStatus = $value;
312
        return $this;
313
    }
314
315
    public function getComments()
316
    {
317
        return $this->_comments;
318
    }
319
320
    /**
321
     * @param array $value
322
     * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface
323
     */
324
    public function setComments($value)
325
    {
326
        $this->_comments = $value;
327
        return $this;
328
    }
329
330
    public function getTransparency()
331
    {
332
        return $this->_transparency;
333
    }
334
335
    /**
336
     * @param Zend_Gdata_Transparency $value
0 ignored issues
show
Bug introduced by
The type Zend_Gdata_Transparency was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
337
     * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface
338
     */
339
    public function setTransparency($value)
340
    {
341
        $this->_transparency = $value;
342
        return $this;
343
    }
344
345
    public function getVisibility()
346
    {
347
        return $this->_visibility;
348
    }
349
350
    /**
351
     * @param Zend_Gdata_Visibility $value
0 ignored issues
show
Bug introduced by
The type Zend_Gdata_Visibility was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
352
     * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface
353
     */
354
    public function setVisibility($value)
355
    {
356
        $this->_visibility = $value;
357
        return $this;
358
    }
359
360
    public function getRecurrenceExcption()
361
    {
362
        return $this->_recurrenceException;
363
    }
364
365
    /**
366
     * @param array $value
367
     * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface
368
     */
369
    public function setRecurrenceException($value)
370
    {
371
        $this->_recurrenceException = $value;
372
        return $this;
373
    }
374
375
    public function getExtendedProperty()
376
    {
377
        return $this->_extendedProperty;
378
    }
379
380
    /**
381
     * @param array $value
382
     * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface
383
     */
384
    public function setExtendedProperty($value)
385
    {
386
        $this->_extendedProperty = $value;
387
        return $this;
388
    }
389
390
    public function getOriginalEvent()
391
    {
392
        return $this->_originalEvent;
393
    }
394
395
    /**
396
     * @param Zend_Gdata_Extension_OriginalEvent $value
397
     * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface
398
     */
399
    public function setOriginalEvent($value)
400
    {
401
        $this->_originalEvent = $value;
402
        return $this;
403
    }
404
405
    /**
406
     * Get this entry's EntryLink element.
407
     *
408
     * @return Zend_Gdata_Extension_EntryLink The requested entry.
409
     */
410
    public function getEntryLink()
411
    {
412
        return $this->_entryLink;
413
    }
414
415
    /**
416
     * Set the child's EntryLink element.
417
     *
418
     * @param Zend_Gdata_Extension_EntryLink $value The desired value for this attribute.
419
     * @return Zend_Gdata_Extension_Who The element being modified.
420
     */
421
    public function setEntryLink($value)
422
    {
423
        $this->_entryLink = $value;
424
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Zend_Gdata_Kind_EventEntry which is incompatible with the documented return type Zend_Gdata_Extension_Who.
Loading history...
425
    }
426
427
428
}
429