/usr/share/horde/timeobjects/lib/Factory/Driver.php is in php-horde-timeobjects 2.1.1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | <?php
/**
* Factory for TimeObjects_Driver
*
* @author Michael J. Rubinsky <mrubinsk@horde.org>
* @category Horde
* @license http://www.horde.org/licenses/bsd BSD
* @package Timeobjects
*/
class TimeObjects_Factory_Driver
{
/**
* Creates a concrete TimeObjects_Driver object.
*
* @param string $name The driver type to create.
* @param array $params Any driver parameters.
*
* @return TimeObjects_Driver
* @throws TimeObjects_Exception
*/
public function create($name, array $params = array())
{
$class = 'TimeObjects_Driver_' . basename($name);
switch ($class) {
case 'TimeObjects_Driver_Weather':
if (!class_exists('Horde_Service_Weather')) {
throw new TimeObjects_Exception('Horde_Services_Weather is not installed');
}
break;
case 'TimeObjects_Driver_FacebookEvents':
if (!class_exists('Horde_Service_Facebook')) {
throw new TimeObjects_Exception('Horde_Services_Facebook is not installed');
}
break;
default:
throw new TimeObjects_Exception(sprintf('Unable to load the definition of %s', $class));
}
return new $class($params);
}
}
|