Minify   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 14
c 2
b 1
f 0
dl 0
loc 26
ccs 12
cts 12
cp 1
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A performAction() 0 6 2
A setUpDefinition() 0 9 1
1
<?php
2
3
namespace Swaggest\JsonCli;
4
5
use Yaoi\Command;
6
use Yaoi\Command\Definition;
7
8
class Minify extends Base
9
{
10
    public $path;
11
    public $eol;
12
13
    /**
14
     * @param Definition $definition
15
     * @param \stdClass|static $options
16 1
     */
17
    static function setUpDefinition(Definition $definition, $options)
18 1
    {
19 1
        $options->path = Command\Option::create()->setIsUnnamed()->setIsRequired()
20 1
            ->setDescription('Path to JSON/YAML file');
21 1
        parent::setUpDefinition($definition, $options);
22 1
        unset($options->pretty);
23 1
        unset($options->toYaml);
24 1
        $options->eol = Command\Option::create()->setDescription('Add line break to the output');
25
        $definition->description = 'Minify JSON document';
26 1
    }
27
28 1
    public function performAction()
29 1
    {
30 1
        $this->out = $this->readData($this->path);
31
        $this->postPerform();
32
        if ($this->eol) {
33
            echo "\n";
34
        }
35
    }
36
37
}