PHP code example of webignition / node-jslint-output-parser

1. Go to this page and download the library: Download webignition/node-jslint-output-parser 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/ */

    

webignition / node-jslint-output-parser example snippets



$parser = new webignition\NodeJslintOutput\Parser();

$parser->parse($rawOutputString);
$nodeJsLintOutput = $parser->getNodeJsLintOutput();
        
$this->assertNotNull($nodeJsLintOutput);
$this->assertEquals(7, $nodeJsLintOutput->getEntryCount());
$this->assertEquals(4, $nodeJsLintOutput->getPercentScanned());

$outputEntries = $nodeJsLintOutput->getEntries();
foreach ($outputEntries as $outputEntry) {
    /* @var $outputEntry \webignition\NodeJslintOutput\Entry\Entry */    
    echo $outputEntry->getReason() . "\n";
    echo $outputEntry->getEvidence() . "\n";    
}


$parser = new webignition\NodeJslintOutput\Parser();

$parser->parse($rawOutputString);
$nodeJsLintOutput = $parser->getNodeJsLintOutput();
        
$this->assertTrue($nodeJsLintOutput->wasStopped());
$this->assertFalse($nodeJsLintOutput->hasTooManyErrors());