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
|
|
/**
|
21
|
|
* A wrapper for the implementations of PHPUnit2ResultFormatter.
|
22
|
|
*
|
23
|
|
* @author Michiel Rook <mrook@php.net>
|
24
|
|
* @package phing.tasks.ext.phploc
|
25
|
|
*/
|
26
|
|
class PHPLocFormatterFactory
|
27
|
|
{
|
28
|
|
/**
|
29
|
|
* Returns formatter object
|
30
|
|
*
|
31
|
|
* @param PHPLocFormatterElement $formatterElement
|
32
|
|
* @throws BuildException
|
33
|
|
* @return AbstractPHPLocFormatter
|
34
|
|
*/
|
35
|
0
|
public static function createFormatter($formatterElement)
|
36
|
|
{
|
37
|
0
|
$formatter = null;
|
38
|
0
|
$type = $formatterElement->getType();
|
39
|
|
|
40
|
0
|
switch ($type) {
|
41
|
0
|
case "xml":
|
42
|
0
|
include_once 'phing/tasks/ext/phploc/PHPLocXMLFormatter.php';
|
43
|
0
|
$formatter = new PHPLocXMLFormatter();
|
44
|
0
|
break;
|
45
|
0
|
case "csv":
|
46
|
0
|
include_once 'phing/tasks/ext/phploc/PHPLocCSVFormatter.php';
|
47
|
0
|
$formatter = new PHPLocCSVFormatter();
|
48
|
0
|
break;
|
49
|
0
|
case "txt":
|
50
|
0
|
case "cli":
|
51
|
0
|
include_once 'phing/tasks/ext/phploc/PHPLocTextFormatter.php';
|
52
|
0
|
$formatter = new PHPLocTextFormatter();
|
53
|
0
|
break;
|
54
|
0
|
default:
|
55
|
0
|
throw new BuildException("Formatter '" . $type . "' not implemented");
|
56
|
|
}
|
57
|
|
|
58
|
0
|
$formatter->setOutfile($formatterElement->getOutfile());
|
59
|
0
|
$formatter->setToDir($formatterElement->getToDir());
|
60
|
0
|
$formatter->setUseFile($formatterElement->getUseFile());
|
61
|
|
|
62
|
0
|
return $formatter;
|
63
|
|
}
|
64
|
|
}
|