Source Code: SmartFactory/Interfaces/ISettingsValidator.php

 1: <?php
 2: /**
 3:  * This file contains the declaration of the interface ISettingsValidator for settings validation.
 4:  *
 5:  * @package System
 6:  *
 7:  * @author Oleg Schildt
 8:  */
 9: 
10: namespace SmartFactory\Interfaces;
11: 
12: /**
13:  * Interface for settings validation.
14:  *
15:  * @author Oleg Schildt
16:  */
17: interface ISettingsValidator
18: {
19:     /**
20:      * Validates the settings of a settings manager.
21:      *
22:      * @param ISettingsManager $settingsmanager
23:      * The settings manager whose settings should be validated.
24:      *
25:      * @param string $context
26:      * The settings context.
27:      *
28:      * Settings might be edited not in one dialog,
29:      * There can be several masks for different type of settings,
30:      * or the settings can be configured in a wizard.
31:      * In this case, only a subset of settings has to be
32:      * saved and validated.
33:      * To be able to write a flexible validator for the subsets,
34:      * the $context is used. It can be - step1, step1, server_settings,
35:      * db_connection_settings etc.
36:      *
37:      * @return void
38:      *
39:      * @throws \SmartFactory\SmartException|\SmartFactory\SmartExceptionCollection
40:      * * It might throw an exception in the case of any errors.
41:      *
42:      * @author Oleg Schildt
43:      */
44:     public function validate(ISettingsManager $settingsmanager, string $context): void;
45: } // ISettingsValidator