Failed Conditions
Pull Request — experimental/3.1 (#2532)
by Kentaro
34:08 queued 17:05
created

GenerateProxyCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 2
dl 0
loc 17
ccs 0
cts 10
cp 0
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/*
3
 * This file is part of EC-CUBE
4
 *
5
 * Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved.
6
 *
7
 * http://www.lockon.co.jp/
8
 *
9
 * This program is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU General Public License
11
 * as published by the Free Software Foundation; either version 2
12
 * of the License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
 */
23
24
namespace Eccube\Command;
25
26
use Eccube\Entity\ProxyGenerator;
27
use Eccube\Repository\PluginRepository;
28
use Eccube\Service\EntityProxyService;
29
use Knp\Command\Command;
30
use Symfony\Component\Console\Input\InputInterface;
31
use Symfony\Component\Console\Output\OutputInterface;
32
33
34
class GenerateProxyCommand extends Command
0 ignored issues
show
introduced by
Missing class doc comment
Loading history...
35
{
36
    protected function configure()
37
    {
38
        $this
39
            ->setName('generate-proxies')
40
            ->setDescription('generate entity proxies');
41
    }
42
43
    protected function execute(InputInterface $input, OutputInterface $output)
44
    {
45
        /** @var \Eccube\Application $app */
46
        $app = $this->getSilexApplication();
47
        /** @var EntityProxyService $entityProxyService */
48
        $entityProxyService = $app[EntityProxyService::class];
49
50
        $dirs = array_map(function($p) use ($app) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
51
            return $app['config']['root_dir'].'/app/Plugin/'.$p->getCode().'/Entity';
52
        }, $app[PluginRepository::class]->findAllEnabled());
53
54
        $entityProxyService->generate(
55
            array_merge([$app['config']['root_dir'].'/app/Acme/Entity'], $dirs),
56
            $app['config']['root_dir'].'/app/proxy/entity',
57
            $output
58
        );
59
    }
60
}
61