• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

JBZoo / CI-Report-Converter / 7520440609

14 Oct 2023 08:18PM UTC coverage: 94.375%. Remained the same
7520440609

push

github

web-flow
PHP CS Fixer - `ordered_types` (#40)

1426 of 1511 relevant lines covered (94.37%)

28.38 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

76.47
/src/Commands/AbstractCommand.php
1
<?php
2

3
/**
4
 * JBZoo Toolbox - CI-Report-Converter.
5
 *
6
 * This file is part of the JBZoo Toolbox project.
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license    MIT
11
 * @copyright  Copyright (C) JBZoo.com, All rights reserved.
12
 * @see        https://github.com/JBZoo/CI-Report-Converter
13
 */
14

15
declare(strict_types=1);
16

17
namespace JBZoo\CIReportConverter\Commands;
18

19
use JBZoo\Cli\CliCommand;
20
use JBZoo\Cli\OutLvl;
21

22
abstract class AbstractCommand extends CliCommand
23
{
24
    protected function getSourceCode(): ?string
25
    {
26
        $filename = $this->getOptString('input-file');
32✔
27

28
        if ($filename !== '') {
32✔
29
            if (\realpath($filename) === false && !\file_exists($filename)) {
32✔
30
                $this->_("File \"{$filename}\" not found", OutLvl::ERROR);
8✔
31

32
                return null;
8✔
33
            }
34

35
            return (string)\file_get_contents($filename);
24✔
36
        }
37

38
        $contents = self::getStdIn();
×
39
        if (\trim((string)$contents) === '') {
×
40
            throw new Exception('Please provide input-file or use STDIN as input (CLI pipeline).');
×
41
        }
42

43
        return $contents;
×
44
    }
45

46
    protected function saveResult(string $result): bool
47
    {
48
        $filename = $this->getOptString('output-file');
28✔
49
        if ($filename !== '') {
28✔
50
            \file_put_contents($filename, $result);
4✔
51
            $this->_("Result is saved: {$filename}");
4✔
52

53
            return true;
4✔
54
        }
55

56
        $this->_($result);
24✔
57

58
        return false;
24✔
59
    }
60
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc