/**
  * Creates a changelog entry with the current release
  * notes and dates, or overwrites a previous creation
  *
  * @return void
  * @access private
  * @since  1.6.0a1
  */
 function _updateChangeLog()
 {
     if ($this->_oldPackageFile) {
         $changelog = $this->_oldPackageFile->getChangelog();
     } else {
         $changelog = false;
     }
     $notes = $this->_options['changelognotes'];
     if (!$changelog) {
         $this->setChangelogEntry($this->getVersion(), $this->generateChangeLogEntry($notes));
         return;
     } else {
         if (!isset($changelog['release'][0])) {
             $changelog['release'] = array($changelog['release']);
         }
         $found = false;
         foreach ($changelog['release'] as $i => $centry) {
             $changelog['release'][$i]['notes'] = trim($changelog['release'][$i]['notes']);
             if ($centry['version']['release'] == $this->getVersion()) {
                 $changelog['release'][$i] = $this->generateChangeLogEntry($notes);
                 $found = true;
             }
         }
         if (!$found) {
             $changelog['release'][] = $this->generateChangeLogEntry($notes);
         }
         usort($changelog['release'], array($this, '_changelogsort'));
         $this->clearChangeLog();
         foreach ($changelog['release'] as $entry) {
             $this->setChangelogEntry($entry['version']['release'], $entry);
         }
     }
 }