Completed
Push — unit-tests-conditions ( fc6a80...b4e1a6 )
by Romain
02:09
created

wrongAssetHandlerClassName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 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
    /**
25
     * @code 1477468381
26
     *
27
     * @param string $className
28
     * @return self
29
     */
30
    final public static function wrongAssetHandlerClassName($className)
31
    {
32
        /** @var self $exception */
33
        $exception = self::getNewExceptionInstance(
34
            self::WRONG_ASSET_HANDLER_CLASS_NAME,
35
            [$className]
36
        );
37
38
        return $exception;
39
    }
40
41
    /**
42
     * @code 1467191011
43
     *
44
     * @param string $className
45
     * @return self
46
     */
47
    final public static function wrongFormClassName($className)
48
    {
49
        /** @var self $exception */
50
        $exception = self::getNewExceptionInstance(
51
            self::WRONG_FORM_CLASS_NAME,
52
            [$className]
53
        );
54
55
        return $exception;
56
    }
57
58
    /**
59
     * @code 1457442014
60
     *
61
     * @param string $formClassName
62
     * @param string $formName
63
     * @param string $controller
64
     * @param string $action
65
     * @return ClassNotFoundException
66
     */
67
    final public static function formViewHelperClassNotFound($formClassName, $formName, $controller, $action)
68
    {
69
        /** @var self $exception */
70
        $exception = self::getNewExceptionInstance(
71
            self::FORM_VIEW_HELPER_CLASS_NOT_FOUND,
72
            [$formClassName, $formName, $controller, $action]
73
        );
74
75
        return $exception;
76
    }
77
}
78