Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 4 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| Rotate | |
0.00% |
0 / 4 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| perform | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Karla ImageMagick wrapper library |
| 5 | * |
| 6 | * PHP Version 8.0< |
| 7 | * |
| 8 | * @category Utility |
| 9 | * @author Johannes Skov Frandsen <jsf@greenoak.dk> |
| 10 | * @license http://www.opensource.org/licenses/mit-license.php MIT |
| 11 | * @link https://github.com/localgod/karla Karla |
| 12 | * @since 2013-05-26 |
| 13 | */ |
| 14 | |
| 15 | declare(strict_types=1); |
| 16 | |
| 17 | namespace Karla\Action; |
| 18 | |
| 19 | use Karla\Query; |
| 20 | use Karla\Action; |
| 21 | |
| 22 | /** |
| 23 | * Class for handeling rotate action |
| 24 | * |
| 25 | * @category Utility |
| 26 | * @author Johannes Skov Frandsen <jsf@greenoak.dk> |
| 27 | * @license http://www.opensource.org/licenses/mit-license.php MIT |
| 28 | * @link https://github.com/localgod/karla Karla |
| 29 | */ |
| 30 | class Rotate implements Action |
| 31 | { |
| 32 | /** |
| 33 | * Degrees to rotate the image |
| 34 | * |
| 35 | * @var integer |
| 36 | */ |
| 37 | private int $degree; |
| 38 | |
| 39 | /** |
| 40 | * Rotate image |
| 41 | * |
| 42 | * @param integer $degree |
| 43 | * Degrees to rotate the image |
| 44 | * |
| 45 | * @throws \InvalidArgumentException if degree is not an integer value |
| 46 | */ |
| 47 | public function __construct(int $degree) |
| 48 | { |
| 49 | $this->degree = $degree; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * (non-PHPdoc) |
| 54 | * |
| 55 | * @param Query $query |
| 56 | * The query to add the action to |
| 57 | * @return Query |
| 58 | * @see Action::perform() |
| 59 | */ |
| 60 | public function perform(Query $query): Query |
| 61 | { |
| 62 | $query->notWith('rotate', Query::ARGUMENT_TYPE_INPUT); |
| 63 | $query->setInputOption(' -rotate "' . $this->degree . '"'); |
| 64 | return $query; |
| 65 | } |
| 66 | } |