Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. <?php
  2. ....
  3. /**
  4. * @param int $type
  5. * @return Application|Job
  6. * @throws ErrorException
  7. */
  8. public static function getTypeModel(int $type)
  9. {
  10. $objectType = AliasObjectType::findOne($type);
  11. switch ($objectType->type) {
  12. case self::TYPE_APPLICATION :
  13. return new Application();
  14. break;
  15. case self::TYPE_JOB :
  16. return new Job();
  17. break;
  18. default:
  19. throw new ErrorException('Unknown type');
  20. break;
  21. }
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement