Example #1
0
 /**
  * Salva sul file $file il contenuto della struttura
  * @param String|Filename|\kernel\File $file
  */
 public function write($file)
 {
     if (!$file instanceof File) {
         $file = new File($file);
     }
     $file->close();
     $file->setMode('w');
     $file->fopen();
     $buffer = '';
     if ($this->_process_sections == true) {
         //ogni indice รจ una sezione
         foreach ($this->toArray() as $section => $data) {
             $buffer .= $this->writeSection($section, $data);
             $buffer .= PHP_EOL;
         }
     } else {
         $buffer .= $this->writeSection('section', $this->toArray());
     }
     $file->write($buffer);
 }