| @@ 15-81 (lines=67) @@ | ||
| 12 | * |
|
| 13 | * @author Mahmoud Zalt <[email protected]> |
|
| 14 | */ |
|
| 15 | class EmptyCommand extends Command |
|
| 16 | { |
|
| 17 | /** |
|
| 18 | * The console command name. |
|
| 19 | * |
|
| 20 | * @var string |
|
| 21 | */ |
|
| 22 | protected $name = 'cdn:empty'; |
|
| 23 | ||
| 24 | /** |
|
| 25 | * The console command description. |
|
| 26 | * |
|
| 27 | * @var string |
|
| 28 | */ |
|
| 29 | protected $description = 'Empty all assets from CDN'; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * an instance of the main Cdn class. |
|
| 33 | * |
|
| 34 | * @var Vinelab\Cdn\Cdn |
|
| 35 | */ |
|
| 36 | protected $cdn; |
|
| 37 | ||
| 38 | /** |
|
| 39 | * @param CdnInterface $cdn |
|
| 40 | */ |
|
| 41 | public function __construct(CdnInterface $cdn) |
|
| 42 | { |
|
| 43 | $this->cdn = $cdn; |
|
| 44 | ||
| 45 | parent::__construct(); |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * Execute the console command. |
|
| 50 | * |
|
| 51 | * @return mixed |
|
| 52 | */ |
|
| 53 | public function fire() |
|
| 54 | { |
|
| 55 | $this->cdn->emptyBucket(); |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * Get the console command arguments. |
|
| 60 | * |
|
| 61 | * @return array |
|
| 62 | */ |
|
| 63 | protected function getArguments() |
|
| 64 | { |
|
| 65 | return array( |
|
| 66 | // array('cdn', InputArgument::OPTIONAL, 'cdn option.'), |
|
| 67 | ); |
|
| 68 | } |
|
| 69 | ||
| 70 | /** |
|
| 71 | * Get the console command options. |
|
| 72 | * |
|
| 73 | * @return array |
|
| 74 | */ |
|
| 75 | protected function getOptions() |
|
| 76 | { |
|
| 77 | return array( |
|
| 78 | // array('example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null), |
|
| 79 | ); |
|
| 80 | } |
|
| 81 | } |
|
| 82 | ||
| @@ 15-81 (lines=67) @@ | ||
| 12 | * |
|
| 13 | * @author Mahmoud Zalt <[email protected]> |
|
| 14 | */ |
|
| 15 | class PushCommand extends Command |
|
| 16 | { |
|
| 17 | /** |
|
| 18 | * The console command name. |
|
| 19 | * |
|
| 20 | * @var string |
|
| 21 | */ |
|
| 22 | protected $name = 'cdn:push'; |
|
| 23 | ||
| 24 | /** |
|
| 25 | * The console command description. |
|
| 26 | * |
|
| 27 | * @var string |
|
| 28 | */ |
|
| 29 | protected $description = 'Push assets to CDN'; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * an instance of the main Cdn class. |
|
| 33 | * |
|
| 34 | * @var Vinelab\Cdn\Cdn |
|
| 35 | */ |
|
| 36 | protected $cdn; |
|
| 37 | ||
| 38 | /** |
|
| 39 | * @param CdnInterface $cdn |
|
| 40 | */ |
|
| 41 | public function __construct(CdnInterface $cdn) |
|
| 42 | { |
|
| 43 | $this->cdn = $cdn; |
|
| 44 | ||
| 45 | parent::__construct(); |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * Execute the console command. |
|
| 50 | * |
|
| 51 | * @return mixed |
|
| 52 | */ |
|
| 53 | public function fire() |
|
| 54 | { |
|
| 55 | $this->cdn->push(); |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * Get the console command arguments. |
|
| 60 | * |
|
| 61 | * @return array |
|
| 62 | */ |
|
| 63 | protected function getArguments() |
|
| 64 | { |
|
| 65 | return array( |
|
| 66 | // array('cdn', InputArgument::OPTIONAL, 'cdn option.'), |
|
| 67 | ); |
|
| 68 | } |
|
| 69 | ||
| 70 | /** |
|
| 71 | * Get the console command options. |
|
| 72 | * |
|
| 73 | * @return array |
|
| 74 | */ |
|
| 75 | protected function getOptions() |
|
| 76 | { |
|
| 77 | return array( |
|
| 78 | // array('example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null), |
|
| 79 | ); |
|
| 80 | } |
|
| 81 | } |
|
| 82 | ||