CrossTableException::fileNotFoundOrNotReadable()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Datapp\TableauExport;
6
7
/**
8
 * @author Manuel Dimmler
9
 */
10
class CrossTableException extends \RuntimeException
11
{
12
13
    const FILE_NOT_FOUND_OR_NOT_READABLE = 1;
14
    const ERROR_READING_CSV_LINE = 2;
15
    const ERROR_PARSING_CSV_LINE = 3;
16
17 1
    public static function fileNotFoundOrNotReadable(string $fileName): self
18
    {
19 1
        return new self(sprintf('file "%s" not found or not readable', $fileName), self::FILE_NOT_FOUND_OR_NOT_READABLE);
20
    }
21
22
    public static function errorReadingCsvLine(): self
23
    {
24
        // @codeCoverageIgnoreStart
25
        return new self('error reading csv line', self::ERROR_READING_CSV_LINE);
26
        // @codeCoverageIgnoreEnd
27
    }
28
29 1
    public static function errorParsingCsvLine(): self
30
    {
31 1
        return new self('error parsing csv line', self::ERROR_PARSING_CSV_LINE);
32
    }
33
}
34