I'd just call `$this->metadataFactory->getMetadataFor($this->class->name)` once instead of doing checks