|
@@ -12,14 +12,29 @@ use Lackoxygen\TiktokShop\Util\Json; |
|
@@ -12,14 +12,29 @@ use Lackoxygen\TiktokShop\Util\Json; |
|
12
|
|
12
|
|
|
13
|
class Mock
|
13
|
class Mock
|
|
14
|
{
|
14
|
{
|
|
15
|
- protected string $passage;
|
15
|
+ /**
|
|
|
|
16
|
+ * @var string
|
|
|
|
17
|
+ */
|
|
|
|
18
|
+ protected string $request;
|
|
|
|
19
|
+
|
|
|
|
20
|
+ /**
|
|
|
|
21
|
+ * @var string
|
|
|
|
22
|
+ */
|
|
16
|
protected string $method;
|
23
|
protected string $method;
|
|
17
|
|
24
|
|
|
|
|
25
|
+ /**
|
|
|
|
26
|
+ * @var Annotation
|
|
|
|
27
|
+ */
|
|
18
|
protected Annotation $annotation;
|
28
|
protected Annotation $annotation;
|
|
19
|
|
29
|
|
|
20
|
- public function __construct(string $passage, string $method)
|
30
|
+ /**
|
|
|
|
31
|
+ * @param string $request
|
|
|
|
32
|
+ * @param string $method
|
|
|
|
33
|
+ */
|
|
|
|
34
|
+ public function __construct(string $request, string $method)
|
|
21
|
{
|
35
|
{
|
|
22
|
- $this->passage = $passage;
|
36
|
+ $this->request = $request;
|
|
|
|
37
|
+
|
|
23
|
$this->method = $method;
|
38
|
$this->method = $method;
|
|
24
|
|
39
|
|
|
25
|
$this->annotation = new Annotation();
|
40
|
$this->annotation = new Annotation();
|
|
@@ -75,10 +90,13 @@ class Mock |
|
@@ -75,10 +90,13 @@ class Mock |
|
75
|
);
|
90
|
);
|
|
76
|
}
|
91
|
}
|
|
77
|
|
92
|
|
|
|
|
93
|
+ /**
|
|
|
|
94
|
+ * @return Response
|
|
|
|
95
|
+ */
|
|
78
|
public function response(): Response
|
96
|
public function response(): Response
|
|
79
|
{
|
97
|
{
|
|
80
|
$methodAnnotation = $this->annotation->method(
|
98
|
$methodAnnotation = $this->annotation->method(
|
|
81
|
- $this->passage,
|
99
|
+ $this->request,
|
|
82
|
$this->method
|
100
|
$this->method
|
|
83
|
);
|
101
|
);
|
|
84
|
|
102
|
|
|
@@ -99,6 +117,10 @@ class Mock |
|
@@ -99,6 +117,10 @@ class Mock |
|
99
|
return $response;
|
117
|
return $response;
|
|
100
|
}
|
118
|
}
|
|
101
|
|
119
|
|
|
|
|
120
|
+ /**
|
|
|
|
121
|
+ * @param array $methodAnnotation
|
|
|
|
122
|
+ * @return false|mixed
|
|
|
|
123
|
+ */
|
|
102
|
protected function extractUrlAnnotation(array $methodAnnotation)
|
124
|
protected function extractUrlAnnotation(array $methodAnnotation)
|
|
103
|
{
|
125
|
{
|
|
104
|
$tag = '@link';
|
126
|
$tag = '@link';
|