Exemplo n.º 1
0
 public function parseHttpRequest(ServerHttpRequest $httpRequest, array $attributes) : RequestInterface
 {
     $rpHelper = new HttpRequestParserHelper($httpRequest);
     $this->helper->addPathFilter($rpHelper->getFilter(), 'path');
     $this->helper->addPathValidator($rpHelper->getValidator(), 'path');
     return new Request(self::MESSAGE, $rpHelper->filterAndValidate($attributes), $httpRequest);
 }
Exemplo n.º 2
0
 public function parseHttpRequest(ServerHttpRequest $httpRequest, array $attributes) : RequestInterface
 {
     $rpHelper = new HttpRequestParserHelper($httpRequest);
     $filter = $rpHelper->getFilter();
     $this->helper->addPathFilter($filter, 'path');
     $this->helper->addFileNameFilter($filter, 'filename');
     $validator = $rpHelper->getValidator();
     $this->helper->addFullPathValidator($validator, 'path');
     $this->helper->addFileNameValidator($validator, 'filename');
     $data = ['path' => $attributes['path'], 'filename' => $httpRequest->getParsedBody()['filename']];
     return new Request(self::MESSAGE, $rpHelper->filterAndValidate($data), $httpRequest);
 }
Exemplo n.º 3
0
 public function parseHttpRequest(ServerHttpRequest $httpRequest, array $attributes) : RequestInterface
 {
     $rpHelper = new HttpRequestParserHelper($httpRequest);
     $this->helper->addPathFilter($rpHelper->getFilter(), 'path');
     $validator = $rpHelper->getValidator();
     $this->helper->addPathValidator($validator, 'path');
     $validator->required('files')->callback(function ($array) {
         return is_array($array) && count($array) > 0;
     });
     $data = ['path' => $attributes['path'], 'files' => $httpRequest->getUploadedFiles()];
     return new Request(self::MESSAGE, $rpHelper->filterAndValidate($data), $httpRequest);
 }
Exemplo n.º 4
0
 public function parseHttpRequest(ServerHttpRequest $httpRequest, array $attributes) : RequestInterface
 {
     $rpHelper = new HttpRequestParserHelper($httpRequest);
     $filter = $rpHelper->getFilter();
     $validator = $rpHelper->getValidator();
     $this->helper->addPathFilter($filter, 'path');
     $this->helper->addFullPathValidator($validator, 'path');
     $data = $httpRequest->getQueryParams();
     $data['path'] = $attributes['path'];
     $this->parseOperationResize($validator, $filter, $data);
     $this->parseOperationCrop($validator, $filter, $data);
     $this->parseOperationRotate($validator, $filter, $data);
     $this->parseOperationNegative($validator, $filter, $data);
     $this->parseOperationGamma($validator, $filter, $data);
     $this->parseOperationGreyscale($validator, $filter, $data);
     $this->parseOperationBlur($validator, $filter, $data);
     return new Request($this->messageName, $rpHelper->filterAndValidate($data), $httpRequest);
 }