Fifree2pubblicamanualeCommand::copiaManuale()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 11
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Fi\CoreBundle\Command;
4
5
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
use Symfony\Component\Finder\Finder;
9
10
class Fifree2pubblicamanualeCommand extends ContainerAwareCommand
11
{
12
13 6
    protected function configure()
14
    {
15
        $this
16 6
                ->setName('fifree2:pubblicamanuale')
17 6
                ->setDescription('Copia il manuale dalla cartella Doc alla cartella Web')
18 6
                ->setHelp('Estende la pubblicazione degli assets al manuale');
19 6
    }
20
21
    protected function execute(InputInterface $input, OutputInterface $output)
22
    {
23
        $this->copiaManuale();
24
    }
25
26
    protected function copiaManuale()
27
    {
28
        $filesystem = $this->getContainer()->get('filesystem');
29
30
        $projectDir = substr($this->getContainer()->get('kernel')->getRootDir(), 0, -4);
31
        $originDir = $projectDir . '/doc/manuale';
32
        $targetDir = $projectDir . '/web/uploads';
33
34
        $filesystem->mkdir($targetDir, 0777);
35
        //    // We use a custom iterator to ignore VCS files
36
        $filesystem->mirror($originDir, $targetDir, Finder::create()->name('manuale.pdf')->in($originDir));
37
    }
38
}
39