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

Path::converterType()   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 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 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