Passed
Push — master ( 449e1e...ad7a00 )
by Elvis Henrique
04:51
created

wpsteak.php (1 issue)

1
<?php declare(strict_types = 1);
2
3
/**
4
 * WP Steak
5
 *
6
 * @package App
7
 *
8
 * Plugin Name: WP Steak
9
 * Description: A fully structured plugin.
10
 * Version: 3.0.1
11
 * Author: Apiki
12
 * Author URI: https://apiki.com/
13
 * Text Domain: app
14
 * Domain Path: /languages
15
 * Requires PHP: 7.4
16
 */
17
18
use Cedaro\WP\Plugin\Plugin;
19
use Cedaro\WP\Plugin\PluginFactory;
20
21
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
22
	require __DIR__ . '/vendor/autoload.php';
23
}
24
25
/**
26
 * Retrieve the main plugin instance.
27
 *
28
 * @return \Cedaro\WP\Plugin
29
 */
30
function wpsteak(): Plugin {
31
	static $instance;
32
33
	if ( null === $instance ) {
34
		$instance = PluginFactory::create( 'app' );
35
	}
36
37
	return $instance;
38
}
39
40
$container = new League\Container\Container();
41
42
/* register the reflection container as a delegate to enable auto wiring. */
43
$container->delegate(
44
	( new League\Container\ReflectionContainer() )->cacheResolutions(),
45
);
46
47
$plugin = wpsteak(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride
0 ignored issues
show
Comment after code is disallowed.
Loading history...
48
49
$plugin->set_container( $container );
50
$plugin->register_hooks( $container->get( Cedaro\WP\Plugin\Provider\I18n::class ) );
51
$plugin->register_hooks( $container->get( WPSteak\Providers\I18n::class ) );
52
53
$config = ( require __DIR__ . '/config.php' );
54
55
foreach ( $config['service_providers'] as $service_provider ) {
56
	$container->addServiceProvider( $service_provider );
57
}
58
59
foreach ( $config['hook_providers'] as $hook_provider ) {
60
	$plugin->register_hooks( $container->get( $hook_provider ) );
61
}
62