FormFactoryParamConverter   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getObject() 0 4 1
A supports() 0 5 2
1
<?php
2
3
namespace Zenstruck\ControllerUtil\ParamConverter;
4
5
use Symfony\Component\Form\FormFactoryInterface;
6
use Symfony\Component\HttpFoundation\Request;
7
8
/**
9
 * @author Kevin Bond <[email protected]>
10
 */
11
class FormFactoryParamConverter implements ParamConverter
12
{
13
    private $formFactory;
14
15 2
    public function __construct(FormFactoryInterface $formFactory)
16
    {
17 2
        $this->formFactory = $formFactory;
18 2
    }
19
20
    /**
21
     * {@inheritdoc}
22
     */
23 1
    public function getObject(Request $request)
24
    {
25 1
        return $this->formFactory;
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31 1
    public function supports($class)
32
    {
33 1
        return is_subclass_of($class, 'Symfony\\Component\\Form\\FormFactoryInterface') ||
34 1
            $class === 'Symfony\\Component\\Form\\FormFactoryInterface';
35
    }
36
}
37