public static createForUnsupportedTypeForIdenticalValuesCheck ( $value ) : InvalidArgumentException | ||
리턴 | InvalidArgumentException |
private function isIdentical($val1, $val2) : bool { if (gettype($val1) !== gettype($val2)) { return false; } if (is_object($val1)) { return $val1 == $val2; } if (is_scalar($val1) || null === $val1) { return $val1 === $val2; } if (false === is_array($val1)) { throw InvalidArgumentExceptionFactory::createForUnsupportedTypeForIdenticalValuesCheck($val1); } foreach ($val1 as $key => $item) { if (is_string($key)) { if (false === $this->isIdentical($item, $val2[$key])) { return false; } continue; } if (false === $this->arrayHasValue($item, $val2)) { return false; } } return true; }
public function testTestCreateForUnsupportedTypeForIdenticalValuesCheck() { $exception = InvalidArgumentExceptionFactory::createForUnsupportedTypeForIdenticalValuesCheck(true); $this->assertEquals('Unsupported type "boolean": cannot determine if two values of this type are identical.', $exception->getMessage()); $this->assertEquals(0, $exception->getCode()); $this->assertNull($exception->getPrevious()); }