First version
This commit is contained in:
parent
7622c3f5fa
commit
8f6b4afe5b
|
@ -1,4 +1,6 @@
|
|||
csv-validator
|
||||
=============
|
||||
|
||||
CSV validator library
|
||||
CSV validator library.
|
||||
|
||||
Works in progress. You should not use this package.
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"": "src/"
|
||||
"psr-4": {
|
||||
"Deblan\\CsvValidator\\": "src/Deblan/CsvValidator/"
|
||||
}
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Deblan\Validator\Constraints;
|
||||
namespace Deblan\CsvValidator\Constraints;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\File;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Deblan\Validator\Constraints;
|
||||
namespace Deblan\CsvValidator\Constraints;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\FileValidator;
|
||||
use Symfony\Component\Validator\Constraint;
|
|
@ -4,8 +4,8 @@ namespace Deblan\CsvValidator;
|
|||
|
||||
use Deblan\Csv\CsvParser;
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\Validator\LegacyValidator;
|
||||
use Symfony\Component\Validator\ConstraintViolationList;
|
||||
use Symfony\Component\Validator\Validator\RecursiveValidator;
|
||||
|
||||
class Validator
|
||||
{
|
||||
|
@ -21,7 +21,7 @@ class Validator
|
|||
|
||||
protected $errors = [];
|
||||
|
||||
public function __construct(CsvParser $parser, LegacyValidator $validator)
|
||||
public function __construct(CsvParser $parser, RecursiveValidator $validator)
|
||||
{
|
||||
$this->parser = $parser;
|
||||
$this->parser->parse();
|
||||
|
@ -77,6 +77,10 @@ class Validator
|
|||
|
||||
protected function mergeViolationsMessages(ConstraintViolationList $violations, $line, $key = null)
|
||||
{
|
||||
if (count($violations) === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!array_key_exists($line, $this->errors)) {
|
||||
$this->errors[$line] = [];
|
||||
}
|
Loading…
Reference in a new issue