csv-validator/src/Deblan/CsvValidator/Violation.php

103 lines
1.8 KiB
PHP
Raw Permalink Normal View History

2016-05-20 12:03:28 +02:00
<?php
namespace Deblan\CsvValidator;
use Symfony\Component\Validator\ConstraintViolation;
/**
* Class Violation
* @author Simon Vieille <simon@deblan.fr>
*/
class Violation
{
/**
* @var integer
*/
protected $line;
/**
* @var integer
*/
protected $column;
/**
* @var ConstraintViolation
*/
protected $violation;
/**
* Constructor
*
* @param integer $line The line of the violation
* @param integer $column The column of the violation
* @param ConstraintViolation $violation The violation
*/
public function __construct($line, $column, ConstraintViolation $violation)
{
$this->setLine($line)
->setColumn($column)
->setViolation($violation);
}
/**
* @param int $line
* @return Violation
*/
public function setLine($line)
{
$this->line = (int) $line;
return $this;
}
/**
* @return int $line
*/
public function getLine()
{
return $this->line;
}
/**
* @param int $column
* @return Violation
*/
public function setColumn($column)
{
2016-05-22 23:22:12 +02:00
if ($column !== null) {
$column = (int) $column;
}
$this->column = $column;
2016-05-20 12:03:28 +02:00
return $this;
}
/**
* @return int $column
*/
public function getColumn()
{
return $this->column;
}
/**
* @param ConstraintViolation $violation
2016-05-20 15:09:52 +02:00
* @return Violation
2016-05-20 12:03:28 +02:00
*/
public function setViolation(ConstraintViolation $violation)
{
$this->violation = $violation;
return $this;
}
/**
2016-05-20 15:09:52 +02:00
* @return ConstraintViolation
2016-05-20 12:03:28 +02:00
*/
public function getViolation()
{
return $this->violation;
}
}