ClassNotFoundException   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 112
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 112
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A conditionClassNameNotFound() 0 11 1
A wrongAssetHandlerClassName() 0 11 1
A wrongFormClassName() 0 11 1
A formViewHelperClassNotFound() 0 11 1
A backendCacheClassNameNotFound() 0 11 1
A ajaxControllerFormClassNameNotFound() 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 ClassNotFoundException extends FormzException
17
{
18
    const WRONG_ASSET_HANDLER_CLASS_NAME = 'Trying to get an asset handler with a wrong class name: "%s".';
19
20
    const WRONG_FORM_CLASS_NAME = 'Invalid form class name given: "%s".';
21
22
    const FORM_VIEW_HELPER_CLASS_NOT_FOUND = 'Invalid value for the form class name (current value: "%s"). You need to either fill the parameter `formClassName` in the view helper, or specify the type of the parameter `$%s` for the method "%s::%s()".';
23
24
    const BACKEND_CACHE_CLASS_NAME_NOT_FOUND = 'The cache class name given in configuration "config.tx_formz.settings.defaultBackendCache" was not found (current value: "%s")';
25
26
    const CONDITION_CLASS_NAME_NOT_FOUND = 'The class name for the condition "%s" was not found (given value: "%s").';
27
28
    /**
29
     * @param string $name
30
     * @param string $className
31
     * @return self
32
     */
33
    final public static function conditionClassNameNotFound($name, $className)
34
    {
35
        /** @var self $exception */
36
        $exception = self::getNewExceptionInstance(
37
            self::CONDITION_CLASS_NAME_NOT_FOUND,
38
            1489602455,
39
            [$name, $className]
40
        );
41
42
        return $exception;
43
    }
44
45
    /**
46
     * @param string $className
47
     * @return self
48
     */
49
    final public static function wrongAssetHandlerClassName($className)
50
    {
51
        /** @var self $exception */
52
        $exception = self::getNewExceptionInstance(
53
            self::WRONG_ASSET_HANDLER_CLASS_NAME,
54
            1477468381,
55
            [$className]
56
        );
57
58
        return $exception;
59
    }
60
61
    /**
62
     * @param string $className
63
     * @return self
64
     */
65
    final public static function wrongFormClassName($className)
66
    {
67
        /** @var self $exception */
68
        $exception = self::getNewExceptionInstance(
69
            self::WRONG_FORM_CLASS_NAME,
70
            1467191011,
71
            [$className]
72
        );
73
74
        return $exception;
75
    }
76
77
    /**
78
     * @param string $formClassName
79
     * @param string $formName
80
     * @param string $controller
81
     * @param string $action
82
     * @return self
83
     */
84
    final public static function formViewHelperClassNotFound($formClassName, $formName, $controller, $action)
85
    {
86
        /** @var self $exception */
87
        $exception = self::getNewExceptionInstance(
88
            self::FORM_VIEW_HELPER_CLASS_NOT_FOUND,
89
            1457442014,
90
            [$formClassName, $formName, $controller, $action . 'Action']
91
        );
92
93
        return $exception;
94
    }
95
96
    /**
97
     * @param string $className
98
     * @return self
99
     */
100
    final public static function backendCacheClassNameNotFound($className)
101
    {
102
        /** @var self $exception */
103
        $exception = self::getNewExceptionInstance(
104
            self::BACKEND_CACHE_CLASS_NAME_NOT_FOUND,
105
            1488475103,
106
            [$className]
107
        );
108
109
        return $exception;
110
    }
111
112
    /**
113
     * @param string $className
114
     * @return self
115
     */
116
    final public static function ajaxControllerFormClassNameNotFound($className)
117
    {
118
        /** @var self $exception */
119
        $exception = self::getNewExceptionInstance(
120
            self::WRONG_FORM_CLASS_NAME,
121
            1490179346,
122
            [$className]
123
        );
124
125
        return $exception;
126
    }
127
}
128