archive = $archive; // set up the rule data $this->setup($data); } /** * Returns the rule identifier. * * @return string */ public function getRule() { // remove the class prefix $rule = preg_replace("/^VBOBackupExportRule/", '', get_class($this)); // place an underscore between each camelCase return strtolower(preg_replace("/([a-z])([A-Z])/", '$1_$2', $rule)); } /** * Returns the rules instructions. * * @return mixed */ abstract public function getData(); /** * Configures the rule to work according to the specified data. * * @param mixed $data The rule setup data. * * @return void */ abstract protected function setup($data); /** * Creates a standard object, containing all the supported properties, * to be used when this class is passed to "json_encode()". * * @return object * * @see JsonSerializable */ public function jsonSerialize() { $rule = new stdClass; $rule->role = $this->getRule(); $rule->data = $this->getData(); $rule->dateCreated = JFactory::getDate()->toSql(); return $rule; } }