summaryrefslogtreecommitdiff
path: root/lib/Kolab/FreeBusy/Format.php
blob: b5ebfdab548d26e8fb38c3048fd9115c7fc41de4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php

namespace Kolab\FreeBusy;

/**
 * Base class to handle free/busy data format conversion
 */
class Format
{
	protected $config;

	/**
	 * Factory method creating an instace of Format according to the given type
	 *
	 * @param string Format identifier
	 */
	public static function factory($type)
	{
		switch (strtolower($type)) {
			case 'exchange2010':
				return new FormatExchange2010;

			default:
				if (!empty($type)) {
					Logger::get('format')->addError("Unknown format type '$type'!");
				}
				return new Format;
		}

		return null;
	}

	/**
	 * Convert the given free/busy data stream to iCal format
	 *
	 * @param string Input data stream
	 * @return string iCal formatted free/busy list
	 */
	public function toVCalendar($input)
	{
		// default: no format changes
		return $input;
	}


}