/** * Returns a directory to save the downloaded project into. * @return string */ protected function getDestination() { $type = $this->project->getProjectType(); $name = $this->project->getProject(); $version = $this->project->getVersion(); $dir = $this->getTempDirectory() . DIRECTORY_SEPARATOR . $type . DIRECTORY_SEPARATOR . $name; // Build the destination folder tree if it doesn't already exists. if (!is_dir($dir)) { mkdir($dir, 0775, true); } return $dir . DIRECTORY_SEPARATOR . $version; }
/** * @param Project $project * @param ReleaseHistory $release_history * @param boolean $flat * @return array */ protected function generateReport(Project $project, ReleaseHistory $release_history, $flat = false) { $report = array('project' => $project->getProject(), 'type' => $project->getProjectType(), 'version' => $project->getVersion(), 'version_date' => $project->getDatestamp(), 'recommended' => null, 'dev' => null, 'also_available' => array(), 'status' => $project->getStatus(), 'status_label' => ReleaseHistory::getStatusLabel($project->getStatus()), 'reason' => ''); if ($flat) { $report['recommended'] = $project->getRecommended(); $report['dev'] = $project->getDevVersion(); $report['also_available'] = implode(',', $project->getAlsoAvailable()); } else { if ($release = $release_history->getRelease($project->getRecommended())) { $report['recommended'] = $this->getReportFromRelease($release); } if ($release = $release_history->getRelease($project->getDevVersion())) { $report['dev'] = $this->getReportFromRelease($release); } foreach ($project->getAlsoAvailable() as $version) { if ($release = $project->getRelease($version)) { $report['also_available'][] = $this->getReportFromRelease($release); } } } if ($reason = $project->getReason()) { $report['reason'] = $reason; } return $report; }