Passed
Push — master ( a646e4...d7c664 )
by Mariano
02:11
created

getRequest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * This file is part of Phiremock.
4
 *
5
 * Phiremock is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU Lesser General Public License as published by
7
 * the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * Phiremock is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with Phiremock.  If not, see <http://www.gnu.org/licenses/>.
17
 */
18
19
namespace Mcustiel\Phiremock\Client;
20
21
use Mcustiel\Phiremock\Client\Utils\A;
22
use Mcustiel\Phiremock\Client\Utils\ConditionsBuilder;
23
use Mcustiel\Phiremock\Client\Utils\HttpResponseBuilder;
24
use Mcustiel\Phiremock\Client\Utils\Is;
25
use Mcustiel\Phiremock\Client\Utils\Proxy;
26
use Mcustiel\Phiremock\Client\Utils\ProxyResponseBuilder;
27
use Mcustiel\Phiremock\Client\Utils\Respond;
28
use Mcustiel\Phiremock\Domain\Condition\Matchers\CaseInsensitiveEquals;
29
use Mcustiel\Phiremock\Domain\Condition\Matchers\Contains;
30
use Mcustiel\Phiremock\Domain\Condition\Matchers\Equals;
31
use Mcustiel\Phiremock\Domain\Condition\Matchers\JsonEquals;
32
use Mcustiel\Phiremock\Domain\Condition\Matchers\RegExp;
33
34
// ConditionBuilder creators
35
36
function request(): ConditionsBuilder
37
{
38
    return new ConditionsBuilder();
39
}
40
41
function getRequest(): ConditionsBuilder
42
{
43
    return A::getRequest();
44
}
45
46
function postRequest(): ConditionsBuilder
47
{
48
    return A::postRequest();
49
}
50
51
function putRequest(): ConditionsBuilder
52
{
53
    return A::putRequest();
54
}
55
56
function deleteRequest(): ConditionsBuilder
57
{
58
    return A::deleteRequest();
59
}
60
61
function patchRequest(): ConditionsBuilder
62
{
63
    return A::patchRequest();
64
}
65
66
function headRequest(): ConditionsBuilder
67
{
68
    return A::headRequest();
69
}
70
71
function optionsRequest(): ConditionsBuilder
72
{
73
    return A::optionsRequest();
74
}
75
76
function fetchRequest(): ConditionsBuilder
77
{
78
    return A::fetchRequest();
79
}
80
81
function linkRequest(): ConditionsBuilder
82
{
83
    return A::linkRequest();
84
}
85
86
// Matcher creators
87
88
function isEqualTo($value): Equals
89
{
90
    return Is::equalTo($value);
91
}
92
93
function isSameStringAs(string $value): CaseInsensitiveEquals
94
{
95
    return Is::sameStringAs($value);
96
}
97
98
function matchesRegex(string $value): RegExp
99
{
100
    return Is::matching($value);
101
}
102
103
function isSameJsonAs($value): JsonEquals
104
{
105
    return Is::sameJsonObjectAs($value);
106
}
107
108
function contains(string $value): Contains
109
{
110
    return Is::containing($value);
111
}
112
113
// ResponseBuilder creators
114
115
function respond(int $statusCode): HttpResponseBuilder
116
{
117
    return Respond::withStatusCode($statusCode);
118
}
119
120
function proxyTo(string $url): ProxyResponseBuilder
121
{
122
    return Proxy::to($url);
123
}
124