* @package WB */ WBClass::load( 'WBCli' , 'WBObserver'); /** * Command Line Interface class: QRCode * * Done for Palas GmbH * * @version 0.1.0 * @package WB */ class WBCli_QRCode extends WBCli { /** * @var WBUte_QRCode */ private $qrc; /** * Command line arguments * @var array */ protected $arguments = array( CONSOLE_GETARGS_PARAMS => array( 'min' => 1, 'max' => -1, 'default' => '', 'desc' => 'text', ) ); /** * 2nd constructor * * Load event processor * * @see include/WB/WBCli#init() */ protected function init() { $this->qrc = WBClass::create('WBUte_QRCode'); } /** * execute programme * * Use observer and execute event queue */ protected function execute() { if (empty($this->commands)) { $this->commands = array(); } foreach ($this->commands as $i => $c) { $this->mkQRCode($i, $c); } } private function mkQRCode($i, $text) { $this->p($i); $this->qrc->setText($text); $file = $this->qrc->getImage(); copy($file->realpath(), $i . '.png'); $this->pv(': ' . $text); $this->pl(); } }