Completed
Push — master ( 2bd965...c99558 )
by Peter
07:34
created

Version20160823215458RemoveKnpMenuTemplate::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/**
3
 * AnimeDb package.
4
 *
5
 * @author    Peter Gribanov <[email protected]>
6
 * @copyright Copyright (c) 2011, Peter Gribanov
7
 * @license   http://opensource.org/licenses/GPL-3.0 GPL v3
8
 */
9
namespace AnimeDb\Bundle\CatalogBundle\DoctrineMigrations;
10
11
use Doctrine\DBAL\Migrations\AbstractMigration;
12
use Doctrine\DBAL\Schema\Schema;
13
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
14
use Symfony\Component\DependencyInjection\ContainerInterface;
15
use Symfony\Component\Filesystem\Filesystem;
16
17
/**
18
 * Auto-generated Migration: Please modify to your needs!
19
 */
20
class Version20160823215458RemoveKnpMenuTemplate extends AbstractMigration implements ContainerAwareInterface
21
{
22
    /**
23
     * @var Filesystem
24
     */
25
    protected $fs;
26
27
    /**
28
     * @var string
29
     */
30
    protected $tpl;
31
32
    /**
33
     * @param ContainerInterface $container
34
     */
35
    public function setContainer(ContainerInterface $container = null)
36
    {
37
        $this->fs = $container->get('filesystem');
0 ignored issues
show
Bug introduced by
It seems like $container is not always an object, but can also be of type null. Maybe add an additional type check?

If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe:

function someFunction(A $objectMaybe = null)
{
    if ($objectMaybe instanceof A) {
        $objectMaybe->doSomething();
    }
}
Loading history...
38
        $this->tpl = $container->getParameter('kernel.root_dir').'/Resources/knp_menu.html.twig';
39
    }
40
41
    /**
42
     * @param Schema $schema
43
     */
44
    public function up(Schema $schema)
45
    {
46
        $this->fs->remove($this->tpl);
47
    }
48
49
    /**
50
     * @param Schema $schema
51
     */
52
    public function down(Schema $schema)
53
    {
54
        $this->fs->copy(__DIR__.'/data/knp_menu.html.twig', $this->tpl);
55
    }
56
}
57