TQ\Svn\Repository\Repository::getLog PHP Method

getLog() public method

Returns the current repository log
public getLog ( integer | null $limit = null, integer | null $skip = null ) : array
$limit integer | null The maximum number of log entries returned
$skip integer | null Number of log entries that are skipped from the beginning
return array
    public function getLog($limit = null, $skip = null)
    {
        $arguments = array('--xml', '--revision' => 'HEAD:0');
        $skip = $skip === null ? 0 : (int) $skip;
        if ($limit !== null) {
            $arguments['--limit'] = (int) ($limit + $skip);
        }
        /** @var $result CallResult */
        $result = $this->getSvn()->{'log'}($this->getRepositoryPath(), $arguments);
        $result->assertSuccess(sprintf('Cannot retrieve log from "%s"', $this->getRepositoryPath()));
        $xml = simplexml_load_string($result->getStdOut());
        if (!$xml) {
            throw new \RuntimeException(sprintf('Cannot read log XML for "%s"', $this->getRepositoryPath()));
        }
        $logEntries = new \ArrayIterator($xml->xpath('/log/logentry'));
        if ($limit !== null) {
            $logEntries = new \LimitIterator($logEntries, $skip, $limit);
        }
        $log = array();
        foreach ($logEntries as $item) {
            $log[] = array((string) $item['revision'], (string) $item->author, (string) $item->date, (string) $item->msg);
        }
        return $log;
    }