PHP code example of phbsis / kr04-php-lint

1. Go to this page and download the library: Download phbsis/kr04-php-lint 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/ */

    

phbsis / kr04-php-lint example snippets



namespace KR04\Checkers;

use KR04\Checkers\Checker;
use KR04\Files\Loader;
use KR04\Cli\Commands;

class TesteChecker extends Checker
{

    public function __construct(Loader $loader, Commands $commands)
    {
        parent::__construct($loader, $commands);
    }

    protected function check()
    {
        /**
         * Aqui ficarão suas implementações de checagem das regras
         */
        return $this;
    }

    protected function configure()
    {
        /**
         * Aqui ficarão suas implementações de configurações
         * Este método será executado antes do método check()
         */
        return $this;
    }
}

[
    [‘./index.php’] => [
        “string” =>  ‘
              echo “isso é um teste”;’,
        “array” => [
             0 => ‘’,
             1 => ‘    echo “isso é um teste”;’
        ]
    ]
    // mais arquivos...
]

    // código omitido
    $checkerContainer->setChecker(\KR04\Checkers\PsrChecker::class);
    $checkerContainer->setChecker(\KR04\Checkers\ChaordicPatternChecker::class);
    // registrando aqui uma classe TesteChecker
    $checkerContainer->setChecker(\KR04\Checkers\TesteChecker::class);

    // init the verification into the files
    new KR04\Linter($checkerContainer, $commands);
   // código omitido

    // código omitido
    private function configure()
    {
        $this->ignoreFile = [
            $this->rootDirectory . 'header-desktop.php',
            $this->rootDirectory . 'template.php'
        ];
    }
    // código omitido

    // código omitido
    private function configure()
    {
        $this->ignoreDirectory = [
            $this->rootDirectory . 'api/',
            $this->rootDirectory . 'css/',
            $this->rootDirectory . 'images/'
        ];
    }
    // código omitido

    // @ignore    aqui inicia a tag
    var_dum([‘teste’]);  // este var_dump será ignorado
    var_dum($this);  // este var_dump será ignorado
    // @endignore   fim da tag

    var_dum($response);  // @ignoreline  esta linha será ignorada
    return $response;
json
{
    "hbsis/kr04-php-lint": "^0.5.0"
    },
    "scripts": {
        "post-install-cmd": [
            "php -r \"copy('vendor/phbsis/kr04-php-lint/index.php', 'checker-kr04');\""
        ],
        "post-update-cmd": [
            "php -r \"copy('vendor/phbsis/kr04-php-lint/index.php', 'checker-kr04');\""
        ]
    }
}
bash
php checker-kr04
bash
php checker-kr04 --list
bash
php checker-kr04 --stop
bash
php checker-kr04 --only=chaordicpatternchecker,syntaxchecker
bash
php checker-kr04 --except=syntaxchecker