PHP code example of v.chetkov / vcs-statistics-counter

1. Go to this page and download the library: Download v.chetkov/vcs-statistics-counter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

v.chetkov / vcs-statistics-counter example snippets




use Chetkov\VCSStatisticsCounter\VCS\Git\BranchFilter\AllowablePrefixes\AllowablePrefixesStrategy;

return [
    'vcs' => 'git',
    'authors' => [
        'Валерий Четков', 
        'Василий Пупкин',
        'Nikolia Zubrov',
        'Dmitriy Ignatenko',
    ],
    'branchFilter' => [
        'strategy' => AllowablePrefixesStrategy::class,
        'branchPrefixes' => [
            'to-',
        ],
        'vcsRemoteServerName' => 'origin',
    ],
    'rootDirectories' => [
        '/home/v.chetkov/projects/VCSStatisticsCounter/',
        '/home/v.chetkov/projects/Extractor/',
        '/home/v.chetkov/projects/Logger/',
    ],
];



use VCSStatisticsCounter\Model\Statistics;
use VCSStatisticsCounter\VCSStatisticsCounterFactory;

sCounterFactory->create(tatistic->getTopAuthors(3, Statistics::TYPE_CHANGED_LINES);
foreach ($topAuthorsByNumChangedLines as $authorStatistics) {
    echo "\n{$authorStatistics->getName()}:\n";
    echo "изменённых файлов - {$authorStatistics->getNumChangedFiles()}\n";
    echo "изменённых строк - {$authorStatistics->getNumChangedLines()}\n";
    echo "удалённых строк - {$authorStatistics->getNumCreatedLines()}\n";
    echo "новых строк - {$authorStatistics->getNumDeletedLines()}\n";
}

//==================== ТОПЫ АВТОРОВ ====================

//ТОП-3 авторов по кол-ву измененных строк
$topAuthorsByNumChangedLines = $totalStatistic->getTopAuthors(3, Statistics::TYPE_CHANGED_LINES);

//ТОП-3 авторов по кол-ву новых строк
$topAuthorsByNumCreatedLines = $totalStatistic->getTopAuthors(3, Statistics::TYPE_CREATED_LINES);

//ТОП-3 авторов по кол-ву удалённых строк
$topAuthorsByNumDeletedLines = $totalStatistic->getTopAuthors(3, Statistics::TYPE_DELETED_LINES);

//ТОП-3 авторов по кол-ву измененных файлов
$topAuthorsByNumChangedFiles = $totalStatistic->getTopAuthors(3, Statistics::TYPE_CHANGED_FILES);


//==================== ТОПЫ РЕПОЗИТОРИЕВ ====================

//ТОП-3 репозиториев по кол-ву измененных строк
$topRepositoriesByNumChangedLines = $totalStatistic->getTopRepositories(3, Statistics::TYPE_CHANGED_LINES);

//ТОП-3 репозиториев по кол-ву новых строк
$topRepositoriesByNumCreatedLines = $totalStatistic->getTopRepositories(3, Statistics::TYPE_CREATED_LINES);

//ТОП-3 репозиториев по кол-ву удалённых строк
$topRepositoriesByNumDeletedLines = $totalStatistic->getTopRepositories(3, Statistics::TYPE_DELETED_LINES);

//ТОП-3 репозиториев по кол-ву измененных файлов
$topRepositoriesByNumChangedFiles = $totalStatistic->getTopRepositories(3, Statistics::TYPE_CHANGED_FILES
);