From 8682dca742467e351f7d50016b764cf56e45b8fc Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 2 Mar 2020 22:49:01 +0100 Subject: [PATCH] php cs and stan fixes --- Models/Media.php | 4 ++-- .../Components/InlinePreview/BaseView.php | 24 ++++++++++++++++--- Theme/Backend/Components/Media/BaseView.php | 6 +++++ Theme/Backend/Components/Upload/BaseView.php | 24 ++++++++++++++++--- 4 files changed, 50 insertions(+), 8 deletions(-) diff --git a/Models/Media.php b/Models/Media.php index f93e5da..2d2083d 100644 --- a/Models/Media.php +++ b/Models/Media.php @@ -196,7 +196,7 @@ class Media implements \JsonSerializable * * @since 1.0.0 */ - public function decrypt(string $password, string $outputPath) : string + public function decrypt(string $password, string $outputPath = null) : string { /** * @todo Orange-Management/Modules#185 @@ -273,7 +273,7 @@ class Media implements \JsonSerializable */ public function compareNonce(string $nonce) : bool { - return \hash_equals($this->nonce, $nonce); + return $this->nonce === null ? false : \hash_equals($this->nonce, $nonce); } /** diff --git a/Theme/Backend/Components/InlinePreview/BaseView.php b/Theme/Backend/Components/InlinePreview/BaseView.php index 0adc8bb..8a880fc 100644 --- a/Theme/Backend/Components/InlinePreview/BaseView.php +++ b/Theme/Backend/Components/InlinePreview/BaseView.php @@ -30,11 +30,29 @@ use phpOMS\Views\View; */ class BaseView extends View { - protected $form = ''; + /** + * Form id + * + * @var string + * @since 1.0.0 + */ + protected string $form = ''; - protected $virtualPath = ''; + /** + * Virtual path of the media file + * + * @var string + * @since 1.0.0 + */ + protected string $virtualPath = ''; - protected $name = ''; + /** + * Name of the image preview + * + * @var string + * @since 1.0.0 + */ + protected string $name = ''; /** * {@inheritdoc} diff --git a/Theme/Backend/Components/Media/BaseView.php b/Theme/Backend/Components/Media/BaseView.php index a7700c9..e4d6d25 100644 --- a/Theme/Backend/Components/Media/BaseView.php +++ b/Theme/Backend/Components/Media/BaseView.php @@ -30,6 +30,12 @@ use phpOMS\Views\View; */ class BaseView extends View { + /** + * Media files + * + * @var \Modules\Media\Models\Media[] + * @since 1.0.0 + */ protected $media = []; /** diff --git a/Theme/Backend/Components/Upload/BaseView.php b/Theme/Backend/Components/Upload/BaseView.php index f443d70..56349d4 100644 --- a/Theme/Backend/Components/Upload/BaseView.php +++ b/Theme/Backend/Components/Upload/BaseView.php @@ -30,11 +30,29 @@ use phpOMS\Views\View; */ class BaseView extends View { - protected $form = ''; + /** + * Form id + * + * @var string + * @since 1.0.0 + */ + protected string $form = ''; - protected $virtualPath = ''; + /** + * Virtual path of the media file + * + * @var string + * @since 1.0.0 + */ + protected string $virtualPath = ''; - protected $name = ''; + /** + * Name of the image preview + * + * @var string + * @since 1.0.0 + */ + protected string $name = ''; /** * {@inheritdoc}