matt-whittom 12 anni fa
parent
commit
f3722a46ed

+ 7 - 10
src/Composer/Downloader/PerforceDownloader.php

@@ -51,19 +51,10 @@ class PerforceDownloader extends VcsDownloader
             return;
         }
         $repository = $package->getRepository();
-        $repoConfig = $this->getRepoConfig($repository);
+        $repoConfig = $repository->getRepoConfig();
         $this->perforce = Perforce::createPerforce($repoConfig, $package->getSourceUrl(), $path);
     }
 
-    public function injectPerforce($perforce){
-        $this->perforce = $perforce;
-        $this->perforceInjected = true;
-    }
-
-    private function getRepoConfig(VcsRepository $repository){
-        return $repository->getRepoConfig();
-    }
-
     /**
      * {@inheritDoc}
      */
@@ -91,4 +82,10 @@ class PerforceDownloader extends VcsDownloader
         return $commitLogs;
     }
 
+    public function injectPerforce($perforce){
+        $this->perforce = $perforce;
+        $this->perforceInjected = true;
+    }
+
+
 }

+ 35 - 20
src/Composer/Repository/Vcs/PerforceDriver.php

@@ -34,7 +34,8 @@ class PerforceDriver extends VcsDriver {
     /**
      * {@inheritDoc}
      */
-    public function initialize() {
+    public function initialize()
+    {
         $this->depot = $this->repoConfig['depot'];
         $this->branch = "";
         if (isset($this->repoConfig['branch'])) {
@@ -51,7 +52,8 @@ class PerforceDriver extends VcsDriver {
         return TRUE;
     }
 
-    private function initPerforce() {
+    private function initPerforce()
+    {
         if (isset($this->perforce)) {
             return;
         }
@@ -60,15 +62,11 @@ class PerforceDriver extends VcsDriver {
         $this->perforce = Perforce::createPerforce($this->repoConfig, $this->getUrl(), $repoDir, $this->process);
     }
 
-    public function injectPerforce(Perforce $perforce) {
-        $this->perforce = $perforce;
-    }
-
-
     /**
      * {@inheritDoc}
      */
-    public function getComposerInformation($identifier) {
+    public function getComposerInformation($identifier)
+    {
         if (isset($this->composer_info_identifier)){
             if (strcmp($identifier, $this->composer_info_identifier) === 0 )
             {
@@ -83,14 +81,16 @@ class PerforceDriver extends VcsDriver {
     /**
      * {@inheritDoc}
      */
-    public function getRootIdentifier() {
+    public function getRootIdentifier()
+    {
         return $this->branch;
     }
 
     /**
      * {@inheritDoc}
      */
-    public function getBranches() {
+    public function getBranches()
+    {
         $branches = $this->perforce->getBranches();
 
         return $branches;
@@ -99,7 +99,8 @@ class PerforceDriver extends VcsDriver {
     /**
      * {@inheritDoc}
      */
-    public function getTags() {
+    public function getTags()
+    {
         $tags = $this->perforce->getTags();
 
         return $tags;
@@ -108,14 +109,16 @@ class PerforceDriver extends VcsDriver {
     /**
      * {@inheritDoc}
      */
-    public function getDist($identifier) {
+    public function getDist($identifier)
+    {
         return NULL;
     }
 
     /**
      * {@inheritDoc}
      */
-    public function getSource($identifier) {
+    public function getSource($identifier)
+    {
         $source = array(
             'type'      => 'perforce',
             'url'       => $this->repoConfig['url'],
@@ -128,14 +131,16 @@ class PerforceDriver extends VcsDriver {
     /**
      * {@inheritDoc}
      */
-    public function getUrl() {
+    public function getUrl()
+    {
         return $this->url;
     }
 
     /**
      * {@inheritDoc}
      */
-    public function hasComposerFile($identifier) {
+    public function hasComposerFile($identifier)
+    {
         $this->composer_info = $this->perforce->getComposerInformation("//$this->depot/$identifier");
         $this->composer_info_identifier = $identifier;
         $result = false;
@@ -148,30 +153,40 @@ class PerforceDriver extends VcsDriver {
     /**
      * {@inheritDoc}
      */
-    public function getContents($url) {
+    public function getContents($url)
+    {
         return FALSE;
     }
 
     /**
      * {@inheritDoc}
      */
-    public static function supports(IOInterface $io, $url, $deep = FALSE) {
+    public static function supports(IOInterface $io, $url, $deep = FALSE)
+    {
         return Perforce::checkServerExists($url, new ProcessExecutor);
     }
 
     /**
      * {@inheritDoc}
      */
-    public function cleanup(){
+    public function cleanup()
+    {
         $this->perforce->cleanupClientSpec();
         $this->perforce = null;
     }
 
-    public function getDepot(){
+    public function getDepot()
+    {
         return $this->depot;
     }
 
-    public function getBranch(){
+    public function getBranch()
+    {
         return $this->branch;
     }
+
+    public function injectPerforce(Perforce $perforce)
+    {
+        $this->perforce = $perforce;
+    }
 }