No flags found
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
d7ca56f
... +10 ...
258decd
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
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.'); |
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 | 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 | 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 | /** |
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. |
150 | 151 | } |
|
151 | 152 | ||
152 | 153 | if ($this->verbose) { |
|
153 | - | self::getHandlerStack()->push(Middleware::log(new ConsoleLogger(), new \GuzzleHttp\MessageFormatter())); |
|
154 | + | self::getHandlerStack()->push(Middleware::log(new ConsoleLogger(new ConsoleOutput()), new \GuzzleHttp\MessageFormatter())); |
|
154 | 155 | } |
|
155 | 156 | ||
156 | 157 | return parent::request($options); |
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: |
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 | 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; |
Learn more Showing 8 files with coverage changes found.
classes/phing/tasks/ext/phploc/PHPLocJSONFormatter.php
classes/phing/util/SourceFileScanner.php
classes/phing/tasks/ext/phploc/PHPLocXMLFormatter.php
classes/phing/tasks/ext/phploc/PHPLocFormatterFactory.php
classes/phing/tasks/ext/phploc/PHPLocTask.php
classes/phing/tasks/ext/phploc/PHPLocCSVFormatter.php
classes/phing/tasks/ext/phploc/AbstractPHPLocFormatter.php
classes/phing/tasks/ext/phploc/PHPLocFormatterElement.php
Files | Complexity | Coverage |
---|---|---|
VisualizerTask.php | ø | -2.30% 80.51% |
Project Totals (477 files) | 9306 | 53.07% |
258decd
038ad1f
06668f8
8a6a501
2ef28b4
86b802b
869a00b
70f11a6
c1c4556
ba72dd2
a819dbe
d7ca56f