Showing 24 of 65 files from the diff.
Other files ignored by Codecov
UPGRADING.md has changed.
bin/phing.php has changed.
.editorconfig has changed.
test/build.xml has changed.
test/phpunit.xml has changed.
README.md has changed.
build/build.xml has changed.
composer.json has changed.
composer.lock has changed.

@@ -78,7 +78,7 @@
Loading
78 78
    {
79 79
        include_once 'Archive/Tar.php';
80 80
        if (!class_exists('Archive_Tar')) {
81 -
            throw new BuildException("You must have installed the PEAR Archive_Tar class in order to use TarTask.");
81 +
            throw new BuildException("You must have installed the pear/archive_tar package use TarTask.");
82 82
        }
83 83
    }
84 84

@@ -32,14 +32,14 @@
Loading
32 32
     *
33 33
     * @var string
34 34
     */
35 -
    protected $filename = null;
35 +
    protected $filename;
36 36
37 37
    /**
38 38
     * Holds the save location
39 39
     *
40 40
     * @var string
41 41
     */
42 -
    protected $dir = null;
42 +
    protected $dir;
43 43
44 44
    /**
45 45
     * Holds value for "ssl_verify_peer" option
@@ -53,14 +53,14 @@
Loading
53 53
     *
54 54
     * @var null|bool
55 55
     */
56 -
    protected $followRedirects = null;
56 +
    protected $followRedirects;
57 57
58 58
    /**
59 59
     * Holds the proxy
60 60
     *
61 61
     * @var string
62 62
     */
63 -
    protected $proxy = null;
63 +
    protected $proxy;
64 64
65 65
    private $quiet = false;
66 66
@@ -74,13 +74,12 @@
Loading
74 74
            throw new BuildException("Required attribute 'dir' is missing", $this->getLocation());
75 75
        }
76 76
77 -
        $options = [
78 -
            'verify' => $this->sslVerifyPeer
79 -
        ];
77 +
        $options['verify'] = $this->sslVerifyPeer;
78 +
80 79
        if (isset($this->proxy)) {
81 80
            $options['proxy'] = $this->proxy;
82 81
        }
