<?php boolval(mixed $value): bool
<?php protected function isUniqueConstraintError(Exception $exception) { return boolval(preg_match('#Integrity constraint violation: 1062#i', $exception->getMessage())); }
<?php protected function isUniqueConstraintError(Exception $exception) { return boolval(preg_match('#(column(s)? .* (is|are) not unique|UNIQUE constraint failed: .*)#i', $exception->getMessage())); }
<?php protected function isUniqueConstraintError(Exception $exception) { return boolval(preg_match('#Cannot insert duplicate key row in object#i', $exception->getMessage())); }