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.

BlockRenderingHelpers   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 20
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A getCustomPostTitle() 0 15 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GraphQLAPI\GraphQLAPI\General;
6
7
use WP_Post;
8
9
class BlockRenderingHelpers
10
{
11
    /**
12
     * Get a standardized title for a Custom Post
13
     */
14
    public static function getCustomPostTitle(WP_Post $customPostObject): string
15
    {
16
        $title = $customPostObject->post_title ?
17
            $customPostObject->post_title :
18
            \__('(No title)', 'graphql-api');
19
20
        // If the post is either draft/pending (or maybe trash?), add that info in the title
21
        if ($customPostObject->post_status != 'publish') {
22
            $title = sprintf(
23
                \__('(%s) %s', 'graphql-api'),
24
                ucwords($customPostObject->post_status),
25
                $title
26
            );
27
        }
28
        return $title;
29
    }
30
}
31