File: Notifications_Factory.php

package info (click to toggle)
spotweb 20130826%2Bdfsg2-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 5,132 kB
  • ctags: 11,281
  • sloc: php: 31,367; xml: 1,009; sh: 148; makefile: 83
file content (30 lines) | stat: -rwxr-xr-x 1,074 bytes parent folder | download | duplicates (2)
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
<?php
class Notifications_Factory {

	public static function build($appName, $provider, array $dataArray) {
		# Nieuwe handlers voegen we expliciet toe omdat we anders
		# niet weten wat we includen in combinate met __autoload()
		switch ($provider) {
			case 'boxcar'			: $handler = new Notifications_Boxcar($appName, $dataArray); break;
			case 'email'			: $handler = new Notifications_Email($appName, $dataArray); break;
			case 'growl'			: $handler = new Notifications_Growl($appName, $dataArray); break;
			case 'nma'				: $handler = new Notifications_NMA($appName, $dataArray); break;
			case 'prowl'			: $handler = new Notifications_Prowl($appName, $dataArray); break;
			case 'twitter'			: $handler = new Notifications_Twitter($appName, $dataArray); break;
			default					: $handler = false; break;
		} # switch

		return $handler;
	} # build()
	
	public static function getActiveServices() {
		return array('boxcar',
					 'email',
					 'growl',
					 'nma',
					 'prowl',
					 'twitter'
					);
	}

} # class Notifications_Factory