From 7d1f32fd8feb2d472c98b671c6fb30c8531dc647 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Wed, 16 Aug 2023 12:38:07 -0400 Subject: [PATCH] updating stubs for 5.3.0 --- src/Autoload/Loader.php | 9 ++++ src/Encryption/Security/JWT/Builder.php | 21 +++++++- src/Encryption/Security/JWT/Token/Token.php | 10 ++++ src/Encryption/Security/JWT/Validator.php | 28 ++++++++++- src/Http/Request.php | 9 ++++ src/Mvc/Model.php | 10 ++++ src/Mvc/Model/MetaData.php | 54 +++++++++++++++++++-- src/Mvc/Model/MetaDataInterface.php | 11 +++-- 8 files changed, 139 insertions(+), 13 deletions(-) diff --git a/src/Autoload/Loader.php b/src/Autoload/Loader.php index 40367b7b..b11e3f0e 100644 --- a/src/Autoload/Loader.php +++ b/src/Autoload/Loader.php @@ -336,6 +336,15 @@ public function unregister(): Loader { } + /** + * returns isRegister + * + * @return bool + */ + public function isRegistered(): bool + { + } + /** * If the file exists, require it and return true; false otherwise * diff --git a/src/Encryption/Security/JWT/Builder.php b/src/Encryption/Security/JWT/Builder.php index 12423772..cbda1190 100644 --- a/src/Encryption/Security/JWT/Builder.php +++ b/src/Encryption/Security/JWT/Builder.php @@ -20,7 +20,14 @@ use Phalcon\Support\Helper\Json\Encode; /** - * JWT Builder + * Builder + * + * The builder offers + * + * @property CollectionInterface $claims + * @property CollectionInterface $jose + * @property string $passphrase + * @property SignerInterface $signer * * @link https://tools.ietf.org/html/rfc7519 */ @@ -79,6 +86,18 @@ public function addClaim(string $name, $value): Builder { } + /** + * Adds a custom header + * + * @param string $name + * @param mixed $value + * + * @return Builder + */ + public function addHeader(string $name, $value): Builder + { + } + /** * @return array|string */ diff --git a/src/Encryption/Security/JWT/Token/Token.php b/src/Encryption/Security/JWT/Token/Token.php index 023b04ad..931a2925 100644 --- a/src/Encryption/Security/JWT/Token/Token.php +++ b/src/Encryption/Security/JWT/Token/Token.php @@ -49,6 +49,8 @@ public function __construct(Item $headers, Item $claims, Signature $signature) } /** + * Return the registered claims + * * @return Item */ public function getClaims(): Item @@ -56,6 +58,8 @@ public function getClaims(): Item } /** + * Return the registered headers + * * @return Item */ public function getHeaders(): Item @@ -63,6 +67,8 @@ public function getHeaders(): Item } /** + * Return the payload + * * @return string */ public function getPayload(): string @@ -70,6 +76,8 @@ public function getPayload(): string } /** + * Return the signature + * * @return Signature */ public function getSignature(): Signature @@ -77,6 +85,8 @@ public function getSignature(): Signature } /** + * Return the token + * * @return string */ public function getToken(): string diff --git a/src/Encryption/Security/JWT/Validator.php b/src/Encryption/Security/JWT/Validator.php index 665cb799..f6e7423a 100644 --- a/src/Encryption/Security/JWT/Validator.php +++ b/src/Encryption/Security/JWT/Validator.php @@ -50,6 +50,8 @@ public function __construct(\Phalcon\Encryption\Security\JWT\Token\Token $token, } /** + * Return an array with validation errors (if any) + * * @return array */ public function getErrors(): array @@ -57,16 +59,22 @@ public function getErrors(): array } /** + * Return the value of a claim + * * @param string $claim - * @return mixed|null + * + * @return mixed */ public function get(string $claim) { } /** + * Set the value of a claim, for comparison with the token values + * * @param string $claim - * @param mixed $value + * @param mixed $value + * * @return Validator */ public function set(string $claim, $value): Validator @@ -74,6 +82,8 @@ public function set(string $claim, $value): Validator } /** + * Set the token to be validated + * * @param Token $token * * @return Validator @@ -83,6 +93,8 @@ public function setToken(\Phalcon\Encryption\Security\JWT\Token\Token $token): V } /** + * Validate the audience + * * @param string|array $audience * * @return Validator @@ -93,6 +105,8 @@ public function validateAudience($audience): Validator } /** + * Validate the expiration time of the token + * * @param int $timestamp * * @return Validator @@ -103,6 +117,8 @@ public function validateExpiration(int $timestamp): Validator } /** + * Validate the id of the token + * * @param string $id * * @return Validator @@ -113,6 +129,8 @@ public function validateId(string $id): Validator } /** + * Validate the issued at (iat) of the token + * * @param int $timestamp * * @return Validator @@ -123,6 +141,8 @@ public function validateIssuedAt(int $timestamp): Validator } /** + * Validate the issuer of the token + * * @param string $issuer * * @return Validator @@ -133,6 +153,8 @@ public function validateIssuer(string $issuer): Validator } /** + * Validate the notbefore (nbf) of the token + * * @param int $timestamp * * @return Validator @@ -143,6 +165,8 @@ public function validateNotBefore(int $timestamp): Validator } /** + * Validate the signature of the token + * * @param SignerInterface $signer * @param string $passphrase * diff --git a/src/Http/Request.php b/src/Http/Request.php index f9ce7096..1b5e7549 100644 --- a/src/Http/Request.php +++ b/src/Http/Request.php @@ -986,4 +986,13 @@ public function getFilteredData(string $methodKey, string $method, string $name private function getPatchPut(string $collection, string $name = null, $filters = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false) { } + + /** + * parse multipart/form-data from raw data + * + * @return array + */ + private function getFormData(): array + { + } } diff --git a/src/Mvc/Model.php b/src/Mvc/Model.php index 6efdc14f..ebcebc26 100644 --- a/src/Mvc/Model.php +++ b/src/Mvc/Model.php @@ -2220,4 +2220,14 @@ public function validationHasFailed(): bool private static function caseInsensitiveColumnMap($columnMap, $key): string { } + + /** + * Append messages to this model from another Model. + * + * @param mixed $model + * @return void + */ + public function appendMessagesFrom($model): void + { + } } diff --git a/src/Mvc/Model/MetaData.php b/src/Mvc/Model/MetaData.php index a69b669f..1504dc32 100644 --- a/src/Mvc/Model/MetaData.php +++ b/src/Mvc/Model/MetaData.php @@ -451,8 +451,9 @@ final public function readColumnMap(\Phalcon\Mvc\ModelInterface $model): ?array * * @param \Phalcon\Mvc\ModelInterface $model * @param int $index + * @return array|null */ - final public function readColumnMapIndex(\Phalcon\Mvc\ModelInterface $model, int $index) + final public function readColumnMapIndex(\Phalcon\Mvc\ModelInterface $model, int $index): ?array { } @@ -468,9 +469,9 @@ final public function readColumnMapIndex(\Phalcon\Mvc\ModelInterface $model, int * ``` * * @param \Phalcon\Mvc\ModelInterface $model - * @return array + * @return array|null */ - final public function readMetaData(\Phalcon\Mvc\ModelInterface $model): array + final public function readMetaData(\Phalcon\Mvc\ModelInterface $model): ?array { } @@ -488,8 +489,9 @@ final public function readMetaData(\Phalcon\Mvc\ModelInterface $model): array * * @param \Phalcon\Mvc\ModelInterface $model * @param int $index + * @return array|null */ - final public function readMetaDataIndex(\Phalcon\Mvc\ModelInterface $model, int $index) + final public function readMetaDataIndex(\Phalcon\Mvc\ModelInterface $model, int $index): ?array { } @@ -622,7 +624,7 @@ final public function writeMetaDataIndex(\Phalcon\Mvc\ModelInterface $model, int } /** - * Initialize the metadata for certain table + * Initialize old behavior for compatability * * @param \Phalcon\Mvc\ModelInterface $model * @param mixed $key @@ -633,6 +635,28 @@ final protected function initialize(\Phalcon\Mvc\ModelInterface $model, $key, $t { } + /** + * Initialize the metadata for certain table + * + * @param \Phalcon\Mvc\ModelInterface $model + * @param mixed $key + * @return bool + */ + final protected function initializeMetaData(\Phalcon\Mvc\ModelInterface $model, $key): bool + { + } + + /** + * Initialize ColumnMap for a certain table + * + * @param \Phalcon\Mvc\ModelInterface $model + * @param mixed $key + * @return bool + */ + final protected function initializeColumnMap(\Phalcon\Mvc\ModelInterface $model, $key): bool + { + } + /** * Throws an exception when the metadata cannot be written * @@ -653,4 +677,24 @@ private function throwWriteException($option): void protected function getArrVal(array $collection, $index, $defaultValue = null) { } + + /** + * Returns a MetaData Unique key for meta-data is created using className + * + * @return string + * @param \Phalcon\Mvc\ModelInterface $model + */ + final public function getMetaDataUniqueKey(\Phalcon\Mvc\ModelInterface $model): ?string + { + } + + /** + * Returns a ColumnMap Unique key for meta-data is created using className + * + * @return string + * @param \Phalcon\Mvc\ModelInterface $model + */ + final public function getColumnMapUniqueKey(\Phalcon\Mvc\ModelInterface $model): ?string + { + } } diff --git a/src/Mvc/Model/MetaDataInterface.php b/src/Mvc/Model/MetaDataInterface.php index 41db4a75..6fed1245 100644 --- a/src/Mvc/Model/MetaDataInterface.php +++ b/src/Mvc/Model/MetaDataInterface.php @@ -175,25 +175,26 @@ public function readColumnMap(\Phalcon\Mvc\ModelInterface $model): ?array; * * @param \Phalcon\Mvc\ModelInterface $model * @param int $index + * @return array|null */ - public function readColumnMapIndex(\Phalcon\Mvc\ModelInterface $model, int $index); + public function readColumnMapIndex(\Phalcon\Mvc\ModelInterface $model, int $index): ?array; /** * Reads meta-data for certain model * * @param \Phalcon\Mvc\ModelInterface $model - * @return array + * @return array|null */ - public function readMetaData(\Phalcon\Mvc\ModelInterface $model): array; + public function readMetaData(\Phalcon\Mvc\ModelInterface $model): ?array; /** * Reads meta-data for certain model using a MODEL_ constant * * @param \Phalcon\Mvc\ModelInterface $model * @param int $index - * @return mixed + * @return array|null */ - public function readMetaDataIndex(\Phalcon\Mvc\ModelInterface $model, int $index); + public function readMetaDataIndex(\Phalcon\Mvc\ModelInterface $model, int $index): ?array; /** * Resets internal meta-data in order to regenerate it