Passed
Push — master ( 74a67e...bf1276 )
by Atanas
01:58
created

functions.php ➔ app_redirect()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 3
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 3
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
use WPEmerge\Facades\Framework;
4
use WPEmerge\Responses\Response;
5
use WPEmerge\Helpers\Mixed;
6
7 View Code Duplication
if ( ! function_exists( 'app_response' ) ) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
8
	/**
9
	 * @codeCoverageIgnore
10
	 * @see Response::response()
11
	 * @return \Psr\Http\Message\ResponseInterface
12
	 */
13
	function app_response() {
14
		return call_user_func_array( [Response::class, 'response'], func_get_args() );
15
	}
16
}
17
18 View Code Duplication
if ( ! function_exists( 'app_output' ) ) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
19
	/**
20
	 * @codeCoverageIgnore
21
	 * @see Response::output()
22
	 * @return \Psr\Http\Message\ResponseInterface
23
	 */
24
	function app_output( $output ) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
25
		return call_user_func_array( [Response::class, 'output'], func_get_args() );
26
	}
27
}
28
29 View Code Duplication
if ( ! function_exists( 'app_json' ) ) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
30
	/**
31
	 * @codeCoverageIgnore
32
	 * @see Response::json()
33
	 * @return \Psr\Http\Message\ResponseInterface
34
	 */
35
	function app_json( $data ) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
36
		return call_user_func_array( [Response::class, 'json'], func_get_args() );
37
	}
38
}
39
40 View Code Duplication
if ( ! function_exists( 'app_redirect' ) ) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
41
	/**
42
	 * @codeCoverageIgnore
43
	 * @see Response::redirect()
44
	 * @return \Psr\Http\Message\ResponseInterface
45
	 */
46
	function app_redirect() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
47
		return call_user_func_array( [Response::class, 'redirect'], func_get_args() );
48
	}
49
}
50
51 View Code Duplication
if ( ! function_exists( 'app_view' ) ) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
52
	/**
53
	 * @codeCoverageIgnore
54
	 * @see Response::view()
55
	 * @return \Psr\Http\Message\ResponseInterface
56
	 */
57
	function app_view( $views, $context = [] ) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
58
		return call_user_func_array( [Response::class, 'view'], func_get_args() );
59
	}
60
}
61
62 View Code Duplication
if ( ! function_exists( 'app_error' ) ) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
63
	/**
64
	 * @codeCoverageIgnore
65
	 * @see Response::error()
66
	 * @return \Psr\Http\Message\ResponseInterface
67
	 */
68
	function app_error( $code ) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
69
		return call_user_func_array( [Response::class, 'error'], func_get_args() );
70
	}
71
}
72
73
if ( ! function_exists( 'app_partial' ) ) {
74
	/**
75
	 * @codeCoverageIgnore
76
	 * @see WPEmerge\View\PhpViewEngine::make()
77
	 * @see WPEmerge\View\PhpView::toString()
78
	 * @return void
79
	 */
80
	function app_partial( $views, $context = [] ) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
81
		$views = Mixed::toArray( $views );
82
		$engine = Framework::resolve( WPEMERGE_VIEW_ENGINE_PHP_KEY );
83
		echo $engine->make( $views, $context )->toString();
84
	}
85
}
86