File tree Expand file tree Collapse file tree 2 files changed +10
-11
lines changed
Expand file tree Collapse file tree 2 files changed +10
-11
lines changed Original file line number Diff line number Diff line change 55[ ![ WezomAgency] ( https://img.shields.io/badge/composer-require-orange.svg )] ( https://packagist.org/packages/wezom-agency/r2d2 )
66[ ![ WezomAgency] ( https://img.shields.io/badge/Wezom-Agency-red.svg )] ( https://github.com/WezomAgency )
77
8- > R2D2 tiny helper
9-
10- <img src =" https://raw.githubusercontent.com/dutchenkoOleg/storage/master/img/r2d2/r2d2.gif " alt >
8+ > tiny helper
119
1210---
1311
@@ -35,7 +33,8 @@ WezomAgency\R2D2::eject()->set('KEY', VALUE);
3533
3634### API
3735
38- [ See docs sections ►] ( https://github.com/WezomAgency/r2d2/blob/master/docs/index.md )
36+ _ Working in progress..._
37+ [ See draft docs sections ►] ( https://github.com/WezomAgency/r2d2/blob/master/docs/index.md )
3938
4039---
4140
Original file line number Diff line number Diff line change @@ -75,12 +75,12 @@ public function attr($name, $value)
7575 }
7676
7777 if (is_array ($ value ) && $ name === 'style ' ) {
78- $ css = $ this ->cssRules ($ value );
78+ $ css = $ this ->cssRules (array_filter ( $ value) );
7979 return $ css ? 'style=" ' . $ css . '" ' : '' ;
8080 }
8181
8282 if (is_array ($ value ) && $ name === 'class ' ) {
83- return 'class=" ' . implode (' ' , $ value ) . '" ' ;
83+ return 'class=" ' . implode (' ' , array_filter ( $ value) ) . '" ' ;
8484 }
8585
8686 if (strpos ($ name , 'json-data- ' ) === 0 ) {
@@ -101,14 +101,14 @@ public function attr($name, $value)
101101 */
102102 public function attrs ($ attrs )
103103 {
104- $ markup = [];
104+ $ list = [];
105105 foreach ($ attrs as $ name => $ value ) {
106- $ element = $ this ->attr ($ name , $ value );
107- if (!is_null ($ element )) {
108- $ markup [] = $ element ;
106+ $ attr = $ this ->attr ($ name , $ value );
107+ if (!is_null ($ attr )) {
108+ $ list [] = $ attr ;
109109 }
110110 }
111- return count ($ markup ) > 0 ? ' ' . implode (' ' , $ markup ) : '' ;
111+ return count ($ list ) > 0 ? ' ' . implode (' ' , $ list ) : '' ;
112112 }
113113
114114
You can’t perform that action at this time.
0 commit comments