ProcessingErrorHandler   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 33.33%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 46
ccs 3
cts 9
cp 0.3333
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addErrors() 0 5 2
A getErrors() 0 3 1
A addError() 0 3 1
1
<?php
2
3
namespace ParamProcessor;
4
5
/**
6
 * Static class for error handling.
7
 *
8
 * @since 0.4
9
 * @deprecated since 1.0
10
 *
11
 * @licence GNU GPL v2+
12
 * @author Jeroen De Dauw < [email protected] >
13
 */
14
final class ProcessingErrorHandler {
15
16
	/**
17
	 * @since 0.4
18
	 *
19
	 * @var array of ProcessingError
20
	 */
21
	private static $errors = [];
22
23
	/**
24
	 * Adds a single ProcessingError.
25
	 *
26
	 * @since 0.4
27
	 *
28
	 * @param string $errorMessage
0 ignored issues
show
Bug introduced by
There is no parameter named $errorMessage. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
29
	 * @param integer $severity
0 ignored issues
show
Bug introduced by
There is no parameter named $severity. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
30
	 */
31 17
	public static function addError( ProcessingError $error ) {
32 17
		self::$errors[$error->getElement()][] = $error;
33 17
	}
34
35
	/**
36
	 * Adds a list of ProcessingError.
37
	 *
38
	 * @since 0.4
39
	 *
40
	 * @param array $errors
41
	 */
42
	public static function addErrors( array $errors ) {
43
		foreach ( $errors as $error ) {
44
			self::addError( $error );
45
		}
46
	}
47
48
	/**
49
	 * Returns a list of all registered errors.
50
	 *
51
	 * @since 0.4
52
	 *
53
	 * @return array of ProcessingError
54
	 */
55
	public static function getErrors() {
56
		return self::$errors;
57
	}
58
59
}