FormatLine::CSV()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 3
rs 10
ccs 2
cts 2
cp 1
cc 1
eloc 1
nc 1
nop 1
crap 1
1
<?php
0 ignored issues
show
introduced by
Missing declare(strict_types=1).
Loading history...
2
3
namespace ClickHouseDB\Quote;
4
5
class FormatLine
6
{
7
    /**
0 ignored issues
show
introduced by
Found multi-line comment for property \ClickHouseDB\Quote\FormatLine::$strict with single line content, use one-line comment instead.
Loading history...
8
     *
9
     * @var array
0 ignored issues
show
introduced by
Expected 0 lines before first content, found 1.
Loading history...
introduced by
@var annotation of property \ClickHouseDB\Quote\FormatLine::$strict does not specify type hint for its items.
Loading history...
10
     */
11
    private static $strict = [];
12
13
    /**
14
     * Format
15
     *
16
     * @param string $format
0 ignored issues
show
introduced by
Incorrect annotations group.
Loading history...
17
     * @return StrictQuoteLine
18
     */
19 12
    public static function strictQuote($format)
0 ignored issues
show
introduced by
Method \ClickHouseDB\Quote\FormatLine::strictQuote() does not have native type hint for its parameter $format but it should be possible to add it based on @param annotation "string".
Loading history...
introduced by
Method \ClickHouseDB\Quote\FormatLine::strictQuote() does not have native return type hint for its return value but it should be possible to add it based on @return annotation "StrictQuoteLine".
Loading history...
20
    {
21 12
        if (empty(self::$strict[$format]))
0 ignored issues
show
introduced by
Expected 1 lines after "if", found 0.
Loading history...
22
        {
23 2
            self::$strict[$format] = new StrictQuoteLine($format);
24
        }
25 12
        return self::$strict[$format];
0 ignored issues
show
introduced by
Expected 1 lines before "return", found 0.
Loading history...
26
    }
27
28
    /**
29
     * Array in a string for a query Insert
30
     *
31
     * @param mixed[] $row
0 ignored issues
show
introduced by
Incorrect annotations group.
Loading history...
32
     * @param bool $skipEncode
0 ignored issues
show
Coding Style introduced by
Expected 4 spaces after parameter type; 1 found
Loading history...
introduced by
Method \ClickHouseDB\Quote\FormatLine::Insert() has useless @param annotation for parameter $skipEncode.
Loading history...
33
     * @return string
34
     */
35 12
    public static function Insert(array $row,bool $skipEncode=false)
0 ignored issues
show
Coding Style introduced by
Method name "FormatLine::Insert" is not in camel caps format
Loading history...
Coding Style introduced by
Expected 1 space between comma and type hint "bool"; 0 found
Loading history...
Coding Style introduced by
Incorrect spacing between argument "$skipEncode" and equals sign; expected 1 but found 0
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$skipEncode"; expected 1 but found 0
Loading history...
introduced by
Method \ClickHouseDB\Quote\FormatLine::Insert() does not have native return type hint for its return value but it should be possible to add it based on @return annotation "string".
Loading history...
36
    {
37 12
        return self::strictQuote('Insert')->quoteRow($row,$skipEncode);
38
    }
39
40
    /**
41
     * Array to TSV
42
     *
43
     * @param array $row
0 ignored issues
show
introduced by
Incorrect annotations group.
Loading history...
introduced by
@param annotation of method \ClickHouseDB\Quote\FormatLine::TSV() does not specify type hint for items of its traversable parameter $row.
Loading history...
44
     * @return string
45
     */
46 1
    public static function TSV(Array $row)
0 ignored issues
show
Coding Style introduced by
PHP parameter type declarations must be lowercase; expected "array" but found "Array"
Loading history...
introduced by
Method \ClickHouseDB\Quote\FormatLine::TSV() does not have native return type hint for its return value but it should be possible to add it based on @return annotation "string".
Loading history...
47
    {
48 1
        return self::strictQuote('TSV')->quoteRow($row);
49
    }
50
51
    /**
52
     * Array to CSV
53
     *
54
     * @param array $row
0 ignored issues
show
introduced by
Incorrect annotations group.
Loading history...
introduced by
@param annotation of method \ClickHouseDB\Quote\FormatLine::CSV() does not specify type hint for items of its traversable parameter $row.
Loading history...
55
     * @return string
56
     */
57 1
    public static function CSV(Array $row)
0 ignored issues
show
Coding Style introduced by
PHP parameter type declarations must be lowercase; expected "array" but found "Array"
Loading history...
introduced by
Method \ClickHouseDB\Quote\FormatLine::CSV() does not have native return type hint for its return value but it should be possible to add it based on @return annotation "string".
Loading history...
58
    {
59 1
        return self::strictQuote('CSV')->quoteRow($row);
60
    }
61
}
62