Completed
Push — middleware ( 3e173d...488069 )
by Romain
02:53
created

slotViewHelperFieldContextNotFound()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
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\Formz\ViewHelpers\FieldViewHelper;
17
use Romm\Formz\ViewHelpers\FormViewHelper;
18
use Romm\Formz\ViewHelpers\OptionViewHelper;
19
use Romm\Formz\ViewHelpers\Slot\HasViewHelper;
20
use Romm\Formz\ViewHelpers\Slot\RenderViewHelper;
21
use Romm\Formz\ViewHelpers\SlotViewHelper;
22
23
class ContextNotFoundException extends FormzException
24
{
25
    const FORM_CONTEXT_NOT_FOUND = 'The view helper "%s" must be used inside the view helper "%s".';
26
27
    const FIELD_CONTEXT_NOT_FOUND = 'The view helper "%s" must be used inside the view helper "%s".';
28
29
    /**
30
     * @code 1465243085
31
     *
32
     * @return ContextNotFoundException
33
     */
34
    final public static function fieldViewHelperFormContextNotFound()
35
    {
36
        /** @var self $exception */
37
        $exception = self::getNewExceptionInstance(
38
            self::FORM_CONTEXT_NOT_FOUND,
39
            [FieldViewHelper::class, FormViewHelper::class]
40
        );
41
42
        return $exception;
43
    }
44
45
    /**
46
     * @code 1465243287
47
     *
48
     * @return ContextNotFoundException
49
     */
50
    final public static function optionViewHelperFieldContextNotFound()
51
    {
52
        /** @var self $exception */
53
        $exception = self::getNewExceptionInstance(
54
            self::FIELD_CONTEXT_NOT_FOUND,
55
            [OptionViewHelper::class, FieldViewHelper::class]
56
        );
57
58
        return $exception;
59
    }
60
61
    /**
62
     * @code 1488473956
63
     *
64
     * @return ContextNotFoundException
65
     */
66
    final public static function slotRenderViewHelperFieldContextNotFound()
67
    {
68
        /** @var self $exception */
69
        $exception = self::getNewExceptionInstance(
70
            self::FIELD_CONTEXT_NOT_FOUND,
71
            [RenderViewHelper::class, FieldViewHelper::class]
72
        );
73
74
        return $exception;
75
    }
76
77
    /**
78
     * @code 1488474106
79
     *
80
     * @return ContextNotFoundException
81
     */
82
    final public static function slotViewHelperFieldContextNotFound()
83
    {
84
        /** @var self $exception */
85
        $exception = self::getNewExceptionInstance(
86
            self::FIELD_CONTEXT_NOT_FOUND,
87
            [SlotViewHelper::class, FieldViewHelper::class]
88
        );
89
90
        return $exception;
91
    }
92
93
    /**
94
     * @code 1488988566
95
     *
96
     * @return ContextNotFoundException
97
     */
98
    final public static function slotHasViewHelperFieldContextNotFound()
99
    {
100
        /** @var self $exception */
101
        $exception = self::getNewExceptionInstance(
102
            self::FIELD_CONTEXT_NOT_FOUND,
103
            [HasViewHelper::class, FieldViewHelper::class]
104
        );
105
106
        return $exception;
107
    }
108
}
109