Passed
Push — master ( aab48a...d51f23 )
by Evgenii
01:25
created

bootstrap.php (2 issues)

Labels
Severity
1
<?php
2
/*
3
Plugin Name:    Helick Blocks
4
Author:         Evgenii Nasyrov
5
Author URI:     https://helick.io/
6
*/
7
8
// Require Composer autoloader if installed on it's own
9
if (file_exists($composer = __DIR__ . '/vendor/autoload.php')) {
10
    require_once $composer;
11
}
12
13
// Let's compose the registered blocks
14
add_action('carbon_fields_register_fields', function () {
0 ignored issues
show
The function add_action was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

14
/** @scrutinizer ignore-call */ 
15
add_action('carbon_fields_register_fields', function () {
Loading history...
15
    /**
16
     * Control the list of registered blocks.
17
     *
18
     * @param array $blocks
19
     */
20
    $blocks = apply_filters('helick_blocks', []);
0 ignored issues
show
The function apply_filters was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
    $blocks = /** @scrutinizer ignore-call */ apply_filters('helick_blocks', []);
Loading history...
21
22
    $blocks = array_filter((array)$blocks, function (string $class) {
23
        return $class instanceof \Helick\Blocks\Contracts\Composable;
24
    });
25
26
    $blocks = array_unique($blocks);
27
28
    array_walk($blocks, static function (string $class) {
29
        (new $class)->compose();
30
    });
31
});
32
33