/** * Destructs the repository, makes sure the index is saved * @return null */ public function __destruct() { if (!$this->isIndexDirty) { return; } $indexFile = new File($this->directory, self::INDEX_FILE); $this->indexDom->save($indexFile); }