You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
996 B
45 lines
996 B
<?php |
|
|
|
class FreshRSS_FilterAction { |
|
|
|
private $booleanSearch = null; |
|
private $actions = null; |
|
|
|
private function __construct($booleanSearch, $actions) { |
|
$this->booleanSearch = $booleanSearch; |
|
$this->_actions($actions); |
|
} |
|
|
|
public function booleanSearch() { |
|
return $this->booleanSearch; |
|
} |
|
|
|
public function actions() { |
|
return $this->actions; |
|
} |
|
|
|
public function _actions($actions) { |
|
if (is_array($actions)) { |
|
$this->actions = array_unique($actions); |
|
} else { |
|
$this->actions = null; |
|
} |
|
} |
|
|
|
public function toJSON() { |
|
if (is_array($this->actions) && $this->booleanSearch != null) { |
|
return array( |
|
'search' => $this->booleanSearch->getRawInput(), |
|
'actions' => $this->actions, |
|
); |
|
} |
|
return ''; |
|
} |
|
|
|
public static function fromJSON($json) { |
|
if (!empty($json['search']) && !empty($json['actions']) && is_array($json['actions'])) { |
|
return new FreshRSS_FilterAction(new FreshRSS_BooleanSearch($json['search']), $json['actions']); |
|
} |
|
return null; |
|
} |
|
}
|
|
|