32
32
*
33
33
* @package BladeOne
34
34
* @author Jorge Patricio Castro Castillo <jcastro arroba eftec dot cl>
35
- * @copyright Copyright (c) 2016-2023 Jorge Patricio Castro Castillo MIT License.
35
+ * @copyright Copyright (c) 2016-2024 Jorge Patricio Castro Castillo MIT License.
36
36
* Don't delete this comment, its part of the license.
37
37
* Part of this code is based in the work of Laravel PHP Components.
38
- * @version 4.14
38
+ * @version 4.15.1
39
39
* @link https://github.com/EFTEC/BladeOne
40
40
*/
41
41
class BladeOne
42
42
{
43
43
//<editor-fold desc="fields">
44
- public const VERSION = '4.14 ' ;
44
+ public const VERSION = '4.15.1 ' ;
45
45
/** @var int BladeOne reads if the compiled file has changed. If it has changed,then the file is replaced. */
46
46
public const MODE_AUTO = 0 ;
47
47
/** @var int Then compiled file is always replaced. It's slow and it's useful for development. */
@@ -81,8 +81,8 @@ class BladeOne
81
81
protected array $ hierarcy = [];
82
82
/**
83
83
* @var callable[] associative array with the callable methods. The key must be the name of the method<br>
84
- * <b> example:</b> <br>
85
- * ```php
84
+ * ** example:** <br>
85
+ * ```
86
86
* $this->methods['compileAlert']=static function(?string $expression=null) { return };
87
87
* $this->methods['runtimeAlert']=function(?array $arguments=null) { return };
88
88
* ```
@@ -112,7 +112,7 @@ class BladeOne
112
112
* @var callable[] It allows to parse the compiled output using a function.
113
113
* This function doesn't require to return a value<br>
114
114
* **Example:** this converts all compiled result in uppercase (note, content is a ref)
115
- * ```php
115
+ * ```
116
116
* $this->compileCallbacks[]= static function (&$content, $templatename=null) {
117
117
* $content=strtoupper($content);
118
118
* };
@@ -876,11 +876,7 @@ public function relative($relativeWeb): string
876
876
public function addAssetDict ($ name , $ url = '' ): void
877
877
{
878
878
if (\is_array ($ name )) {
879
- if ($ this ->assetDict === null ) {
880
- $ this ->assetDict = $ name ;
881
- } else {
882
- $ this ->assetDict = \array_merge ($ this ->assetDict , $ name );
883
- }
879
+ $ this ->assetDict = \array_merge ($ this ->assetDict , $ name );
884
880
} else {
885
881
$ this ->assetDict [$ name ] = $ url ;
886
882
}
@@ -2895,7 +2891,7 @@ protected function compileComments($value): string
2895
2891
case 1 :
2896
2892
return \preg_replace ($ pattern , '<!-- $1 --> ' , $ value );
2897
2893
default :
2898
- return "" ;
2894
+ return \preg_replace ( $ pattern , '' , $ value ) ;
2899
2895
}
2900
2896
}
2901
2897
@@ -2968,7 +2964,7 @@ protected function compileComponents($value)
2968
2964
* [3]=...
2969
2965
* [4]=content
2970
2966
*
2971
- * @return mixed| string
2967
+ * @return string
2972
2968
*/
2973
2969
2974
2970
$ callback = function ($ match ) {
@@ -2985,7 +2981,8 @@ protected function compileComponents($value)
2985
2981
2986
2982
}
2987
2983
2988
- protected function parseParams ($ params ) {
2984
+ protected function parseParams ($ params ): string
2985
+ {
2989
2986
preg_match_all ('/([a-z-0-9:]*?)\s*?=\s*?(.+?)(\s|$)/ms ' , $ params , $ matches );
2990
2987
$ paramsCompiled = [];
2991
2988
foreach ($ matches [1 ] as $ i => $ key ) {
0 commit comments