Fifree2pubblicamanualeCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 33.33%

Importance

Changes 0
Metric Value
wmc 3
eloc 12
dl 0
loc 27
ccs 5
cts 15
cp 0.3333
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 3 1
A copiaManuale() 0 11 1
A configure() 0 6 1
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