PHP Class Symfony\Installer\DownloadCommand

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

Protected Properties

Свойство 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

Méthodes protégées

Méthode 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

Méthode Description
enableSignalHandler ( ) Enables the signal handler.
getSymfonyRequirementsFilePath ( )

Method Details

checkInstallerVersion() protected méthode

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

checkPermissions() protected méthode

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

checkProjectName() protected méthode

Checks the project name.
protected checkProjectName ( )

checkSymfonyRequirements() protected méthode

Checks if environment meets symfony requirements.
protected checkSymfonyRequirements ( )

createGitIgnore() protected méthode

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

download() protected méthode

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 méthode

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

generateRandomSecret() protected méthode

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

getDownloadedApplicationType() abstract protected méthode

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

getErrorMessage() protected méthode

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
Résultat string The formatted error message

getExecutedCommand() protected méthode

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

getGuzzleClient() protected méthode

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
Résultat GuzzleHttp\Client The configured Guzzle client

getInstalledSymfonyVersion() protected méthode

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

getRemoteFileUrl() abstract protected méthode

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

getUrlContents() protected méthode

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
Résultat string The obtained contents of $url

initialize() protected méthode

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 méthode

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

isInstallerUpdated() protected méthode

protected isInstallerUpdated ( ) : boolean
Résultat boolean Whether the installed version is the latest one

isSymfony3() protected méthode

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

updateComposerConfig() protected méthode

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
Résultat 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