PHP Class Symfony\Installer\DownloadCommand

Author: Christophe Coevoet ([email protected])
Author: Javier Eguiluz ([email protected])
Inheritance: extends Symfony\Component\Console\Command\Command
Mostrar archivo Open project: symfony/symfony-installer Class Usage Examples

Protected Properties

Property Type Description
$composerManager Symfony\Installer\Manager\ComposerManager
$downloadedFilePath The path to the downloaded file
$fs To dump content to a file
$latestInstallerVersion The latest installer version
$localInstallerVersion The version of the local installer being executed
$output To output content
$projectDir The project dir
$projectName The project name
$requirementsErrors The requirement errors
$version The version to install

Protected Methods

Method Description
checkInstallerVersion ( ) Checks if the installed version is the latest one and displays some warning messages if not.
checkPermissions ( ) Checks if the installer has enough permissions to create the project.
checkProjectName ( ) Checks the project name.
checkSymfonyRequirements ( ) Checks if environment meets symfony requirements.
createGitIgnore ( ) Creates the appropriate .gitignore file for a Symfony project if it doesn't exist.
download ( ) Chooses the best compressed file format to download (ZIP or TGZ) depending upon the available operating system uncompressing commands and the enabled PHP extensions and it downloads the file.
extract ( ) Extracts the compressed Symfony file (ZIP or TGZ) using the native operating system commands if available or PHP code otherwise.
generateRandomSecret ( ) : string Generates a good random value for Symfony's 'secret' option.
getDownloadedApplicationType ( ) : string Returns the type of the downloaded application in a human readable format.
getErrorMessage ( Requirement $requirement, integer $lineSize = 70 ) : string Formats the error message contained in the given Requirement item using the optional line length provided.
getExecutedCommand ( ) : string Returns the executed command with all its arguments (e.g. "symfony new blog 2.8.1").
getGuzzleClient ( ) : Client Returns the Guzzle client configured according to the system environment (e.g. it takes into account whether it should use a proxy server or not).
getInstalledSymfonyVersion ( ) : string Returns the full Symfony version number of the project by getting it from the composer.lock file.
getRemoteFileUrl ( ) : string Returns the absolute URL of the remote file downloaded by the command.
getUrlContents ( string $url ) : string Returns the contents obtained by making a GET request to the given URL.
initialize ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
isEmptyDirectory ( string $dir ) : boolean Checks whether the given directory is empty or not.
isInstallerUpdated ( ) : boolean
isSymfony3 ( ) : boolean Checks that the asked version is in the 3.x branch.
updateComposerConfig ( ) Updates the composer.json file to provide better values for some of the default configuration values.

Private Methods

Method Description
enableSignalHandler ( ) Enables the signal handler.
getSymfonyRequirementsFilePath ( )

Method Details

checkInstallerVersion() protected method

Checks if the installed version is the latest one and displays some warning messages if not.
protected checkInstallerVersion ( )

checkPermissions() protected method

Checks if the installer has enough permissions to create the project.
protected checkPermissions ( )

checkProjectName() protected method

Checks the project name.
protected checkProjectName ( )

checkSymfonyRequirements() protected method

Checks if environment meets symfony requirements.
protected checkSymfonyRequirements ( )

createGitIgnore() protected method

Creates the appropriate .gitignore file for a Symfony project if it doesn't exist.
protected createGitIgnore ( )

download() protected method

Chooses the best compressed file format to download (ZIP or TGZ) depending upon the available operating system uncompressing commands and the enabled PHP extensions and it downloads the file.
protected download ( )

extract() protected method

Extracts the compressed Symfony file (ZIP or TGZ) using the native operating system commands if available or PHP code otherwise.
protected extract ( )

generateRandomSecret() protected method

Generates a good random value for Symfony's 'secret' option.
protected generateRandomSecret ( ) : string
return string The randomly generated secret

getDownloadedApplicationType() abstract protected method

It's mainly used to display readable error messages.
abstract protected getDownloadedApplicationType ( ) : string
return string The type of the downloaded application in a human readable format

getErrorMessage() protected method

Formats the error message contained in the given Requirement item using the optional line length provided.
protected getErrorMessage ( Requirement $requirement, integer $lineSize = 70 ) : string
$requirement Requirement The Symfony requirements
$lineSize integer The maximum line length
return string The formatted error message

getExecutedCommand() protected method

Returns the executed command with all its arguments (e.g. "symfony new blog 2.8.1").
protected getExecutedCommand ( ) : string
return string The executed command with all its arguments

getGuzzleClient() protected method

Returns the Guzzle client configured according to the system environment (e.g. it takes into account whether it should use a proxy server or not).
protected getGuzzleClient ( ) : Client
return GuzzleHttp\Client The configured Guzzle client

getInstalledSymfonyVersion() protected method

Returns the full Symfony version number of the project by getting it from the composer.lock file.
protected getInstalledSymfonyVersion ( ) : string
return string The installed Symfony version

getRemoteFileUrl() abstract protected method

Returns the absolute URL of the remote file downloaded by the command.
abstract protected getRemoteFileUrl ( ) : string
return string The absolute URL of the remote file downloaded by the command

getUrlContents() protected method

Returns the contents obtained by making a GET request to the given URL.
protected getUrlContents ( string $url ) : string
$url string The URL to get the contents from
return string The obtained contents of $url

initialize() protected method

protected initialize ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface

isEmptyDirectory() protected method

Checks whether the given directory is empty or not.
protected isEmptyDirectory ( string $dir ) : boolean
$dir string the path of the directory to check
return boolean Whether the given directory is empty

isInstallerUpdated() protected method

protected isInstallerUpdated ( ) : boolean
return boolean Whether the installed version is the latest one

isSymfony3() protected method

Checks that the asked version is in the 3.x branch.
protected isSymfony3 ( ) : boolean
return boolean Whether is Symfony3

updateComposerConfig() protected method

Updates the composer.json file to provide better values for some of the default configuration values.
protected updateComposerConfig ( )

Property Details

$composerManager protected_oe property

protected ComposerManager,Symfony\Installer\Manager $composerManager
return Symfony\Installer\Manager\ComposerManager

$downloadedFilePath protected_oe property

The path to the downloaded file
protected $downloadedFilePath

$fs protected_oe property

To dump content to a file
protected $fs

$latestInstallerVersion protected_oe property

The latest installer version
protected $latestInstallerVersion

$localInstallerVersion protected_oe property

The version of the local installer being executed
protected $localInstallerVersion

$output protected_oe property

To output content
protected $output

$projectDir protected_oe property

The project dir
protected $projectDir

$projectName protected_oe property

The project name
protected $projectName

$requirementsErrors protected_oe property

The requirement errors
protected $requirementsErrors

$version protected_oe property

The version to install
protected $version