Skip to content

Commit 077df95

Browse files
Merge pull request #33 from dutchenkoOleg/master
1.8.0
2 parents 893f5d0 + 544e48f commit 077df95

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
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

src/WezomAgency/R2D2.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)