Use Symfony ExecutableFinder instead of custom autodetect method
This commit is contained in:
		
					parent
					
						
							
								4233651502
							
						
					
				
			
			
				commit
				
					
						70f963f347
					
				
			
		
					 1 changed files with 3 additions and 12 deletions
				
			
		|  | @ -37,7 +37,9 @@ abstract class Binary implements AdapterInterface | |||
| 
 | ||||
|     public static function load(\Monolog\Logger $logger = null) | ||||
|     { | ||||
|         if ('' === $binary = self::autodetect(static::getBinaryName())) | ||||
|         $finder = new \Symfony\Component\Process\ExecutableFinder(); | ||||
| 
 | ||||
|         if (null === $binary = $finder->find(static::getBinaryName())) | ||||
|         { | ||||
|             throw new Exception\BinaryNotFoundException('Binary not found'); | ||||
|         } | ||||
|  | @ -61,17 +63,6 @@ abstract class Binary implements AdapterInterface | |||
|         return $result; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Autodetect the presence of a binary | ||||
|      * | ||||
|      * @param   string      $binaryName | ||||
|      * @return  string | ||||
|      */ | ||||
|     protected static function autodetect($binaryName) | ||||
|     { | ||||
|         return trim(self::run(sprintf('which %s', escapeshellarg($binaryName)), true)); | ||||
|     } | ||||
| 
 | ||||
|     protected static function getBinaryName() | ||||
|     { | ||||
|         throw new Exception('Should be implemented'); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue