CommitCommand::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 2
1
<?php
2
3
/**
4
 * @file CommitCommand.php
5
 * @brief This file contains the CommitCommand class.
6
 * @details
7
 * @author Filippo F. Fadda
8
 */
9
10
11
namespace EoC\CLI\Command;
12
13
14
use Symfony\Component\Console\Input\InputInterface;
15
use Symfony\Component\Console\Output\OutputInterface;
16
17
use ToolBag\Helper\TimeHelper;
18
19
20
/**
21
 * @brief Makes sure all uncommited database changes are written and synchronized to the disk.
22
 * @nosubgrouping
23
 */
24
class CommitCommand extends AbstractCommand {
25
26
27
  /**
28
   * @brief Configures the command.
29
   */
30
  protected function configure() {
31
    $this->setName("commit");
32
    $this->setDescription("Makes sure all uncommited database changes are written and synchronized to the disk");
33
  }
34
35
36
  /**
37
   * @brief Executes the command.
38
   */
39
  protected function execute(InputInterface $input, OutputInterface $output) {
40
    $couch = $this->getConnection();
41
42
    $time = TimeHelper::since($couch->ensureFullCommit($this->getDatabase()), TRUE);
0 ignored issues
show
Documentation introduced by
TRUE is of type boolean, but the function expects a false|string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
43
44
    $output->writeln(sprintf('File opened since: %d days, %d hours, %d minutes, %d seconds', $time['days'], $time['hours'], $time['minutes'], $time['seconds']));
45
  }
46
47
}