@@ -22,15 +22,15 @@ class WP_REST_Resolvable_Route implements ArrayAccess, IteratorAggregate, Counta
2222 * @since X.X.0
2323 * @var callable
2424 */
25- protected $ callable ;
25+ protected $ callable ;
2626
2727 /**
2828 * The resolved route definition.
2929 *
3030 * @since X.X.0
3131 * @var array|null
3232 */
33- protected $ resolved = null ;
33+ protected $ resolved = null ;
3434
3535 /**
3636 * Constructor.
@@ -39,11 +39,11 @@ class WP_REST_Resolvable_Route implements ArrayAccess, IteratorAggregate, Counta
3939 *
4040 * @param callable $closure The callable used to resolve the route. Returns a single route definition.
4141 */
42- public function __construct ( string $ namespace , string $ route , callable $ closure ) {
42+ public function __construct ( string $ namespace , string $ route , callable $ closure ) {
4343 $ this ->namespace = $ namespace ;
4444 $ this ->route = $ route ;
45- $ this ->callable = $ closure ;
46- }
45+ $ this ->callable = $ closure ;
46+ }
4747
4848 /**
4949 * Invokes the callable to resolve, if needed.
@@ -56,15 +56,15 @@ public function __construct( string $namespace, string $route, callable $closure
5656 *
5757 * @return array The resolved route definition.
5858 */
59- public function __invoke () {
60- if ( ! $ this ->resolved ) {
61- $ this ->resolved = call_user_func ( $ this ->callable );
59+ public function __invoke () {
60+ if ( ! $ this ->resolved ) {
61+ $ this ->resolved = call_user_func ( $ this ->callable );
6262
63- // Normalize the result.
63+ // Normalize the result.
6464 $ this ->resolved = normalize_rest_endpoint_options ( $ this ->namespace , $ this ->route , $ this ->resolved );
65- }
66- return $ this ->resolved ;
67- }
65+ }
66+ return $ this ->resolved ;
67+ }
6868
6969 /**
7070 * Checks a single array key exists in the resolved route definition.
@@ -75,10 +75,10 @@ public function __invoke() {
7575 * @return bool True if the key exists, false otherwise.
7676 */
7777 #[ReturnTypeWillChange]
78- public function offsetExists ( mixed $ k ) {
79- $ this ->__invoke ();
80- return isset ( $ this ->resolved [ $ k ] );
81- }
78+ public function offsetExists ( mixed $ k ) {
79+ $ this ->__invoke ();
80+ return isset ( $ this ->resolved [ $ k ] );
81+ }
8282
8383 /**
8484 * Gets a single array key from the resolved route definition.
@@ -89,10 +89,10 @@ public function offsetExists( mixed $k ) {
8989 * @return mixed The value of the key, or null if not set. Returns by reference, so it can be modified if needed.
9090 */
9191 #[ReturnTypeWillChange]
92- public function &offsetGet ( mixed $ k ) {
93- $ this ->__invoke ();
94- return $ this ->resolved [ $ k ];
95- }
92+ public function &offsetGet ( mixed $ k ) {
93+ $ this ->__invoke ();
94+ return $ this ->resolved [ $ k ];
95+ }
9696
9797 /**
9898 * Sets a single array key in the resolved route definition.
@@ -103,10 +103,10 @@ public function &offsetGet( mixed $k ) {
103103 * @param mixed $value The value to set.
104104 */
105105 #[ReturnTypeWillChange]
106- public function offsetSet ( mixed $ k , mixed $ v ) {
107- $ this ->__invoke ();
108- $ this ->resolved [ $ k ] = $ v ;
109- }
106+ public function offsetSet ( mixed $ k , mixed $ v ) {
107+ $ this ->__invoke ();
108+ $ this ->resolved [ $ k ] = $ v ;
109+ }
110110
111111 /**
112112 * Unsets a single array key in the resolved route definition.
@@ -116,10 +116,10 @@ public function offsetSet( mixed $k, mixed $v ) {
116116 * @param string $key The key to unset.
117117 */
118118 #[ReturnTypeWillChange]
119- public function offsetUnset ( mixed $ k ) {
120- $ this ->__invoke ();
121- unset( $ this ->resolved [ $ k ] );
122- }
119+ public function offsetUnset ( mixed $ k ) {
120+ $ this ->__invoke ();
121+ unset( $ this ->resolved [ $ k ] );
122+ }
123123
124124 /**
125125 * Gets an iterator for the resolved route definition.
@@ -128,20 +128,20 @@ public function offsetUnset( mixed $k ) {
128128 *
129129 * @return Traversable An iterator for the resolved route definition.
130130 */
131- public function getIterator (): Traversable {
132- $ this ->__invoke ();
133- return new ArrayIterator ( $ this ->resolved );
134- }
131+ public function getIterator (): Traversable {
132+ $ this ->__invoke ();
133+ return new ArrayIterator ( $ this ->resolved );
134+ }
135135
136- /**
136+ /**
137137 * Counts the number of elements in the resolved route definition.
138138 *
139139 * @since X.X.0
140140 *
141141 * @return int The number of elements in the resolved route definition.
142142 */
143- public function count () : int {
144- $ this ->__invoke ();
145- return count ( $ this ->resolved );
146- }
143+ public function count () : int {
144+ $ this ->__invoke ();
145+ return count ( $ this ->resolved );
146+ }
147147}
0 commit comments