83 -
        if (null !== $this->followRedirects) {
82 +
        if ($this->followRedirects !== null) {
84 83
            $options['allow_redirects'] = $this->followRedirects;
85 84
        }
86 85
@@ -137,7 +136,7 @@
Loading
137 136
     *
138 137
     * @param string $filename
139 138
     */
140 -
    public function setFilename($filename)
139 +
    public function setFilename($filename): void
141 140
    {
142 141
        $this->filename = $filename;
143 142
    }
@@ -147,7 +146,7 @@
Loading
147 146
     *
148 147
     * @param string $dir
149 148
     */
150 -
    public function setDir($dir)
149 +
    public function setDir($dir): void
151 150
    {
152 151
        $this->dir = $dir;
153 152
    }
@@ -157,7 +156,7 @@
Loading
157 156
     *
158 157
     * @param bool $value
159 158
     */
160 -
    public function setSslVerifyPeer($value)
159 +
    public function setSslVerifyPeer($value): void
161 160
    {
162 161
        $this->sslVerifyPeer = $value;
163 162
    }
@@ -167,7 +166,7 @@
Loading
167 166
     *
168 167
     * @param bool $value
169 168
     */
170 -
    public function setFollowRedirects($value)
169 +
    public function setFollowRedirects($value): void
171 170
    {
172 171
        $this->followRedirects = $value;
173 172
    }
@@ -177,7 +176,7 @@
Loading
177 176
     *
178 177
     * @param string $proxy
179 178
     */
180 -
    public function setProxy($proxy)
179 +
    public function setProxy($proxy): void
181 180
    {
182 181
        $this->proxy = $proxy;
183 182
    }
@@ -187,11 +186,16 @@
Loading
187 186
     *
188 187
     * @param boolean $v if "true" then be quiet
189 188
     */
190 -
    public function setQuiet($v)
189 +
    public function setQuiet($v): void
191 190
    {
192 191
        $this->quiet = $v;
193 192
    }
194 193
194 +
    /**
195 +
     * @param string $msg
196 +
     * @param int $msgLevel
197 +
     * @param Exception|null $t
198 +
     */
195 199
    public function log($msg, $msgLevel = Project::MSG_INFO, Exception $t = null)
196 200
    {
197 201
        if (!$this->quiet || $msgLevel <= Project::MSG_ERR) {

@@ -55,8 +55,7 @@
Loading
55 55
        @include_once 'VersionControl/Git.php';
56 56
        if (false == class_exists('VersionControl_Git')) {
57 57
            throw new BuildException(
58 -
                "The Git tasks depend on PEAR\'s "
59 -
                . "VersionControl_Git package.",
58 +
                "The Git tasks depend on the pear/versioncontrol_git package being installed.",
60 59
                $this->getLocation()
61 60
            );
62 61
        }

@@ -56,6 +56,9 @@
Loading
56 56
            }
57 57
58 58
            $pos = strpos($line, '=');
59 +
            if (false === $pos) {
60 +
                continue;
61 +
            }
59 62
            $property = trim(substr($line, 0, $pos));
60 63
            $value = trim(substr($line, $pos + 1));
61 64
            $properties[$property] = $this->inVal($value);

@@ -1494,10 +1494,6 @@
Loading
1494 1494
        return $paths;
1495 1495
    }
1496 1496
1497 -
    // -------------------------------------------------------------------------------------------
1498 -
    // System-wide methods (moved from System class, which had namespace conflicts w/ PEAR System)
1499 -
    // -------------------------------------------------------------------------------------------
1500 -
1501 1497
    /**
1502 1498
     * Set System constants which can be retrieved by calling Phing::getProperty($propName).
1503 1499
     *

@@ -548,7 +548,11 @@
Loading
548 548
     */
549 549
    private function fixEncoding($strPath)
550 550
    {
551 -
        $codepage = 'CP' . trim(strstr(setlocale(LC_CTYPE, ''), '.'), '.');
551 +
        $charSet = trim(strstr(setlocale(LC_CTYPE, ''), '.'), '.');
552 +
        if ($charSet === 'utf8') {
553 +
            return $strPath;
554 +
        }
555 +
        $codepage = 'CP' . $charSet;
552 556
        if (function_exists('iconv')) {
553 557
            $strPath = iconv('UTF-8', $codepage . '//IGNORE', $strPath);
554 558
        } elseif (function_exists('mb_convert_encoding')) {

@@ -35,7 +35,7 @@
Loading
35 35
    /**
36 36
     * @var array
37 37
     */
38 -
    protected $acceptedReportTypes = ['cli', 'txt', 'xml', 'csv'];
38 +
    protected $acceptedReportTypes = ['cli', 'txt', 'xml', 'csv', 'json'];
39 39
40 40
    /**
41 41
     * @var null
@@ -302,10 +302,10 @@
Loading
302 302
303 303
        if (count($this->filesToCheck) > 0) {
304 304
            foreach ($this->filesToCheck as $file) {
305 -
                $files[] = new SplFileInfo($file);
305 +
                $files[] = (new SplFileInfo($file))->getRealPath();
306 306
            }
307 307
        } elseif ($this->fileToCheck !== null) {
308 -
            $files = [new SplFileInfo($this->fileToCheck)];
308 +
            $files = [(new SplFileInfo($this->fileToCheck))->getRealPath()];
309 309
        }
310 310
311 311
        return $files;

@@ -90,7 +90,7 @@
Loading
90 90
91 91
        if (!$handle = @fopen($autoloader, 'r', true)) {
92 92
            throw new BuildException(
93 -
                'The Growl Notify task requires the Net_Growl PEAR package.'
93 +
                'The Growl Notify task requires the pear/net_growl package.'
94 94
            );
95 95
        }
96 96

@@ -25,9 +25,7 @@
Loading
25 25
{
26 26
    public function printResult(array $count, $countTests = false)
27 27
    {
28 -
        if (class_exists('\\SebastianBergmann\\PHPLOC\\Log\\XML')) {
29 -
            $printer = new SebastianBergmann\PHPLOC\Log\XML();
30 -
        } elseif (class_exists('\\SebastianBergmann\\PHPLOC\\Log\\Xml')) {
28 +
        if (class_exists('\\SebastianBergmann\\PHPLOC\\Log\\Xml')) {
31 29
            $printer = new SebastianBergmann\PHPLOC\Log\Xml();
32 30
        } else {
33 31
            throw new BuildException('Not supported PHPLOC version used.');

@@ -30,33 +30,20 @@
Loading
30 30
    /**
31 31
     * Set icon attribute
32 32
     *
33 -
     * @param string $icon name/location of icon
33 +
     * @param \PhingFile $icon name/location of icon
34 34
     *
35 35
     * @return void
36 36
     */
37 -
    public function setIcon($icon)
37 +
    public function setIcon(PhingFile $icon)
38 38
    {
39 -
        switch ($icon) {
40 -
            case 'info':
41 -
            case 'error':
42 -
            case 'warning':
43 -
                $this->icon = $icon;
44 -
                break;
45 -
            default:
46 -
                if (file_exists($icon) && is_file($icon)) {
47 -
                    $this->icon = $icon;
48 -
                } else {
49 -
                    if (isset($this->log)) {
50 -
                        $this->log(
51 -
                            sprintf(
52 -
                                "%s is not a file. Using default icon instead.",
53 -
                                $icon
54 -
                            ),
55 -
                            Project::MSG_WARN
56 -
                        );
57 -
                    }
58 -
                }
39 +
        if ($icon->isFile()) {
40 +
            $this->log(sprintf('Using "%s" as icon.', $icon), Project::MSG_VERBOSE);
41 +
            $this->icon = $icon->getAbsoluteFile();
42 +
            return;
59 43
        }
44 +
45 +
        $this->log(sprintf('"%s" is not a file. Assuming it is a stock icon name.', $icon->getName()), Project::MSG_WARN);
46 +
        $this->icon = $icon->getName();
60 47
    }
61 48
62 49
    /**

@@ -428,6 +428,9 @@
Loading
428 428
        if (false !== strpos($found, '${')) {
429 429
            // attempt to resolve properties
430 430
            $found = $this->replaceProperties($found, null);
431 +
            if (StringHelper::startsWith('${', $found) && StringHelper::endsWith('}', $found)) {
432 +
                $found = null;
433 +
            }
431 434
            // save resolved value
432 435
            $this->properties[$name] = $found;
433 436
        }

@@ -47,7 +47,7 @@
Loading
47 47
    {
48 48
        include_once 'Archive/Tar.php';
49 49
        if (!class_exists('Archive_Tar')) {
50 -
            throw new BuildException("You must have installed the PEAR Archive_Tar class in order to use UntarTask.");
50 +
            throw new BuildException("You must have installed the pear/archive_tar package to use UntarTask.");
51 51
        }
52 52
    }
53 53

@@ -72,7 +72,7 @@
Loading
72 72
        include_once 'VersionControl/SVN.php';
73 73
        $this->fetchMode = VERSIONCONTROL_SVN_FETCHMODE_ASSOC;
74 74
        if (!class_exists('VersionControl_SVN')) {
75 -
            throw new Exception("The SVN tasks depend on PEAR VersionControl_SVN package being installed.");
75 +
            throw new Exception("The SVN tasks depend on the pear/versioncontrol_svn package being installed.");
76 76
        }
77 77
    }
78 78
@@ -369,7 +369,7 @@
Loading
369 369
        $tempSwitches = array_merge($this->svnSwitches, $switches);
370 370
371 371
        if ($this->oldVersion) {
372 -
            $svnstack = PEAR_ErrorStack::singleton('VersionControl_SVN');
372 +
            $svnstack = \PEAR_ErrorStack::singleton('VersionControl_SVN');
373 373
374 374
            if ($output = $this->svn->run($tempArgs, $tempSwitches)) {
375 375
                return $output;

@@ -25,17 +25,15 @@
Loading
25 25
{
26 26
    public function printResult(array $count, $countTests = false)
27 27
    {
28 +
        $printerClass = '\\SebastianBergmann\\PHPLOC\\Log\\Text';
29 +
        $printer = new $printerClass();
28 30
        if ($this->getUseFile()) {
29 -
            $outputClass = '\\Symfony\\Component\\Console\\Output\\StreamOutput';
30 -
            $stream = fopen($this->getToDir() . DIRECTORY_SEPARATOR . $this->getOutfile(), 'a+');
31 -
            $output = new $outputClass($stream);
31 +
            ob_start();
32 +
            $printer->printResult($count, $countTests);
33 +
            $output = ob_get_clean();
34 +
            file_put_contents($this->getToDir() . DIRECTORY_SEPARATOR . $this->getOutfile(), $output, FILE_APPEND);
32 35
        } else {
33 -
            $outputClass = '\\Symfony\\Component\\Console\\Output\\ConsoleOutput';
34 -
            $output = new $outputClass();
36 +
            $printer->printResult($count, $countTests);
35 37
        }
36 -
37 -
        $printerClass = '\\SebastianBergmann\\PHPLOC\\Log\\Text';
38 -
        $printer = new $printerClass();
39 -
        $printer->printResult($output, $count, $countTests);
40 38
    }
41 39
}

@@ -61,10 +61,10 @@
Loading
61 61
        @include_once 'Mail/mime.php';
62 62
63 63
        if (!class_exists('Mail_mime')) {
64 -
            throw new BuildException('Need the PEAR Mail_mime package to send attachments');
64 +
            throw new BuildException('Need the pear/mail and pear/mail_mime packages installed');
65 65
        }
66 66
67 -
        $mime = new Mail_mime(['text_charset' => 'UTF-8']);
67 +
        $mime = new \Mail_mime(['text_charset' => 'UTF-8']);
68 68
        $hdrs = [
69 69
            'From' => $this->from,
70 70
            'Subject' => $this->subject
@@ -84,7 +84,7 @@
Loading
84 84
        $body = $mime->get();
85 85
        $hdrs = $mime->headers($hdrs);
86 86
87 -
        $mail = Mail::factory($this->backend, $this->backendParams);
87 +
        $mail = \Mail::factory($this->backend, $this->backendParams);
88 88
        $mail->send($this->tolist, $hdrs, $body);
89 89
    }
90 90

@@ -61,79 +61,28 @@
Loading
61 61
     */
62 62
    public function init(): void
63 63
    {
64 -
        $this->setFormat(VisualizerTask::FORMAT_PNG);
65 -
        $this->setServer(VisualizerTask::SERVER);
66 -
        $this->checkHttpRequestLibrary();
67 -
        $this->checkPlantUmlLibrary();
68 -
        $this->checkXslExtension();
69 -
        $this->checkXmlExtension();
70 -
    }
71 -
72 -
    /**
73 -
     * Checks that `\HTTP_Request2` class is available
74 -
     *
75 -
     * Instead of checking that `pear/http_request2` library is loaded we only check `\HTTP_Request2` class availability
76 -
     */
77 -
    protected function checkHttpRequestLibrary()
78 -
    {
79 -
        $this->classExists('HTTP_Request2', "Please install 'pear/http_request2' library");
80 -
    }
81 -
82 -
    /**
83 -
     * Verifies that provided $class exists
84 -
     *
85 -
     * @param string $class Name of the class to verify
86 -
     * @param string $message Error message to display when class don't exists
87 -
     */
88 -
    protected function classExists(string $class, string $message): void
89 -
    {
90 -
        if (!class_exists($class)) {
91 -
            $this->log($message, Project::MSG_ERR);
92 -
            throw new BuildException($message);
64 +
        parent::init();
65 +
        if (!function_exists(\Jawira\PlantUml\encodep::class)) {
66 +
            $exceptionMessage = get_class($this) . ' requires "jawira/plantuml-encoding" library';
93 67
        }
94 -
    }
95 -
96 -
    /**
97 -
     * Checks that `encodep` function is available
98 -
     *
99 -
     * Instead of checking that `jawira/plantuml-encoding` library is loaded we only check 'encodep' function
100 -
     * availability
101 -
     */
102 -
    protected function checkPlantUmlLibrary()
103 -
    {
104 -
        $function = '\Jawira\PlantUml\encodep';
105 -
        $message = "Please install 'jawira/plantuml-encoding' library";
106 -
107 -
        if (!function_exists($function)) {
108 -
            $this->log($message, Project::MSG_ERR);
109 -
            throw new BuildException($message);
68 +
        if (!class_exists(XSLTProcessor::class)) {
69 +
            $exceptionMessage = get_class($this) . ' requires XSL extension';
110 70
        }
111 -
    }
112 -
113 -
    /**
114 -
     * Checks that `XSLTProcessor` class is available
115 -
     *
116 -
     * Instead of checking that XSL extension is loaded we only check `XSLTProcessor` class availability
117 -
     */
118 -
    protected function checkXslExtension(): void
119 -
    {
120 -
        $this->classExists('XSLTProcessor', 'Please install XSL extension');
121 -
    }
122 -
123 -
    /**
124 -
     * Checks that `SimpleXMLElement` class is available
125 -
     *
126 -
     * Instead of checking that SimpleXML extension is loaded we only check `SimpleXMLElement` class availability
127 -
     */
128 -
    protected function checkXmlExtension(): void
129 -
    {
130 -
        $this->classExists('SimpleXMLElement', 'Please install SimpleXML extension');
71 +
        if (!class_exists(SimpleXMLElement::class)) {
72 +
            $exceptionMessage = get_class($this) . ' requires SimpleXML extension';
73 +
        }
74 +
        if (isset($exceptionMessage)) {
75 +
            $this->log($exceptionMessage, Project::MSG_ERR);
76 +
            throw new BuildException($exceptionMessage);
77 +
        }
78 +
        $this->setFormat(VisualizerTask::FORMAT_PNG);
79 +
        $this->setServer(VisualizerTask::SERVER);
131 80
    }
132 81
133 82
    /**
134 83
     * The main entry point method.
135 84
     *
136 -
     * @throws \HTTP_Request2_Exception
85 +
     * @throws \GuzzleHttp\Exception\GuzzleException
137 86
     * @throws \IOException
138 87
     * @throws \NullPointerException
139 88
     */
@@ -342,7 +291,7 @@
Loading
342 291
     * @param string $format
343 292
     *
344 293
     * @return string
345 -
     * @throws \HTTP_Request2_Exception
294 +
     * @throws \GuzzleHttp\Exception\GuzzleException
346 295
     */
347 296
    protected function generateImage(string $pumlDiagram, string $format): string
348 297
    {
@@ -356,10 +305,10 @@
Loading
356 305
        $encodedPuml = encodep($pumlDiagram);
357 306
        $this->prepareImageUrl($format, $encodedPuml);
358 307
359 -
        $response = $this->request()->send();
308 +
        $response = $this->request();
360 309
        $this->processResponse($response); // used for status validation
361 310
362 -
        return $response->getBody();
311 +
        return $response->getBody()->getContents();
363 312
    }
364 313
365 314
    /**

@@ -18,16 +18,17 @@
Loading
18 18
 */
19 19
20 20
/**
21 -
 * fileHash
21 +
 * FileSizeTask
22 22
 *
23 -
 * Calculate either MD5 or SHA hash value of a specified file and retun the
24 -
 * value in a property
23 +
 * Returns the size of a file
25 24
 *
26 25
 * @author  Johan Persson <johan162@gmail.com>
27 26
 * @package phing.tasks.ext
28 27
 */
29 28
class FileSizeTask extends Task
30 29
{
30 +
    const UNITS = ['B', 'K', 'M', 'G', 'T', 'P'];
31 +
31 32
    /**
32 33
     * Property for File
33 34
     *
@@ -38,17 +39,27 @@
Loading
38 39
    /**
39 40
     * Property where the file size will be stored
40 41
     *
41 -
     * @var string $property
42 +
     * @var string
42 43
     */
43 44
    private $propertyName = "filesize";
44 45
46 +
    /**
47 +
     * Return size in this unit
48 +
     *
49 +
     * @var string
50 +
     */
51 +
    private $unit = self::UNITS[0];
52 +
45 53
    /**
46 54
     * Which file to calculate the file size of
47 55
     *
48 56
     * @param PhingFile $file
49 57
     */
50 -
    public function setFile($file)
58 +
    public function setFile(PhingFile $file)
51 59
    {
60 +
        if (!$file->canRead()) {
61 +
            throw new BuildException(sprintf('Input file does not exist or is not readable: %s', $file->getName()));
62 +
        }
52 63
        $this->file = $file;
53 64
    }
54 65
@@ -58,11 +69,23 @@
Loading
58 69
     * @param  $property
59 70
     * @return void
60 71
     */
61 -
    public function setPropertyName($property)
72 +
    public function setPropertyName(string $property)
62 73
    {
74 +
        if (empty($property)) {
75 +
            throw new BuildException('Property name cannot be empty');
76 +
        }
63 77
        $this->propertyName = $property;
64 78
    }
65 79
80 +
    public function setUnit(string $originalUnit)
81 +
    {
82 +
        $unit = strtoupper($originalUnit);
83 +
        if (!in_array($unit, self::UNITS)) {
84 +
            throw new BuildException(sprintf('Invalid unit: %s', $originalUnit));
85 +
        }
86 +
        $this->unit = $unit;
87 +
    }
88 +
66 89
    /**
67 90
     * Main-Method for the Task
68 91
     *
@@ -71,58 +94,25 @@
Loading
71 94
     */
72 95
    public function main()
73 96
    {
74 -
        $this->checkFile();
75 -
        $this->checkPropertyName();
97 +
        if (!($this->file instanceof PhingFile)) {
98 +
            throw new BuildException('Input file not specified');
99 +
        }
76 100
77 101
        $size = filesize($this->file);
78 102
79 103
        if ($size === false) {
80 -
            throw new BuildException(sprintf('[FileSize] Cannot determine size of file: %s', $this->file));
104 +
            throw new BuildException(sprintf('Cannot determine size of file: %s', $this->file));
81 105
        }
106 +
        $this->log(sprintf('%s %s', $size, self::UNITS[0]), Project::MSG_VERBOSE);
82 107
83 -
        // publish hash value
84 -
        $this->project->setProperty($this->propertyName, $size);
85 -
    }
108 +
        $size = $size / pow(1024, array_search($this->unit, self::UNITS, true));
86 109
87 -
    /**
88 -
     * checks file attribute
89 -
     *
90 -
     * @return void
91 -
     * @throws BuildException
92 -
     */
93 -
    private function checkFile()
94 -
    {
95 -
        // check File
96 -
        if (
97 -
            $this->file === null
98 -
            || strlen($this->file) == 0
99 -
        ) {
100 -
            throw new BuildException('[FileSize] You must specify an input file.', $this->file);
110 +
        if (is_float($size)) {
111 +
            $size = round($size, 2);
101 112
        }
113 +
        $this->log(sprintf('%s %s', $size, $this->unit), Project::MSG_INFO);
102 114
103 -
        if (!is_readable($this->file)) {
104 -
            throw new BuildException(
105 -
                sprintf(
106 -
                    '[FileSize] Input file does not exist or is not readable: %s',
107 -
                    $this->file
108 -
                )
109 -
            );
110 -
        }
111 -
    }
112 -
113 -
    /**
114 -
     * checks property attribute
115 -
     *
116 -
     * @return void
117 -
     * @throws BuildException
118 -
     */
119 -
    private function checkPropertyName()
120 -
    {
121 -
        if (
122 -
            null === $this->propertyName
123 -
            || strlen($this->propertyName) === 0
124 -
        ) {
125 -
            throw new BuildException('[FileSize] Property name for publishing file size is not set');
126 -
        }
115 +
        // publish hash value
116 +
        $this->project->setProperty($this->propertyName, $size);
127 117
    }
128 118
}

@@ -20,6 +20,7 @@
Loading
20 20
use GuzzleHttp\Middleware;
21 21
use Psr\Http\Message\ResponseInterface;
22 22
use Symfony\Component\Console\Logger\ConsoleLogger;
23 +
use Symfony\Component\Console\Output\ConsoleOutput;
23 24
24 25
/**
25 26
 * A HTTP request task.
@@ -130,11 +131,10 @@
Loading
130 131
    }
131 132
132 133
    /**
133 -
     * Creates and configures an instance of HTTP_Request2
134 +
     * Creates, configures, and sends a request
134 135
     *
135 136
     * @param array $options
136 137
     * @return ResponseInterface
137 -
     * @throws HTTP_Request2_Exception
138 138
     */
139 139
    protected function request($options = [])
140 140
    {
@@ -150,7 +150,7 @@
Loading
150 150
        }
151 151
152 152
        if ($this->verbose) {
153 -
            self::getHandlerStack()->push(Middleware::log(new ConsoleLogger(), new \GuzzleHttp\MessageFormatter()));
153 +
            self::getHandlerStack()->push(Middleware::log(new ConsoleLogger(new ConsoleOutput()), new \GuzzleHttp\MessageFormatter()));
154 154
        }
155 155
156 156
        return parent::request($options);

@@ -39,16 +39,16 @@
Loading
39 39
40 40
        switch ($type) {
41 41
            case "xml":
42 -
                include_once 'phing/tasks/ext/phploc/PHPLocXMLFormatter.php';
43 42
                $formatter = new PHPLocXMLFormatter();
44 43
                break;
44 +
            case "json":
45 +
                $formatter = new PHPLocJSONFormatter();
46 +
                break;
45 47
            case "csv":
46 -
                include_once 'phing/tasks/ext/phploc/PHPLocCSVFormatter.php';
47 48
                $formatter = new PHPLocCSVFormatter();
48 49
                break;
49 50
            case "txt":
50 51
            case "cli":
51 -
                include_once 'phing/tasks/ext/phploc/PHPLocTextFormatter.php';
52 52
                $formatter = new PHPLocTextFormatter();
53 53
                break;
54 54
            default:
55 55
imilarity index 62%
56 56
ename from classes/phing/tasks/ext/PearPkgOption.php
57 57
ename to classes/phing/tasks/ext/phploc/PHPLocJSONFormatter.php

@@ -125,7 +125,7 @@
Loading
125 125
    }
126 126
127 127
    /**
128 -
     * Creates and configures an instance of HTTP_Request2
128 +
     * Creates, configures, and sends a request
129 129
     *
130 130
     * @param array $options
131 131
     * @return ResponseInterface
@@ -151,7 +151,7 @@
Loading
151 151
152 152
        foreach (array_keys($this->getProject()->getProperties()) as $propName) {
153 153
            if (0 === strpos($propName, 'phing.http.')) {
154 -
                $options[substr($propName, 11)] = $this->getProject()->getProperty($propName);
154 +
                $options[substr($propName, 11)] = (string) $this->getProject()->getProperty($propName);
155 155
            }
156 156
        }
157 157

@@ -40,7 +40,7 @@
Loading
40 40
        parent::__construct();
41 41
42 42
        if (!class_exists('Mail')) {
43 -
            throw new BuildException('Need the PEAR Mail package to send logs');
43 +
            throw new BuildException('Need the pear/mail_mime package installed to send logs');
44 44
        }
45 45
46 46
        $tolist = Phing::getDefinedProperty('phing.log.mail.recipients');

@@ -18,46 +18,18 @@
Loading
18 18
 */
19 19
20 20
/**
21 -
 * Generic option class is used for non-complex options.
22 -
 *
23 -
 * @package phing.tasks.ext
21 +
 * @author Siad Ardroumli <siad.ardroumli@gmail.com>
22 +
 * @package phing.tasks.ext.phploc
24 23
 */
25 -
class PearPkgOption
24 +
class PHPLocJSONFormatter extends AbstractPHPLocFormatter
26 25
{
27 -
    private $name;
28 -
    private $value;
29 -
30 -
    /**
31 -
     * @param $v
32 -
     */
33 -
    public function setName($v)
34 -
    {
35 -
        $this->name = $v;
36 -
    }
37 -
38 -
    public function getName()
39 -
    {
40 -
        return $this->name;
41 -
    }
42 -
43 -
    /**
44 -
     * @param $v
45 -
     */
46 -
    public function setValue($v)
47 -
    {
48 -
        $this->value = $v;
49 -
    }
50 -
51 -
    public function getValue()
52 -
    {
53 -
        return $this->value;
54 -
    }
55 -
56 -
    /**
57 -
     * @param $txt
58 -
     */
59 -
    public function addText($txt)
26 +
    public function printResult(array $count, $countTests = false)
60 27
    {
61 -
        $this->value = trim($txt);
28 +
        if (class_exists('\\SebastianBergmann\\PHPLOC\\Log\\Json')) {
29 +
            $printer = new SebastianBergmann\PHPLOC\Log\Json();
30 +
        } else {
31 +
            throw new BuildException('Not supported PHPLOC version used.');
32 +
        }
33 +
        $printer->printResult($this->getToDir() . DIRECTORY_SEPARATOR . $this->getOutfile(), $count);
62 34
    }
63 35
}

@@ -872,17 +872,6 @@
Loading
872 872
        $this->file = $file;
873 873
    }
874 874
875 -
    /**
876 -
     * Init: pull in the PEAR System class
877 -
     *
878 -
     * @access public
879 -
     * @return void
880 -
     */
881 -
    public function init()
882 -
    {
883 -
        @include_once 'vendor/autoload.php';
884 -
    }
885 -
886 875
    /**
887 876
     * Our main execution of the task.
888 877
     *

@@ -271,7 +271,11 @@
Loading
271 271
                    continue;
272 272
                }
273 273
                $this->log('Setting environment variable: ' . $variable, Project::MSG_VERBOSE);
274 -
                $envString .= $variable . '; ';
274 +
                if (OsCondition::isOS(OsCondition::FAMILY_WINDOWS)) {
275 +
                    $envString .= 'set ' . $variable . ' & ';
276 +
                } else {
277 +
                    $envString .= $variable . '; ';
278 +
                }
275 279
            }
276 280
        }
277 281
Files Complexity Coverage
classes/phing 9,126 54.14%
Project Totals (468 files) 9126 54.14%
4802.10
7.3=.3
TRAVIS_OS_NAME=linux
4801.10
7.3=.3
TRAVIS_OS_NAME=linux
1
ignore:
2
- "docs"
3
- "etc"
4
- "vendor"
5
coverage:
6
  status:
7
    patch: off
8
    project:
9
      default:
10
        threshold: 2
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading