Completed
Push — master ( 7a9ce5...aad2c9 )
by Gregory
01:53
created

Style   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 36
ccs 0
cts 16
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A error() 0 6 1
A section() 0 5 2
A title() 0 5 2
1
<?php
2
namespace Tivnet\Console;
3
4
use Symfony\Component\Console\Output\Output;
5
use Symfony\Component\Console\Style\SymfonyStyle;
6
7
8
/**
9
 * Same as SymfonyStyle, but quiet by default. Requires `-v` to start talking.
10
 */
11
class Style extends SymfonyStyle {
12
13
	/**
14
	 * Minimum verbosity level at which any output is displayed.
15
	 */
16
	const MIN_VERBOSITY = Output::VERBOSITY_VERBOSE;
17
18
	/**
19
	 * The error output is forced.
20
	 * {@inheritdoc}
21
	 */
22
	public function error( $message ) {
23
		$old_verbosity = $this->getVerbosity();
24
		$this->setVerbosity( Output::VERBOSITY_NORMAL );
25
		parent::error( $message );
26
		$this->setVerbosity( $old_verbosity );
27
	}
28
29
	/**
30
	 * {@inheritdoc}
31
	 */
32
	public function section( $message ) {
33
		if ( $this->getVerbosity() >= self::MIN_VERBOSITY ) {
34
			parent::section( $message );
35
		}
36
	}
37
38
	/**
39
	 * {@inheritdoc}
40
	 */
41
	public function title( $message ) {
42
		if ( $this->getVerbosity() >= self::MIN_VERBOSITY ) {
43
			parent::title( $message );
44
		}
45
	}
46
}
47