} if (empty($opt->dictionary)) { throw new \Exception("Dictionary file is required"); } if (!empty($opt->process) && empty($opt->file) && empty($opt->overwrite)) { throw new \Exception("Overwrite option is required if you going to process multiple files"); } if (!file_exists($opt->dictionary)) { touch($opt->dictionary); } $processor = new Processor(new Formatter(), realpath($opt->dictionary)); $layouts = array(); if (!empty($opt->file) && file_exists($opt->file)) { $layouts = array(realpath($opt->file)); } else { $layouts = $processor->getLayoutFiles($rootDir); } if ($opt->collect) { $processor->getReferences($layouts)->writeToFile(); } if ($opt->process) { $processor->updateReferences($layouts, $opt->processor, $opt->overwrite); } exit(0); } catch (\Zend_Console_Getopt_Exception $e) { echo $e->getUsageMessage(); exit(255); } catch (\Exception $e) { echo $e, PHP_EOL; exit(255); }