InvalidConfigurationException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 52
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A ajaxControllerInvalidFormConfiguration() 0 7 1
A ajaxControllerAjaxValidationNotActivated() 0 11 1
A wrongBooleanNodeOperator() 0 11 1
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
class InvalidConfigurationException extends FormzException
17
{
18
    const INVALID_FORM_CONFIGURATION = 'The form configuration contains errors.';
19
20
    const AJAX_VALIDATION_NOT_ACTIVATED = 'The validation "%s" of the field "%s" is not configured to work with Ajax. Please add the option `useAjax`.';
21
22
    const WRONG_BOOLEAN_NODE_OPERATOR = 'The boolean node has a wrong operator: "%s".';
23
24
    /**
25
     * @return self
26
     */
27
    final public static function ajaxControllerInvalidFormConfiguration()
28
    {
29
        /** @var self $exception */
30
        $exception = self::getNewExceptionInstance(self::INVALID_FORM_CONFIGURATION, 1487671395);
31
32
        return $exception;
33
    }
34
35
    /**
36
     * @param string $validationName
37
     * @param string $fieldName
38
     * @return self
39
     */
40
    final public static function ajaxControllerAjaxValidationNotActivated($validationName, $fieldName)
41
    {
42
        /** @var self $exception */
43
        $exception = self::getNewExceptionInstance(
44
            self::AJAX_VALIDATION_NOT_ACTIVATED,
45
            1487673434,
46
            [$validationName, $fieldName]
47
        );
48
49
        return $exception;
50
    }
51
52
    /**
53
     * @param string $operator
54
     * @return self
55
     */
56
    final public static function wrongBooleanNodeOperator($operator)
57
    {
58
        /** @var self $exception */
59
        $exception = self::getNewExceptionInstance(
60
            self::WRONG_BOOLEAN_NODE_OPERATOR,
61
            1458150438,
62
            [$operator]
63
        );
64
65
        return $exception;
66
    }
67
}
68