Passed
Push — master ( 9a7a16...e17332 )
by Atanas
01:51
created

functions.php ➔ partial()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 2
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace WPEmerge;
4
5
use WPEmerge\Response;
6
use WPEmerge\Helpers\Mixed;
7
8
if ( ! function_exists( 'response' ) ) {
9
	/**
10
	 * @codeCoverageIgnore
11
	 * @see Response::response()
12
	 * @return \Psr\Http\Message\ResponseInterface
13
	 */
14
	function response() {
15
		return Response::response();
16
	}
17
}
18
19
if ( ! function_exists( 'output' ) ) {
20
	/**
21
	 * @codeCoverageIgnore
22
	 * @see Response::output()
23
	 * @return \Psr\Http\Message\ResponseInterface
24
	 */
25
	function output( $output ) {
26
		return Response::output( response(), $output );
27
	}
28
}
29
30
if ( ! function_exists( 'view' ) ) {
31
	/**
32
	 * @codeCoverageIgnore
33
	 * @see Response::view()
34
	 * @return \Psr\Http\Message\ResponseInterface
35
	 */
36
	function view( $views, $context = array() ) {
37
		return Response::view( response(), $views, $context );
38
	}
39
}
40
41
if ( ! function_exists( 'json' ) ) {
42
	/**
43
	 * @codeCoverageIgnore
44
	 * @see Response::json()
45
	 * @return \Psr\Http\Message\ResponseInterface
46
	 */
47
	function json( $data ) {
48
		return Response::json( response(), $data );
49
	}
50
}
51
52
if ( ! function_exists( 'redirect' ) ) {
53
	/**
54
	 * @codeCoverageIgnore
55
	 * @see Response::redirect()
56
	 * @return \Psr\Http\Message\ResponseInterface
57
	 */
58
	function redirect( $url, $status = 302 ) {
59
		return Response::redirect( response(), $url, $status );
60
	}
61
}
62
63
if ( ! function_exists( 'reload' ) ) {
64
	/**
65
	 * @codeCoverageIgnore
66
	 * @see Response::reload()
67
	 * @return \Psr\Http\Message\ResponseInterface
68
	 */
69
	function reload( $request, $status = 302 ) {
70
		return Response::reload( response(), $request, $status );
71
	}
72
}
73
74
if ( ! function_exists( 'error' ) ) {
75
	/**
76
	 * @codeCoverageIgnore
77
	 * @see Response::error()
78
	 * @return \Psr\Http\Message\ResponseInterface
79
	 */
80
	function error( $code ) {
81
		return Response::error( response(), $code );
82
	}
83
}
84
85
if ( ! function_exists( 'partial' ) ) {
86
	/**
87
	 * @codeCoverageIgnore
88
	 * @see WPEmerge\View\Php::render()
89
	 * @return void
90
	 */
91
	function partial( $views, $context = [] ) {
92
		$views = Mixed::toArray( $views );
93
		$engine = \WPEmerge::resolve( WPEMERGE_VIEW_ENGINE_PHP_KEY );
94
		echo $engine->render( $views, $context );
95
	}
96
}
97