Completed
Pull Request — master (#33)
by
unknown
03:26
created
src/Command/ConfigCommand.php 1 patch
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -15,29 +15,29 @@  discard block
 block discarded – undo
15 15
  */
16 16
 class ConfigCommand extends BaseCommand
17 17
 {
18
-  //--------------------------------------------------------------------------------------------------------------------
19
-  /**
20
-   * The helper instance by name.
21
-   */
22
-  private $helper;
18
+    //--------------------------------------------------------------------------------------------------------------------
19
+    /**
20
+     * The helper instance by name.
21
+     */
22
+    private $helper;
23 23
 
24
-  //--------------------------------------------------------------------------------------------------------------------
25
-  /**
26
-   * {@inheritdoc}
27
-   */
28
-  protected function configure()
29
-  {
24
+    //--------------------------------------------------------------------------------------------------------------------
25
+    /**
26
+     * {@inheritdoc}
27
+     */
28
+    protected function configure()
29
+    {
30 30
     $this->setName('config')
31
-         ->setDescription('Create or edit config file')
32
-         ->addArgument('config file', InputArgument::OPTIONAL, 'The audit configuration file', 'etc/audit.json');
33
-  }
31
+            ->setDescription('Create or edit config file')
32
+            ->addArgument('config file', InputArgument::OPTIONAL, 'The audit configuration file', 'etc/audit.json');
33
+    }
34 34
 
35
-  //--------------------------------------------------------------------------------------------------------------------
36
-  /**
37
-   * {@inheritdoc}
38
-   */
39
-  protected function execute(InputInterface $input, OutputInterface $output)
40
-  {
35
+    //--------------------------------------------------------------------------------------------------------------------
36
+    /**
37
+     * {@inheritdoc}
38
+     */
39
+    protected function execute(InputInterface $input, OutputInterface $output)
40
+    {
41 41
     $this->io = new StratumStyle($input, $output);
42 42
 
43 43
     $this->configFileName = $input->getArgument('config file');
@@ -48,74 +48,74 @@  discard block
 block discarded – undo
48 48
 
49 49
     foreach ($this->config as $configPart => $partData)
50 50
     {
51
-      $this->setConfigPart($input, $output, $configPart);
51
+        $this->setConfigPart($input, $output, $configPart);
52 52
     }
53 53
 
54 54
     $this->writeTwoPhases($this->configFileName, json_encode($this->config, JSON_PRETTY_PRINT));
55
-  }
55
+    }
56 56
 
57
-  //--------------------------------------------------------------------------------------------------------------------
58
-  /**
59
-   * Controls config parts.
60
-   *
61
-   * @param InputInterface  $input
62
-   * @param OutputInterface $output
63
-   * @param string          $configPart Part of config file.
64
-   */
65
-  protected function setConfigPart(InputInterface $input, OutputInterface $output, $configPart)
66
-  {
57
+    //--------------------------------------------------------------------------------------------------------------------
58
+    /**
59
+     * Controls config parts.
60
+     *
61
+     * @param InputInterface  $input
62
+     * @param OutputInterface $output
63
+     * @param string          $configPart Part of config file.
64
+     */
65
+    protected function setConfigPart(InputInterface $input, OutputInterface $output, $configPart)
66
+    {
67 67
     switch ($configPart)
68 68
     {
69
-      case 'database':
69
+        case 'database':
70 70
         $this->setDatabasePart($input, $output, $configPart);
71 71
         break;
72
-      case 'tables':
72
+        case 'tables':
73 73
         foreach ($this->config[$configPart] as $tableName => $tableData)
74 74
         {
75
-          $this->setTableParams($input, $output, $configPart, $tableName);
75
+            $this->setTableParams($input, $output, $configPart, $tableName);
76 76
         }
77 77
         break;
78 78
     }
79
-  }
79
+    }
80 80
 
81
-  //--------------------------------------------------------------------------------------------------------------------
82
-  /**
83
-   * Configure each table for audit or not.
84
-   *
85
-   * @param InputInterface  $input
86
-   * @param OutputInterface $output
87
-   * @param string          $configPart Part of config file.
88
-   * @param string          $tableName  The table name.
89
-   */
90
-  protected function setTableParams(InputInterface $input, OutputInterface $output, $configPart, $tableName)
91
-  {
81
+    //--------------------------------------------------------------------------------------------------------------------
82
+    /**
83
+     * Configure each table for audit or not.
84
+     *
85
+     * @param InputInterface  $input
86
+     * @param OutputInterface $output
87
+     * @param string          $configPart Part of config file.
88
+     * @param string          $tableName  The table name.
89
+     */
90
+    protected function setTableParams(InputInterface $input, OutputInterface $output, $configPart, $tableName)
91
+    {
92 92
     $this->io->logInfo('Please input data for table <dbo>\'%s\'</dbo>.', $tableName);
93 93
     $question = sprintf('Audit table \'%s\' or not (y|(n)): ', $tableName);
94 94
     $question = new ConfirmationQuestion($question, false);
95 95
 
96 96
     $this->config[$configPart][$tableName]['audit'] = $this->helper->ask($input, $output, $question);
97
-  }
97
+    }
98 98
 
99
-  //--------------------------------------------------------------------------------------------------------------------
100
-  /**
101
-   * Configure database part.
102
-   *
103
-   * @param InputInterface  $input
104
-   * @param OutputInterface $output
105
-   * @param string          $configPart Part of config file.
106
-   */
107
-  protected function setDatabasePart(InputInterface $input, OutputInterface $output, $configPart)
108
-  {
99
+    //--------------------------------------------------------------------------------------------------------------------
100
+    /**
101
+     * Configure database part.
102
+     *
103
+     * @param InputInterface  $input
104
+     * @param OutputInterface $output
105
+     * @param string          $configPart Part of config file.
106
+     */
107
+    protected function setDatabasePart(InputInterface $input, OutputInterface $output, $configPart)
108
+    {
109 109
     $this->io->logInfo('Please input data for <dbo>\'%s\'</dbo> part.', $configPart);
110 110
     foreach ($this->config[$configPart] as $parameter => $value)
111 111
     {
112
-      $question                              = sprintf('Please enter the \'%s\' (%s): ', $parameter, $value);
113
-      $question                              = new Question($question, $value);
114
-      $this->config[$configPart][$parameter] = $this->helper->ask($input, $output, $question);
112
+        $question                              = sprintf('Please enter the \'%s\' (%s): ', $parameter, $value);
113
+        $question                              = new Question($question, $value);
114
+        $this->config[$configPart][$parameter] = $this->helper->ask($input, $output, $question);
115
+    }
115 116
     }
116
-  }
117 117
 
118
-  //--------------------------------------------------------------------------------------------------------------------
118
+    //--------------------------------------------------------------------------------------------------------------------
119 119
 }
120 120
 
121 121
 //----------------------------------------------------------------------------------------------------------------------
Please login to merge, or discard this patch.