parser->yamlParser($this->opentalentConfig, 'enum.yaml'); $enumClass = $enums['opentalent'][$id]; if(!$enumClass) throw new NotFoundHttpException(sprintf('Enum %s does\'nt exist', $id)); try{ $items = $this->reflection->dynamicInvokeClassWithArgsAndMethod( $enumClass, 'toArray' ); }catch (\Exception $exception){ throw new NotFoundHttpException(sprintf('Enum %s does\'nt exist', $id)); } $enumResponse = new Enum(); $enumResponse->setName($id); $enumResponse->setItems($items); return $enumResponse; } }