| Conditions | 4 |
| Paths | 8 |
| Total Lines | 26 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | public function handle(): void |
||
| 10 | { |
||
| 11 | $this->verifyNonce(); |
||
| 12 | $args = [ |
||
| 13 | 'post__in' => [], |
||
| 14 | 'posts_per_page' => 25, |
||
| 15 | ]; |
||
| 16 | if (is_numeric($this->search)) { |
||
| 17 | $args['post__in'][] = (int) $this->search; |
||
| 18 | } else { |
||
| 19 | $args['s'] = $this->search; |
||
| 20 | } |
||
| 21 | $results = glsr(Database::class)->posts($args); |
||
| 22 | if ($missingIds = $this->missingIds($results, $this->include)) { |
||
| 23 | $results += glsr(Database::class)->posts([ |
||
| 24 | 'post__in' => $missingIds, |
||
| 25 | ]); |
||
| 26 | } |
||
| 27 | $formatted = $this->formatResults($results); |
||
| 28 | if (empty($this->search)) { |
||
| 29 | $formatted = [ |
||
| 30 | 'post_id' => esc_html_x('The Current Page', 'admin-text', 'site-reviews'), |
||
| 31 | 'parent_id' => esc_html_x('The Parent Page', 'admin-text', 'site-reviews'), |
||
| 32 | ] + $formatted; |
||
| 33 | } |
||
| 34 | $this->response = $formatted; |
||
| 35 | } |
||
| 37 |