Passed
Push — master ( 054f95...d111a7 )
by Alain
04:18
created
src/Shortcode.php 1 patch
Braces   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
  * @package BrightNucleus\Shortcode
30 30
  * @author  Alain Schlesser <[email protected]>
31 31
  */
32
-class Shortcode implements ShortcodeInterface {
32
+class Shortcode implements ShortcodeInterface {
33 33
 
34 34
 	use ConfigTrait;
35 35
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 		ConfigInterface $config,
89 89
 		ShortcodeAttsParser $atts_parser,
90 90
 		DependencyManager $dependencies = null
91
-	) {
91
+	) {
92 92
 
93 93
 		Assert\that( $shortcode_tag )->string()->notEmpty();
94 94
 
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
 	 * @param mixed $context Optional. Arguments to pass on to the Registrable.
108 108
 	 * @return void
109 109
 	 */
110
-	public function register( $context = null ) {
111
-		if ( ! $this->is_needed( $context ) ) {
110
+	public function register( $context = null ) {
111
+		if ( ! $this->is_needed( $context ) ) {
112 112
 			return;
113 113
 		}
114 114
 		$this->context = $context;
@@ -124,13 +124,13 @@  discard block
 block discarded – undo
124 124
 	 * @param mixed $context Data about the context in which the call is made.
125 125
 	 * @return boolean Whether the shortcode is needed or not.
126 126
 	 */
127
-	protected function is_needed( $context = null ) {
127
+	protected function is_needed( $context = null ) {
128 128
 
129 129
 		$is_needed = $this->hasConfigKey( 'is_needed' )
130 130
 			? $this->getConfigKey( 'is_needed' )
131 131
 			: true;
132 132
 
133
-		if ( is_callable( $is_needed ) ) {
133
+		if ( is_callable( $is_needed ) ) {
134 134
 			return $is_needed( $context );
135 135
 		}
136 136
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 *
145 145
 	 * @return string Shortcode tag.
146 146
 	 */
147
-	public function get_tag() {
147
+	public function get_tag() {
148 148
 		return (string) $this->shortcode_tag;
149 149
 	}
150 150
 
@@ -163,16 +163,16 @@  discard block
 block discarded – undo
163 163
 	 *                              render.
164 164
 	 * @return string               The shortcode's HTML output.
165 165
 	 */
166
-	public function render( $atts, $content = null, $tag = null ) {
166
+	public function render( $atts, $content = null, $tag = null ) {
167 167
 		$context = $this->context;
168 168
 		$atts    = $this->atts_parser->parse_atts( $atts, $this->get_tag() );
169 169
 		$handles = $this->get_dependency_handles();
170 170
 
171
-		if ( $this->dependencies && count( $handles ) > 0 ) {
172
-			foreach ( $handles as $handle ) {
171
+		if ( $this->dependencies && count( $handles ) > 0 ) {
172
+			foreach ( $handles as $handle ) {
173 173
 				$handle_found = $this->dependencies->enqueue_handle( $handle,
174 174
 					$atts );
175
-				if ( ! $handle_found ) {
175
+				if ( ! $handle_found ) {
176 176
 					trigger_error( sprintf(
177 177
 							__( 'Could not enqueue dependency "%1$s" for shortcode "%2$s".',
178 178
 								'bn-shortcodes' ),
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 	 *
195 195
 	 * @return array Array of strings that are registered dependency handles.
196 196
 	 */
197
-	protected function get_dependency_handles() {
198
-		if ( ! $this->hasConfigKey( 'dependencies' ) ) {
197
+	protected function get_dependency_handles() {
198
+		if ( ! $this->hasConfigKey( 'dependencies' ) ) {
199 199
 			return [ ];
200 200
 		}
201 201
 		return (array) $this->getConfigKey( 'dependencies' );
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
 	 * @param mixed  $context The context to pass through to the view.
211 211
 	 * @return string HTML rendering of the view.
212 212
 	 */
213
-	protected function render_view( $view, $context ) {
214
-		if ( empty( $view ) ) {
213
+	protected function render_view( $view, $context ) {
214
+		if ( empty( $view ) ) {
215 215
 			return '';
216 216
 		}
217 217
 
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
 	 *
228 228
 	 * @return string Name of the view to render.
229 229
 	 */
230
-	protected function get_view() {
231
-		if ( ! $this->hasConfigKey( 'view' ) ) {
230
+	protected function get_view() {
231
+		if ( ! $this->hasConfigKey( 'view' ) ) {
232 232
 			return '';
233 233
 		}
234 234
 		$view = $this->getConfigKey( 'view' );
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	 * @param string|null $content Inner content to pass to the shortcode.
248 248
 	 * @return string|false Rendered HTML.
249 249
 	 */
250
-	public function do_this( array $atts = [ ], $content = null ) {
250
+	public function do_this( array $atts = [ ], $content = null ) {
251 251
 		\BrightNucleus\Shortcode\do_tag( $this->get_tag(), $atts, $content );
252 252
 	}
253 253
 }
Please login to merge, or discard this patch.