public function parseLog($log)
    {
        $commits = $tags = [];

        for ($i = 0, $lines = count($log); $i < $lines; $i++) {
            $tmp = explode(': ', $log[$i]);
            $tmp = array_map('trim', $tmp);

            if ($tmp[0] == 'changeset') {
                $commit = $tmp[1];
            }

            if ($tmp[0] == 'user') {
                $email  = $this->extractEmail($tmp[1]);
                $author = $this->extractAuthor($tmp[1]);
            }

            if ($tmp[0] == 'date') {
                $date = trim($tmp[1]);
            }

            if ($tmp[0] == 'tag') {
                $tags[] = trim($tmp[1]);
            }

            if ($tmp[0] == 'summary') {
                $commits[] = [
                    'commit'  => trim($commit),
                    'author'  => trim($author),
                    'email'   => trim($email),
                    'date'    => DateTime::createFromFormat('D M j H:i:s Y O', $date),
                    'summary' => trim($tmp[1]),
                    'tags'    => $tags,
                    'vcs'     => trim($this->repository_type),
                ];
                $tags = [];
            }
        }

        return $commits;
    }
public function parseLog($log)
    {
        $commits = $tags = [];

        for ($i = 0, $lines = count($log); $i < $lines; $i++) {
            $tmp = explode(': ', $log[$i]);
            $tmp = array_map('trim', $tmp);

            if ($tmp[0] == 'changeset') {
                $commit = $tmp[1];
            }

            if ($tmp[0] == 'user') {
                $email  = $this->extractEmail($tmp[1]);
                $author = $this->extractAuthor($tmp[1]);
            }

            if ($tmp[0] == 'date') {
                $date = trim($tmp[1]);
            }

            if ($tmp[0] == 'tag') {
                $tags[] = trim($tmp[1]);
            }

            if ($tmp[0] == 'summary') {
                $commits[] = [
                    'commit'  => trim($commit),
                    'author'  => trim($author),
                    'email'   => trim($email),
                    'date'    => DateTime::createFromFormat('D M j H:i:s Y O', $date),
                    'summary' => trim($tmp[1]),
                    'tags'    => $tags,
                    'vcs'     => trim($this->repository_type),
                ];
                $tags = [];
            }
        }

        return $commits;
    }
public function parseLog ( $ log ) { $ commits = $ tags = [ ] ; for ( $ i = 0 , $ lines = count ( $ log ) ; $ i < $ lines ; $ i ++ ) { $ tmp = explode ( ': ' , $ log [ $ i ] ) ; $ tmp = array_map ( 'trim' , $ tmp ) ; if ( $ tmp [ 0 ] == 'changeset' ) { $ commit = $ tmp [ 1 ] ; } if ( $ tmp [ 0 ] == 'user' ) { $ email = $ this -> extractEmail ( $ tmp [ 1 ] ) ; $ author = $ this -> extractAuthor ( $ tmp [ 1 ] ) ; } if ( $ tmp [ 0 ] == 'date' ) { $ date = trim ( $ tmp [ 1 ] ) ; } if ( $ tmp [ 0 ] == 'tag' ) { $ tags [ ] = trim ( $ tmp [ 1 ] ) ; } if ( $ tmp [ 0 ] == 'summary' ) { $ commits [ ] = [ 'commit' => trim ( $ commit ) , 'author' => trim ( $ author ) , 'email' => trim ( $ email ) , 'date' => DateTime :: createFromFormat ( 'D M j H:i:s Y O' , $ date ) , 'summary' => trim ( $ tmp [ 1 ] ) , 'tags' => $ tags , 'vcs' => trim ( $ this -> repository_type ) , ] ; $ tags = [ ] ; } } return $ commits ; }
Parse the log provided as a string
@param  string $log VCS log
@return array structured data extracted from the log
Parse the log provided as a string