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

CompatibilityHelper   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 66.67%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 22
ccs 4
cts 6
cp 0.6667
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isFormLegacy() 0 8 2
A __construct() 0 3 1
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