@@ -29,7 +29,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | : false; |
| 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 |
||
| 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,11 +163,11 @@ discard block |
||
| 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 | |
| 170 | - if ( $this->dependencies ) {
|
|
| 170 | + if ( $this->dependencies ) { |
|
| 171 | 171 | $this->dependencies->enqueue( $atts ); |
| 172 | 172 | } |
| 173 | 173 | |
@@ -182,8 +182,8 @@ discard block |
||
| 182 | 182 | * @param string $view The view to render. |
| 183 | 183 | * @return string HTML rendering of the view. |
| 184 | 184 | */ |
| 185 | - protected function render_view( $view ) {
|
|
| 186 | - if ( empty( $view ) ) {
|
|
| 185 | + protected function render_view( $view ) { |
|
| 186 | + if ( empty( $view ) ) { |
|
| 187 | 187 | return ''; |
| 188 | 188 | } |
| 189 | 189 | |
@@ -199,8 +199,8 @@ discard block |
||
| 199 | 199 | * |
| 200 | 200 | * @return string Name of the view to render. |
| 201 | 201 | */ |
| 202 | - protected function get_view() {
|
|
| 203 | - if ( ! $this->hasConfigKey( 'view' ) ) {
|
|
| 202 | + protected function get_view() { |
|
| 203 | + if ( ! $this->hasConfigKey( 'view' ) ) { |
|
| 204 | 204 | return ''; |
| 205 | 205 | } |
| 206 | 206 | $view = $this->getConfigKey( 'view' ); |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | * @param string|null $content Inner content to pass to the shortcode. |
| 220 | 220 | * @return string|false Rendered HTML. |
| 221 | 221 | */ |
| 222 | - public function do_this( array $atts = [ ], $content = null ) {
|
|
| 222 | + public function do_this( array $atts = [ ], $content = null ) { |
|
| 223 | 223 | \BrightNucleus\Shortcode\do_tag( $this->get_tag(), $atts, $content ); |
| 224 | 224 | } |
| 225 | 225 | } |