Completed
Push — master ( 39c49c...e3f5df )
by James
06:01 queued 03:51
created
src/Contract/Core/HasActions.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -2,13 +2,13 @@
 block discarded – undo
2 2
 namespace Intraxia\Jaxion\Contract\Core;
3 3
 
4 4
 interface HasActions {
5
-	/**
6
-	 * Provides the array of actions the class wants to register with WordPress.
7
-	 *
8
-	 * These actions are retrieved by the Loader class and used to register the
9
-	 * correct service methods with WordPress.
10
-	 *
11
-	 * @return array[]
12
-	 */
13
-	public function action_hooks();
5
+    /**
6
+     * Provides the array of actions the class wants to register with WordPress.
7
+     *
8
+     * These actions are retrieved by the Loader class and used to register the
9
+     * correct service methods with WordPress.
10
+     *
11
+     * @return array[]
12
+     */
13
+    public function action_hooks();
14 14
 }
15 15
\ No newline at end of file
Please login to merge, or discard this patch.
src/Contract/Assets/Register.php 2 patches
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -4,48 +4,48 @@
 block discarded – undo
4 4
 use Intraxia\Jaxion\Contract\Core\HasActions;
5 5
 
6 6
 interface Register extends HasActions {
7
-	/**
8
-	 * Enable debug mode for the enqueued assets.
9
-	 *
10
-	 * Debug mode will enqueue unminified versions of the registered assets.
11
-	 * Primarily, this is intended to be used along with WordPress's `SCRIPT_DEBUG`
12
-	 * constant, which enables unminified core assets to be enqueued.
13
-	 *
14
-	 * @param bool $debug
15
-	 */
16
-	public function set_debug( $debug );
17
-
18
-	/**
19
-	 * Provides a method to register new scripts outside of the constructor.
20
-	 *
21
-	 * @param $script
22
-	 */
23
-	public function register_script( $script );
24
-
25
-	/**
26
-	 * Provides a method to register new styles outside of the constructor.
27
-	 *
28
-	 * @param $style
29
-	 */
30
-	public function register_style( $style );
31
-
32
-	/**
33
-	 * Enqueues the web & shared scripts on the Register.
34
-	 */
35
-	public function enqueue_web_scripts();
36
-
37
-	/**
38
-	 * Enqueues the web & shared styles on the Register.
39
-	 */
40
-	public function enqueue_web_styles();
41
-
42
-	/**
43
-	 * Enqueues the admin & shared scripts on the Register.
44
-	 */
45
-	public function enqueue_admin_scripts();
46
-
47
-	/**
48
-	 * Enqueues the admin & shared styles on the Register.
49
-	 */
50
-	public function enqueue_admin_styles();
7
+    /**
8
+     * Enable debug mode for the enqueued assets.
9
+     *
10
+     * Debug mode will enqueue unminified versions of the registered assets.
11
+     * Primarily, this is intended to be used along with WordPress's `SCRIPT_DEBUG`
12
+     * constant, which enables unminified core assets to be enqueued.
13
+     *
14
+     * @param bool $debug
15
+     */
16
+    public function set_debug( $debug );
17
+
18
+    /**
19
+     * Provides a method to register new scripts outside of the constructor.
20
+     *
21
+     * @param $script
22
+     */
23
+    public function register_script( $script );
24
+
25
+    /**
26
+     * Provides a method to register new styles outside of the constructor.
27
+     *
28
+     * @param $style
29
+     */
30
+    public function register_style( $style );
31
+
32
+    /**
33
+     * Enqueues the web & shared scripts on the Register.
34
+     */
35
+    public function enqueue_web_scripts();
36
+
37
+    /**
38
+     * Enqueues the web & shared styles on the Register.
39
+     */
40
+    public function enqueue_web_styles();
41
+
42
+    /**
43
+     * Enqueues the admin & shared scripts on the Register.
44
+     */
45
+    public function enqueue_admin_scripts();
46
+
47
+    /**
48
+     * Enqueues the admin & shared styles on the Register.
49
+     */
50
+    public function enqueue_admin_styles();
51 51
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,21 +13,21 @@
 block discarded – undo
13 13
 	 *
14 14
 	 * @param bool $debug
15 15
 	 */
16
-	public function set_debug( $debug );
16
+	public function set_debug($debug);
17 17
 
18 18
 	/**
19 19
 	 * Provides a method to register new scripts outside of the constructor.
20 20
 	 *
21 21
 	 * @param $script
22 22
 	 */
23
-	public function register_script( $script );
23
+	public function register_script($script);
24 24
 
25 25
 	/**
26 26
 	 * Provides a method to register new styles outside of the constructor.
27 27
 	 *
28 28
 	 * @param $style
29 29
 	 */
30
-	public function register_style( $style );
30
+	public function register_style($style);
31 31
 
32 32
 	/**
33 33
 	 * Enqueues the web & shared scripts on the Register.
Please login to merge, or discard this patch.
src/Contract/Http/Filter.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@
 block discarded – undo
10 10
  * @subpackage Contract\Http
11 11
  */
12 12
 interface Filter {
13
-	/**
14
-	 * Generates argument rules.
15
-	 *
16
-	 * Returns an array matching the WP-API format for argument rules,
17
-	 * including sanitization, validation, required, or defaults.
18
-	 *
19
-	 * @return array
20
-	 */
21
-	public function rules();
13
+    /**
14
+     * Generates argument rules.
15
+     *
16
+     * Returns an array matching the WP-API format for argument rules,
17
+     * including sanitization, validation, required, or defaults.
18
+     *
19
+     * @return array
20
+     */
21
+    public function rules();
22 22
 }
Please login to merge, or discard this patch.
src/Contract/Http/Guard.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@
 block discarded – undo
10 10
  * @subpackage Contract\Http
11 11
  */
12 12
 interface Guard {
13
-	/**
14
-	 * Validates when the user is authorized for the route.
15
-	 *
16
-	 * Returns a boolean based on whether the current user is authorized
17
-	 * to interact with the given route.
18
-	 *
19
-	 * @return bool
20
-	 */
21
-	public function authorized();
13
+    /**
14
+     * Validates when the user is authorized for the route.
15
+     *
16
+     * Returns a boolean based on whether the current user is authorized
17
+     * to interact with the given route.
18
+     *
19
+     * @return bool
20
+     */
21
+    public function authorized();
22 22
 }
Please login to merge, or discard this patch.
src/Assets/Register.php 2 patches
Indentation   +194 added lines, -194 removed lines patch added patch discarded remove patch
@@ -12,198 +12,198 @@
 block discarded – undo
12 12
  * @subpackage Register
13 13
  */
14 14
 class Register implements RegisterContract {
15
-	/**
16
-	 * Minification string for enqueued assets.
17
-	 *
18
-	 * @var string
19
-	 */
20
-	private $min = '';
21
-
22
-	/**
23
-	 * Url to the plugin directory.
24
-	 *
25
-	 * @var string
26
-	 */
27
-	protected $url;
28
-
29
-	/**
30
-	 * Script/plugin version.
31
-	 *
32
-	 * @var string
33
-	 */
34
-	protected $version;
35
-
36
-	/**
37
-	 * Array of script definition arrays.
38
-	 *
39
-	 * @var array
40
-	 */
41
-	private $scripts = array();
42
-
43
-	/**
44
-	 * Array of style definition arrays.
45
-	 *
46
-	 * @var array
47
-	 */
48
-	private $styles = array();
49
-
50
-	/**
51
-	 * Instantiates a new instance of the Register class.
52
-	 *
53
-	 * The URL param should be relative to the plugin directory. The URL
54
-	 * form should always end with a '/'. All asset location definitions
55
-	 * should not begin with a slash and should be relative to the plugin's
56
-	 * root directory. The URL provided by default from the Application
57
-	 * class is compatible.
58
-	 *
59
-	 * @param string $url
60
-	 * @param string $version
61
-	 */
62
-	public function __construct( $url, $version = null ) {
63
-		$this->url = $url;
64
-		$this->version = $version;
65
-	}
66
-
67
-	/**
68
-	 * {@inheritdoc}
69
-	 *
70
-	 * @param bool $debug
71
-	 */
72
-	public function set_debug( $debug ) {
73
-		if ( $debug ) {
74
-			$this->min = '.min';
75
-		} else {
76
-			$this->min = '';
77
-		}
78
-	}
79
-
80
-	/**
81
-	 * {@inheritdoc}
82
-	 *
83
-	 * @param array $script
84
-	 */
85
-	public function register_script( $script ) {
86
-		$this->scripts[] = $script;
87
-	}
88
-
89
-	/**
90
-	 * {@inheritdoc}
91
-	 *
92
-	 * @param array $style
93
-	 */
94
-	public function register_style( $style ) {
95
-		$this->styles[] = $style;
96
-	}
97
-
98
-	/**
99
-	 * {@inheritDoc}
100
-	 */
101
-	public function enqueue_web_scripts() {
102
-		foreach ( $this->scripts as $script ) {
103
-			if ( in_array( $script['type'], array( 'web', 'shared' ) ) ) {
104
-				$this->enqueue_script( $script );
105
-			}
106
-		}
107
-	}
108
-
109
-	/**
110
-	 * {@inheritDoc}
111
-	 */
112
-	public function enqueue_web_styles() {
113
-		foreach ( $this->styles as $style ) {
114
-			if ( in_array( $style['type'], array( 'web', 'shared' ) ) ) {
115
-				$this->enqueue_style( $style );
116
-			}
117
-		}
118
-	}
119
-
120
-	/**
121
-	 * {@inheritDoc}
122
-	 */
123
-	public function enqueue_admin_scripts() {
124
-		foreach ( $this->scripts as $script ) {
125
-			if ( in_array( $script['type'], array( 'admin', 'shared' ) ) ) {
126
-				$this->enqueue_script( $script );
127
-			}
128
-		}
129
-	}
130
-
131
-	/**
132
-	 * {@inheritDoc}
133
-	 */
134
-	public function enqueue_admin_styles() {
135
-		foreach ( $this->styles as $style ) {
136
-			if ( in_array( $style['type'], array( 'admin', 'shared' ) ) ) {
137
-				$this->enqueue_style( $style );
138
-			}
139
-		}
140
-	}
141
-
142
-	/**
143
-	 * {@inheritDoc}
144
-	 *
145
-	 * @return array[]
146
-	 */
147
-	public function action_hooks() {
148
-		return array(
149
-			array(
150
-				'hook'   => 'wp_enqueue_scripts',
151
-				'method' => 'enqueue_web_scripts',
152
-			),
153
-			array(
154
-				'hook'   => 'wp_enqueue_scripts',
155
-				'method' => 'enqueue_web_styles',
156
-			),
157
-			array(
158
-				'hook'   => 'admin_enqueue_scripts',
159
-				'method' => 'enqueue_admin_scripts',
160
-			),
161
-			array(
162
-				'hook'   => 'admin_enqueue_scripts',
163
-				'method' => 'enqueue_admin_styles',
164
-			),
165
-		);
166
-	}
167
-
168
-	/**
169
-	 * Enqueues an individual script if the style's condition is met.
170
-	 *
171
-	 * @param array $script
172
-	 */
173
-	protected function enqueue_script( $script ) {
174
-		if ( $script['condition']() ) {
175
-			wp_enqueue_script(
176
-				$script['handle'],
177
-				$this->url . $script['src'] . '.js',
178
-				isset( $script['deps'] ) ? $script['deps'] : array(),
179
-				$this->version,
180
-				isset( $script['footer'] ) ? $script['footer'] : false
181
-			);
182
-
183
-			if ( isset( $script['localize'] ) ) {
184
-				wp_localize_script(
185
-					$script['handle'],
186
-					$script['localize']['name'],
187
-					$script['localize']['data']
188
-				);
189
-			}
190
-		}
191
-	}
192
-
193
-	/**
194
-	 * Enqueues an individual stylesheet if the style's condition is met.
195
-	 *
196
-	 * @param array $style
197
-	 */
198
-	protected function enqueue_style( $style ) {
199
-		if ( $style['condition']() ) {
200
-			wp_enqueue_style(
201
-				$style['handle'],
202
-				$this->url . $style['src'] . '.css',
203
-				isset( $style['deps'] ) ? $style['deps'] : array(),
204
-				$this->version,
205
-				isset( $style['media'] ) ? $style['media'] : 'all'
206
-			);
207
-		}
208
-	}
15
+    /**
16
+     * Minification string for enqueued assets.
17
+     *
18
+     * @var string
19
+     */
20
+    private $min = '';
21
+
22
+    /**
23
+     * Url to the plugin directory.
24
+     *
25
+     * @var string
26
+     */
27
+    protected $url;
28
+
29
+    /**
30
+     * Script/plugin version.
31
+     *
32
+     * @var string
33
+     */
34
+    protected $version;
35
+
36
+    /**
37
+     * Array of script definition arrays.
38
+     *
39
+     * @var array
40
+     */
41
+    private $scripts = array();
42
+
43
+    /**
44
+     * Array of style definition arrays.
45
+     *
46
+     * @var array
47
+     */
48
+    private $styles = array();
49
+
50
+    /**
51
+     * Instantiates a new instance of the Register class.
52
+     *
53
+     * The URL param should be relative to the plugin directory. The URL
54
+     * form should always end with a '/'. All asset location definitions
55
+     * should not begin with a slash and should be relative to the plugin's
56
+     * root directory. The URL provided by default from the Application
57
+     * class is compatible.
58
+     *
59
+     * @param string $url
60
+     * @param string $version
61
+     */
62
+    public function __construct( $url, $version = null ) {
63
+        $this->url = $url;
64
+        $this->version = $version;
65
+    }
66
+
67
+    /**
68
+     * {@inheritdoc}
69
+     *
70
+     * @param bool $debug
71
+     */
72
+    public function set_debug( $debug ) {
73
+        if ( $debug ) {
74
+            $this->min = '.min';
75
+        } else {
76
+            $this->min = '';
77
+        }
78
+    }
79
+
80
+    /**
81
+     * {@inheritdoc}
82
+     *
83
+     * @param array $script
84
+     */
85
+    public function register_script( $script ) {
86
+        $this->scripts[] = $script;
87
+    }
88
+
89
+    /**
90
+     * {@inheritdoc}
91
+     *
92
+     * @param array $style
93
+     */
94
+    public function register_style( $style ) {
95
+        $this->styles[] = $style;
96
+    }
97
+
98
+    /**
99
+     * {@inheritDoc}
100
+     */
101
+    public function enqueue_web_scripts() {
102
+        foreach ( $this->scripts as $script ) {
103
+            if ( in_array( $script['type'], array( 'web', 'shared' ) ) ) {
104
+                $this->enqueue_script( $script );
105
+            }
106
+        }
107
+    }
108
+
109
+    /**
110
+     * {@inheritDoc}
111
+     */
112
+    public function enqueue_web_styles() {
113
+        foreach ( $this->styles as $style ) {
114
+            if ( in_array( $style['type'], array( 'web', 'shared' ) ) ) {
115
+                $this->enqueue_style( $style );
116
+            }
117
+        }
118
+    }
119
+
120
+    /**
121
+     * {@inheritDoc}
122
+     */
123
+    public function enqueue_admin_scripts() {
124
+        foreach ( $this->scripts as $script ) {
125
+            if ( in_array( $script['type'], array( 'admin', 'shared' ) ) ) {
126
+                $this->enqueue_script( $script );
127
+            }
128
+        }
129
+    }
130
+
131
+    /**
132
+     * {@inheritDoc}
133
+     */
134
+    public function enqueue_admin_styles() {
135
+        foreach ( $this->styles as $style ) {
136
+            if ( in_array( $style['type'], array( 'admin', 'shared' ) ) ) {
137
+                $this->enqueue_style( $style );
138
+            }
139
+        }
140
+    }
141
+
142
+    /**
143
+     * {@inheritDoc}
144
+     *
145
+     * @return array[]
146
+     */
147
+    public function action_hooks() {
148
+        return array(
149
+            array(
150
+                'hook'   => 'wp_enqueue_scripts',
151
+                'method' => 'enqueue_web_scripts',
152
+            ),
153
+            array(
154
+                'hook'   => 'wp_enqueue_scripts',
155
+                'method' => 'enqueue_web_styles',
156
+            ),
157
+            array(
158
+                'hook'   => 'admin_enqueue_scripts',
159
+                'method' => 'enqueue_admin_scripts',
160
+            ),
161
+            array(
162
+                'hook'   => 'admin_enqueue_scripts',
163
+                'method' => 'enqueue_admin_styles',
164
+            ),
165
+        );
166
+    }
167
+
168
+    /**
169
+     * Enqueues an individual script if the style's condition is met.
170
+     *
171
+     * @param array $script
172
+     */
173
+    protected function enqueue_script( $script ) {
174
+        if ( $script['condition']() ) {
175
+            wp_enqueue_script(
176
+                $script['handle'],
177
+                $this->url . $script['src'] . '.js',
178
+                isset( $script['deps'] ) ? $script['deps'] : array(),
179
+                $this->version,
180
+                isset( $script['footer'] ) ? $script['footer'] : false
181
+            );
182
+
183
+            if ( isset( $script['localize'] ) ) {
184
+                wp_localize_script(
185
+                    $script['handle'],
186
+                    $script['localize']['name'],
187
+                    $script['localize']['data']
188
+                );
189
+            }
190
+        }
191
+    }
192
+
193
+    /**
194
+     * Enqueues an individual stylesheet if the style's condition is met.
195
+     *
196
+     * @param array $style
197
+     */
198
+    protected function enqueue_style( $style ) {
199
+        if ( $style['condition']() ) {
200
+            wp_enqueue_style(
201
+                $style['handle'],
202
+                $this->url . $style['src'] . '.css',
203
+                isset( $style['deps'] ) ? $style['deps'] : array(),
204
+                $this->version,
205
+                isset( $style['media'] ) ? $style['media'] : 'all'
206
+            );
207
+        }
208
+    }
209 209
 }
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 * @param string $url
60 60
 	 * @param string $version
61 61
 	 */
62
-	public function __construct( $url, $version = null ) {
62
+	public function __construct($url, $version = null) {
63 63
 		$this->url = $url;
64 64
 		$this->version = $version;
65 65
 	}
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 	 *
70 70
 	 * @param bool $debug
71 71
 	 */
72
-	public function set_debug( $debug ) {
73
-		if ( $debug ) {
72
+	public function set_debug($debug) {
73
+		if ($debug) {
74 74
 			$this->min = '.min';
75 75
 		} else {
76 76
 			$this->min = '';
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 *
83 83
 	 * @param array $script
84 84
 	 */
85
-	public function register_script( $script ) {
85
+	public function register_script($script) {
86 86
 		$this->scripts[] = $script;
87 87
 	}
88 88
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 * @param array $style
93 93
 	 */
94
-	public function register_style( $style ) {
94
+	public function register_style($style) {
95 95
 		$this->styles[] = $style;
96 96
 	}
97 97
 
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 	 * {@inheritDoc}
100 100
 	 */
101 101
 	public function enqueue_web_scripts() {
102
-		foreach ( $this->scripts as $script ) {
103
-			if ( in_array( $script['type'], array( 'web', 'shared' ) ) ) {
104
-				$this->enqueue_script( $script );
102
+		foreach ($this->scripts as $script) {
103
+			if (in_array($script['type'], array('web', 'shared'))) {
104
+				$this->enqueue_script($script);
105 105
 			}
106 106
 		}
107 107
 	}
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
 	 * {@inheritDoc}
111 111
 	 */
112 112
 	public function enqueue_web_styles() {
113
-		foreach ( $this->styles as $style ) {
114
-			if ( in_array( $style['type'], array( 'web', 'shared' ) ) ) {
115
-				$this->enqueue_style( $style );
113
+		foreach ($this->styles as $style) {
114
+			if (in_array($style['type'], array('web', 'shared'))) {
115
+				$this->enqueue_style($style);
116 116
 			}
117 117
 		}
118 118
 	}
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 	 * {@inheritDoc}
122 122
 	 */
123 123
 	public function enqueue_admin_scripts() {
124
-		foreach ( $this->scripts as $script ) {
125
-			if ( in_array( $script['type'], array( 'admin', 'shared' ) ) ) {
126
-				$this->enqueue_script( $script );
124
+		foreach ($this->scripts as $script) {
125
+			if (in_array($script['type'], array('admin', 'shared'))) {
126
+				$this->enqueue_script($script);
127 127
 			}
128 128
 		}
129 129
 	}
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
 	 * {@inheritDoc}
133 133
 	 */
134 134
 	public function enqueue_admin_styles() {
135
-		foreach ( $this->styles as $style ) {
136
-			if ( in_array( $style['type'], array( 'admin', 'shared' ) ) ) {
137
-				$this->enqueue_style( $style );
135
+		foreach ($this->styles as $style) {
136
+			if (in_array($style['type'], array('admin', 'shared'))) {
137
+				$this->enqueue_style($style);
138 138
 			}
139 139
 		}
140 140
 	}
@@ -170,17 +170,17 @@  discard block
 block discarded – undo
170 170
 	 *
171 171
 	 * @param array $script
172 172
 	 */
173
-	protected function enqueue_script( $script ) {
174
-		if ( $script['condition']() ) {
173
+	protected function enqueue_script($script) {
174
+		if ($script['condition']()) {
175 175
 			wp_enqueue_script(
176 176
 				$script['handle'],
177 177
 				$this->url . $script['src'] . '.js',
178
-				isset( $script['deps'] ) ? $script['deps'] : array(),
178
+				isset($script['deps']) ? $script['deps'] : array(),
179 179
 				$this->version,
180
-				isset( $script['footer'] ) ? $script['footer'] : false
180
+				isset($script['footer']) ? $script['footer'] : false
181 181
 			);
182 182
 
183
-			if ( isset( $script['localize'] ) ) {
183
+			if (isset($script['localize'])) {
184 184
 				wp_localize_script(
185 185
 					$script['handle'],
186 186
 					$script['localize']['name'],
@@ -195,14 +195,14 @@  discard block
 block discarded – undo
195 195
 	 *
196 196
 	 * @param array $style
197 197
 	 */
198
-	protected function enqueue_style( $style ) {
199
-		if ( $style['condition']() ) {
198
+	protected function enqueue_style($style) {
199
+		if ($style['condition']()) {
200 200
 			wp_enqueue_style(
201 201
 				$style['handle'],
202 202
 				$this->url . $style['src'] . '.css',
203
-				isset( $style['deps'] ) ? $style['deps'] : array(),
203
+				isset($style['deps']) ? $style['deps'] : array(),
204 204
 				$this->version,
205
-				isset( $style['media'] ) ? $style['media'] : 'all'
205
+				isset($style['media']) ? $style['media'] : 'all'
206 206
 			);
207 207
 		}
208 208
 	}
Please login to merge, or discard this patch.
src/Assets/RegisterServiceProvider.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -5,29 +5,29 @@
 block discarded – undo
5 5
 use Intraxia\Jaxion\Contract\Core\ServiceProvider;
6 6
 
7 7
 class RegisterServiceProvider implements ServiceProvider {
8
-	/**
9
-	 * {@inheritDoc}
10
-	 */
11
-	public function register( Container $container ) {
12
-		$container->define(
13
-			array( 'register' => 'Intraxia\Jaxion\Contract\Assets\Register' ),
14
-			$register = new Register( $container->fetch( 'url' ), $container->fetch( 'version' ) )
15
-		);
8
+    /**
9
+     * {@inheritDoc}
10
+     */
11
+    public function register( Container $container ) {
12
+        $container->define(
13
+            array( 'register' => 'Intraxia\Jaxion\Contract\Assets\Register' ),
14
+            $register = new Register( $container->fetch( 'url' ), $container->fetch( 'version' ) )
15
+        );
16 16
 
17
-		$this->add_assets( $register );
18
-	}
17
+        $this->add_assets( $register );
18
+    }
19 19
 
20
-	/**
21
-	 * Registers the assets on the generated Register.
22
-	 *
23
-	 * This is a no-op by default by can be overwritten by the implementing developer
24
-	 * to provide a single, clean location to register their assets.
25
-	 *
26
-	 * @param Register $register
27
-	 *
28
-	 * @codeCoverageIgnore
29
-	 */
30
-	protected function add_assets( Register $register ) {
31
-		// no-op
32
-	}
20
+    /**
21
+     * Registers the assets on the generated Register.
22
+     *
23
+     * This is a no-op by default by can be overwritten by the implementing developer
24
+     * to provide a single, clean location to register their assets.
25
+     *
26
+     * @param Register $register
27
+     *
28
+     * @codeCoverageIgnore
29
+     */
30
+    protected function add_assets( Register $register ) {
31
+        // no-op
32
+    }
33 33
 }
34 34
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
 	/**
9 9
 	 * {@inheritDoc}
10 10
 	 */
11
-	public function register( Container $container ) {
11
+	public function register(Container $container) {
12 12
 		$container->define(
13
-			array( 'register' => 'Intraxia\Jaxion\Contract\Assets\Register' ),
14
-			$register = new Register( $container->fetch( 'url' ), $container->fetch( 'version' ) )
13
+			array('register' => 'Intraxia\Jaxion\Contract\Assets\Register'),
14
+			$register = new Register($container->fetch('url'), $container->fetch('version'))
15 15
 		);
16 16
 
17
-		$this->add_assets( $register );
17
+		$this->add_assets($register);
18 18
 	}
19 19
 
20 20
 	/**
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 *
28 28
 	 * @codeCoverageIgnore
29 29
 	 */
30
-	protected function add_assets( Register $register ) {
30
+	protected function add_assets(Register $register) {
31 31
 		// no-op
32 32
 	}
33 33
 }
34 34
\ No newline at end of file
Please login to merge, or discard this patch.
src/Utility/Str.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -11,39 +11,39 @@
 block discarded – undo
11 11
  * @subpackage Utility
12 12
  */
13 13
 class Str {
14
-	/**
15
-	 * Determine if a given string starts with a given substring.
16
-	 *
17
-	 * @param  string       $haystack
18
-	 * @param  string|array $needles
19
-	 *
20
-	 * @return bool
21
-	 */
22
-	public static function starts_with( $haystack, $needles ) {
23
-		foreach ( (array) $needles as $needle ) {
24
-			if ( $needle != '' && strpos( $haystack, $needle ) === 0 ) {
25
-				return true;
26
-			}
27
-		}
14
+    /**
15
+     * Determine if a given string starts with a given substring.
16
+     *
17
+     * @param  string       $haystack
18
+     * @param  string|array $needles
19
+     *
20
+     * @return bool
21
+     */
22
+    public static function starts_with( $haystack, $needles ) {
23
+        foreach ( (array) $needles as $needle ) {
24
+            if ( $needle != '' && strpos( $haystack, $needle ) === 0 ) {
25
+                return true;
26
+            }
27
+        }
28 28
 
29
-		return false;
30
-	}
29
+        return false;
30
+    }
31 31
 
32
-	/**
33
-	 * Determine if a given string ends with a given substring.
34
-	 *
35
-	 * @param  string       $haystack
36
-	 * @param  string|array $needles
37
-	 *
38
-	 * @return bool
39
-	 */
40
-	public static function ends_with( $haystack, $needles ) {
41
-		foreach ( (array) $needles as $needle ) {
42
-			if ( (string) $needle === substr( $haystack, - strlen( $needle ) ) ) {
43
-				return true;
44
-			}
45
-		}
32
+    /**
33
+     * Determine if a given string ends with a given substring.
34
+     *
35
+     * @param  string       $haystack
36
+     * @param  string|array $needles
37
+     *
38
+     * @return bool
39
+     */
40
+    public static function ends_with( $haystack, $needles ) {
41
+        foreach ( (array) $needles as $needle ) {
42
+            if ( (string) $needle === substr( $haystack, - strlen( $needle ) ) ) {
43
+                return true;
44
+            }
45
+        }
46 46
 
47
-		return false;
48
-	}
47
+        return false;
48
+    }
49 49
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 	 *
20 20
 	 * @return bool
21 21
 	 */
22
-	public static function starts_with( $haystack, $needles ) {
23
-		foreach ( (array) $needles as $needle ) {
24
-			if ( $needle != '' && strpos( $haystack, $needle ) === 0 ) {
22
+	public static function starts_with($haystack, $needles) {
23
+		foreach ((array) $needles as $needle) {
24
+			if ($needle != '' && strpos($haystack, $needle) === 0) {
25 25
 				return true;
26 26
 			}
27 27
 		}
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
 	 *
38 38
 	 * @return bool
39 39
 	 */
40
-	public static function ends_with( $haystack, $needles ) {
41
-		foreach ( (array) $needles as $needle ) {
42
-			if ( (string) $needle === substr( $haystack, - strlen( $needle ) ) ) {
40
+	public static function ends_with($haystack, $needles) {
41
+		foreach ((array) $needles as $needle) {
42
+			if ((string) $needle === substr($haystack, - strlen($needle))) {
43 43
 				return true;
44 44
 			}
45 45
 		}
Please login to merge, or discard this patch.
src/Http/Router.php 2 patches
Indentation   +198 added lines, -198 removed lines patch added patch discarded remove patch
@@ -21,202 +21,202 @@
 block discarded – undo
21 21
  * @method Endpoint all(string $route, callable $callback, array $options = array())
22 22
  */
23 23
 class Router implements HasActions {
24
-	/**
25
-	 * Resource's vendor prefix.
26
-	 *
27
-	 * @var string
28
-	 */
29
-	protected $vendor;
30
-
31
-	/**
32
-	 * Resource's version.
33
-	 *
34
-	 * @var int
35
-	 */
36
-	protected $version;
37
-
38
-	/**
39
-	 * Valid methods and their HTTP verb(s).
40
-	 *
41
-	 * @var array
42
-	 */
43
-	private $methods = array(
44
-		'get'      => 'GET',
45
-		'post'     => 'POST',
46
-		'put'      => 'PUT',
47
-		'patch'    => 'PATCH',
48
-		'delete'   => 'DELETE',
49
-		'editable' => 'POST, PUT, PATCH',
50
-		'all'      => 'GET, POST, PUT, PATCH, DELETE',
51
-	);
52
-
53
-	/**
54
-	 * Endpoints registered for the resource.
55
-	 *
56
-	 * @var Endpoint[]
57
-	 */
58
-	protected $endpoints = array();
59
-
60
-	/**
61
-	 * Returns all the resource endpoints.
62
-	 *
63
-	 * @return Endpoint[]
64
-	 */
65
-	public function get_endpoints() {
66
-		return $this->endpoints;
67
-	}
68
-
69
-	/**
70
-	 * Sets the resource's vendor prefix.
71
-	 *
72
-	 * @param string $vendor
73
-	 */
74
-	public function set_vendor( $vendor ) {
75
-		$this->vendor = $vendor;
76
-	}
77
-
78
-	/**
79
-	 * Sets the resource's version.
80
-	 *
81
-	 * @param int $version
82
-	 */
83
-	public function set_version( $version ) {
84
-		$this->version = $version;
85
-	}
86
-
87
-	/**
88
-	 * Registers all of the routes with the WP-API.
89
-	 *
90
-	 * Runs on the `rest_api_init` hook. Registers all of the routes loaded
91
-	 * on the router into the WordPress REST API.
92
-	 *
93
-	 * @throws VendorNotSetException
94
-	 * @throws VersionNotSetException
95
-	 */
96
-	public function register() {
97
-		if ( ! $this->vendor ) {
98
-			throw new VendorNotSetException;
99
-		}
100
-
101
-		if ( ! $this->version ) {
102
-			throw new VersionNotSetException;
103
-		}
104
-
105
-		foreach ( $this->endpoints as $endpoint ) {
106
-			register_rest_route(
107
-				$this->get_namespace(),
108
-				$endpoint->get_route(),
109
-				$endpoint->get_options()
110
-			);
111
-		}
112
-	}
113
-
114
-	/**
115
-	 * Registers a set of routes with a shared set of options.
116
-	 *
117
-	 * Allows you to group routes together with shared set of options, including
118
-	 * a route prefix, shared guards, and common parameter validation or sanitization.
119
-	 *
120
-	 * @param array    $options
121
-	 * @param callable $callback
122
-	 */
123
-	public function group( array $options, $callback ) {
124
-		$router = new static;
125
-
126
-		call_user_func( $callback, $router );
127
-
128
-		foreach ( $router->get_endpoints() as $endpoint ) {
129
-			$this->endpoints[] = $this->set_options( $endpoint, $options );
130
-		}
131
-	}
132
-
133
-	/**
134
-	 * Magic __call method.
135
-	 *
136
-	 * All of the endpoints registration method calls pass through here. This validates whether the method
137
-	 * is a valid endpoint type to register, and creates a new endpoint with the passed options.
138
-	 *
139
-	 * @param string $name
140
-	 * @param array  $arguments
141
-	 *
142
-	 * @return Endpoint
143
-	 *
144
-	 * @throws UnknownMethodException
145
-	 * @throws MissingArgumentException
146
-	 * @throws InvalidArgumentException
147
-	 */
148
-	public function __call( $name, $arguments ) {
149
-		if ( ! in_array( $name, array_keys( $this->methods ) ) ) {
150
-			throw new UnknownMethodException;
151
-		}
152
-
153
-		// array_merge ensures we have 3 elements
154
-		list( $route, $callback, $options ) = array_merge( $arguments, array( null, null, null ) );
155
-
156
-		if ( ! $route || ! $callback ) {
157
-			throw new MissingArgumentException;
158
-		}
159
-
160
-		if ( ! is_callable( $callback ) ) {
161
-			throw new InvalidArgumentException;
162
-		}
163
-
164
-		$endpoint = new Endpoint( $route, $this->methods[ $name ], $callback );
165
-
166
-		if ( $options && is_array( $options ) ) {
167
-			$endpoint = $this->set_options( $endpoint, $options );
168
-		}
169
-
170
-		return $this->endpoints[] = $endpoint;
171
-	}
172
-
173
-	/**
174
-	 * Sets the passed options on the endpoint.
175
-	 *
176
-	 * Only sets endpoints matching setters in the Endpoint class.
177
-	 *
178
-	 * @param Endpoint $endpoint
179
-	 * @param array    $options
180
-	 *
181
-	 * @return Endpoint
182
-	 * @throws MalformedRouteException
183
-	 */
184
-	protected function set_options( Endpoint $endpoint, array $options ) {
185
-		if ( isset( $options['guard'] ) ) {
186
-			$endpoint->set_guard( $options['guard'] );
187
-		}
188
-
189
-		if ( isset( $options['filter'] ) ) {
190
-			$endpoint->set_filter( $options['filter'] );
191
-		}
192
-
193
-		if ( isset( $options['prefix'] ) ) {
194
-			$endpoint->set_prefix( $options['prefix'] );
195
-		}
196
-
197
-		return $endpoint;
198
-	}
199
-
200
-	/**
201
-	 * Generates the resource's namespace.
202
-	 *
203
-	 * @return string
204
-	 */
205
-	protected function get_namespace() {
206
-		return $this->vendor . '/v' . $this->version;
207
-	}
208
-
209
-	/**
210
-	 * {@inheritDoc}
211
-	 *
212
-	 * @return array[]
213
-	 */
214
-	public function action_hooks() {
215
-		return array(
216
-			array(
217
-				'method' => 'register',
218
-				'hook'   => 'rest_api_init',
219
-			),
220
-		);
221
-	}
24
+    /**
25
+     * Resource's vendor prefix.
26
+     *
27
+     * @var string
28
+     */
29
+    protected $vendor;
30
+
31
+    /**
32
+     * Resource's version.
33
+     *
34
+     * @var int
35
+     */
36
+    protected $version;
37
+
38
+    /**
39
+     * Valid methods and their HTTP verb(s).
40
+     *
41
+     * @var array
42
+     */
43
+    private $methods = array(
44
+        'get'      => 'GET',
45
+        'post'     => 'POST',
46
+        'put'      => 'PUT',
47
+        'patch'    => 'PATCH',
48
+        'delete'   => 'DELETE',
49
+        'editable' => 'POST, PUT, PATCH',
50
+        'all'      => 'GET, POST, PUT, PATCH, DELETE',
51
+    );
52
+
53
+    /**
54
+     * Endpoints registered for the resource.
55
+     *
56
+     * @var Endpoint[]
57
+     */
58
+    protected $endpoints = array();
59
+
60
+    /**
61
+     * Returns all the resource endpoints.
62
+     *
63
+     * @return Endpoint[]
64
+     */
65
+    public function get_endpoints() {
66
+        return $this->endpoints;
67
+    }
68
+
69
+    /**
70
+     * Sets the resource's vendor prefix.
71
+     *
72
+     * @param string $vendor
73
+     */
74
+    public function set_vendor( $vendor ) {
75
+        $this->vendor = $vendor;
76
+    }
77
+
78
+    /**
79
+     * Sets the resource's version.
80
+     *
81
+     * @param int $version
82
+     */
83
+    public function set_version( $version ) {
84
+        $this->version = $version;
85
+    }
86
+
87
+    /**
88
+     * Registers all of the routes with the WP-API.
89
+     *
90
+     * Runs on the `rest_api_init` hook. Registers all of the routes loaded
91
+     * on the router into the WordPress REST API.
92
+     *
93
+     * @throws VendorNotSetException
94
+     * @throws VersionNotSetException
95
+     */
96
+    public function register() {
97
+        if ( ! $this->vendor ) {
98
+            throw new VendorNotSetException;
99
+        }
100
+
101
+        if ( ! $this->version ) {
102
+            throw new VersionNotSetException;
103
+        }
104
+
105
+        foreach ( $this->endpoints as $endpoint ) {
106
+            register_rest_route(
107
+                $this->get_namespace(),
108
+                $endpoint->get_route(),
109
+                $endpoint->get_options()
110
+            );
111
+        }
112
+    }
113
+
114
+    /**
115
+     * Registers a set of routes with a shared set of options.
116
+     *
117
+     * Allows you to group routes together with shared set of options, including
118
+     * a route prefix, shared guards, and common parameter validation or sanitization.
119
+     *
120
+     * @param array    $options
121
+     * @param callable $callback
122
+     */
123
+    public function group( array $options, $callback ) {
124
+        $router = new static;
125
+
126
+        call_user_func( $callback, $router );
127
+
128
+        foreach ( $router->get_endpoints() as $endpoint ) {
129
+            $this->endpoints[] = $this->set_options( $endpoint, $options );
130
+        }
131
+    }
132
+
133
+    /**
134
+     * Magic __call method.
135
+     *
136
+     * All of the endpoints registration method calls pass through here. This validates whether the method
137
+     * is a valid endpoint type to register, and creates a new endpoint with the passed options.
138
+     *
139
+     * @param string $name
140
+     * @param array  $arguments
141
+     *
142
+     * @return Endpoint
143
+     *
144
+     * @throws UnknownMethodException
145
+     * @throws MissingArgumentException
146
+     * @throws InvalidArgumentException
147
+     */
148
+    public function __call( $name, $arguments ) {
149
+        if ( ! in_array( $name, array_keys( $this->methods ) ) ) {
150
+            throw new UnknownMethodException;
151
+        }
152
+
153
+        // array_merge ensures we have 3 elements
154
+        list( $route, $callback, $options ) = array_merge( $arguments, array( null, null, null ) );
155
+
156
+        if ( ! $route || ! $callback ) {
157
+            throw new MissingArgumentException;
158
+        }
159
+
160
+        if ( ! is_callable( $callback ) ) {
161
+            throw new InvalidArgumentException;
162
+        }
163
+
164
+        $endpoint = new Endpoint( $route, $this->methods[ $name ], $callback );
165
+
166
+        if ( $options && is_array( $options ) ) {
167
+            $endpoint = $this->set_options( $endpoint, $options );
168
+        }
169
+
170
+        return $this->endpoints[] = $endpoint;
171
+    }
172
+
173
+    /**
174
+     * Sets the passed options on the endpoint.
175
+     *
176
+     * Only sets endpoints matching setters in the Endpoint class.
177
+     *
178
+     * @param Endpoint $endpoint
179
+     * @param array    $options
180
+     *
181
+     * @return Endpoint
182
+     * @throws MalformedRouteException
183
+     */
184
+    protected function set_options( Endpoint $endpoint, array $options ) {
185
+        if ( isset( $options['guard'] ) ) {
186
+            $endpoint->set_guard( $options['guard'] );
187
+        }
188
+
189
+        if ( isset( $options['filter'] ) ) {
190
+            $endpoint->set_filter( $options['filter'] );
191
+        }
192
+
193
+        if ( isset( $options['prefix'] ) ) {
194
+            $endpoint->set_prefix( $options['prefix'] );
195
+        }
196
+
197
+        return $endpoint;
198
+    }
199
+
200
+    /**
201
+     * Generates the resource's namespace.
202
+     *
203
+     * @return string
204
+     */
205
+    protected function get_namespace() {
206
+        return $this->vendor . '/v' . $this->version;
207
+    }
208
+
209
+    /**
210
+     * {@inheritDoc}
211
+     *
212
+     * @return array[]
213
+     */
214
+    public function action_hooks() {
215
+        return array(
216
+            array(
217
+                'method' => 'register',
218
+                'hook'   => 'rest_api_init',
219
+            ),
220
+        );
221
+    }
222 222
 }
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @param string $vendor
73 73
 	 */
74
-	public function set_vendor( $vendor ) {
74
+	public function set_vendor($vendor) {
75 75
 		$this->vendor = $vendor;
76 76
 	}
77 77
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @param int $version
82 82
 	 */
83
-	public function set_version( $version ) {
83
+	public function set_version($version) {
84 84
 		$this->version = $version;
85 85
 	}
86 86
 
@@ -94,15 +94,15 @@  discard block
 block discarded – undo
94 94
 	 * @throws VersionNotSetException
95 95
 	 */
96 96
 	public function register() {
97
-		if ( ! $this->vendor ) {
97
+		if (!$this->vendor) {
98 98
 			throw new VendorNotSetException;
99 99
 		}
100 100
 
101
-		if ( ! $this->version ) {
101
+		if (!$this->version) {
102 102
 			throw new VersionNotSetException;
103 103
 		}
104 104
 
105
-		foreach ( $this->endpoints as $endpoint ) {
105
+		foreach ($this->endpoints as $endpoint) {
106 106
 			register_rest_route(
107 107
 				$this->get_namespace(),
108 108
 				$endpoint->get_route(),
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
 	 * @param array    $options
121 121
 	 * @param callable $callback
122 122
 	 */
123
-	public function group( array $options, $callback ) {
123
+	public function group(array $options, $callback) {
124 124
 		$router = new static;
125 125
 
126
-		call_user_func( $callback, $router );
126
+		call_user_func($callback, $router);
127 127
 
128
-		foreach ( $router->get_endpoints() as $endpoint ) {
129
-			$this->endpoints[] = $this->set_options( $endpoint, $options );
128
+		foreach ($router->get_endpoints() as $endpoint) {
129
+			$this->endpoints[] = $this->set_options($endpoint, $options);
130 130
 		}
131 131
 	}
132 132
 
@@ -145,26 +145,26 @@  discard block
 block discarded – undo
145 145
 	 * @throws MissingArgumentException
146 146
 	 * @throws InvalidArgumentException
147 147
 	 */
148
-	public function __call( $name, $arguments ) {
149
-		if ( ! in_array( $name, array_keys( $this->methods ) ) ) {
148
+	public function __call($name, $arguments) {
149
+		if (!in_array($name, array_keys($this->methods))) {
150 150
 			throw new UnknownMethodException;
151 151
 		}
152 152
 
153 153
 		// array_merge ensures we have 3 elements
154
-		list( $route, $callback, $options ) = array_merge( $arguments, array( null, null, null ) );
154
+		list($route, $callback, $options) = array_merge($arguments, array(null, null, null));
155 155
 
156
-		if ( ! $route || ! $callback ) {
156
+		if (!$route || !$callback) {
157 157
 			throw new MissingArgumentException;
158 158
 		}
159 159
 
160
-		if ( ! is_callable( $callback ) ) {
160
+		if (!is_callable($callback)) {
161 161
 			throw new InvalidArgumentException;
162 162
 		}
163 163
 
164
-		$endpoint = new Endpoint( $route, $this->methods[ $name ], $callback );
164
+		$endpoint = new Endpoint($route, $this->methods[$name], $callback);
165 165
 
166
-		if ( $options && is_array( $options ) ) {
167
-			$endpoint = $this->set_options( $endpoint, $options );
166
+		if ($options && is_array($options)) {
167
+			$endpoint = $this->set_options($endpoint, $options);
168 168
 		}
169 169
 
170 170
 		return $this->endpoints[] = $endpoint;
@@ -181,17 +181,17 @@  discard block
 block discarded – undo
181 181
 	 * @return Endpoint
182 182
 	 * @throws MalformedRouteException
183 183
 	 */
184
-	protected function set_options( Endpoint $endpoint, array $options ) {
185
-		if ( isset( $options['guard'] ) ) {
186
-			$endpoint->set_guard( $options['guard'] );
184
+	protected function set_options(Endpoint $endpoint, array $options) {
185
+		if (isset($options['guard'])) {
186
+			$endpoint->set_guard($options['guard']);
187 187
 		}
188 188
 
189
-		if ( isset( $options['filter'] ) ) {
190
-			$endpoint->set_filter( $options['filter'] );
189
+		if (isset($options['filter'])) {
190
+			$endpoint->set_filter($options['filter']);
191 191
 		}
192 192
 
193
-		if ( isset( $options['prefix'] ) ) {
194
-			$endpoint->set_prefix( $options['prefix'] );
193
+		if (isset($options['prefix'])) {
194
+			$endpoint->set_prefix($options['prefix']);
195 195
 		}
196 196
 
197 197
 		return $endpoint;
Please login to merge, or discard this patch.
src/Http/Filter.php 2 patches
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -12,96 +12,96 @@
 block discarded – undo
12 12
  * @subpackage Http
13 13
  */
14 14
 class Filter implements FilterContract {
15
-	/**
16
-	 * Filter rules.
17
-	 *
18
-	 * @var array
19
-	 */
20
-	protected $rules;
15
+    /**
16
+     * Filter rules.
17
+     *
18
+     * @var array
19
+     */
20
+    protected $rules;
21 21
 
22
-	/**
23
-	 * Instantiates a new filter with the provided rules array.
24
-	 *
25
-	 * @param array $rules
26
-	 */
27
-	public function __construct( $rules = array() ) {
28
-		$this->rules = $rules;
29
-	}
22
+    /**
23
+     * Instantiates a new filter with the provided rules array.
24
+     *
25
+     * @param array $rules
26
+     */
27
+    public function __construct( $rules = array() ) {
28
+        $this->rules = $rules;
29
+    }
30 30
 
31
-	/**
32
-	 * Generates argument rules.
33
-	 *
34
-	 * Returns an array matching the WP-API format for argument rules,
35
-	 * including sanitization, validation, required, or defaults.
36
-	 *
37
-	 * @return array
38
-	 */
39
-	public function rules() {
40
-		$args = array();
31
+    /**
32
+     * Generates argument rules.
33
+     *
34
+     * Returns an array matching the WP-API format for argument rules,
35
+     * including sanitization, validation, required, or defaults.
36
+     *
37
+     * @return array
38
+     */
39
+    public function rules() {
40
+        $args = array();
41 41
 
42
-		foreach ( $this->rules as $arg => $validation ) {
43
-			if ( ! $validation || ! is_string( $validation ) ) {
44
-				continue;
45
-			}
42
+        foreach ( $this->rules as $arg => $validation ) {
43
+            if ( ! $validation || ! is_string( $validation ) ) {
44
+                continue;
45
+            }
46 46
 
47
-			$args[ $arg ] = $this->parse_validation( $validation );
48
-		}
47
+            $args[ $arg ] = $this->parse_validation( $validation );
48
+        }
49 49
 
50
-		return $args;
51
-	}
50
+        return $args;
51
+    }
52 52
 
53
-	/**
54
-	 * Parses a validation string into a WP-API compatible rule.
55
-	 *
56
-	 * @param string $validation
57
-	 *
58
-	 * @return array
59
-	 */
60
-	protected function parse_validation( $validation ) {
61
-		$validation = explode( '|', $validation );
53
+    /**
54
+     * Parses a validation string into a WP-API compatible rule.
55
+     *
56
+     * @param string $validation
57
+     *
58
+     * @return array
59
+     */
60
+    protected function parse_validation( $validation ) {
61
+        $validation = explode( '|', $validation );
62 62
 
63
-		$rules = array();
63
+        $rules = array();
64 64
 
65
-		foreach ( $validation as $rule ) {
66
-			if ( 0 === strpos( $rule, 'default' ) ) {
67
-				$ruleArr = explode( ':', $rule );
65
+        foreach ( $validation as $rule ) {
66
+            if ( 0 === strpos( $rule, 'default' ) ) {
67
+                $ruleArr = explode( ':', $rule );
68 68
 
69
-				$rules['default'] = count( $ruleArr ) === 2 ? array_pop( $ruleArr ) : '';
70
-			}
69
+                $rules['default'] = count( $ruleArr ) === 2 ? array_pop( $ruleArr ) : '';
70
+            }
71 71
 
72
-			switch ( $rule ) {
73
-				case 'required':
74
-					$rules['required'] = true;
75
-					break;
76
-				case 'integer':
77
-					$rules['validate_callback'] = array( $this, 'validate_integer' );
78
-					$rules['sanitize_callback'] = array( $this, 'make_integer' );
79
-					break;
80
-			}
81
-		}
72
+            switch ( $rule ) {
73
+                case 'required':
74
+                    $rules['required'] = true;
75
+                    break;
76
+                case 'integer':
77
+                    $rules['validate_callback'] = array( $this, 'validate_integer' );
78
+                    $rules['sanitize_callback'] = array( $this, 'make_integer' );
79
+                    break;
80
+            }
81
+        }
82 82
 
83
-		return $rules;
84
-	}
83
+        return $rules;
84
+    }
85 85
 
86
-	/**
87
-	 * Validate that provided value is an integer.
88
-	 *
89
-	 * @param mixed $value
90
-	 *
91
-	 * @return bool
92
-	 */
93
-	public function validate_integer( $value ) {
94
-		return filter_var( $value, FILTER_VALIDATE_INT ) !== false;
95
-	}
86
+    /**
87
+     * Validate that provided value is an integer.
88
+     *
89
+     * @param mixed $value
90
+     *
91
+     * @return bool
92
+     */
93
+    public function validate_integer( $value ) {
94
+        return filter_var( $value, FILTER_VALIDATE_INT ) !== false;
95
+    }
96 96
 
97
-	/**
98
-	 * Casts a provided value to an integer.
99
-	 *
100
-	 * @param mixed $value
101
-	 *
102
-	 * @return int
103
-	 */
104
-	public function make_integer( $value ) {
105
-		return (int) $value;
106
-	}
97
+    /**
98
+     * Casts a provided value to an integer.
99
+     *
100
+     * @param mixed $value
101
+     *
102
+     * @return int
103
+     */
104
+    public function make_integer( $value ) {
105
+        return (int) $value;
106
+    }
107 107
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @param array $rules
26 26
 	 */
27
-	public function __construct( $rules = array() ) {
27
+	public function __construct($rules = array()) {
28 28
 		$this->rules = $rules;
29 29
 	}
30 30
 
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 	public function rules() {
40 40
 		$args = array();
41 41
 
42
-		foreach ( $this->rules as $arg => $validation ) {
43
-			if ( ! $validation || ! is_string( $validation ) ) {
42
+		foreach ($this->rules as $arg => $validation) {
43
+			if (!$validation || !is_string($validation)) {
44 44
 				continue;
45 45
 			}
46 46
 
47
-			$args[ $arg ] = $this->parse_validation( $validation );
47
+			$args[$arg] = $this->parse_validation($validation);
48 48
 		}
49 49
 
50 50
 		return $args;
@@ -57,25 +57,25 @@  discard block
 block discarded – undo
57 57
 	 *
58 58
 	 * @return array
59 59
 	 */
60
-	protected function parse_validation( $validation ) {
61
-		$validation = explode( '|', $validation );
60
+	protected function parse_validation($validation) {
61
+		$validation = explode('|', $validation);
62 62
 
63 63
 		$rules = array();
64 64
 
65
-		foreach ( $validation as $rule ) {
66
-			if ( 0 === strpos( $rule, 'default' ) ) {
67
-				$ruleArr = explode( ':', $rule );
65
+		foreach ($validation as $rule) {
66
+			if (0 === strpos($rule, 'default')) {
67
+				$ruleArr = explode(':', $rule);
68 68
 
69
-				$rules['default'] = count( $ruleArr ) === 2 ? array_pop( $ruleArr ) : '';
69
+				$rules['default'] = count($ruleArr) === 2 ? array_pop($ruleArr) : '';
70 70
 			}
71 71
 
72
-			switch ( $rule ) {
72
+			switch ($rule) {
73 73
 				case 'required':
74 74
 					$rules['required'] = true;
75 75
 					break;
76 76
 				case 'integer':
77
-					$rules['validate_callback'] = array( $this, 'validate_integer' );
78
-					$rules['sanitize_callback'] = array( $this, 'make_integer' );
77
+					$rules['validate_callback'] = array($this, 'validate_integer');
78
+					$rules['sanitize_callback'] = array($this, 'make_integer');
79 79
 					break;
80 80
 			}
81 81
 		}
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @return bool
92 92
 	 */
93
-	public function validate_integer( $value ) {
94
-		return filter_var( $value, FILTER_VALIDATE_INT ) !== false;
93
+	public function validate_integer($value) {
94
+		return filter_var($value, FILTER_VALIDATE_INT) !== false;
95 95
 	}
96 96
 
97 97
 	/**
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 *
102 102
 	 * @return int
103 103
 	 */
104
-	public function make_integer( $value ) {
104
+	public function make_integer($value) {
105 105
 		return (int) $value;
106 106
 	}
107 107
 }
Please login to merge, or discard this patch.