Example #1
0
 /**
  * @param bool $devMode Opération sur BdD de dev ou de prod. Par défaut sur l'API de DEV pour éviter les erreurs.
  */
 public function __construct(array $options = array())
 {
     // Check that all options exist then override defaults
     foreach ($options as $k => $v) {
         if (!array_key_exists($k, $this->_options)) {
             throw new OSM_Exception('Unknow ' . __CLASS__ . ' option "' . $k . '"');
         }
         $this->_options[$k] = $v;
     }
     // Set the Logger
     OSM_ZLog::configure($this->_options['log']);
     OSM_ZLog::debug(__METHOD__, 'options: ', print_r($this->_options, true));
     // Set the Servers url
     if (empty($this->_options['url'])) {
         throw new OSM_Exception('Option "url" must be set');
     }
     if (empty($this->_options['oapi_url'])) {
         throw new OSM_Exception('Option "oapi_url" must be set');
     }
     if (!empty($this->_options['outputFolder'])) {
         if (!file_exists($this->_options['outputFolder'])) {
             throw new OSM_Exception('Option "outputFolder" is set, but the folder does not exists');
         }
     }
     OSM_ZLog::debug(__METHOD__, 'url: ' . $this->_options['url'] . ', url4Write: ' . $this->_options['url4Write']);
 }