Completed
Pull Request — master (#5)
by Issei
01:46 queued 45s
created

CompatibilityHelper::isFormLegacy()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
crap 2
1
<?php
2
3
namespace Issei\ConfirmableForm;
4
5
/**
6
 * @author Issei Murasawa <[email protected]>
7
 */
8
final class CompatibilityHelper
9
{
10
    private static $isFormLegacy;
11
12
    /**
13
     * Returns true if legacy (older than 2.8, not support FQCN passing) version of symfony/form component is installed.
14
     *
15
     * @return bool
16
     */
17 9
    public static function isFormLegacy()
18
    {
19 9
        if (null === self::$isFormLegacy) {
20 1
            self::$isFormLegacy = !(new \ReflectionClass('Symfony\Component\Form\AbstractType'))->hasMethod('getBlockPrefix');
21
        }
22
23 9
        return self::$isFormLegacy;
24
    }
25
26
    private function __construct()
27
    {
28
    }
29
}
30