| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /* | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * 2017 Romain CANON <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * This file is part of the TYPO3 FormZ project. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * It is free software; you can redistribute it and/or modify it | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * under the terms of the GNU General Public License, either | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * version 3 of the License, or any later version. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * For the full copyright and license information, see: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * http://www.gnu.org/licenses/gpl-3.0.html | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | namespace Romm\Formz\Exceptions; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | use Romm\ConfigurationObject\Exceptions\SilentExceptionInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | use Romm\Formz\Form\Definition\Field\Field; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | use Romm\Formz\Form\Definition\Field\Validation\Validator; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | class SilentException extends FormzException implements SilentExceptionInterface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |     const FIELD_HAS_NO_ACTIVATION = 'The field "%s" does not have activation. Please use the function `%s::hasActivation()` before.'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |     const VALIDATOR_HAS_NO_ACTIVATION = 'The validator "%s" does not have activation. Please use the function `%s::hasActivation()` before.'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |      * @code 1494685913 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |      * @param Field $field | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |      * @return self | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |     final public static function fieldHasNoActivation(Field $field) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |         /** @var self $exception */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |         $exception = self::getNewExceptionInstance( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |             self::FIELD_HAS_NO_ACTIVATION, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |             [$field->getName(), Field::class] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |         return $exception; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |      * @code 1494690671 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |      * @param Validator $validator | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |      * @return self | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 48 |  |  |      */ | 
            
                                                        
            
                                    
            
            
                | 49 |  |  |     final public static function validatorHasNoActivation(Validator $validator) | 
            
                                                        
            
                                    
            
            
                | 50 |  |  |     { | 
            
                                                        
            
                                    
            
            
                | 51 |  |  |         /** @var self $exception */ | 
            
                                                        
            
                                    
            
            
                | 52 |  |  |         $exception = self::getNewExceptionInstance( | 
            
                                                        
            
                                    
            
            
                | 53 |  |  |             self::VALIDATOR_HAS_NO_ACTIVATION, | 
            
                                                        
            
                                    
            
            
                | 54 |  |  |             [$validator->getName(), Validator::class] | 
            
                                                        
            
                                    
            
            
                | 55 |  |  |         ); | 
            
                                                        
            
                                    
            
            
                | 56 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 57 |  |  |         return $exception; | 
            
                                                        
            
                                    
            
            
                | 58 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 59 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 60 |  |  |  |