Passed
Push — master ( 425aaa...cf215e )
by zyt
02:31
created

bootstrap()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 0
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php
2
// @codingStandardsIgnoreFile
3
/**
4
 * Plugin Name:  WP Google Fonts Optimizer
5
 * Plugin URI:   https://wordpress.org/plugins/wp-google-fonts-optimizer/
6
 * Description:  Automatically detect and combine multiple Google Web Fonts requests into a single one.
7
 * Author:       zytzagoo
8
 * Author URI:   https://zytzagoo.net
9
 * Version:      0.0.1
10
 * Requires PHP: 5.4
11
 *
12
 * @package ZWF\GoogleFontsOptimizer
13
 */
14
15
namespace ZWF;
16
17
defined( 'ABSPATH' ) || exit;
18
19
/**
20
 * Bootstraps the plugin.
21
 *
22
 * @wp-hook plugins_loaded
23
 *
24
 * @return void
25
 */
26
function bootstrap() {
27
    if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
28
        // Composer-generated autoload file.
29
        include_once __DIR__ . '/vendor/autoload.php';
30
    }
31
32
    $combiner = new GoogleFontsOptimizer();
33
    add_action( 'wp', [ $combiner, 'run' ] );
34
}
35
36
add_action( 'plugins_loaded', __NAMESPACE__ . '\\bootstrap', 0 );
37