Failed Conditions
Pull Request — master (#40)
by Viktor
09:39
created

src/Responses/ResponsesServiceProvider.php (5 issues)

Labels
Severity
1
<?php
2
/**
3
 * @package   WPEmerge
4
 * @author    Atanas Angelov <[email protected]>
5
 * @copyright 2017-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
namespace WPEmerge\Responses;
11
12
use WPEmerge\ServiceProviders\ServiceProviderInterface;
13
14
/**
15
 * Provide responses dependencies.
16
 *
17
 * @codeCoverageIgnore
18
 */
19
class ResponsesServiceProvider implements ServiceProviderInterface {
20
	/**
21
	 * {@inheritDoc}
22
	 */
23
	public function register( $container ) {
24
		$container[ WPEMERGE_RESPONSE_SERVICE_KEY ] = function ( $c ) {
25
			return new ResponseService( $c[ WPEMERGE_REQUEST_KEY ], $c[ WPEMERGE_VIEW_SERVICE_KEY ] );
26
		};
27
28
		$app = $container[ WPEMERGE_APPLICATION_KEY ];
29
		$app->alias( 'responses', WPEMERGE_RESPONSE_SERVICE_KEY );
30
31
		$app->alias( 'response', function () use ( $app ) {
32
			return call_user_func_array( [$app->responses(), 'response'], func_get_args() );
0 ignored issues
show
The function call_user_func_array was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

32
			return /** @scrutinizer ignore-call */ call_user_func_array( [$app->responses(), 'response'], func_get_args() );
Loading history...
33
		} );
34
35
		$app->alias( 'output', function () use ( $app ) {
36
			return call_user_func_array( [$app->responses(), 'output'], func_get_args() );
0 ignored issues
show
The function call_user_func_array was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

36
			return /** @scrutinizer ignore-call */ call_user_func_array( [$app->responses(), 'output'], func_get_args() );
Loading history...
37
		} );
38
39
		$app->alias( 'json', function () use ( $app ) {
40
			return call_user_func_array( [$app->responses(), 'json'], func_get_args() );
0 ignored issues
show
The function call_user_func_array was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

40
			return /** @scrutinizer ignore-call */ call_user_func_array( [$app->responses(), 'json'], func_get_args() );
Loading history...
41
		} );
42
43
		$app->alias( 'redirect', function () use ( $app ) {
44
			return call_user_func_array( [$app->responses(), 'redirect'], func_get_args() );
0 ignored issues
show
The function call_user_func_array was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

44
			return /** @scrutinizer ignore-call */ call_user_func_array( [$app->responses(), 'redirect'], func_get_args() );
Loading history...
45
		} );
46
47
		$app->alias( 'error', function () use ( $app ) {
48
			return call_user_func_array( [$app->responses(), 'error'], func_get_args() );
0 ignored issues
show
The function call_user_func_array was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

48
			return /** @scrutinizer ignore-call */ call_user_func_array( [$app->responses(), 'error'], func_get_args() );
Loading history...
49
		} );
50
	}
51
52
	/**
53
	 * {@inheritDoc}
54
	 */
55
	public function bootstrap( $container ) {
56
		// Nothing to bootstrap.
57
	}
58
}
59