Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
13 / 13
GitChanged
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
3 / 3
3
100.00% covered (success)
100.00%
13 / 13
 __construct
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
5 / 5
 getPreviousFiles
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
4 / 4
 getNewFiles
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
4 / 4
<?php
/**
 * Copyright (C) 2018 Kunal Mehta <legoktm@member.fsf.org>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */
namespace MediaWiki\Tool\PatchCoverage;
/**
 * Typed object to hold changed files in a
 * git commit
 */
class GitChanged {
    /**
     * @var string[]
     */
    public $added = [];
    /**
     * @var string[]
     */
    public $modified = [];
    /**
     * @var string[]
     */
    public $deleted = [];
    /**
     * @var array
     */
    public $renamed = [];
    public function __construct( $added = [], $modified = [], $deleted = [],
        $renamed = []
    ) {
        $this->added = $added;
        $this->modified = $modified;
        $this->deleted = $deleted;
        $this->renamed = $renamed;
    }
    public function getPreviousFiles() {
        return array_merge(
            $this->deleted,
            $this->modified,
            array_keys( $this->renamed )
        );
    }
    public function getNewFiles() {
        return array_merge(
            $this->added,
            $this->modified,
            array_values( $this->renamed )
        );
    }
}