public function execute($value = false, $params = array()) { try { $scale = Scale::parse($value); } catch (Exception $ex) { throw new Exception(sprintf('Option "%s" must be 2 integeres separated by a colon (:)', $this->option->name)); } $this->setResult($scale->simplify()); }
public function load($file) { $this->file = $file; $xml = simplexml_load_file($this->file); $this->pieces = array(); $basedir = dirname($file); $this->input_scale = Scale::parse($xml['scale']); foreach ($xml->piece as $_piece) { $file = (string) $_piece['file']; if ($file[0] == '/') { $file = realpath($file); } else { $file = realpath($basedir . DIRECTORY_SEPARATOR . $file); } $this->pieces[] = (object) array('file' => $file, 'left' => (int) $_piece['left'], 'top' => (int) $_piece['top']); } $this->bounds = $this->calculateBounds($this->pieces); }