Commit ac1fcf72 authored by Shakarim Sapa's avatar Shakarim Sapa

- Добавлены аннотации и комментарии к методам;

 - Добавлена возможность запросить класс условия по ID;
 - Изменен метод получения списка условий в системе. Теперь возвращается не массив названий, а массив объектов;
parent 8a2eb2ed
...@@ -60,14 +60,29 @@ class Conditions { ...@@ -60,14 +60,29 @@ class Conditions {
} }
/** /**
* Возвращаем массив всех условий в системе
* @return array * @return array
*/ */
public function getConditions(){ public function getConditions(){
$data = array(); $data = array();
foreach(self::$config as $condition) { foreach(self::$config as $condition) {
$class = $condition['class']::init(); $class = $condition['class']::init();
$data[$class::CONDITION_ID] = $class->getName(); $data[$class::CONDITION_ID] = $class;
} }
return $data; return $data;
} }
/**
* Возвращаем класс условия по ID
* @param $id
* @return null
*/
public function getConditionById($id){
foreach(self::$config as $condition) {
$class = $condition['class']::init();
if ($class::CONDITION_ID==$id)
return $class;
}
return null;
}
} }
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment