5use InvalidArgumentException;
8use Psr\Http\Message\UploadedFileInterface;
24 $this->request = $request;
25 $this->authority = $authority;
33 private function getParamsFromSource(
$source ) {
37 return $this->request->getPathParams();
40 return $this->request->getQueryParams();
43 return $this->request->getPostParams();
46 return $this->request->getParsedBody() ?? [];
49 throw new InvalidArgumentException( __METHOD__ .
": Invalid source '$source'" );
53 public function hasParam( $name, array $options ) {
54 $params = $this->getParamsFromSource( $options[
'source'] );
58 public function getValue( $name, $default, array $options ) {
59 $params = $this->getParamsFromSource( $options[
'source'] );
60 return $params[$name] ?? $default;
66 public function hasUpload( $name, array $options ) {
67 if ( $options[
'source'] !==
'post' ) {
74 if ( $options[
'source'] !==
'post' ) {
77 $upload = $this->request->getUploadedFiles()[$name] ??
null;
78 return $upload instanceof UploadedFileInterface ? $upload :
null;
88 return $this->authority->isAllowed(
'apihighlimits' );
array $params
The job parameters.