Back to Changelog class

Method endElement

public void
endElement
(mixed $parser, mixed $name)
Callback for closing the element
Parameters
  • object $parser Parser object
  • string $name Name of element that was closed
Returns
  • void
Since
  • 1.7.0
-
  • This is public because it is called externally
Class: Changelog
Project: Joomla

Method endElement - Source code

/**
 * Callback for closing the element
 *
 * @param   object  $parser  Parser object
 * @param   string  $name    Name of element that was closed
 *
 * @return  void
 *
 * @note    This is public because it is called externally
 * @since   1.7.0
 */
public function endElement($parser, $name)
{
    array_pop($this->stack);
    switch ($name) {
        case 'SECURITY':
        case 'FIX':
        case 'LANGUAGE':
        case 'ADDITION':
        case 'CHANGE':
        case 'REMOVE':
        case 'NOTE':
            $name = strtolower($name);
            $this->currentChangelog->{$name}->data = $this->items;
            $this->items = array();
            break;
        case 'CHANGELOG':
            if (version_compare($this->currentChangelog->version->data, $this->matchVersion, '==') === true) {
                $this->latest = $this->currentChangelog;
            }
            // No version match, empty it
            $this->currentChangelog = new \stdClass();
            break;
        case 'CHANGELOGS':
            // If the latest item is set then we transfer it to where we want to
            if (isset($this->latest)) {
                foreach (get_object_vars($this->latest) as $key => $val) {
                    $this->{$key} = $val;
                }
                unset($this->latest);
                unset($this->currentChangelog);
            } elseif (isset($this->currentChangelog)) {
                // The update might be for an older version of j!
                unset($this->currentChangelog);
            }
            break;
    }
}