PHP 8.2.31
Preview: Svnblame.php Size: 1.66 KB
/opt/cpanel/ea-wappspector/vendor/squizlabs/php_codesniffer/src/Reports/Svnblame.php

<?php
/**
 * SVN blame report for PHP_CodeSniffer.
 *
 * @author    Greg Sherwood <gsherwood@squiz.net>
 * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
 * @license   https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/licence.txt BSD Licence
 */

namespace PHP_CodeSniffer\Reports;

use PHP_CodeSniffer\Exceptions\DeepExitException;

class Svnblame extends VersionControl
{

    /**
     * The name of the report we want in the output
     *
     * @var string
     */
    protected $reportName = 'SVN';


    /**
     * Extract the author from a blame line.
     *
     * @param string $line Line to parse.
     *
     * @return mixed string or false if impossible to recover.
     */
    protected function getAuthor($line)
    {
        $blameParts = [];
        preg_match('|\s*([^\s]+)\s+([^\s]+)|', $line, $blameParts);

        if (isset($blameParts[2]) === false) {
            return false;
        }

        return $blameParts[2];

    }//end getAuthor()


    /**
     * Gets the blame output.
     *
     * @param string $filename File to blame.
     *
     * @return array
     * @throws \PHP_CodeSniffer\Exceptions\DeepExitException
     */
    protected function getBlameContent($filename)
    {
        $command = 'svn blame "'.$filename.'" 2>&1';
        $handle  = popen($command, 'r');
        if ($handle === false) {
            $error = 'ERROR: Could not execute "'.$command.'"'.PHP_EOL.PHP_EOL;
            throw new DeepExitException($error, 3);
        }

        $rawContent = stream_get_contents($handle);
        pclose($handle);

        $blames = explode("\n", $rawContent);

        return $blames;

    }//end getBlameContent()


}//end class

Directory Contents

Dirs: 0 × Files: 20

Name Size Perms Modified Actions
8.40 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
3.91 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
13.08 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
3.28 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
4.18 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
3.07 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
9.43 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
2.16 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
2.74 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
5.80 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
3.89 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
4.84 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
6.77 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
6.21 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
3.18 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
10.79 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
5.97 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
1.66 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
12.63 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
4.67 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).