Passed
Push — master ( d87c6c...60d5d8 )
by Glynn
06:35 queued 04:41
created
src/Route_Collection.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
 class Route_Collection extends Collection {
20 20
 
21
-	protected const ALLOWED_ROUTE_TYPES = array( Route::class, Route_Group::class );
21
+	protected const ALLOWED_ROUTE_TYPES = array(Route::class, Route_Group::class);
22 22
 
23 23
 	/**
24 24
 	 * Overwrite this method in any extended classes, to modify the inital data.
@@ -26,12 +26,12 @@  discard block
 block discarded – undo
26 26
 	 * @param array<int|string, mixed> $data
27 27
 	 * @return array<int|string, mixed>
28 28
 	 */
29
-	protected function map_construct( array $data ): array {
29
+	protected function map_construct(array $data): array {
30 30
 		return array_filter(
31 31
 			$data,
32
-			function( $datum ): bool {
32
+			function($datum): bool {
33 33
 				return in_array(
34
-					get_class( $datum ),
34
+					get_class($datum),
35 35
 					self::ALLOWED_ROUTE_TYPES,
36 36
 					true
37 37
 				);
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 	 * @param Route|Route_Group $route
46 46
 	 * @return static
47 47
 	 */
48
-	public function add_route( $route ) {
49
-		$this->push( $route );
48
+	public function add_route($route) {
49
+		$this->push($route);
50 50
 		return $this;
51 51
 	}
52 52
 }
Please login to merge, or discard this patch.
src/Route/Abstract_Route.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 	 * @param Argument $argument
56 56
 	 * @return static
57 57
 	 */
58
-	public function argument( Argument $argument ) {
59
-		$this->arguments[ $argument->get_key() ] = $argument;
58
+	public function argument(Argument $argument) {
59
+		$this->arguments[$argument->get_key()] = $argument;
60 60
 		return $this;
61 61
 	}
62 62
 
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 	 * @param string $key
67 67
 	 * @return bool
68 68
 	 */
69
-	public function has_argument( string $key ): bool {
70
-		return \array_key_exists( $key, $this->arguments );
69
+	public function has_argument(string $key): bool {
70
+		return \array_key_exists($key, $this->arguments);
71 71
 	}
72 72
 
73 73
 	/**
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 * @param callable(\WP_REST_Request): bool $auth_callback
77 77
 	 * @return static
78 78
 	 */
79
-	public function authentication( callable $auth_callback ) {
79
+	public function authentication(callable $auth_callback) {
80 80
 		$this->authentication[] = $auth_callback;
81 81
 		return $this;
82 82
 	}
Please login to merge, or discard this patch.
src/Route/Route.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
 	protected $callback = null;
37 37
 
38 38
 
39
-	public function __construct( string $method, string $route ) {
39
+	public function __construct(string $method, string $route) {
40 40
 		$this->method = $method;
41
-		$this->route  = $this->format_route( $route );
41
+		$this->route  = $this->format_route($route);
42 42
 	}
43 43
 
44 44
 	/**
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
 	 * @param string $route
48 48
 	 * @return string
49 49
 	 */
50
-	protected function format_route( string $route ): string {
51
-		$route = $this->translate_arguments( $route );
52
-		return '/' . ltrim( $route, '/\\' );
50
+	protected function format_route(string $route): string {
51
+		$route = $this->translate_arguments($route);
52
+		return '/'.ltrim($route, '/\\');
53 53
 	}
54 54
 
55 55
 	/**
@@ -59,27 +59,27 @@  discard block
 block discarded – undo
59 59
 	 * @param string $route
60 60
 	 * @return string
61 61
 	 */
62
-	protected function translate_arguments( string $route ): string {
63
-		if ( preg_match( '/[^-:\/_{}()a-zA-Z\d]/', $route ) ) {
62
+	protected function translate_arguments(string $route): string {
63
+		if (preg_match('/[^-:\/_{}()a-zA-Z\d]/', $route)) {
64 64
 			return $route;
65 65
 		}
66 66
 
67 67
 		// Create capture group for ":parameter"
68 68
 		$allowed_chars = '[\@a-zA-Z0-9&.?:-_=#]*';
69 69
 		$route         = preg_replace(
70
-			'/:(' . $allowed_chars . ')/',
71
-			'(?<$1>' . $allowed_chars . ')',
70
+			'/:('.$allowed_chars.')/',
71
+			'(?<$1>'.$allowed_chars.')',
72 72
 			$route
73 73
 		);
74 74
 
75 75
 		// Create capture group for '{parameter}'
76 76
 		$route = preg_replace(
77
-			'/{(' . $allowed_chars . ')}/',
78
-			'(?<$1>' . $allowed_chars . ')',
79
-			is_string( $route ) ? $route : ''
77
+			'/{('.$allowed_chars.')}/',
78
+			'(?<$1>'.$allowed_chars.')',
79
+			is_string($route) ? $route : ''
80 80
 		);
81 81
 
82
-		return is_string( $route ) ? $route : '';
82
+		return is_string($route) ? $route : '';
83 83
 	}
84 84
 
85 85
 	/**
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 *
99 99
 	 * @return self
100 100
 	 */
101
-	public function callback( callable $callback ): self {
101
+	public function callback(callable $callback): self {
102 102
 		$this->callback = $callback;
103 103
 		return $this;
104 104
 	}
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 * @param string $namespace
128 128
 	 * @return static
129 129
 	 */
130
-	public function namespace( string $namespace ) {
130
+	public function namespace(string $namespace) {
131 131
 		$this->namespace = $namespace;
132 132
 		return $this;
133 133
 	}
@@ -138,27 +138,27 @@  discard block
 block discarded – undo
138 138
 	 * @param string $method
139 139
 	 * @return self
140 140
 	 */
141
-	public function with_method( string $method ): self {
142
-		$clone = new self( $method, $this->get_route() );
141
+	public function with_method(string $method): self {
142
+		$clone = new self($method, $this->get_route());
143 143
 		// Arguments
144
-		if ( ! empty( $this->arguments ) ) {
145
-			foreach ( $this->arguments as $argument ) {
146
-				$clone->argument( $argument );
144
+		if ( ! empty($this->arguments)) {
145
+			foreach ($this->arguments as $argument) {
146
+				$clone->argument($argument);
147 147
 			}
148 148
 		}
149 149
 		// Authentication
150
-		if ( ! empty( $this->authentication ) ) {
151
-			foreach ( $this->authentication as $authentication ) {
152
-				$clone->authentication( $authentication );
150
+		if ( ! empty($this->authentication)) {
151
+			foreach ($this->authentication as $authentication) {
152
+				$clone->authentication($authentication);
153 153
 			}
154 154
 		}
155 155
 		// Callback
156
-		if ( ! empty( $this->callback ) ) {
157
-			$clone->callback( $this->callback );
156
+		if ( ! empty($this->callback)) {
157
+			$clone->callback($this->callback);
158 158
 		}
159 159
 		// Namespace
160
-		if ( ! empty( $this->namespace ) ) {
161
-			$clone->namespace( $this->namespace );
160
+		if ( ! empty($this->namespace)) {
161
+			$clone->namespace($this->namespace);
162 162
 		}
163 163
 
164 164
 		return $clone;
Please login to merge, or discard this patch.
src/Route_Exception.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
 	 * @return self
25 25
 	 * @code 101
26 26
 	 */
27
-	public static function namespace_not_defined( string $route ): self {
27
+	public static function namespace_not_defined(string $route): self {
28 28
 		return new self(
29
-			sprintf( 'Namespace not defined in %s', $route ),
29
+			sprintf('Namespace not defined in %s', $route),
30 30
 			101
31 31
 		);
32 32
 	}
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 * @return self
39 39
 	 * @code 102
40 40
 	 */
41
-	public static function callback_not_defined( Route $route ): self {
41
+	public static function callback_not_defined(Route $route): self {
42 42
 		// Set the namespace if exists.
43 43
 		$namespace = '' !== $route->get_namespace()
44 44
 				? $route->get_namespace()
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
 		return new self(
48 48
 			sprintf(
49 49
 				'Callback not defined for [%s] %s%s',
50
-				strtoupper( $route->get_method() ),
51
-				strtoupper( $namespace ),
52
-				strtoupper( $route->get_route() )
50
+				strtoupper($route->get_method()),
51
+				strtoupper($namespace),
52
+				strtoupper($route->get_route())
53 53
 			),
54 54
 			102
55 55
 		);
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
 	 * @param Route $route
62 62
 	 * @return self
63 63
 	 */
64
-	public static function invalid_http_method( Route $route ): self {
64
+	public static function invalid_http_method(Route $route): self {
65 65
 		return new self(
66 66
 			sprintf(
67 67
 				'%s is a none supported HTTP Mehtod.',
68
-				strtoupper( $route->get_method() )
68
+				strtoupper($route->get_method())
69 69
 			),
70 70
 			103
71 71
 		);
Please login to merge, or discard this patch.
src/Registration/WP_Rest_Registrar.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
 	 * @param \PinkCrab\Route\Route\Route $route
27 27
 	 * @return callable
28 28
 	 */
29
-	public function create_callback( Route $route ): callable {
30
-		return function() use ( $route ): void {
31
-			$model = $this->map_to_wp_rest( $route );
32
-			register_rest_route( $model->namespace, $model->route, $model->args );
29
+	public function create_callback(Route $route): callable {
30
+		return function() use ($route): void {
31
+			$model = $this->map_to_wp_rest($route);
32
+			register_rest_route($model->namespace, $model->route, $model->args);
33 33
 		};
34 34
 	}
35 35
 
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 	 * @param \PinkCrab\Route\Route\Route $route
40 40
 	 * @return WP_Rest_Route
41 41
 	 */
42
-	public function map_to_wp_rest( Route $route ): WP_Rest_Route {
42
+	public function map_to_wp_rest(Route $route): WP_Rest_Route {
43 43
 		$wp_rest            = new WP_Rest_Route();
44 44
 		$wp_rest->namespace = $route->get_namespace();
45 45
 		$wp_rest->route     = $route->get_route();
46
-		$wp_rest->args      = $this->parse_options( $route );
46
+		$wp_rest->args      = $this->parse_options($route);
47 47
 		return $wp_rest;
48 48
 	}
49 49
 
@@ -54,23 +54,23 @@  discard block
 block discarded – undo
54 54
 	 * @return array<mixed>
55 55
 	 * @throws Route_Exception
56 56
 	 */
57
-	protected function parse_options( Route $route ): array {
57
+	protected function parse_options(Route $route): array {
58 58
 
59 59
 		// If we have no callback defined for route, throw.
60
-		if ( is_null( $route->get_callback() ) ) {
61
-			throw Route_Exception::callback_not_defined( $route );
60
+		if (is_null($route->get_callback())) {
61
+			throw Route_Exception::callback_not_defined($route);
62 62
 		}
63 63
 
64 64
 		// If we have an invlaid method, throw
65
-		if ( ! $this->is_valid_method( $route->get_method() ) ) {
66
-			throw Route_Exception::invalid_http_method( $route );
65
+		if ( ! $this->is_valid_method($route->get_method())) {
66
+			throw Route_Exception::invalid_http_method($route);
67 67
 		}
68 68
 
69 69
 		$options                        = array();
70 70
 		$options['methods']             = $route->get_method();
71 71
 		$options['callback']            = $route->get_callback();
72
-		$options['permission_callback'] = $this->compose_permission_callback( $route );
73
-		$options['args']                = $this->parse_args( $route );
72
+		$options['permission_callback'] = $this->compose_permission_callback($route);
73
+		$options['args']                = $this->parse_args($route);
74 74
 
75 75
 		return $options;
76 76
 	}
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
 	 * @param Route $route
82 82
 	 * @return array<mixed>
83 83
 	 */
84
-	protected function parse_args( Route $route ): array {
84
+	protected function parse_args(Route $route): array {
85 85
 		return array_reduce(
86 86
 			$route->get_arguments(),
87
-			function( array $args, Argument $argument ) {
88
-				$args[ $argument->get_key() ] = Argument_Parser::as_single( $argument );
87
+			function(array $args, Argument $argument) {
88
+				$args[$argument->get_key()] = Argument_Parser::as_single($argument);
89 89
 				return $args;
90 90
 			},
91 91
 			array()
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 	 * @param string $method
99 99
 	 * @return boolean
100 100
 	 */
101
-	protected function is_valid_method( string $method ): bool {
101
+	protected function is_valid_method(string $method): bool {
102 102
 		return in_array(
103 103
 			$method,
104 104
 			apply_filters(
105 105
 				'pinkcrab/route/accepted_http_methods', // phpcs:ignore WordPress.NamingConventions.ValidHookName
106
-				array( Route::DELETE, Route::POST, Route::PUT, Route::PATCH, Route::GET )
106
+				array(Route::DELETE, Route::POST, Route::PUT, Route::PATCH, Route::GET)
107 107
 			),
108 108
 			true
109 109
 		);
@@ -115,20 +115,20 @@  discard block
 block discarded – undo
115 115
 	 * @param Route $route
116 116
 	 * @return callable
117 117
 	 */
118
-	protected function compose_permission_callback( Route $route ): callable {
118
+	protected function compose_permission_callback(Route $route): callable {
119 119
 		$callbacks = $route->get_authentication();
120 120
 
121 121
 		// If we have no callback defined, use return true.
122
-		if ( count( $callbacks ) === 0 ) {
122
+		if (count($callbacks) === 0) {
123 123
 			return '__return_true';
124 124
 		}
125 125
 
126 126
 		// If we only have 1, return as is.
127
-		if ( count( $callbacks ) === 1 ) {
128
-			return reset( $callbacks );
127
+		if (count($callbacks) === 1) {
128
+			return reset($callbacks);
129 129
 		}
130 130
 
131
-		return all( ...$callbacks );
131
+		return all(...$callbacks);
132 132
 	}
133 133
 
134 134
 
Please login to merge, or discard this patch.
src/Module/Route_Middleware.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 	protected Route_Manager $route_manager;
27 27
 
28
-	public function __construct( Route_Manager $route_manager ) {
28
+	public function __construct(Route_Manager $route_manager) {
29 29
 		$this->route_manager = $route_manager;
30 30
 	}
31 31
 
@@ -35,19 +35,19 @@  discard block
 block discarded – undo
35 35
 	 * @param object $class
36 36
 	 * @return object
37 37
 	 */
38
-	public function process( object $class ): object {
38
+	public function process(object $class): object {
39 39
 
40
-		if ( is_a( $class, Route_Controller::class ) ) {
41
-			$routes = $class->get_routes( new Route_Collection() );
40
+		if (is_a($class, Route_Controller::class)) {
41
+			$routes = $class->get_routes(new Route_Collection());
42 42
 			$routes->each(
43
-				function( Abstract_Route $route ) {
44
-					if ( is_a( $route, Route::class ) ) {
45
-						$this->route_manager->from_route( $route );
43
+				function(Abstract_Route $route) {
44
+					if (is_a($route, Route::class)) {
45
+						$this->route_manager->from_route($route);
46 46
 						return;
47 47
 					}
48 48
 
49
-					if ( is_a( $route, Route_Group::class ) ) {
50
-						$this->route_manager->from_group( $route );
49
+					if (is_a($route, Route_Group::class)) {
50
+						$this->route_manager->from_group($route);
51 51
 						return;
52 52
 					}
53 53
 				}
Please login to merge, or discard this patch.
src/Module/Route.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@
 block discarded – undo
32 32
 	## Unused methods
33 33
 
34 34
 	/** @inheritDoc */
35
-	public function pre_register( App_Config $config, Hook_Loader $loader, DI_Container $di_container ): void {} // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed
35
+	public function pre_register(App_Config $config, Hook_Loader $loader, DI_Container $di_container): void {} // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed
36 36
 
37 37
 	/** @inheritDoc */
38
-	public function post_register( App_Config $config, Hook_Loader $loader, DI_Container $di_container ): void {} // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed
38
+	public function post_register(App_Config $config, Hook_Loader $loader, DI_Container $di_container): void {} // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed
39 39
 
40 40
 	/** @inheritDoc */
41
-	public function pre_boot( App_Config $config, Hook_Loader $loader, DI_Container $di_container ): void {} // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed
41
+	public function pre_boot(App_Config $config, Hook_Loader $loader, DI_Container $di_container): void {} // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed
42 42
 }
Please login to merge, or discard this patch.
src/Route/Route_Group.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
 	protected Route_Factory $route_factory;
31 31
 	protected string $route;
32 32
 
33
-	public function __construct( string $namespace, string $route ) {
33
+	public function __construct(string $namespace, string $route) {
34 34
 		$this->route         = $route;
35 35
 		$this->namespace     = $namespace;
36
-		$this->route_factory = new Route_Factory( $namespace );
36
+		$this->route_factory = new Route_Factory($namespace);
37 37
 	}
38 38
 
39 39
 	/**
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
 	 * @param callable(\WP_REST_Request): (\WP_HTTP_Response|\WP_Error) $callable
52 52
 	 * @return Route
53 53
 	 */
54
-	public function get( callable $callable ): Route {
55
-		$route = $this->route_factory->get( $this->route, $callable );
56
-		$route->namespace( $this->namespace );
57
-		$this->routes[ Route::GET ] = $route;
54
+	public function get(callable $callable): Route {
55
+		$route = $this->route_factory->get($this->route, $callable);
56
+		$route->namespace($this->namespace);
57
+		$this->routes[Route::GET] = $route;
58 58
 		return $route;
59 59
 	}
60 60
 
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
 	 * @param callable(\WP_REST_Request): (\WP_HTTP_Response|\WP_Error) $callable
65 65
 	 * @return Route
66 66
 	 */
67
-	public function post( callable $callable ): Route {
68
-		$route = $this->route_factory->post( $this->route, $callable );
69
-		$route->namespace( $this->namespace );
70
-		$this->routes[ Route::POST ] = $route;
67
+	public function post(callable $callable): Route {
68
+		$route = $this->route_factory->post($this->route, $callable);
69
+		$route->namespace($this->namespace);
70
+		$this->routes[Route::POST] = $route;
71 71
 		return $route;
72 72
 	}
73 73
 
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
 	 * @param callable(\WP_REST_Request): (\WP_HTTP_Response|\WP_Error) $callable
78 78
 	 * @return Route
79 79
 	 */
80
-	public function put( callable $callable ): Route {
81
-		$route = $this->route_factory->put( $this->route, $callable );
82
-		$route->namespace( $this->namespace );
83
-		$this->routes[ Route::PUT ] = $route;
80
+	public function put(callable $callable): Route {
81
+		$route = $this->route_factory->put($this->route, $callable);
82
+		$route->namespace($this->namespace);
83
+		$this->routes[Route::PUT] = $route;
84 84
 		return $route;
85 85
 	}
86 86
 
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 	 * @param callable(\WP_REST_Request): (\WP_HTTP_Response|\WP_Error) $callable
91 91
 	 * @return Route
92 92
 	 */
93
-	public function patch( callable $callable ): Route {
94
-		$route = $this->route_factory->patch( $this->route, $callable );
95
-		$route->namespace( $this->namespace );
96
-		$this->routes[ Route::PATCH ] = $route;
93
+	public function patch(callable $callable): Route {
94
+		$route = $this->route_factory->patch($this->route, $callable);
95
+		$route->namespace($this->namespace);
96
+		$this->routes[Route::PATCH] = $route;
97 97
 		return $route;
98 98
 	}
99 99
 
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
 	 * @param callable(\WP_REST_Request): (\WP_HTTP_Response|\WP_Error) $callable
104 104
 	 * @return Route
105 105
 	 */
106
-	public function delete( callable $callable ): Route {
107
-		$route = $this->route_factory->delete( $this->route, $callable );
108
-		$route->namespace( $this->namespace );
109
-		$this->routes[ Route::DELETE ] = $route;
106
+	public function delete(callable $callable): Route {
107
+		$route = $this->route_factory->delete($this->route, $callable);
108
+		$route->namespace($this->namespace);
109
+		$this->routes[Route::DELETE] = $route;
110 110
 		return $route;
111 111
 	}
112 112
 
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 	 * @deprecated 0.0.2 This is not really used and should be removed in a future version.
118 118
 	 * @return self
119 119
 	 */
120
-	public function add_rest_route( Route $route ): self {
121
-		$this->routes[ $route->get_method() ] = $route;
120
+	public function add_rest_route(Route $route): self {
121
+		$this->routes[$route->get_method()] = $route;
122 122
 		return $this;
123 123
 	}
124 124
 
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
 	 * @param string $method
138 138
 	 * @return bool
139 139
 	 */
140
-	public function method_exists( string $method ): bool {
141
-		return array_key_exists( \strtoupper( $method ), $this->routes );
140
+	public function method_exists(string $method): bool {
141
+		return array_key_exists(\strtoupper($method), $this->routes);
142 142
 	}
143 143
 
144 144
 	/**
@@ -147,6 +147,6 @@  discard block
 block discarded – undo
147 147
 	 * @return bool
148 148
 	 */
149 149
 	public function has_routes(): bool {
150
-		return ! empty( $this->routes );
150
+		return ! empty($this->routes);
151 151
 	}
152 152
 }
Please login to merge, or discard this patch.
src/Route_Factory.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
 	protected string $namespace;
22 22
 
23
-	public function __construct( string $namespace ) {
23
+	public function __construct(string $namespace) {
24 24
 		$this->namespace = $namespace;
25 25
 	}
26 26
 
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 	 * @param string $namespace
31 31
 	 * @return Route_Factory
32 32
 	 */
33
-	public static function for( string $namespace ): Route_Factory {
34
-		return new self( $namespace );
33
+	public static function for (string $namespace): Route_Factory {
34
+		return new self($namespace);
35 35
 	}
36 36
 
37 37
 	/**
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 	 * @param callable(\WP_REST_Request): (\WP_HTTP_Response|\WP_Error) $callback
43 43
 	 * @return Route
44 44
 	 */
45
-	protected function request( string $method, string $route, callable $callback ): Route {
46
-		$route = new Route( $method, $route );
45
+	protected function request(string $method, string $route, callable $callback): Route {
46
+		$route = new Route($method, $route);
47 47
 		return $route
48
-			->callback( $callback )
49
-			->namespace( $this->namespace );
48
+			->callback($callback)
49
+			->namespace($this->namespace);
50 50
 	}
51 51
 
52 52
 	/**
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	 * @param callable(\WP_REST_Request): (\WP_HTTP_Response|\WP_Error) $callback
57 57
 	 * @return Route
58 58
 	 */
59
-	public function get( string $route, callable $callback ): Route {
60
-		return $this->request( Route::GET, $route, $callback );
59
+	public function get(string $route, callable $callback): Route {
60
+		return $this->request(Route::GET, $route, $callback);
61 61
 	}
62 62
 
63 63
 	/**
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
 	 * @param callable(\WP_REST_Request): (\WP_HTTP_Response|\WP_Error) $callback
68 68
 	 * @return Route
69 69
 	 */
70
-	public function post( string $route, callable $callback ): Route {
71
-		return $this->request( Route::POST, $route, $callback );
70
+	public function post(string $route, callable $callback): Route {
71
+		return $this->request(Route::POST, $route, $callback);
72 72
 	}
73 73
 
74 74
 	/**
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 	 * @param callable(\WP_REST_Request): (\WP_HTTP_Response|\WP_Error) $callback
79 79
 	 * @return Route
80 80
 	 */
81
-	public function put( string $route, callable $callback ): Route {
82
-		return $this->request( Route::PUT, $route, $callback );
81
+	public function put(string $route, callable $callback): Route {
82
+		return $this->request(Route::PUT, $route, $callback);
83 83
 	}
84 84
 
85 85
 	/**
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 	 * @param callable(\WP_REST_Request): (\WP_HTTP_Response|\WP_Error) $callback
90 90
 	 * @return Route
91 91
 	 */
92
-	public function patch( string $route, callable $callback ): Route {
93
-		return $this->request( Route::PATCH, $route, $callback );
92
+	public function patch(string $route, callable $callback): Route {
93
+		return $this->request(Route::PATCH, $route, $callback);
94 94
 	}
95 95
 
96 96
 	/**
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 	 * @param callable(\WP_REST_Request): (\WP_HTTP_Response|\WP_Error) $callback
101 101
 	 * @return Route
102 102
 	 */
103
-	public function delete( string $route, callable $callback ): Route {
104
-		return $this->request( Route::DELETE, $route, $callback );
103
+	public function delete(string $route, callable $callback): Route {
104
+		return $this->request(Route::DELETE, $route, $callback);
105 105
 	}
106 106
 
107 107
 	/**
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
 	 * @param ?callable(Route_Group): void $config
112 112
 	 * @return Route_Group
113 113
 	 */
114
-	public function group_builder( string $route, ?callable $config ): Route_Group {
115
-		$group = new Route_Group( $this->namespace, $route );
114
+	public function group_builder(string $route, ?callable $config): Route_Group {
115
+		$group = new Route_Group($this->namespace, $route);
116 116
 
117 117
 		// Apply the callback.
118
-		if ( ! is_null( $config ) ) {
119
-			$config( $group );
118
+		if ( ! is_null($config)) {
119
+			$config($group);
120 120
 		}
121 121
 
122 122
 		return $group;
Please login to merge, or discard this patch.