public function actionWritePreviews() { $sizes = ['xs', 'sm', 'md', 'lg']; foreach ($sizes as $size) { $str = ''; foreach ($this->getIconsList() as $name) { $str .= "![{$name}](https://raw.githubusercontent.com/hiqdev/payment-icons/master/src/assets/png/{$size}/{$name}.png)\n"; } FileHelper::write('@hiqdev/paymenticons/../docs/Preview' . strtoupper($size) . '.md', $str); if ($size === 'xs') { $ps = []; foreach ($sizes as $s) { $us = strtoupper($s); $ps[] = "[{$us}](docs/Preview{$us}.md)"; } $str .= "\n" . implode(' | ', $ps); FileHelper::write('@hiqdev/paymenticons/../docs/readme/Preview.md', $str); } } }
/** * Writes given content to the file. * Doesn't touch file if it has exactly same content. * Creates intermediate directories when necessary. * @param string $path * @param string $content * @return bool true if file was changed */ public function write($path, $content) { return FileHelper::write($path, $content); }