Completed
Push — master ( d41fc5...2d6fec )
by James
09:02
created
src/Assets/Register.php 1 patch
Spacing   +32 added lines, -32 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 ?: null; // Empty string should remain null.
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 = '';
75 75
 		} else {
76 76
 			$this->min = '.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
 	}
@@ -122,10 +122,10 @@  discard block
 block discarded – undo
122 122
 	 *
123 123
 	 * @param string $hook Passes a string representing the current page.
124 124
 	 */
125
-	public function enqueue_admin_scripts( $hook ) {
126
-		foreach ( $this->scripts as $script ) {
127
-			if ( in_array( $script['type'], array( 'admin', 'shared' ) ) ) {
128
-				$this->enqueue_script( $script, $hook );
125
+	public function enqueue_admin_scripts($hook) {
126
+		foreach ($this->scripts as $script) {
127
+			if (in_array($script['type'], array('admin', 'shared'))) {
128
+				$this->enqueue_script($script, $hook);
129 129
 			}
130 130
 		}
131 131
 	}
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
 	 *
136 136
 	 * @param string $hook Passes a string representing the current page.
137 137
 	 */
138
-	public function enqueue_admin_styles( $hook ) {
139
-		foreach ( $this->styles as $style ) {
140
-			if ( in_array( $style['type'], array( 'admin', 'shared' ) ) ) {
141
-				$this->enqueue_style( $style, $hook );
138
+	public function enqueue_admin_styles($hook) {
139
+		foreach ($this->styles as $style) {
140
+			if (in_array($style['type'], array('admin', 'shared'))) {
141
+				$this->enqueue_style($style, $hook);
142 142
 			}
143 143
 		}
144 144
 	}
@@ -175,19 +175,19 @@  discard block
 block discarded – undo
175 175
 	 * @param array  $script The script attachment callback.
176 176
 	 * @param string $hook   The location hook. Only passed on admin side.
177 177
 	 */
178
-	protected function enqueue_script( $script, $hook = null ) {
179
-		if ( $script['condition']( $hook ) ) {
178
+	protected function enqueue_script($script, $hook = null) {
179
+		if ($script['condition']($hook)) {
180 180
 			wp_enqueue_script(
181 181
 				$script['handle'],
182
-				$this->url . $script['src'] . $this->min . '.js',
183
-				isset( $script['deps'] ) ? $script['deps'] : array(),
182
+				$this->url.$script['src'].$this->min.'.js',
183
+				isset($script['deps']) ? $script['deps'] : array(),
184 184
 				$this->version,
185
-				isset( $script['footer'] ) ? $script['footer'] : false
185
+				isset($script['footer']) ? $script['footer'] : false
186 186
 			);
187 187
 
188
-			if ( isset( $script['localize'] ) ) {
189
-				if ( is_callable( $script['localize'] ) ) { // @todo make all properties callables
190
-					$script['localize'] = call_user_func( $script['localize'] );
188
+			if (isset($script['localize'])) {
189
+				if (is_callable($script['localize'])) { // @todo make all properties callables
190
+					$script['localize'] = call_user_func($script['localize']);
191 191
 				}
192 192
 
193 193
 				wp_localize_script(
@@ -205,14 +205,14 @@  discard block
 block discarded – undo
205 205
 	 * @param array  $style The style attachment callback.
206 206
 	 * @param string $hook  The location hook.
207 207
 	 */
208
-	protected function enqueue_style( $style, $hook = null ) {
209
-		if ( $style['condition']( $hook ) ) {
208
+	protected function enqueue_style($style, $hook = null) {
209
+		if ($style['condition']($hook)) {
210 210
 			wp_enqueue_style(
211 211
 				$style['handle'],
212
-				$this->url . $style['src'] . $this->min . '.css',
213
-				isset( $style['deps'] ) ? $style['deps'] : array(),
212
+				$this->url.$style['src'].$this->min.'.css',
213
+				isset($style['deps']) ? $style['deps'] : array(),
214 214
 				$this->version,
215
-				isset( $style['media'] ) ? $style['media'] : 'all'
215
+				isset($style['media']) ? $style['media'] : 'all'
216 216
 			);
217 217
 		}
218 218
 	}
Please login to merge, or discard this patch.