PluginProbe
QuickWebP – WebP & AVIF Image Optimizer, Compression & SEO for WordPress / 3.2.1
QuickWebP – WebP & AVIF Image Optimizer, Compression & SEO for WordPress v3.2.1
4.1.2 4.1.1 4.1.0 4.0.1 4.0.0 3.3.1 3.3.0 trunk 1.0.0 2.0.0 2.1.0 3.0.0 3.1.0 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8
quickwebp / includes / vendor / intervention / image / src / Intervention / Image / Commands / AbstractCommand.php

AbstractCommand.php in QuickWebP – WebP & AVIF Image Optimizer, Compression & SEO for WordPress 3.2.1, at includes/vendor/intervention/image/src/Intervention/Image/Commands/AbstractCommand.php

82 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Intervention\Image\Commands;
4
5 use Intervention\Image\Commands\Argument;
6
7 abstract class AbstractCommand
8 {
9 /**
10 * Arguments of command
11 *
12 * @var array
13 */
14 public $arguments;
15
16 /**
17 * Output of command
18 *
19 * @var mixed
20 */
21 protected $output;
22
23 /**
24 * Executes current command on given image
25 *
26 * @param \Intervention\Image\Image $image
27 * @return mixed
28 */
29 abstract public function execute($image);
30
31 /**
32 * Creates new command instance
33 *
34 * @param array $arguments
35 */
36 public function __construct($arguments)
37 {
38 $this->arguments = $arguments;
39 }
40
41 /**
42 * Creates new argument instance from given argument key
43 *
44 * @param int $key
45 * @return \Intervention\Image\Commands\Argument
46 */
47 public function argument($key)
48 {
49 return new Argument($this, $key);
50 }
51
52 /**
53 * Returns output data of current command
54 *
55 * @return mixed
56 */
57 public function getOutput()
58 {
59 return $this->output ? $this->output : null;
60 }
61
62 /**
63 * Determines if current instance has output data
64 *
65 * @return boolean
66 */
67 public function hasOutput()
68 {
69 return ! is_null($this->output);
70 }
71
72 /**
73 * Sets output data of current command
74 *
75 * @param mixed $value
76 */
77 public function setOutput($value)
78 {
79 $this->output = $value;
80 }
81 }
82