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.
Completed
Push — master ( fa9233...7f89d9 )
by Tomas
06:55
created

MethodParser::getDoc()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 4
rs 10
ccs 2
cts 2
cp 1
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * Copyright (C) 2013-2015
4
 * Piotr Olaszewski <[email protected]>
5
 *
6
 * Permission is hereby granted, free of charge, to any person obtaining a copy
7
 * of this software and associated documentation files (the "Software"), to deal
8
 * in the Software without restriction, including without limitation the rights
9
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
 * copies of the Software, and to permit persons to whom the Software is
11
 * furnished to do so, subject to the following conditions:
12
 *
13
 * The above copyright notice and this permission notice shall be included in
14
 * all copies or substantial portions of the Software.
15
 *
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
 * SOFTWARE.
23
 */
24
namespace WSDL\Parser;
25
26
use Ouzo\Utilities\Arrays;
27
use Ouzo\Utilities\Functions;
28
use WSDL\Types\Type;
29
30
/**
31
 * MethodParser
32
 *
33
 * @author Piotr Olaszewski <[email protected]>
34
 */
35
class MethodParser
36
{
37
    /**
38
     * @var string
39
     */
40
    private $name;
41
    /**
42
     * @var string
43
     */
44
    private $doc;
45
    /**
46
     * @var array
47
     */
48
    private $rawParameters;
49
    /**
50
     * @var string
51
     */
52
    private $rawReturn;
53
54 39
    public function __construct($name, $doc)
55
    {
56 39
        $this->name = $name;
57 39
        $this->doc = $doc;
58 39
    }
59
60
    /**
61
     * @return string
62
     */
63 8
    public function description()
64
    {
65 8
        preg_match('#@desc (.+)#', $this->doc, $groupMatches);
66 8
        $trimGroupMatches = Arrays::map($groupMatches, Functions::trim());
67 8
        return Arrays::getValue($trimGroupMatches, 1, '');
68
    }
69
70
    /**
71
     * @return Type[]
72
     */
73 30
    public function parameters()
74
    {
75 30
        preg_match_all('#@param (.+)#', $this->doc, $groupMatches);
76 30
        $this->rawParameters = $groupMatches[1];
77 30
        return ParameterParser::create($groupMatches[1], $this->getName());
78
    }
79
80
    /**
81
     * @return Type
82
     */
83 17
    public function returning()
84
    {
85 17
        preg_match('#@return (.+)#', $this->doc, $groupMatches);
86 17
        $trimGroupMatches = array_map('trim', $groupMatches);
87 17
        if (isset($trimGroupMatches[1])) {
88 17
            $this->rawReturn = $trimGroupMatches[1];
89 17
        }
90 17
        $parameterParser = new ParameterParser($this->rawReturn, $this->getName());
91 17
        return $parameterParser->parse();
92
    }
93
94
    /**
95
     * @return string
96
     */
97 1
    public function getDoc()
98
    {
99 1
        return $this->doc;
100
    }
101
102
    /**
103
     * @return string
104
     */
105 37
    public function getName()
106
    {
107 37
        return $this->name;
108
    }
109
110
    /**
111
     * @return array
112
     */
113 1
    public function getRawParameters()
114
    {
115 1
        $this->parameters();
116 1
        return $this->rawParameters;
117
    }
118
119
    /**
120
     * @return string
121
     */
122 1
    public function getRawReturn()
123
    {
124 1
        $this->returning();
125 1
        return $this->rawReturn;
126
    }
127
}
128