main.*ErrorHandler.execute   A
last analyzed

Complexity

Conditions 3

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 6
dl 0
loc 9
rs 10
c 0
b 0
f 0
nop 1
1
/**
2
 * @author  : Jagepard <[email protected]>
3
 * @license https://mit-license.org/ MIT
4
 */
5
6
package main
7
8
import "fmt"
9
10
// ErrorHandler is ...
11
type ErrorHandler struct {
12
	name string
13
	next HandlerInterface
14
}
15
16
func (E *ErrorHandler) execute(request string) {
17
18
	if request == E.name {
19
		fmt.Println(E.name)
20
		return
21
	}
22
23
	if E.next != nil {
24
		E.next.execute(request)
25
	}
26
}
27
28
func (E *ErrorHandler) setNext(next HandlerInterface) HandlerInterface {
29
	E.next = next
30
	return next
31
}
32