diff options
author | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2021-08-27 19:38:01 +0300 |
---|---|---|
committer | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2021-08-27 19:38:01 +0300 |
commit | 86798ec45e55d9c7b8851b6d199f9b8128fb0808 (patch) | |
tree | 19f1bda0676f5cf4ea6c7820d68464cb6ced39b7 /libraries/classes/Properties | |
parent | 11752f8e1a66b04b3ffdcc51f3baa5464618fb60 (diff) |
Refactor `PhpMyAdmin\Plugins::getChoice` method
Extracts the getDefault method from the getChoice method and adds a
getName method to the Plugin interface.
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
Diffstat (limited to 'libraries/classes/Properties')
4 files changed, 24 insertions, 32 deletions
diff --git a/libraries/classes/Properties/Plugins/ExportPluginProperties.php b/libraries/classes/Properties/Plugins/ExportPluginProperties.php index cbdf18e904..f56ccc7ef7 100644 --- a/libraries/classes/Properties/Plugins/ExportPluginProperties.php +++ b/libraries/classes/Properties/Plugins/ExportPluginProperties.php @@ -15,7 +15,7 @@ namespace PhpMyAdmin\Properties\Plugins; class ExportPluginProperties extends PluginPropertyItem { /** - * Whether to force or not + * Whether each plugin has to be saved as a file * * @var bool */ @@ -23,10 +23,8 @@ class ExportPluginProperties extends PluginPropertyItem /** * Returns the property item type of either an instance of - * - PhpMyAdmin\Properties\Options\OptionsPropertyOneItem ( f.e. "bool", - * "text", "radio", etc ) or - * - PhpMyAdmin\Properties\Options\OptionsPropertyGroup ( "root", "main" - * or "subgroup" ) + * - PhpMyAdmin\Properties\Options\OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or + * - PhpMyAdmin\Properties\Options\OptionsPropertyGroup ( "root", "main" or "subgroup" ) * - PhpMyAdmin\Properties\Plugins\PluginPropertyItem ( "export", "import", "transformations" ) * * @return string @@ -38,22 +36,16 @@ class ExportPluginProperties extends PluginPropertyItem /** * Gets the force file parameter - * - * @return bool */ - public function getForceFile() + public function getForceFile(): bool { return $this->forceFile; } /** * Sets the force file parameter - * - * @param bool $forceFile the force file parameter - * - * @return void */ - public function setForceFile($forceFile) + public function setForceFile(bool $forceFile): void { $this->forceFile = $forceFile; } diff --git a/libraries/classes/Properties/Plugins/ImportPluginProperties.php b/libraries/classes/Properties/Plugins/ImportPluginProperties.php index 6f0c052261..453dcf4695 100644 --- a/libraries/classes/Properties/Plugins/ImportPluginProperties.php +++ b/libraries/classes/Properties/Plugins/ImportPluginProperties.php @@ -14,10 +14,8 @@ class ImportPluginProperties extends PluginPropertyItem { /** * Returns the property item type of either an instance of - * - PhpMyAdmin\Properties\Options\OptionsPropertyOneItem ( f.e. "bool", - * "text", "radio", etc ) or - * - PhpMyAdmin\Properties\Options\OptionsPropertyGroup ( "root", "main" - * or "subgroup" ) + * - PhpMyAdmin\Properties\Options\OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or + * - PhpMyAdmin\Properties\Options\OptionsPropertyGroup ( "root", "main" or "subgroup" ) * - PhpMyAdmin\Properties\Plugins\PluginPropertyItem ( "export", "import", "transformations" ) * * @return string @@ -26,4 +24,9 @@ class ImportPluginProperties extends PluginPropertyItem { return 'import'; } + + public function getForceFile(): bool + { + return true; + } } diff --git a/libraries/classes/Properties/Plugins/PluginPropertyItem.php b/libraries/classes/Properties/Plugins/PluginPropertyItem.php index f9ef2ced70..bac2c65ce8 100644 --- a/libraries/classes/Properties/Plugins/PluginPropertyItem.php +++ b/libraries/classes/Properties/Plugins/PluginPropertyItem.php @@ -49,7 +49,6 @@ abstract class PluginPropertyItem extends PropertyItem * @var string */ private $mimeType; - /* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */ /** * Gets the text @@ -170,4 +169,12 @@ abstract class PluginPropertyItem extends PropertyItem { return 'plugin'; } + + /** + * Whether each plugin has to be saved as a file + */ + public function getForceFile(): bool + { + return false; + } } diff --git a/libraries/classes/Properties/Plugins/SchemaPluginProperties.php b/libraries/classes/Properties/Plugins/SchemaPluginProperties.php index 92b57bf32a..e81e758daf 100644 --- a/libraries/classes/Properties/Plugins/SchemaPluginProperties.php +++ b/libraries/classes/Properties/Plugins/SchemaPluginProperties.php @@ -12,16 +12,11 @@ namespace PhpMyAdmin\Properties\Plugins; */ class SchemaPluginProperties extends PluginPropertyItem { - /* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */ - /** * Returns the property item type of either an instance of - * - PhpMyAdmin\Properties\Options\OptionsPropertyOneItem ( f.e. "bool", - * "text", "radio", etc ) or - * - PhpMyAdmin\Properties\Options\OptionsPropertyGroup ( "root", "main" - * or "subgroup" ) - * - PhpMyAdmin\Properties\Plugins\PluginPropertyItem ( "export", - * "import", "transformations" ) + * - PhpMyAdmin\Properties\Options\OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or + * - PhpMyAdmin\Properties\Options\OptionsPropertyGroup ( "root", "main" or "subgroup" ) + * - PhpMyAdmin\Properties\Plugins\PluginPropertyItem ( "export", "import", "transformations" ) * * @return string */ @@ -30,12 +25,7 @@ class SchemaPluginProperties extends PluginPropertyItem return 'schema'; } - /** - * Gets the force file parameter - * - * @return bool - */ - public function getForceFile() + public function getForceFile(): bool { return true; } |