-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from jjanvier/simple-format
Simple formatter
- Loading branch information
Showing
3 changed files
with
93 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?php | ||
|
||
namespace Akeneo\CouplingDetector\Formatter; | ||
|
||
use Akeneo\CouplingDetector\Domain\ViolationInterface; | ||
use Akeneo\CouplingDetector\Event\PostNodesParsedEvent; | ||
use Akeneo\CouplingDetector\Event\NodeChecked; | ||
use Akeneo\CouplingDetector\Event\NodeParsedEvent; | ||
use Akeneo\CouplingDetector\Event\PreNodesParsedEvent; | ||
use Akeneo\CouplingDetector\Event\PreRulesCheckedEvent; | ||
use Akeneo\CouplingDetector\Event\RuleCheckedEvent; | ||
use Akeneo\CouplingDetector\Event\PostRulesCheckedEvent; | ||
|
||
/** | ||
* Output the results really simply. Just the number of errors is displayed. | ||
* E/W | ||
* where E is the number of errors and W is the number of warnings | ||
* | ||
* @author Julien Janvier <[email protected]> | ||
* @license http://opensource.org/licenses/MIT MIT | ||
*/ | ||
class SimpleFormatter extends AbstractFormatter | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function outputPreNodesParsed(PreNodesParsedEvent $event) | ||
{ | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function outputNodeParsed(NodeParsedEvent $event) | ||
{ | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function outputPostNodesParsed(PostNodesParsedEvent $event) | ||
{ | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function outputPreRulesChecked(PreRulesCheckedEvent $event) | ||
{ | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function outputNodeChecked(NodeChecked $event) | ||
{ | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function outputRuleChecked(RuleCheckedEvent $event) | ||
{ | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function outputPostRulesChecked(PostRulesCheckedEvent $event) | ||
{ | ||
$errorCount = 0; | ||
$warningCount = 0; | ||
|
||
foreach ($event->getViolations() as $violation) { | ||
if (ViolationInterface::TYPE_ERROR === $violation->getType()) { | ||
$errorCount++; | ||
} else { | ||
$warningCount++; | ||
} | ||
} | ||
|
||
echo sprintf("%d/%d", $errorCount, $warningCount); | ||
} | ||
} |