/** * @return RecurringEvents */ private function newInstance(array $params) { $parameters = new ParserParameterFormatter($params); $instance = new RecurringEvents($parameters->toArray()); $instance->setDefaultNumRecurringEvents(10); $instance->setMaxNumRecurringEvents(50); return $instance; }
private function initRecurringEvents($parameters) { $this->setFirstElementAsPropertyLabel(true); if ($this->recurringEvents !== null) { return $this->recurringEvents; } $this->recurringEvents = new RecurringEvents($parameters); $this->recurringEvents->setDefaultNumRecurringEvents($this->defaultNumRecurringEvents); $this->recurringEvents->setMaxNumRecurringEvents($this->maxNumRecurringEvents); }
/** * Parse parameters, and update the ParserOutput with data from the * RecurringEvents object * * @since 1.9 * * @param ArrayFormatter $parameters * * @return string|null */ public function parse(ArrayFormatter $parameters) { $this->setFirstElementForPropertyLabel(true); // Get recurring events $this->events = new RecurringEvents($parameters->toArray(), $this->settings); $this->messageFormatter->addFromArray($this->events->getErrors()); foreach ($this->events->getDates() as $date_str) { // Override existing parameters array with the returned // pre-processed parameters array from recurring events $parameters->setParameters($this->events->getParameters()); // Add the date string as individual property / value parameter $parameters->addParameter($this->events->getProperty(), $date_str); // @see SubobjectParserFunction::addDataValuesToSubobject // Each new $parameters set will add an additional subobject // to the instance $this->addDataValuesToSubobject($parameters); $this->parserData->getSemanticData()->addSubobject($this->subobject); // Collect errors that occurred during processing $this->messageFormatter->addFromArray($this->subobject->getErrors()); } // Update ParserOutput $this->parserData->pushSemanticDataToParserOutput(); return $this->messageFormatter->getHtml(); }