From 11bbf6a2416e80ebc590ad6321221b0b14ebaea6 Mon Sep 17 00:00:00 2001 From: dominikvoda Date: Tue, 22 Dec 2020 12:04:12 +0100 Subject: [PATCH] update brandembassy/datetime (3.0) --- composer.json | 2 +- src/Request/Request.php | 18 +++++++++--------- src/Request/RequestInterface.php | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/composer.json b/composer.json index 0d5e298..22200e2 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ }, "require": { "php": ">=7.2", - "brandembassy/datetime": "^2.2", + "brandembassy/datetime": "^3.0", "nette/di": "^3.0", "nette/neon": "^3.0", "nette/utils": "^3.0", diff --git a/src/Request/Request.php b/src/Request/Request.php index d669b7c..00d41b6 100644 --- a/src/Request/Request.php +++ b/src/Request/Request.php @@ -16,7 +16,7 @@ /** * @method string[]|string[][] getQueryParams() - * @method string|string[]|null getQueryParam(string $key, ?string $default = null) + * @method string|string[]|null getQueryParam(string $name, ?string $default = null) */ final class Request extends SlimRequest implements RequestInterface { @@ -117,9 +117,9 @@ public function hasField(string $fieldName): bool /** * @return string|string[]|null */ - public function findQueryParam(string $key, ?string $default = null) + public function findQueryParam(string $name, ?string $default = null) { - return $this->getQueryParam($key) ?? $default; + return $this->getQueryParam($name) ?? $default; } @@ -128,21 +128,21 @@ public function findQueryParam(string $key, ?string $default = null) * * @throws QueryParamMissingException */ - public function getQueryParamStrict(string $key) + public function getQueryParamStrict(string $name) { - $value = $this->findQueryParam($key); + $value = $this->findQueryParam($name); if ($value !== null) { return $value; } - throw QueryParamMissingException::create($key); + throw QueryParamMissingException::create($name); } - public function hasQueryParam(string $key): bool + public function hasQueryParam(string $name): bool { - return array_key_exists($key, $this->getQueryParams()); + return array_key_exists($name, $this->getQueryParams()); } @@ -155,7 +155,7 @@ public function getDateTimeQueryParam(string $field, string $format = DateTime:: $datetimeParam = $this->getQueryParamStrict($field); assert(is_string($datetimeParam)); - return DateTimeFromString::create($format, $datetimeParam); + return DateTimeFromString::createFromFormat($format, $datetimeParam); } diff --git a/src/Request/RequestInterface.php b/src/Request/RequestInterface.php index bcba31a..d64b49d 100644 --- a/src/Request/RequestInterface.php +++ b/src/Request/RequestInterface.php @@ -52,7 +52,7 @@ public function hasField(string $fieldName): bool; /** * @return string|string[]|null */ - public function findQueryParam(string $key, ?string $default = null); + public function findQueryParam(string $name, ?string $default = null); /** @@ -60,7 +60,7 @@ public function findQueryParam(string $key, ?string $default = null); * * @throws QueryParamMissingException */ - public function getQueryParamStrict(string $key); + public function getQueryParamStrict(string $name); public function hasAttribute(string $name): bool; @@ -80,10 +80,10 @@ public function findAttribute(string $name, $default = null); public function getAttributeStrict(string $name); - public function hasQueryParam(string $key): bool; + public function hasQueryParam(string $name): bool; - public function getDateTimeQueryParam(string $key): DateTimeImmutable; + public function getDateTimeQueryParam(string $name): DateTimeImmutable; public function isHtml(): bool; @@ -109,5 +109,5 @@ public function getAttribute($name, $default = null); * * @return mixed */ - public function getQueryParam(string $key, $default = null); + public function getQueryParam(string $name, $default = null); }