/** * Writes the sites and nodes to the cache * @return null */ public function warmCache() { if (!$this->sites || !$this->nodes) { $this->loadNodes(); } // generate the PHP code for the obtained nodes $php = $this->generatePhp($this->sites, $this->nodes); // make sure the parent directory of the script exists $parent = $this->file->getParent(); $parent->create(); // write the PHP code to file $this->file->write($php); if (isset($this->needsWrite)) { unset($this->needsWrite); } }