@@ 165-167 (lines=3) @@ | ||
162 | $classMetadata = array_values($fileMetadata->getClasses())[0]; |
|
163 | } |
|
164 | ||
165 | if (null === $classMetadata) { |
|
166 | throw new RuntimeException(sprintf('It is not possible to extract single class metadata from "%s", found %s definition(s).', $class, count($fileMetadata->getClasses()))); |
|
167 | } |
|
168 | ||
169 | if (!ClassUtils::isBuildable($classMetadata)) { |
|
170 | throw new InvalidArgumentException(sprintf('Builder class can not be generated for "%s", class has to have constructor with some parameters.', $classMetadata->getName())); |
|
@@ 213-215 (lines=3) @@ | ||
210 | if (file_exists($class)) { |
|
211 | $fileMetadata = MetadataLoader::create()->load($class); |
|
212 | ||
213 | if (1 !== count($fileMetadata->getClasses())) { |
|
214 | throw new RuntimeException(sprintf('It is not possible to extract single class metadata from "%s", found %s definition(s).', $class, count($fileMetadata->getClasses()))); |
|
215 | } |
|
216 | ||
217 | $classMetadata = array_values($fileMetadata->getClasses())[0]; |
|
218 | $classChoice = new ClassChoice($fileMetadata, $classMetadata); |