| Conditions | 3 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 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 | } |
||
| 31 |