Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
33.33% covered (danger)
33.33%
5 / 15
25.00% covered (danger)
25.00%
1 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 1
CargoPageValuesAction
33.33% covered (danger)
33.33%
5 / 15
25.00% covered (danger)
25.00%
1 / 4
12.41
0.00% covered (danger)
0.00%
0 / 1
 getName
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 show
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 getPageValuesActionArray
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
2
 addLink
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2/**
3 * Handles the 'pagevalues' action.
4 *
5 * @author Yaron Koren
6 * @ingroup Cargo
7 */
8
9class CargoPageValuesAction extends Action {
10
11    /**
12     * Return the name of the action this object responds to.
13     * @return string lowercase
14     */
15    public function getName() {
16        return 'pagevalues';
17    }
18
19    /**
20     * The main action entry point. Do all output for display and send it
21     * to the context output.
22     * $this->getOutput(), etc.
23     */
24    public function show() {
25        $title = $this->getTitle();
26        $pageValuesPage = new CargoPageValues( $title );
27        $pageValuesPage->execute();
28    }
29
30    public static function getPageValuesActionArray( $title ) {
31        return [
32            'msg' => 'pagevalues',
33            'href' => $title->getLocalUrl( [ 'action' => 'pagevalues' ] ),
34            'id' => 't-cargopagevalueslink',
35            'rel' => 'cargo-pagevalues'
36        ];
37    }
38
39    /**
40     * Add the "Page values" link to the toolbox.
41     *
42     * Called with the SidebarBeforeOutput hook.
43     *
44     * @param Skin $skin
45     * @param array &$sidebar
46     * @return void
47     */
48    public static function addLink( Skin $skin, array &$sidebar ) {
49        $title = $skin->getTitle();
50        // This function doesn't usually get called for special pages,
51        // but sometimes it is.
52        if ( $title->isSpecialPage() ) {
53            return;
54        }
55
56        $sidebar['TOOLBOX']['cargo-pagevalues'] =
57            self::getPageValuesActionArray( $title );
58    }
59
60}