Passed
Push — master ( c5c770...04995e )
by Atanas
01:34
created

functions.php ➔ obs_reload()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
use Obsidian\Response;
4
5
if ( ! function_exists( 'obs_response' ) ) {
6
	/**
7
	 * @codeCoverageIgnore
8
	 * @see Response::response()
9
	 * @return \Psr\Http\Message\ResponseInterface
10
	 */
11
	function obs_response() {
12
		return Response::response();
13
	}
14
}
15
16
if ( ! function_exists( 'obs_output' ) ) {
17
	/**
18
	 * @codeCoverageIgnore
19
	 * @see Response::output()
20
	 * @return \Psr\Http\Message\ResponseInterface
21
	 */
22
	function obs_output( $output ) {
23
		return Response::output( obs_response(), $output );
24
	}
25
}
26
27
if ( ! function_exists( 'obs_template' ) ) {
28
	/**
29
	 * @codeCoverageIgnore
30
	 * @see Response::template()
31
	 * @return \Psr\Http\Message\ResponseInterface
32
	 */
33
	function obs_template( $templates, $context = array() ) {
34
		return Response::template( obs_response(), $templates, $context );
35
	}
36
}
37
38
if ( ! function_exists( 'obs_json' ) ) {
39
	/**
40
	 * @codeCoverageIgnore
41
	 * @see Response::json()
42
	 * @return \Psr\Http\Message\ResponseInterface
43
	 */
44
	function obs_json( $data ) {
45
		return Response::json( obs_response(), $data );
46
	}
47
}
48
49
if ( ! function_exists( 'obs_redirect' ) ) {
50
	/**
51
	 * @codeCoverageIgnore
52
	 * @see Response::redirect()
53
	 * @return \Psr\Http\Message\ResponseInterface
54
	 */
55
	function obs_redirect( $url, $status = 302 ) {
56
		return Response::redirect( obs_response(), $url, $status );
57
	}
58
}
59
60
if ( ! function_exists( 'obs_reload' ) ) {
61
	/**
62
	 * @codeCoverageIgnore
63
	 * @param  \Obsidian\Request                   $request
64
	 * @return \Psr\Http\Message\ResponseInterface
65
	 */
66
	function obs_reload( $request ) {
67
		return Response::redirect( obs_response(), $request->getUrl(), 302 );
68
	}
69
}
70
71
if ( ! function_exists( 'obs_error' ) ) {
72
	/**
73
	 * @codeCoverageIgnore
74
	 * @see Response::error()
75
	 * @return \Psr\Http\Message\ResponseInterface
76
	 */
77
	function obs_error( $code ) {
78
		return Response::error( obs_response(), $code );
79
	}
80
}
81