Completed
Pull Request — master (#28)
by Robbie
12:24
created

ComposerUpdateReportExtension   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 25
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateColumns() 0 17 2
1
<?php
2
3
namespace BringYourOwnIdeas\UpdateChecker\Extensions;
4
5
use Extension;
6
7
class ComposerUpdateReportExtension extends Extension
8
{
9
    /**
10
     * Adds the available and latest versions to the site summary report
11
     *
12
     * @param array $columns
13
     */
14
    public function updateColumns(&$columns)
15
    {
16
        $columns['AvailableVersion'] = [
17
            'title' => _t(__CLASS__ . '.AVAILABLE', 'Available'),
18
            // If the available version update is the same as the currently installed version, don't show it
19
            'formatting' => function ($value, $item) {
20
                if ($value === $item->Version) {
21
                    return '';
22
                }
23
                return $value;
24
            },
25
        ];
26
27
        $columns['LatestVersion'] = [
28
            'title' => _t(__CLASS__ . '.LATEST', 'Latest')
29
        ];
30
    }
31
}
32