|
...
|
...
|
@@ -12,14 +12,29 @@ use Lackoxygen\TiktokShop\Util\Json; |
|
|
|
|
|
|
|
class Mock
|
|
|
|
{
|
|
|
|
protected string $passage;
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected string $request;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected string $method;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var Annotation
|
|
|
|
*/
|
|
|
|
protected Annotation $annotation;
|
|
|
|
|
|
|
|
public function __construct(string $passage, string $method)
|
|
|
|
/**
|
|
|
|
* @param string $request
|
|
|
|
* @param string $method
|
|
|
|
*/
|
|
|
|
public function __construct(string $request, string $method)
|
|
|
|
{
|
|
|
|
$this->passage = $passage;
|
|
|
|
$this->request = $request;
|
|
|
|
|
|
|
|
$this->method = $method;
|
|
|
|
|
|
|
|
$this->annotation = new Annotation();
|
|
...
|
...
|
@@ -75,10 +90,13 @@ class Mock |
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return Response
|
|
|
|
*/
|
|
|
|
public function response(): Response
|
|
|
|
{
|
|
|
|
$methodAnnotation = $this->annotation->method(
|
|
|
|
$this->passage,
|
|
|
|
$this->request,
|
|
|
|
$this->method
|
|
|
|
);
|
|
|
|
|
|
...
|
...
|
@@ -99,6 +117,10 @@ class Mock |
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param array $methodAnnotation
|
|
|
|
* @return false|mixed
|
|
|
|
*/
|
|
|
|
protected function extractUrlAnnotation(array $methodAnnotation)
|
|
|
|
{
|
|
|
|
$tag = '@link';
|
...
|
...
|
|