@@ -7,22 +7,22 @@ discard block |
||
| 7 | 7 | /** |
| 8 | 8 | * @return string |
| 9 | 9 | */ |
| 10 | - public function buildAttributes( array $atts = [] ) |
|
| 10 | + public function buildAttributes(array $atts = []) |
|
| 11 | 11 | { |
| 12 | 12 | $attributes = []; |
| 13 | - foreach( $atts as $key => $value ) { |
|
| 14 | - $attributes[] = sprintf( '%s="%s"', $key, $value ); |
|
| 13 | + foreach ($atts as $key => $value) { |
|
| 14 | + $attributes[] = sprintf('%s="%s"', $key, $value); |
|
| 15 | 15 | } |
| 16 | - return implode( ' ', $attributes ); |
|
| 16 | + return implode(' ', $attributes); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * @return string |
| 21 | 21 | */ |
| 22 | - public function buildAttributesFor( $tag, array $atts = [] ) |
|
| 22 | + public function buildAttributesFor($tag, array $atts = []) |
|
| 23 | 23 | { |
| 24 | 24 | return $this->buildAttributes( |
| 25 | - wp_parse_args( $atts, apply_filters( "castor/render/$tag/attributes", [] )) |
|
| 25 | + wp_parse_args($atts, apply_filters("castor/render/$tag/attributes", [])) |
|
| 26 | 26 | ); |
| 27 | 27 | } |
| 28 | 28 | |
@@ -32,13 +32,13 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @return string |
| 34 | 34 | */ |
| 35 | - public function buildClassName( $name, $path = '' ) |
|
| 35 | + public function buildClassName($name, $path = '') |
|
| 36 | 36 | { |
| 37 | - $className = array_map( 'ucfirst', array_map( 'strtolower', preg_split( '/[-_]/', $name ))); |
|
| 38 | - $className = implode( '', $className ); |
|
| 37 | + $className = array_map('ucfirst', array_map('strtolower', preg_split('/[-_]/', $name))); |
|
| 38 | + $className = implode('', $className); |
|
| 39 | 39 | |
| 40 | - return !empty( $path ) |
|
| 41 | - ? str_replace( '\\\\', '\\', sprintf( '%s\%s', $path, $className )) |
|
| 40 | + return !empty($path) |
|
| 41 | + ? str_replace('\\\\', '\\', sprintf('%s\%s', $path, $className)) |
|
| 42 | 42 | : $className; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @return string |
| 50 | 50 | */ |
| 51 | - public function buildMethodName( $name, $prefix = 'get' ) |
|
| 51 | + public function buildMethodName($name, $prefix = 'get') |
|
| 52 | 52 | { |
| 53 | - return lcfirst( $this->buildClassName( $prefix . '-' . $name )); |
|
| 53 | + return lcfirst($this->buildClassName($prefix . '-' . $name)); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | * |
| 59 | 59 | * @return string |
| 60 | 60 | */ |
| 61 | - public function cleanString( $string ) |
|
| 61 | + public function cleanString($string) |
|
| 62 | 62 | { |
| 63 | - return trim( strip_tags( $string )); |
|
| 63 | + return trim(strip_tags($string)); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | * |
| 71 | 71 | * @return string |
| 72 | 72 | */ |
| 73 | - public function endWith( $suffix, $string, $unique = true ) |
|
| 73 | + public function endWith($suffix, $string, $unique = true) |
|
| 74 | 74 | { |
| 75 | - return $unique && $this->endsWith( $suffix, $string ) |
|
| 75 | + return $unique && $this->endsWith($suffix, $string) |
|
| 76 | 76 | ? $string |
| 77 | 77 | : $string . $suffix; |
| 78 | 78 | } |
@@ -83,11 +83,11 @@ discard block |
||
| 83 | 83 | * |
| 84 | 84 | * @return string |
| 85 | 85 | */ |
| 86 | - public function endsWith( $needle, $haystack ) |
|
| 86 | + public function endsWith($needle, $haystack) |
|
| 87 | 87 | { |
| 88 | - $length = strlen( $needle ); |
|
| 88 | + $length = strlen($needle); |
|
| 89 | 89 | return $length != 0 |
| 90 | - ? substr( $haystack, -$length ) === $needle |
|
| 90 | + ? substr($haystack, -$length) === $needle |
|
| 91 | 91 | : true; |
| 92 | 92 | } |
| 93 | 93 | |
@@ -97,12 +97,12 @@ discard block |
||
| 97 | 97 | * |
| 98 | 98 | * @return void |
| 99 | 99 | */ |
| 100 | - public function printTag( $tag, $value, array $attributes = [] ) |
|
| 100 | + public function printTag($tag, $value, array $attributes = []) |
|
| 101 | 101 | { |
| 102 | - $attributes = $this->buildAttributesFor( $tag, $attributes ); |
|
| 102 | + $attributes = $this->buildAttributesFor($tag, $attributes); |
|
| 103 | 103 | |
| 104 | - printf( '<%s>%s</%s>', |
|
| 105 | - rtrim( sprintf( '%s %s', $tag, $attributes )), |
|
| 104 | + printf('<%s>%s</%s>', |
|
| 105 | + rtrim(sprintf('%s %s', $tag, $attributes)), |
|
| 106 | 106 | $value, |
| 107 | 107 | $tag |
| 108 | 108 | ); |
@@ -115,9 +115,9 @@ discard block |
||
| 115 | 115 | * |
| 116 | 116 | * @return string |
| 117 | 117 | */ |
| 118 | - public function startWith( $prefix, $string, $unique = true ) |
|
| 118 | + public function startWith($prefix, $string, $unique = true) |
|
| 119 | 119 | { |
| 120 | - return $unique && $this->startsWith( $prefix, $string ) |
|
| 120 | + return $unique && $this->startsWith($prefix, $string) |
|
| 121 | 121 | ? $string |
| 122 | 122 | : $prefix . $string; |
| 123 | 123 | } |
@@ -128,9 +128,9 @@ discard block |
||
| 128 | 128 | * |
| 129 | 129 | * @return string |
| 130 | 130 | */ |
| 131 | - public function startsWith( $needle, $haystack ) |
|
| 131 | + public function startsWith($needle, $haystack) |
|
| 132 | 132 | { |
| 133 | - return substr( $haystack, 0, strlen( $needle )) === $needle; |
|
| 133 | + return substr($haystack, 0, strlen($needle)) === $needle; |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -140,11 +140,11 @@ discard block |
||
| 140 | 140 | * |
| 141 | 141 | * @return string |
| 142 | 142 | */ |
| 143 | - public function trimLeft( $string, $needle, $caseSensitive = true ) |
|
| 143 | + public function trimLeft($string, $needle, $caseSensitive = true) |
|
| 144 | 144 | { |
| 145 | 145 | $strPos = $caseSensitive ? "strpos" : "stripos"; |
| 146 | - if( $strPos( $string, $needle ) === 0 ) { |
|
| 147 | - $string = substr( $string, strlen( $needle )); |
|
| 146 | + if ($strPos($string, $needle) === 0) { |
|
| 147 | + $string = substr($string, strlen($needle)); |
|
| 148 | 148 | } |
| 149 | 149 | return $string; |
| 150 | 150 | } |
@@ -156,11 +156,11 @@ discard block |
||
| 156 | 156 | * |
| 157 | 157 | * @return string |
| 158 | 158 | */ |
| 159 | - public function trimRight( $string, $needle, $caseSensitive = true ) |
|
| 159 | + public function trimRight($string, $needle, $caseSensitive = true) |
|
| 160 | 160 | { |
| 161 | 161 | $strPos = $caseSensitive ? "strpos" : "stripos"; |
| 162 | - if( $strPos( $string, $needle, strlen( $string ) - strlen( $needle )) !== false ) { |
|
| 163 | - $string = substr( $string, 0, -strlen( $needle )); |
|
| 162 | + if ($strPos($string, $needle, strlen($string) - strlen($needle)) !== false) { |
|
| 163 | + $string = substr($string, 0, -strlen($needle)); |
|
| 164 | 164 | } |
| 165 | 165 | return $string; |
| 166 | 166 | } |
@@ -6,13 +6,13 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Render extends Facade |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Get the fully qualified class name of the component. |
|
| 11 | - * |
|
| 12 | - * @return string |
|
| 13 | - */ |
|
| 14 | - protected static function getFacadeAccessor() |
|
| 15 | - { |
|
| 16 | - return \GeminiLabs\Castor\Helpers\Render::class; |
|
| 17 | - } |
|
| 9 | + /** |
|
| 10 | + * Get the fully qualified class name of the component. |
|
| 11 | + * |
|
| 12 | + * @return string |
|
| 13 | + */ |
|
| 14 | + protected static function getFacadeAccessor() |
|
| 15 | + { |
|
| 16 | + return \GeminiLabs\Castor\Helpers\Render::class; |
|
| 17 | + } |
|
| 18 | 18 | } |