1 | <?php |
||
15 | class PlacerFactory |
||
16 | { |
||
17 | const PLACER_CIRCULAR = 'circular'; |
||
18 | const PLACER_WORDLE = 'wordle'; |
||
19 | const PLACER_SPIRANGLE = 'spirangle'; |
||
20 | const PLACER_LINEAR_H = 'linear-h'; |
||
21 | const PLACER_LINEAR_V = 'linear-v'; |
||
22 | const PLACER_LISSAJOU = 'lissajou'; |
||
23 | |||
24 | /** @var PlacerFactory */ |
||
25 | protected static $instance; |
||
26 | |||
27 | /** @var array */ |
||
28 | protected $placers = array( |
||
29 | self::PLACER_CIRCULAR => CircularPlacer::class, |
||
30 | self::PLACER_WORDLE => WordlePlacer::class, |
||
31 | self::PLACER_SPIRANGLE => SpiranglePlacer::class, |
||
32 | self::PLACER_LINEAR_H => LinearHorizontalPlacer::class, |
||
33 | self::PLACER_LINEAR_V => LinearVerticalPlacer::class, |
||
34 | self::PLACER_LISSAJOU => LissajouPlacer::class, |
||
35 | ); |
||
36 | |||
37 | protected function __construct() { } |
||
38 | |||
39 | 5 | public static function getInstance() |
|
46 | |||
47 | 1 | public function getPlacersNames() |
|
51 | |||
52 | 2 | public function getDefaultPlacer($imgWidth, $imgHeight) |
|
56 | |||
57 | 5 | public function getPlacer($name, $imgWidth, $imgHeight, $increment = 10) |
|
62 | |||
63 | /** |
||
64 | * @param string $name |
||
65 | * @return PlacerInterface |
||
66 | * @throws \InvalidArgumentException |
||
67 | */ |
||
68 | 5 | protected function getPlacerClass($name) |
|
73 | } |