src/Diff.php
public function filter(string $path, array $report) : array
    {
        $report['messages'] = isset($this->paths[$path]) ? array_intersect_key(
            $report['messages'],
            array_flip($this->paths[$path])
        ) : [];

        $errors = $warnings = $fixable = 0;

        foreach ($report['messages'] as $line) {
            foreach ($line as $messages) {
                foreach ($messages as $message) {
                    switch ($message['type']) {
                        case 'ERROR':
                            $errors++;
                            break;
                        case 'WARNING':
                            $warnings++;
                            break;
                    }

                    if ($message['fixable']) {
                        $fixable++;
                    }
                }
            }
        }

        return array_merge($report, [
            'errors' => $errors,
            'warnings' => $warnings,
            'fixable' => $fixable,
        ]);
    }
public function filter(string $path, array $report) : array
    {
        $report['messages'] = isset($this->paths[$path]) ? array_intersect_key(
            $report['messages'],
            array_flip($this->paths[$path])
        ) : [];

        $errors = $warnings = $fixable = 0;

        foreach ($report['messages'] as $line) {
            foreach ($line as $messages) {
                foreach ($messages as $message) {
                    switch ($message['type']) {
                        case 'ERROR':
                            $errors++;
                            break;
                        case 'WARNING':
                            $warnings++;
                            break;
                    }

                    if ($message['fixable']) {
                        $fixable++;
                    }
                }
            }
        }

        return array_merge($report, [
            'errors' => $errors,
            'warnings' => $warnings,
            'fixable' => $fixable,
        ]);
    }
public function filter ( string $ path , array $ report ) : array { $ report [ 'messages' ] = isset ( $ this -> paths [ $ path ] ) ? array_intersect_key ( $ report [ 'messages' ] , array_flip ( $ this -> paths [ $ path ] ) ) : [ ] ; $ errors = $ warnings = $ fixable = 0 ; foreach ( $ report [ 'messages' ] as $ line ) { foreach ( $ line as $ messages ) { foreach ( $ messages as $ message ) { switch ( $ message [ 'type' ] ) { case 'ERROR' : $ errors ++ ; break ; case 'WARNING' : $ warnings ++ ; break ; } if ( $ message [ 'fixable' ] ) { $ fixable ++ ; } } } } return array_merge ( $ report , [ 'errors' => $ errors , 'warnings' => $ warnings , 'fixable' => $ fixable , ] ) ; }
Filters file report producing another one containing only the lines affected by diff

@param string $path File path
@param array $report Report data

@return array
Filters file report producing another one containing only the lines affected by diff