WikiFile::getRevision PHP Method

getRevision() public method

Revision can be the following: - revision timestamp (string, e.g. "2001-01-15T14:56:00Z") - revision index (int, e.g. 3) The most recent revision has index 0, and it increments towards older revisions. A timestamp must be in ISO 8601 format.
public getRevision ( mixed $revision ) : mixed
$revision mixed The index or timestamp of the revision
return mixed The properties (array), or null if not found
    public function getRevision($revision)
    {
        // Select revision by index
        if (is_int($revision)) {
            if (isset($this->history[$revision])) {
                return $this->history[$revision];
            }
            // Search revision by timestamp
        } else {
            foreach ($this->history as $history) {
                if ($history['timestamp'] == $revision) {
                    return $history;
                }
            }
        }
        // Return error message
        $this->error = array();
        $this->error['file'] = "Revision '{$revision}' was not found for this file";
        return null;
    }