This commit is contained in:
2026-05-15 18:33:51 +02:00
parent 3601be572f
commit c980004309
8442 changed files with 783630 additions and 1 deletions

View File

@@ -0,0 +1,49 @@
<?php
class FileGenerator {
private $lines = array();
public function __construct() {
}
public function AddLine($string) {
$this->lines[] = $string;
}
public function GenerateFileContents() {
$output = null;
if(count($this->lines)>1) {
foreach($this->lines as $line) {
$output .= $line.'\n';
}
} else {
$output = $this->lines[0];
}
return $output;
}
public function SaveFile($file) {
if (is_writable($file)) {
if (!$fh = fopen($file, 'w')) {
throw new UserException('Nie moge utworzyc pliku: '.$file);
}
if (fwrite($fh, $this->GenerateFileContents()) === FALSE) {
throw new UserException('Nie moge pisac do pliku pliku: '.$file);
}
fclose($fh);
} else {
throw new UserException('Nie moge pisac do pliku: '.$file);
}
}
}
?>