Completed
Push — master ( b40a0a...cbda81 )
by Sebastian
02:08
created

Diff   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 5
dl 0
loc 17
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A compare() 0 8 1
1
<?php
2
/**
3
 * This file is part of SebastianFeldmann\Git.
4
 *
5
 * (c) Sebastian Feldmann <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace SebastianFeldmann\Git\Operator;
11
12
use SebastianFeldmann\Git\Command\Diff\Compare;
13
14
/**
15
 * Diff operator
16
 *
17
 * @package SebastianFeldmann\Git
18
 * @author  Sebastian Feldmann <[email protected]>
19
 * @link    https://github.com/sebastianfeldmann/git
20
 * @since   Class available since Release 1.2.0
21
 */
22
class Diff extends Base
23
{
24
    /**
25
     * Returns a list of files and their changes.
26
     *
27
     * @param  string $from
28
     * @param  string $to
29
     * @return \SebastianFeldmann\Git\Diff\File[]
30
     */
31 1
    public function compare(string $from, string $to): array
32
    {
33 1
        $compare = (new Compare($this->repo->getRoot()))->revisions($from, $to)
34 1
                                                        ->ignoreWhitespacesAtEndOfLine();
35
36 1
        $result = $this->runner->run($compare, new Compare\FullDiffList());
37
38 1
        return $result->getFormattedOutput();
0 ignored issues
show
Bug Best Practice introduced by
The expression return $result->getFormattedOutput() returns the type iterable which is incompatible with the type-hinted return array.
Loading history...
39
    }
40
}
41