Fixture   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 35
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getOrder() 0 4 1
A get() 0 8 2
A setContainer() 0 4 1
1
<?php
2
3
namespace AppBundle\DataFixtures\ORM;
4
5
use Doctrine\Common\DataFixtures\FixtureInterface;
6
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
7
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8
use Symfony\Component\DependencyInjection\ContainerInterface;
9
10
abstract class Fixture implements FixtureInterface, OrderedFixtureInterface, ContainerAwareInterface
11
{
12
    /**
13
     * @var ContainerInterface
14
     */
15
    private $container;
16
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function getOrder()
21
    {
22
        return 1;
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function get($id)
29
    {
30
        if (null === $this->container) {
31
            throw new \RuntimeException('Container not injected in fixture.');
32
        }
33
34
        return $this->container->get($id);
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function setContainer(ContainerInterface $container = null)
41
    {
42
        $this->container = $container;
43
    }
44
}
45