MethodHelp   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 19
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 9 2
1
<?php namespace Comodojo\RpcServer\Introspection;
2
3
use \Comodojo\RpcServer\Request\Parameters;
4
use \Comodojo\Exception\RpcException;
5
6
/**
7
 * The system.methodHelp method implementation
8
 *
9
 * @package     Comodojo Spare Parts
10
 * @author      Marco Giovinazzi <[email protected]>
11
 * @license     MIT
12
 *
13
 * LICENSE:
14
 *
15
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
 * THE SOFTWARE.
22
 */
23
24
class MethodHelp {
25
26
    /**
27
     * Execute call
28
     *
29
     * @param Parameters $params
30
     *
31
     * @return string
32
     * @throws RpcException
33
     */
34 12
    final public static function execute(Parameters $params) {
35
36 12
        $asked_method = $params->get('method');
37
38 12
        $method = $params->methods()->get($asked_method);
0 ignored issues
show
Deprecated Code introduced by
The function Comodojo\RpcServer\Request\Parameters::methods() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

38
        $method = /** @scrutinizer ignore-deprecated */ $params->methods()->get($asked_method);
Loading history...
39
40 12
        if ( is_null($method) ) throw new RpcException("Method not found", -32601);
41
42 12
        return $method->getDescription();
43
44
    }
45
46
}
47