Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
heckIfValuesAreAnObject class refactored two seperate method
Browse files Browse the repository at this point in the history
  • Loading branch information
mkorkmaz committed Sep 18, 2017
1 parent f7de6f0 commit 0705c83
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/EqualsBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function append($leftHandedValue, $rightHandedValue)
if ($this->isEquals === false) {
return $this;
}
if ($this->checkIfValuesAreClass($leftHandedValue, $rightHandedValue)) {
if ($this->checkIfValuesAreAnObjectAndEqual($leftHandedValue, $rightHandedValue)) {
return $this;
}
if ($this->checkForSameType($leftHandedValue, $rightHandedValue)) {
Expand All @@ -44,9 +44,9 @@ private function checkForSameType($leftHandedValue, $rightHandedValue) :bool
return true;
}

private function checkIfValuesAreClass($leftHandedValue, $rightHandedValue) : bool
private function checkIfValuesAreAnObjectAndEqual($leftHandedValue, $rightHandedValue) : bool
{
if (! is_object($leftHandedValue) || ! is_object($rightHandedValue)) {
if (! $this->checkIfValuesAreAnObject($leftHandedValue, $rightHandedValue)) {
return false;
}
if (get_class($leftHandedValue) !== get_class($rightHandedValue)) {
Expand All @@ -59,6 +59,10 @@ private function checkIfValuesAreClass($leftHandedValue, $rightHandedValue) : bo
}
return true;
}
private function checkIfValuesAreAnObject($leftHandedValue, $rightHandedValue) : bool
{
return (is_object($leftHandedValue) && is_object($rightHandedValue));
}

private function compareObjectProperties($leftHandedObject, $rightHandedObject) : bool
{
Expand Down

0 comments on commit 0705c83

Please sign in to comment.