public static function dumpFile($path, $content) { $content = trim($content); $dirname = dirname($path); if (!is_dir($dirname)) { mkdir($dirname, 0755, true); } if (is_readable($path)) { $pattern = ['@\\/\\*(.*)\\*\\/@sU', '@[\\r\\n]@sU']; // strip only header and svn's Id-keyword, don't skip type hints $old = preg_replace($pattern, null, file_get_contents($path), 2); $new = preg_replace($pattern, null, $content, 2); } else { $old = 1; $new = 2; } $out = MetaConfiguration::out(); $className = basename($path, EXT_CLASS); if ($old !== $new) { $out->warning("\t\t" . $className . ' '); if (!MetaConfiguration::me()->isDryRun()) { $fp = fopen($path, 'wb'); fwrite($fp, $content); fclose($fp); } $out->log('(')->remark(str_replace(getcwd() . DIRECTORY_SEPARATOR, null, $path))->logLine(')'); } else { $out->infoLine("\t\t" . $className . ' ', true); } }