示例#1
0
 /**
  * Inject project dependency objects
  *
  * @param GitPHP_Project $project project object
  */
 protected function InjectProjectDependencies($project)
 {
     if (!$project) {
         return;
     }
     $compat = $project->GetCompat();
     $loader = null;
     if ($compat) {
         $project->SetStrategy(new GitPHP_ProjectLoad_Git($this->exe));
     } else {
         $loader = new GitPHP_GitObjectLoader($project);
         $project->SetStrategy(new GitPHP_ProjectLoad_Raw($loader));
     }
     $headListStrategy = null;
     if ($compat) {
         $headListStrategy = new GitPHP_HeadListLoad_Git($this->exe);
     } else {
         $headListStrategy = new GitPHP_HeadListLoad_Raw();
     }
     $headList = new GitPHP_HeadList($project, $headListStrategy);
     $project->SetHeadList($headList);
     $tagListStrategy = null;
     if ($compat) {
         $tagListStrategy = new GitPHP_TagListLoad_Git($this->exe);
     } else {
         $tagListStrategy = new GitPHP_TagListLoad_Raw();
     }
     $tagList = new GitPHP_TagList($project, $tagListStrategy);
     $project->SetTagList($tagList);
     $manager = new GitPHP_GitObjectManager($project);
     $manager->SetCompat($compat);
     if (!$compat) {
         $manager->SetObjectLoader($loader);
     }
     $manager->SetExe($this->exe);
     if ($this->memoryCache) {
         $manager->SetMemoryCache($this->memoryCache);
     }
     if ($this->cache) {
         $manager->SetCache($this->cache);
     }
     $project->SetObjectManager($manager);
 }