Factory   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 6
c 2
b 1
f 0
lcom 0
cbo 5
dl 0
loc 30
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B makeFactory() 0 20 6
1
<?php
2
3
namespace Jalle19\HaPHProxy\Section;
4
5
/**
6
 * Class Factory
7
 * @package Jalle19\HaPHProxy\Section
8
 * @author  Sam Stenvall <[email protected]>
9
 * @license GNU General Public License 2.0+
10
 */
11
class Factory
12
{
13
14
	/**
15
	 * @param string $line
16
	 *
17
	 * @return AbstractSection|null
18
	 */
19
	public static function makeFactory($line)
20
	{
21
		$words     = explode(' ', $line);
22
		$firstWord = $words[0];
23
24
		switch ($firstWord) {
25
			case Sections::SECTION_GLOBAL:
26
				return new GlobalSection();
27
			case Sections::SECTION_DEFAULTS:
28
				return new DefaultsSection();
29
			case Sections::SECTION_FRONTEND:
30
				return new FrontendSection($line);
31
			case Sections::SECTION_BACKEND:
32
				return new BackendSection($line);
33
			case Sections::SECTION_LISTEN:
34
				return new ListenSection($line);
35
		}
36
37
		return null;
38
	}
39
40
}
41