Completed
Push — master ( 3952c5...023801 )
by Sebastian
02:12
created

Log::getCommitsSince()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * This file is part of CaptainHook.
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\Log\ChangedFiles;
13
use SebastianFeldmann\Git\Command\Log\Commits;
14
15
class Log extends Base
16
{
17
    /**
18
     * Get the list of files that changed since a given revision.
19
     *
20
     * @param  string $revision
21
     * @return array
22
     */
23 1
    public function getChangedFilesSince(string $revision) : array
24
    {
25 1
        $cmd    = (new ChangedFiles($this->repo->getRoot()))->byRevision($revision);
26 1
        $result = $this->runner->run($cmd);
27
28 1
        return $result->getOutput();
29
    }
30
31
    /**
32
     * Get list of commits since given revision.
33
     *
34
     * @param  string $revision
35
     * @return array
36
     */
37 1
    public function getCommitsSince(string $revision) : array
38
    {
39 1
        $cmd       = (new Commits($this->repo->getRoot()))->byRevision($revision)
40 1
                                                          ->prettyFormat(Commits\Jsonized::FORMAT);
41 1
        $formatter = new Commits\Jsonized();
42 1
        $result    = $this->runner->run($cmd, $formatter);
43
44 1
        return $result->getFormattedOutput();
45
    }
46
}
47