| 1 | <?php |
||
| 7 | abstract class BaseManipulator implements ManipulatorInterface |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * The manipulation params. |
||
| 11 | * @var array |
||
| 12 | */ |
||
| 13 | public $params = []; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Set the manipulation params. |
||
| 17 | * @param array $params The manipulation params. |
||
| 18 | */ |
||
| 19 | 135 | public function setParams(array $params) |
|
| 20 | { |
||
| 21 | 135 | $this->params = $params; |
|
| 22 | |||
| 23 | 135 | return $this; |
|
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Get a specific manipulation param. |
||
| 28 | * @param string $name The manipulation name. |
||
| 29 | * @return string The manipulation value. |
||
| 30 | */ |
||
| 31 | 144 | public function __get($name) |
|
| 32 | { |
||
| 33 | 144 | if (array_key_exists($name, $this->params)) { |
|
| 34 | 132 | return $this->params[$name]; |
|
| 35 | } |
||
| 36 | 48 | } |
|
| 37 | |||
| 38 | /** |
||
| 39 | * Perform the image manipulation. |
||
| 40 | * @return Image The manipulated image. |
||
| 41 | */ |
||
| 42 | abstract public function run(Image $image); |
||
| 43 | } |
||
| 44 |