| Conditions | 12 | 
| Paths | 130 | 
| Total Lines | 54 | 
| Code Lines | 33 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 2 | ||
| Bugs | 0 | Features | 0 | 
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 33 | 	public function perform() { | 
            ||
| 34 | set_time_limit(0);  | 
            ||
| 35 | |||
| 36 | 		if(!empty($this->args['logfile'])) { | 
            ||
| 37 | $this->log = new DeploynautLogFile($this->args['logfile']);  | 
            ||
| 38 | }  | 
            ||
| 39 | |||
| 40 | $this->project = DNProject::get()->byId($this->args['projectID']);  | 
            ||
| 41 | 		if(!($this->project && $this->project->exists())) { | 
            ||
| 42 | 			throw new RuntimeException(sprintf('Project ID %s not found', $this->args['projectID'])); | 
            ||
| 43 | }  | 
            ||
| 44 | |||
| 45 | $this->user = DNData::inst()->getGitUser() ?: null;  | 
            ||
| 46 | |||
| 47 | // Disallow concurrent git fetches on the same project.  | 
            ||
| 48 | // Only consider fetches started in the last 30 minutes (older jobs probably got stuck)  | 
            ||
| 49 | 		try { | 
            ||
| 50 | 			if(!empty($this->args['fetchID'])) { | 
            ||
| 51 | $runningFetches = DNGitFetch::get()  | 
            ||
| 52 | ->filter(array(  | 
            ||
| 53 | 'ProjectID' => $this->project->ID,  | 
            ||
| 54 | 						'Status' => array('Queued', 'Started'), | 
            ||
| 55 | 						'Created:GreaterThan' => strtotime('-30 minutes') | 
            ||
| 56 | ))  | 
            ||
| 57 | 					->exclude('ID', $this->args['fetchID']); | 
            ||
| 58 | |||
| 59 | 				if($runningFetches->count()) { | 
            ||
| 60 | $runningFetch = $runningFetches->first();  | 
            ||
| 61 | $message = sprintf(  | 
            ||
| 62 | 'Another fetch is in progress (started at %s by %s)',  | 
            ||
| 63 | 						$runningFetch->dbObject('Created')->Nice(), | 
            ||
| 64 | $runningFetch->Deployer()->Title  | 
            ||
| 65 | );  | 
            ||
| 66 | 					if($this->log) { | 
            ||
| 67 | $this->log->write($message);  | 
            ||
| 68 | }  | 
            ||
| 69 | throw new RuntimeException($message);  | 
            ||
| 70 | }  | 
            ||
| 71 | }  | 
            ||
| 72 | |||
| 73 | // Decide whether we need to just update what we already have  | 
            ||
| 74 | // or initiate a clone if no local repo exists.  | 
            ||
| 75 | 			if($this->project->repoExists() && empty($this->args['forceClone'])) { | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 76 | $this->fetchRepo();  | 
            ||
| 77 | 			} else { | 
            ||
| 78 | $this->cloneRepo();  | 
            ||
| 79 | }  | 
            ||
| 80 | 		} catch(Exception $e) { | 
            ||
| 81 | 			if($this->log) { | 
            ||
| 82 | $this->log->write($e->getMessage());  | 
            ||
| 83 | }  | 
            ||
| 84 | throw $e;  | 
            ||
| 85 | }  | 
            ||
| 86 | }  | 
            ||
| 87 | |||
| 151 | 
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.