Completed
Push — feature/improve-form-definitio... ( 2a8834...8225fe )
by Romain
02:19
created

checkDefinitionFreezeState()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
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\Configuration;
15
16
use Romm\ConfigurationObject\Service\Items\Parents\ParentsTrait;
17
use Romm\ConfigurationObject\Traits\ConfigurationObject\MagicMethodsTrait;
18
use TYPO3\CMS\Core\Utility\GeneralUtility;
19
20
abstract class AbstractConfiguration
21
{
22
    use MagicMethodsTrait;
23
    use ParentsTrait;
24
25
    /**
26
     * @param string $path
27
     * @return string
28
     */
29
    protected function getAbsolutePath($path)
30
    {
31
        return GeneralUtility::getFileAbsFileName($path);
32
    }
33
34
    /**
35
     * @todo
36
     */
37
    protected function checkDefinitionFreezeState()
38
    {
39
        if ($this->isConfigurationFrozen()) {
40
            throw new \Exception('todo');
41
        }
42
    }
43
44
    /**
45
     * @return bool
46
     */
47
    protected function isConfigurationFrozen()
48
    {
49
        $flag = false;
50
51
        if ($this instanceof Configuration) {
52
            $flag = $this->isConfigurationFrozenRoot();
0 ignored issues
show
Documentation Bug introduced by
The method isConfigurationFrozenRoot does not exist on object<Romm\Formz\Config...\AbstractConfiguration>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
53
        } elseif ($this->hasParent(Configuration::class)) {
54
            $flag = $this->getFirstParent(Configuration::class)->isConfigurationFrozenRoot();
55
        }
56
57
        return $flag;
58
    }
59
}
60