private function assertValidDocumentType($documentName, $document, $type) { if ($documentName && !$document instanceof $documentName) { throw new InvalidDocumentTypeException($type, $documentName); } }