Passed
Push — master ( 4595aa...20e07b )
by Romain
06:34
created

DefaultEventFlexFormProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 39
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A hasFlexForm() 0 3 1
A getFile() 0 3 1
A __construct() 0 3 1
A getFlexFormValue() 0 3 1
1
<?php
2
3
/*
4
 * Copyright (C) 2018
5
 * Nathan Boiron <[email protected]>
6
 * Romain Canon <[email protected]>
7
 *
8
 * This file is part of the TYPO3 NotiZ project.
9
 * It is free software; you can redistribute it and/or modify it
10
 * under the terms of the GNU General Public License, either
11
 * version 3 of the License, or any later version.
12
 *
13
 * For the full copyright and license information, see:
14
 * http://www.gnu.org/licenses/gpl-3.0.html
15
 */
16
17
namespace CuyZ\Notiz\Core\Event\Configuration\FlexForm;
18
19
/**
20
 * Default implementation of a FlexForm provider, it does nothing more than
21
 * returning the path to the given file, so TCA can handle the FlexForm file
22
 * itself.
23
 */
24
class DefaultEventFlexFormProvider implements EventFlexFormProvider
25
{
26
    /**
27
     * @var string
28
     *
29
     * @validate Romm.ConfigurationObject:FileExists
30
     */
31
    protected $file;
32
33
    /**
34
     * @param string $file
35
     */
36
    public function __construct($file = '')
37
    {
38
        $this->file = $file;
39
    }
40
41
    /**
42
     * @return string
43
     */
44
    public function getFlexFormValue()
45
    {
46
        return 'FILE:' . $this->file;
47
    }
48
49
    /**
50
     * @return bool
51
     */
52
    public function hasFlexForm()
53
    {
54
        return !empty($this->file);
55
    }
56
57
    /**
58
     * @return string
59
     */
60
    public function getFile()
61
    {
62
        return $this->file;
63
    }
64
}
65