GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

GenericMultiCalDAVResponse   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
eloc 17
c 1
b 0
f 0
dl 0
loc 50
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A isSuccessFull() 0 3 1
A buildSingleResponse() 0 3 1
A getResponses() 0 2 1
A parse() 0 18 4
1
<?php namespace CalDAVClient\Facade\Responses;
2
/**
3
 * Copyright 2017 OpenStack Foundation
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 * http://www.apache.org/licenses/LICENSE-2.0
8
 * Unless required by applicable law or agreed to in writing, software
9
 * distributed under the License is distributed on an "AS IS" BASIS,
10
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
 * See the License for the specific language governing permissions and
12
 * limitations under the License.
13
 **/
14
15
/**
16
 * Class GenericMultiCalDAVResponse
17
 * @package CalDAVClient\Facade\Responses
18
 */
19
class GenericMultiCalDAVResponse extends AbstractCalDAVResponse
20
{
21
    /**
22
     * @var GenericSinglePROPFINDCalDAVResponse[]
23
     */
24
    protected $responses = [];
25
26
    protected function parse()
27
    {
28
        if(isset($this->content['response'])){
29
30
            if(isset($this->content['response']['propstat'])) {
31
                // its a collection with one single element
32
                $single_resource = $this->buildSingleResponse();
33
                $single_resource->setContent(['response' => $this->content['response']]);
34
                $single_resource->parse();
35
                $this->responses[] = $single_resource;
36
                return;
37
            }
38
39
            foreach ($this->content['response'] as $val) {
40
                $single_resource = $this->buildSingleResponse();
41
                $single_resource->setContent(['response' => $val]);
42
                $single_resource->parse();
43
                $this->responses[] = $single_resource;
44
            }
45
        }
46
    }
47
48
    /**
49
     * @return GenericSinglePROPFINDCalDAVResponse[]
50
     */
51
    public function getResponses(){
52
        return $this->responses;
53
    }
54
55
    /**
56
     * @return GenericSinglePROPFINDCalDAVResponse
57
     */
58
    protected function buildSingleResponse()
59
    {
60
        return new GenericSinglePROPFINDCalDAVResponse();
61
    }
62
63
    /**
64
     * @return bool
65
     */
66
    public function isSuccessFull()
67
    {
68
        return $this->code == HttpResponse::HttpCodeMultiResponse;
69
    }
70
}