| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | /* | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * This file is part of the composer-changelogs project. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * (c) Loïck Piera <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * For the full copyright and license information, please view the LICENSE | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * file that was distributed with this source code. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | namespace Pyrech\ComposerChangelogs\UrlGenerator; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | use Pyrech\ComposerChangelogs\Version; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 15 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 16 |  |  | class GithubUrlGenerator extends AbstractUrlGenerator | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 17 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 18 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 19 |  |  |      * {@inheritdoc} | 
            
                                                                        
                            
            
                                    
            
            
                | 20 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 | 23 |  |     protected function getDomain() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 | 23 |  |         return 'github.com'; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 24 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 25 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 26 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 27 |  |  |      * {@inheritdoc} | 
            
                                                                        
                            
            
                                    
            
            
                | 28 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 | 17 |  |     public function generateCompareUrl($sourceUrlFrom, Version $versionFrom, $sourceUrlTo, Version $versionTo) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |         // Check if both urls come from the supported domain | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |         // It avoids problems when one url is from another domain or is local | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 | 17 |  |         if (!$this->supports($sourceUrlFrom) || !$this->supports($sourceUrlTo)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 | 2 |  |             return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 | 15 |  |         $sourceUrlFrom = $this->generateBaseUrl($sourceUrlFrom); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 | 15 |  |         $sourceUrlTo = $this->generateBaseUrl($sourceUrlTo); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |         // Check if comparison across forks is needed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 | 15 |  |         if ($sourceUrlFrom !== $sourceUrlTo) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 | 4 |  |             $repositoryFrom = $this->extractRepositoryInformation($sourceUrlFrom); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 | 4 |  |             $repositoryTo = $this->extractRepositoryInformation($sourceUrlTo); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 | 2 |  |             return sprintf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 | 2 |  |                 '%s/compare/%s:%s...%s:%s', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 | 2 |  |                 $sourceUrlTo, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 | 2 |  |                 $repositoryFrom['user'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 | 2 |  |                 $this->getCompareVersion($versionFrom), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 | 2 |  |                 $repositoryTo['user'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 | 2 |  |                 $this->getCompareVersion($versionTo) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 | 2 |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 | 11 |  |         return sprintf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 | 11 |  |             '%s/compare/%s...%s', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 | 11 |  |             $sourceUrlTo, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 | 11 |  |             $this->getCompareVersion($versionFrom), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 | 11 |  |             $this->getCompareVersion($versionTo) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 | 11 |  |         ); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 61 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 62 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 63 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 64 |  |  |      * {@inheritdoc} | 
            
                                                                        
                            
            
                                    
            
            
                | 65 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 | 11 |  |     public function generateReleaseUrl($sourceUrl, Version $version) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 | 11 |  |         if ($version->isDev()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 | 2 |  |             return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 | 9 |  |         return sprintf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 | 9 |  |             '%s/releases/tag/%s', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 | 9 |  |             $this->generateBaseUrl($sourceUrl), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 | 9 |  |             $version->getPretty() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 | 9 |  |         ); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 77 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 78 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 79 |  |  |  | 
            
                        
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.