Passed
Push — main ( ddd1a4...b98cb8 )
by Michiel
08:47
created

PDOResultFormatter::initialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 0
dl 0
loc 2
rs 10
c 0
b 0
f 0
ccs 0
cts 0
cp 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
 *
15
 * This software consists of voluntary contributions made by many individuals
16
 * and is licensed under the LGPL. For more information please see
17
 * <http://phing.info>.
18
 */
19
20
namespace Phing\Task\System\Pdo;
21
22
use Phing\Io\Writer;
23
24
/**
25
 * Abstract
26
 *
27
 * @author  Hans Lellelid <[email protected]>
28
 * @package phing.tasks.ext.pdo
29
 * @since   2.3.0
30
 */
31
abstract class PDOResultFormatter
32
{
33
    /**
34
     * Output writer.
35
     *
36
     * @var Writer
37
     */
38
    protected $out;
39
40
    /**
41
     * Sets the output writer.
42
     *
43
     * @param Writer $out
44
     */
45
    public function setOutput(Writer $out)
46
    {
47
        $this->out = $out;
48
    }
49
50
    /**
51
     * Gets the output writer.
52
     *
53
     * @return Writer
54
     */
55
    public function getOutput()
56
    {
57
        return $this->out;
58
    }
59
60
    /**
61
     * Gets the preferred output filename for this formatter.
62
     *
63
     * @return string
64
     */
65
    abstract public function getPreferredOutfile();
66
67
    /**
68
     * Perform any initialization.
69
     */
70
    public function initialize()
71
    {
72
    }
73
74
    /**
75
     * Processes a specific row from PDO result set.
76
     *
77
     * @param array $row Row of PDO result set.
78
     */
79
    abstract public function processRow($row);
80
81
    /**
82
     * Perform any final tasks and Close the writer.
83
     */
84
    public function close()
85
    {
86
        $this->out->close();
87
    }
88
}
89