Пример #1
0
 /**
  * @param array $properties
  *
  *@return \WP_Error|false|Base_Reporter
  */
 public function create_reporter(array $properties)
 {
     $properties = Model_Helper::prepare_properties($this->get_settings('reporter_properties'), $properties);
     $reporter_class = $properties['class_name'] ? $properties['class_name'] : $this->get_reporter_class($properties['name']);
     $reporter_class = $this->get_settings('namespaces.classes_namespace') . '\\' . $reporter_class;
     $reporter = new $reporter_class($properties);
     if (!$reporter instanceof Base_Reporter) {
         return new \WP_Error('Each reporter must to be an instance or sub-instance of Base_Reporter class');
     }
     if (!$reporter->is_enabled()) {
         return false;
     }
     return $reporter;
 }
Пример #2
0
 public static final function filter_possible_properties($properties)
 {
     return Model_Helper::filter_possible_properties(self::get_properties_keys(), $properties);
 }