GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

AbstractItemListTable   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 91
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 23
dl 0
loc 91
ccs 0
cts 16
cp 0
rs 10
c 0
b 0
f 0
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A no_items() 0 3 1
A setDefaultItemsPerPage() 0 3 1
A getDefaultItemsPerPage() 0 3 1
A enqueueAssets() 0 10 1
A getItemsPerPageOptionName() 0 3 1
A setItemsPerPageOptionName() 0 3 1
A __construct() 0 15 1
A printStyles() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GraphQLAPI\GraphQLAPI\Admin\Tables;
6
7
use WP_List_Table;
8
9
/**
10
 * Module Table
11
 */
12
abstract class AbstractItemListTable extends WP_List_Table
13
{
14
    protected string $itemsPerPageOptionName = '';
15
    protected int $defaultItemsPerPage = 10;
16
17
    public function setItemsPerPageOptionName(string $itemsPerPageOptionName): void
18
    {
19
        $this->itemsPerPageOptionName = $itemsPerPageOptionName;
20
    }
21
    public function setDefaultItemsPerPage(int $defaultItemsPerPage): void
22
    {
23
        $this->defaultItemsPerPage = $defaultItemsPerPage;
24
    }
25
26
    public function getItemsPerPageOptionName(): string
27
    {
28
        return $this->itemsPerPageOptionName;
29
    }
30
    public function getDefaultItemsPerPage(): int
31
    {
32
        return $this->defaultItemsPerPage;
33
    }
34
35
    /**
36
     * Singular name of the listed records
37
     *
38
     * @return string
39
     */
40
    abstract public function getItemSingularName(): string;
41
42
    /**
43
     * Plural name of the listed records
44
     *
45
     * @return string
46
     */
47
    abstract public function getItemPluralName(): string;
48
49
    /** Class constructor */
50
    public function __construct()
51
    {
52
        parent::__construct([
53
            'singular' => $this->getItemSingularName(),
54
            'plural' => $this->getItemPluralName(),
55
            'ajax' => false,
56
        ]);
57
58
        \add_action(
59
            'admin_enqueue_scripts',
60
            [$this, 'enqueueAssets']
61
        );
62
        add_action(
63
            'admin_head',
64
            [$this, 'printStyles']
65
        );
66
    }
67
68
    /**
69
     * Print custom styles, such as the width of the columns
70
     */
71
    public function printStyles(): void
72
    {
73
        // Do nothing
74
    }
75
76
    /**
77
     * Enqueue the required assets
78
     *
79
     * @return void
80
     */
81
    public function enqueueAssets(): void
82
    {
83
        /**
84
         * Fix the issues with the WP List Table
85
         */
86
        \wp_enqueue_style(
87
            'graphql-api-wp-list-table-fix',
88
            \GRAPHQL_API_URL . 'assets/css/wp-list-table-fix.css',
89
            array(),
90
            \GRAPHQL_API_VERSION
91
        );
92
    }
93
94
    /**
95
     * Text displayed when there are no items
96
     *
97
     * @return void
98
     * phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
99
     */
100
    public function no_items()
101
    {
102
        _e('No items found.', 'graphql-api');
103
    }
104
}
105