File indexing completed on 2025-01-26 05:29:13
0001 <?php 0002 0003 namespace Intervention\Image\Commands; 0004 0005 abstract class AbstractCommand 0006 { 0007 /** 0008 * Arguments of command 0009 * 0010 * @var array 0011 */ 0012 public $arguments; 0013 0014 /** 0015 * Output of command 0016 * 0017 * @var mixed 0018 */ 0019 protected $output; 0020 0021 /** 0022 * Executes current command on given image 0023 * 0024 * @param \Intervention\Image\Image $image 0025 * @return mixed 0026 */ 0027 abstract public function execute($image); 0028 0029 /** 0030 * Creates new command instance 0031 * 0032 * @param array $arguments 0033 */ 0034 public function __construct($arguments) 0035 { 0036 $this->arguments = $arguments; 0037 } 0038 0039 /** 0040 * Creates new argument instance from given argument key 0041 * 0042 * @param int $key 0043 * @return \Intervention\Image\Commands\Argument 0044 */ 0045 public function argument($key) 0046 { 0047 return new \Intervention\Image\Commands\Argument($this, $key); 0048 } 0049 0050 /** 0051 * Returns output data of current command 0052 * 0053 * @return mixed 0054 */ 0055 public function getOutput() 0056 { 0057 return $this->output ? $this->output : null; 0058 } 0059 0060 /** 0061 * Determines if current instance has output data 0062 * 0063 * @return boolean 0064 */ 0065 public function hasOutput() 0066 { 0067 return ! is_null($this->output); 0068 } 0069 0070 /** 0071 * Sets output data of current command 0072 * 0073 * @param mixed $value 0074 */ 0075 public function setOutput($value) 0076 { 0077 $this->output = $value; 0078 } 0079 }