/** * @param Config $config */ public function run(Config $config) { $iterator = new RecursiveDirectoryIterator($config->getExportDir()); $iterator = new RecursiveIteratorIterator($iterator); $iterator = new \RegexIterator($iterator, '/\\.puml$/'); $files = []; foreach ($iterator as $file) { /** @var $file \SplFileInfo */ $files[] = $file->getPathname(); } $jar = $config->getParam(PlantUml::CONFIG_JAR); passthru(sprintf('java -jar %s %s', $jar, implode(' ', $files))); }
/** * @param Config $config */ public function mount(Config $config) { $jar = $this->getParam('jar'); if ($jar) { $dir = new Directory(dirname($jar), $config->getConfigDir()); $jarPath = realpath(sprintf('%s/%s', rtrim((string) $dir, '/'), basename($jar))); $config->setParam(self::CONFIG_JAR, $jarPath); } $url = $this->getParam('url'); if ($url) { $config->setParam(self::CONFIG_URL, $url); } }
/** * @param Config $config * @param string $file * * @return string */ private function createOnlineLink(Config $config, $file) { $content = file_get_contents($file); $generator = new OnlineGenerator($config->getParam(Plugin::CONFIG_URL)); return $generator->createUrl($content); }