Created
January 14, 2019 15:33
-
-
Save BerezhniyDmitro/764e2d393ed6074000ed0d0c91c493ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MapDocuments | |
{ | |
private $aliasMap = [ | |
'document.check' => Check::class, | |
'document.nakladnaya' => Nakladnaya::class, // сущности твои | |
]; | |
public function getEntity(string $aliasEntity) | |
{ | |
if (! array_key_exists($aliasEntity, $this->aliasMap)) { | |
throw new \http\Exception\InvalidArgumentException('Вася ты передал что то не то'); | |
} | |
return new Nakladnaya(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment