Passed
Branch master (203e41)
by Nate
01:56
created

Path   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 24
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A allowMultiple() 0 4 1
A converterType() 0 4 1
1
<?php
2
/*
3
 * Copyright (c) Nate Brunette.
4
 * Distributed under the MIT License (http://opensource.org/licenses/MIT)
5
 */
6
7
declare(strict_types=1);
8
9
namespace Tebru\Retrofit\Annotation;
10
11
use Tebru\Retrofit\StringConverter;
12
13
/**
14
 * Specifies replaceable parts in a url path
15
 *
16
 * Given this service method
17
 *
18
 * /**
19
 *  * @GET("/foo/{my-path}")
20
 *  * @Path("my-path", var="myPath")
21
 *  *
22
 *  public function foo(string $myPath): Call;
23
 *
24
 * Passing in "bar" will result in the path "/foo/bar". The 'var' key is unnecessary if
25
 * the path value inside the {} matches the variable name.
26
 *
27
 * @author Nate Brunette <[email protected]>
28
 *
29
 * @Annotation
30
 * @Target({"CLASS", "METHOD"})
31
 */
32
class Path extends ParameterAnnotation
33
{
34
    /**
35
     * Returns true if multiple annotations of this type are allowed
36
     *
37
     * @return bool
38
     */
39 1
    public function allowMultiple(): bool
40
    {
41 1
        return true;
42
    }
43
44
    /**
45
     * Return the converter interface class
46
     *
47
     * Can be one of RequestBodyConverter, ResponseBodyConverter, or StringConverter
48
     *
49
     * @return string
50
     */
51 1
    public function converterType(): ?string
52
    {
53 1
        return StringConverter::class;
54
    }
55
}
56