Passed
Push — 5.x ( 8b5a2d...246957 )
by Jerome
11:21 queued 14s
created

SuccessResult   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 24
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getInstance() 0 3 1
A __construct() 0 3 1
1
<?php
2
/**
3
 * SuccessResult
4
 * Generic success result class, extend if you want to do something special.
5
 */
6
class SuccessResult extends GenericResult {
7
	
8
	public const RESULT_SUCCESS = 0;
9
10
	/**
11
	 * A new success result
12
	 *
13
	 * @param mixed $result The result
14
	 */
15
	public function __construct($result) {
16
		$this->setResult($result);
17
		$this->setStatusCode(self::RESULT_SUCCESS);
18
	}
19
20
	/**
21
	 * Returns a new instance of this class
22
	 *
23
	 * @param mixed $result A result of some kind?
24
	 *
25
	 * @return SuccessResult
26
	 */
27
	public static function getInstance($result) {
28
		// Return a new error object.
29
		return new SuccessResult($result);
30
	}
31
}
32