Skip to content

Commit

Permalink
[Accept][Item] LSB on __set_state
Browse files Browse the repository at this point in the history
  • Loading branch information
cboden committed May 15, 2012
1 parent 9b74f85 commit 1eb3b24
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 55 deletions.
18 changes: 0 additions & 18 deletions lib/BadFaith/AcceptCharset.php
Expand Up @@ -48,24 +48,6 @@ function __construct($headerStr = null)
$this->init();
}

/**
* @param array $properties the array this method always gets
* @return Accept the object version of that array
*/
static function __set_state(array $properties)
{
parent::__set_state($properties);
$accept = new AcceptCharset();
foreach ($properties as $key=>$prop) {
if (!property_exists('AcceptLike', $key)) {
if (property_exists($accept, $key)) {
$accept->$key = $prop;
}
}
}
return $accept;
}

/**
* Initializes attributes unique to this subclass.
*/
Expand Down
18 changes: 0 additions & 18 deletions lib/BadFaith/AcceptEncoding.php
Expand Up @@ -48,24 +48,6 @@ function __construct($headerStr = NULL)
$this->init();
}

/**
* @param array $properties the array this method always gets
* @return Accept the object version of that array
*/
static function __set_state(array $properties)
{
parent::__set_state($properties);
$accept = new AcceptEncoding();
foreach ($properties as $key=>$prop) {
if (!property_exists('AcceptLike', $key)) {
if (property_exists($accept, $key)) {
$accept->$key = $prop;
}
}
}
return $accept;
}

/**
* Initializes attributes unique to this subclass.
*/
Expand Down
18 changes: 0 additions & 18 deletions lib/BadFaith/AcceptLanguage.php
Expand Up @@ -49,24 +49,6 @@ function __construct($headerStr = NULL)
$this->init();
}

/**
* @param array $properties the array this method always gets
* @return Accept the object version of that array
*/
static function __set_state(array $properties)
{
parent::__set_state($properties);
$accept = new AcceptLanguage();
foreach ($properties as $key => $prop) {
if (!property_exists('AcceptLike', $key)) {
if (property_exists($accept, $key)) {
$accept->$key = $prop;
}
}
}
return $accept;
}

/**
* Initializes attributes unique to this subclass.
*/
Expand Down
3 changes: 2 additions & 1 deletion lib/BadFaith/AcceptLike.php
Expand Up @@ -53,12 +53,13 @@ function __construct($headerStr = NULL)
*/
static function __set_state(array $properties)
{
$acceptLike = new AcceptLike();
$acceptLike = new static();
foreach ($properties as $key=>$prop) {
if (property_exists($acceptLike, $key)) {
$acceptLike->$key = $prop;
}
}

return $acceptLike;
}

Expand Down

0 comments on commit 1eb3b24

Please sign in to comment.