ApplicationConfig   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 42
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A beginCommand() 0 8 1
1
<?php
2
3
/**
4
 * This file is part of the Cubiche package.
5
 *
6
 * Copyright (c) Cubiche
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Cubiche\Core\Console\Api\Config;
13
14
use Webmozart\Console\Api\Config\ApplicationConfig as BaseApplicationConfig;
15
16
/**
17
 * ApplicationConfig class.
18
 *
19
 * @author Ivannis Suárez Jerez <[email protected]>
20
 */
21
class ApplicationConfig extends BaseApplicationConfig
22
{
23
    /**
24
     * Starts a configuration block for a command.
25
     *
26
     * The configuration of the command is returned by this method. You can use
27
     * the fluent interface to configure the sub-command before jumping back to
28
     * this configuration with {@link CommandConfig::end()}:
29
     *
30
     * ```php
31
     * protected function configure()
32
     * {
33
     *     $this
34
     *         ->setName('server')
35
     *         ->setDescription('List and manage servers')
36
     *
37
     *         ->beginCommand('add')
38
     *             ->setDescription('Add a server')
39
     *             ->addArgument('host', Argument::REQUIRED)
40
     *             ->addOption('port', 'p', Option::VALUE_OPTIONAL, null, 80)
41
     *         ->end()
42
     *
43
     *         // ...
44
     *     ;
45
     * }
46
     * ```
47
     *
48
     * @param string $name The name of the command.
49
     *
50
     * @return CommandConfig The command configuration.
51
     *
52
     * @see editCommand()
53
     */
54
    public function beginCommand($name)
55
    {
56
        $commandConfig = new CommandConfig($name, $this);
57
58
        $this->addCommandConfig($commandConfig);
59
60
        return $commandConfig;
61
    }
62
}
63