Gitamin\Services\Git\Repository::getAuthorStatistics PHP Method

getAuthorStatistics() public method

public getAuthorStatistics ( $branch )
    public function getAuthorStatistics($branch)
    {
        $logs = $this->getClient()->run($this, 'log --pretty=format:"%aN||%aE" ' . $branch);
        if (empty($logs)) {
            throw new \RuntimeException('No statistics available');
        }
        $logs = explode("\n", $logs);
        $logs = array_count_values($logs);
        arsort($logs);
        foreach ($logs as $user => $count) {
            $user = explode('||', $user);
            $data[] = ['name' => $user[0], 'email' => $user[1], 'commits' => $count];
        }
        return $data;
    }