Failed Conditions
Branch refactor/kernels (cc9370)
by Atanas
02:23
created

anonymous()

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
nc 2
nop 1
dl 0
loc 12
ccs 0
cts 6
cp 0
c 0
b 0
f 0
1
<?php
2
/**
3
 * @package   WPEmerge
4
 * @author    Atanas Angelov <[email protected]>
5
 * @copyright 2019 Atanas Angelov
6
 * @license   https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0
7
 * @link      https://wpemerge.com/
8
 */
9
10
if ( ! defined( 'ABSPATH' ) ) {
11
	exit;
12
}
13
14
$container = \WPEmerge\Facades\Application::getContainer();
0 ignored issues
show
Bug introduced by
The method getContainer() does not exist on WPEmerge\Facades\Application. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

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

14
$container = \WPEmerge\Facades\Application::/** @scrutinizer ignore-call */ getContainer();
Loading history...
15
$kernel = $container[ WPEMERGE_WORDPRESS_HTTP_KERNEL_KEY ];
16
17
$kernel->bootstrap();
18
19
add_action( 'template_include', function ( $view ) use ( $container, $kernel ) {
20
	$request = $container[ WPEMERGE_REQUEST_KEY ];
21
22
	$response = $kernel->handle( $request, $view );
23
24
	if ( $response instanceof \Psr\Http\Message\ResponseInterface ) {
25
		$container[ WPEMERGE_RESPONSE_KEY ] = $response;
26
27
		return WPEMERGE_DIR . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'view.php';
28
	}
29
30
	return $view;
31
}, 1000 );
32