@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | DependencyManager $dependencies = null |
| 91 | 91 | ) {
|
| 92 | 92 | |
| 93 | - Assert\that( $shortcode_tag )->string()->notEmpty(); |
|
| 93 | + Assert\that($shortcode_tag)->string()->notEmpty(); |
|
| 94 | 94 | |
| 95 | - $this->processConfig( $config ); |
|
| 95 | + $this->processConfig($config); |
|
| 96 | 96 | |
| 97 | 97 | $this->shortcode_tag = $shortcode_tag; |
| 98 | 98 | $this->atts_parser = $atts_parser; |
@@ -107,13 +107,13 @@ 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; |
| 115 | 115 | |
| 116 | - \add_shortcode( $this->get_tag(), [ $this, 'render' ] ); |
|
| 116 | + \add_shortcode($this->get_tag(), [$this, 'render']); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -124,14 +124,14 @@ 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 | - $is_needed = $this->hasConfigKey( 'is_needed' ) |
|
| 130 | - ? $this->getConfigKey( 'is_needed' ) |
|
| 129 | + $is_needed = $this->hasConfigKey('is_needed')
|
|
| 130 | + ? $this->getConfigKey('is_needed')
|
|
| 131 | 131 | : false; |
| 132 | 132 | |
| 133 | - if ( is_callable( $is_needed ) ) {
|
|
| 134 | - return $is_needed( $context ); |
|
| 133 | + if (is_callable($is_needed)) {
|
|
| 134 | + return $is_needed($context); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | return (bool) $is_needed; |
@@ -163,23 +163,23 @@ 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 | - $atts = $this->atts_parser->parse_atts( $atts, $this->get_tag() ); |
|
| 168 | + $atts = $this->atts_parser->parse_atts($atts, $this->get_tag()); |
|
| 169 | 169 | |
| 170 | - if ( $this->dependencies ) {
|
|
| 171 | - $this->dependencies->enqueue( $atts ); |
|
| 170 | + if ($this->dependencies) {
|
|
| 171 | + $this->dependencies->enqueue($atts); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - if ( ! $this->hasConfigKey( 'view' ) ) {
|
|
| 174 | + if ( ! $this->hasConfigKey('view')) {
|
|
| 175 | 175 | return ''; |
| 176 | 176 | } |
| 177 | - $view = $this->getConfigKey( 'view' ); |
|
| 177 | + $view = $this->getConfigKey('view');
|
|
| 178 | 178 | |
| 179 | - Assert\that( $view )->string()->notEmpty()->file(); |
|
| 179 | + Assert\that($view)->string()->notEmpty()->file(); |
|
| 180 | 180 | |
| 181 | 181 | ob_start(); |
| 182 | - include( $this->config['view'] ); |
|
| 182 | + include($this->config['view']); |
|
| 183 | 183 | |
| 184 | 184 | return ob_get_clean(); |
| 185 | 185 | } |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | * @param string|null $content Inner content to pass to the shortcode. |
| 194 | 194 | * @return string|false Rendered HTML. |
| 195 | 195 | */ |
| 196 | - public function do_this( array $atts = [ ], $content = null ) {
|
|
| 197 | - \BrightNucleus\Shortcode\do_tag( $this->get_tag(), $atts, $content ); |
|
| 196 | + public function do_this(array $atts = [], $content = null) {
|
|
| 197 | + \BrightNucleus\Shortcode\do_tag($this->get_tag(), $atts, $content); |
|
| 198 | 198 | } |
| 199 | 199 | } |