Completed
Push — master ( 19a7d3...6b997b )
by Tim
13:45
created

ICalTimeZone   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
c 0
b 0
f 0
lcom 1
cbo 0
dl 0
loc 24
rs 10
1
<?php
2
namespace JMBTechnologyLimited\ICalDissect;
3
4
5
/**
6
 *
7
 * @link https://github.com/JMB-Technology-Limited/ICalDissect
8
 * @license https://raw.github.com/JMB-Technology-Limited/ICalDissect/master/LICENSE.txt 3-clause BSD
9
 * @copyright (c) 2014, JMB Technology Limited, http://jmbtechnology.co.uk/
10
 * @author James Baster <[email protected]>
11
 */
12
13
class ICalTimeZone
14
{
15
	protected $timeZone = 'UTC';
16
17
	public function __construct() {
18
	}
19
20
	public function processLine($keyword, $value) {
21
		if ($keyword == 'TZID') {
22
			$timezoneIdentifiers = \DateTimeZone::listIdentifiers();
23
			if (in_array($value, $timezoneIdentifiers)) {
24
				$this->timeZone = $value;
25
			}
26
		}
27
	}
28
	
29
	public function getTimeZoneIdentifier() {
30
		return $this->timeZone;
31
	}
32
	
33
	public function getTimeZone() {
34
		return new \DateTimeZone($this->timeZone);
35
	}
36
}
37
38