Load a service file
public static loadService ( string $service, array $config ) : Service | ||
$service | string | The service name |
$config | array | The parameters |
리턴 | Service |
/** * Set the $classes array * * @return void */ public static function setClasses() { require 'Services/Service.php'; $columnCounter = 0; foreach (self::getServices() as $column) { $columnCounter++; self::$columns[$columnCounter] = array(); foreach ($column as $service) { list($name, $variable, $config) = $service; $service_instance = strtolower($name . '_' . $variable); ${$service_instance} = Pubwich::loadService($name, $config); ${$service_instance}->setVariable($variable); self::$classes[] = ${$service_instance}; self::$columns[$columnCounter][] =& ${$service_instance}; } } }
/** * Set the $classes array * * @return void */ public static function setClasses() { require_once 'Services/Service.php'; $columnCounter = 0; foreach (self::getServices() as $column) { $columnCounter++; self::$columns[$columnCounter] = array(); foreach ($column as $service) { list($name, $variable, $config) = $service; $name = ucfirst($name); $service_instance = strtolower($name . '_' . $variable); ${$service_instance} = Pubwich::loadService($name, $config); ${$service_instance}->setVariable($variable); self::$classes[$variable] = ${$service_instance}; self::$columns[$columnCounter][] =& ${$service_instance}; } } if (count(self::$classes) < 1) { $error_text_service = array('Text', 'error_empty_config', array('title' => 'Error: Please configure PubwichFork', 'text' => ' <p>There is no configuration found. Please edit <code>config.php</code> and follow the instructions there. Do not forget to edit the service configuration in step 6 and the service grouping in step 7.</p> <p>You may check the <a href="https://github.com/haschek/PubwichFork/wiki">PubwichFork documentation</a> for more informations.</p>')); self::setServices(array(array($error_text_service))); self::setClasses(); } }