| Total Complexity | 3 |
| Total Lines | 74 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | final class ExampleBlock extends Block |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * The block's display name. |
||
| 11 | * |
||
| 12 | * @var string |
||
| 13 | */ |
||
| 14 | protected $name = 'Example'; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * The block's description. |
||
| 18 | * |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | protected $description = 'This is an example block'; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * The block's template. |
||
| 25 | * |
||
| 26 | * @var string|string[] |
||
| 27 | */ |
||
| 28 | protected $template = 'partials/blocks/example.php'; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Fields to be attached to the block. |
||
| 32 | * |
||
| 33 | * @return array |
||
| 34 | */ |
||
| 35 | public function fields(): array |
||
| 36 | { |
||
| 37 | return [ |
||
| 38 | Field::make('text', 'heading', 'Heading'), |
||
| 39 | Field::make('image', 'image', 'Image'), |
||
| 40 | Field::make('rich_text', 'content', 'Content'), |
||
| 41 | Field::make('association', 'associations', 'Associations') |
||
| 42 | ->set_types([ |
||
| 43 | [ |
||
| 44 | 'type' => 'post', |
||
| 45 | 'post_type' => 'post', |
||
| 46 | ] |
||
| 47 | ]) |
||
| 48 | ]; |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Data to be passed to the rendered block. |
||
| 53 | * |
||
| 54 | * @param array $fields |
||
| 55 | * |
||
| 56 | * @return array |
||
| 57 | */ |
||
| 58 | public function with(array $fields): array |
||
| 59 | { |
||
| 60 | return [ |
||
| 61 | 'associations' => $this->queryAssociations($fields['associations']) |
||
| 62 | ]; |
||
| 63 | } |
||
| 64 | |||
| 65 | /** |
||
| 66 | * Query the associations. |
||
| 67 | * |
||
| 68 | * @param array $associations |
||
| 69 | * |
||
| 70 | * @return WP_Query |
||
| 71 | */ |
||
| 72 | private function queryAssociations(array $associations): WP_Query |
||
| 81 | ]); |
||
| 82 | } |
||
| 83 | } |
||
| 84 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths