bytic /
namefy
| 1 | <?php |
||
| 2 | |||
| 3 | namespace ByTIC\Namefy; |
||
| 4 | |||
| 5 | use ByTIC\Namefy\Strategies\AbstractStrategy; |
||
| 6 | use ByTIC\Namefy\Strategies\ByTICStrategy; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * Class Generator |
||
| 10 | * @package ByTIC\Namefy |
||
| 11 | */ |
||
| 12 | class Generator |
||
| 13 | { |
||
| 14 | use Generator\HasStrategy; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Generator constructor. |
||
| 18 | * @param null|string|AbstractStrategy $strategy |
||
| 19 | */ |
||
| 20 | public function __construct($strategy = null) |
||
| 21 | { |
||
| 22 | $strategy = (empty($strategy)) ? ByTICStrategy::class : $strategy; |
||
| 23 | $this->setStrategy($strategy); |
||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @param $name |
||
| 28 | * @param $type |
||
| 29 | * @return Name |
||
| 30 | */ |
||
| 31 | public function from($name, $type): Name |
||
| 32 | { |
||
| 33 | return NameFactory::from($name, $type, $this->getStrategy()); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 34 | } |
||
| 35 | } |
||
| 36 |