Completed
Pull Request — master (#178)
by ignace nyamagana
02:27
created

InvalidRowException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 3
1
<?php
2
/**
3
* This file is part of the League.csv library
4
*
5
* @license http://opensource.org/licenses/MIT
6
* @link https://github.com/thephpleague/csv/
7
* @version 9.0.0
8
* @package League.csv
9
*
10
* For the full copyright and license information, please view the LICENSE
11
* file that was distributed with this source code.
12
*/
13
namespace League\Csv;
14
15
use InvalidArgumentException;
16
17
/**
18
 *  Exception triggered by an invalid CSV record
19
 *
20
 * @package League.csv
21
 * @since  7.0.0
22
 */
23
class InvalidRowException extends InvalidArgumentException
24
{
25
    /**
26
     * Validator which did not validated the data
27
     *
28
     * @var string
29
     */
30
    private $name;
31
32
    /**
33
     * Validator Data which caused the error
34
     *
35
     * @var string[]
36
     */
37
    private $record;
38
39
    /**
40
     * New Instance
41
     *
42
     * @param string   $name    validator name
43
     * @param string[] $record  invalid  data
44
     * @param string   $message exception message
45
     */
46
    public function __construct($name, array $record = [], $message = '')
47
    {
48
        parent::__construct($message);
49
        $this->name = $name;
50
        $this->record = $record;
51
    }
52
53
    /**
54
     * return the validator name
55
     *
56
     * @return string
57
     */
58
    public function getName()
59
    {
60
        return $this->name;
61
    }
62
63
    /**
64
     * return the invalid record
65
     *
66
     * @return string[]
67
     */
68
    public function getData()
69
    {
70
        return $this->record;
71
    }
72
}
73