Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

Commit af4b9fc

Browse files
committed
Apply proxy from setAttribs to setAttributes
1 parent d8086fa commit af4b9fc

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

src/Helper/Gravatar.php

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function __invoke($email = "", $options = [], $attribs = [])
100100
$this->setOptions($options);
101101
}
102102
if (! empty($attribs)) {
103-
$this->setAttribs($attribs);
103+
$this->setAttributes($attribs);
104104
}
105105

106106
return $this;
@@ -175,12 +175,24 @@ public function getImgTag()
175175
}
176176

177177
/**
178-
* Set attribs for image tag
178+
* Set attributes for image tag
179179
*
180-
* Warning! You shouldn't set src attrib for image tag.
181-
* This attrib is overwritten in protected method setSrcAttribForImg().
180+
* Warning! You shouldn't set src attribute for image tag.
181+
* This attribute is overwritten in protected method setSrcAttribForImg().
182182
* This method(_setSrcAttribForImg) is called in public method getImgTag().
183183
*
184+
* @param array $attributes
185+
* @return Gravatar
186+
*/
187+
public function setAttributes(array $attributes)
188+
{
189+
$this->attribs = $attributes;
190+
return $this;
191+
}
192+
193+
/**
194+
* Set attribs for image tag
195+
*
184196
* @param array $attribs
185197
* @return Gravatar
186198
*
@@ -194,7 +206,7 @@ public function setAttribs(array $attribs)
194206
__CLASS__
195207
), E_USER_DEPRECATED);
196208

197-
$this->attribs = $attribs;
209+
$this->setAttributes($attribs);
198210
return $this;
199211
}
200212

@@ -362,6 +374,6 @@ protected function setSrcAttribForImg()
362374
{
363375
$attribs = $this->getAttribs();
364376
$attribs['src'] = $this->getAvatarUrl();
365-
$this->setAttribs($attribs);
377+
$this->setAttributes($attribs);
366378
}
367379
}

test/Helper/GravatarTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function testGetAndSetMethods()
9292
->setImgSize(150)
9393
->setSecure(true)
9494
->setEmail("[email protected]")
95-
->setAttribs($attribs)
95+
->setAttributes($attribs)
9696
->setRating('pg');
9797
$this->assertEquals("monsterid", $this->helper->getDefaultImg());
9898
$this->assertEquals("pg", $this->helper->getRating());
@@ -239,7 +239,7 @@ public function testSetAttribsWithSrcKey()
239239
{
240240
$email = '[email protected]';
241241
$this->helper->setEmail($email);
242-
$this->helper->setAttribs([
242+
$this->helper->setAttributes([
243243
'class' => 'gravatar',
244244
'src' => 'http://example.com',
245245
'id' => 'gravatarID',

0 commit comments

Comments
 (0)