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

[WIP] Update library/Zend/Stdlib/Hydrator/ClassMethods.php #3754

Closed
wants to merge 10 commits into from
10 changes: 8 additions & 2 deletions library/Zend/Stdlib/Hydrator/ClassMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,19 @@ public function extract($object)
$attribute = $method;
if (preg_match('/^get/', $method)) {
$attribute = substr($method, 3);
$attribute = lcfirst($attribute);
}

if ($this->underscoreSeparatedKeys) {
$attribute = preg_replace_callback('/([A-Z])/', $transform, $attribute);
}
$attributes[$attribute] = $this->extractValue($attribute, $object->$method());


if(property_exists($object, $attribute)) {
$attributes[$attribute] = $this->extractValue($attribute, $object->$method());
} else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you perhaps correct the indenting here (and the line above this, and the block below as well)? If it all looks okay in your editor, please make sure you use spaces. Not tabs. (we try to adhere to PSR2, which uses 4 spaces per tab: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md )

Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Will do

$attribute = lcfirst($attribute);
$attributes[$attribute] = $this->extractValue($attribute, $object->$method());
}
}

return $attributes;
Expand Down