CreateCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 8 1
A execute() 0 7 1
1
<?php
2
3
/*
4
 * @file CreateCommand.php
5
 * @brief This file contains the CreateCommand class.
6
 * @details
7
 * @author Filippo F. Fadda
8
 */
9
10
11
namespace EoC\CLI\Command;
12
13
14
use Symfony\Component\Console\Input\InputArgument;
15
use Symfony\Component\Console\Input\InputInterface;
16
use Symfony\Component\Console\Output\OutputInterface;
17
18
19
/**
20
 * @brief Creates a new PitPress database.
21
 * @nosubgrouping
22
 */
23
class CreateCommand extends AbstractCommand {
24
25
26
  /**
27
   * @brief Configures the command.
28
   */
29
  protected function configure() {
30
    $this->setName("create");
31
    $this->setDescription("Creates a new database");
32
33
    $this->addArgument("database",
34
      InputArgument::REQUIRED,
35
      "The CouchDB database name to use");
36
  }
37
38
39
  /**
40
   * @brief Executes the command.
41
   */
42
  protected function execute(InputInterface $input, OutputInterface $output) {
43
    $database = (string)$input->getArgument('database');
44
45
    $couch = $this->getConnection();
46
47
    $couch->createDb($database);
48
  }
49
50
}