/** * 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(); }
<li>Run <code>getArrayAsList( $anyArray )</code> then display the results to the screen</li> </ul> </li> <li>Show your instructor when complete</li> </ul> <span> <?php //some arrays to work with $arrayOfStudents = array("Jill", "Jane", "John", "Joe", "Janet", "Jethro"); $arrayOfNumbers = array(23, 123, 12, 43, 4512, 1234, 3434, 12, 3); $musicians = array("Jack", "Jill", "Joe", "Jane"); //load the class file include "ArrayFormatter.php"; //instantiate a new ArrayFormatter object $myArrayFormatter = new ArrayFormatter(); //invoke some public functions $myArrayFormatter->setTypeOfHTMLList("ol"); $myArrayFormatter->displayArrayAsList($musicians); $myArrayFormatter->setTypeOfHTMLList("ul"); echo $myArrayFormatter->getArrayAsList($musicians); //clear the ArrayFormatter from memory when we are done with it unset($myArrayFormatter); ?> </span> <h2>Standard Object Handling Reminder</h2><pre><code>require_once("MyClass.php"); //load class file $myObject = new MyClass(); //instantiate a new Object $myObject->functionName(); //use the Object's public functions as needed unset($myObject); //delete Object when finished</code></pre>