PHP Class Pyrech\ComposerChangelogs\UrlGenerator\GitBasedUrlGenerator

Inheritance: implements Pyrech\ComposerChangelogs\UrlGenerator\UrlGenerator
Show file Open project: pyrech/composer-changelogs

Public Methods

Method Description
supports ( $sourceUrl )

Protected Methods

Method Description
extractRepositoryInformation ( string $sourceUrl ) : array Extracts information like user and repository from the http url.
generateBaseUrl ( string $sourceUrl ) : string Generates the canonical http url for a repository.
getCompareVersion ( Version $version ) : string Get the version to use for the compare url.
getDomain ( ) : string Returns the domain of the service, like "example.org".

Private Methods

Method Description
isSshUrl ( string $url ) : string Returns whether an url uses a ssh git protocol.
transformSshUrlIntoHttp ( string $url ) : string Transform an ssh git url into an http one.

Method Details

extractRepositoryInformation() protected method

Extracts information like user and repository from the http url.
protected extractRepositoryInformation ( string $sourceUrl ) : array
$sourceUrl string
return array

generateBaseUrl() protected method

It ensures there is no .git part in http url. It also supports ssh urls by converting them in their http equivalent format.
protected generateBaseUrl ( string $sourceUrl ) : string
$sourceUrl string
return string

getCompareVersion() protected method

For dev versions, it returns the commit short hash in full pretty version.
protected getCompareVersion ( Version $version ) : string
$version Pyrech\ComposerChangelogs\Version
return string

getDomain() abstract protected method

Returns the domain of the service, like "example.org".
abstract protected getDomain ( ) : string
return string

supports() public method

public supports ( $sourceUrl )