コード例 #1
0
ファイル: DataField.class.php プロジェクト: ratbird/hope
 /**
  * Specialized getter for values. Will try to obtain the value
  * and if an error occurs, convert it to snake case and try again.
  *
  * @param String $field Field name
  * @return mixed Contents of the variable with the key "$field"
  * @throws InvalidArgumentException when the field is invalid
  * @todo This should be removed after a while (today is 2015-11-19)
  */
 public function getValue($field)
 {
     try {
         return parent::getValue($field);
     } catch (Exception $e) {
         $field = $this->convertLegacyFields($field);
         return parent::getValue($field);
     }
 }
コード例 #2
0
ファイル: CronjobTask.class.php プロジェクト: ratbird/hope
 /**
  * Proxy the static methods "getDescription", "getName" and
  * "getParameters" from the task class.
  *
  * @param  String $field Field which should be accessed.
  * @return String Value of the method call
  */
 public function getValue($field)
 {
     if (in_array($field, words('description name parameters'))) {
         if ($this->valid) {
             $method = 'get' . ucfirst($field);
             return call_user_func("{$this->class}::{$method}");
         } elseif ($field === 'description') {
             return _('Unbekannt');
         } elseif ($field === 'name') {
             return preg_replace('/(_Cronjob)?(\\.class)?\\.php$/', '', basename($this->filename)) . ' (' . _('fehlerhaft') . ')';
         } elseif ($field === 'parameters') {
             return array();
         }
     }
     return parent::getValue($field);
 }