3838abstract class DownloadCommand extends Command
3939{
4040 /**
41- * @var Filesystem
41+ * @var Filesystem To dump content to a file
4242 */
4343 protected $ fs ;
4444
4545 /**
46- * @var OutputInterface
46+ * @var OutputInterface To output content
4747 */
4848 protected $ output ;
4949
5050 /**
51- * @var string
51+ * @var string The project name
5252 */
5353 protected $ projectName ;
5454
5555 /**
56- * @var string
56+ * @var string The project dir
5757 */
5858 protected $ projectDir ;
5959
6060 /**
61- * @var string
61+ * @var string The version to install
6262 */
6363 protected $ version = 'latest ' ;
6464
6565 /**
66- * @var string
66+ * @var string The path to the downloaded file
6767 */
6868 protected $ downloadedFilePath ;
6969
7070 /**
71- * @var array
71+ * @var array The requirement errors
7272 */
7373 protected $ requirementsErrors = array ();
7474
7575 /**
7676 * Returns the type of the downloaded application in a human readable format.
7777 * It's mainly used to display readable error messages.
7878 *
79- * @return string
79+ * @return string The type of the downloaded application in a human readable format
8080 */
8181 abstract protected function getDownloadedApplicationType ();
8282
8383 /**
8484 * Returns the absolute URL of the remote file downloaded by the command.
85+ *
86+ * @return string The absolute URL of the remote file downloaded by the command
8587 */
8688 abstract protected function getRemoteFileUrl ();
8789
90+ /**
91+ * {@inheritdoc}
92+ */
8893 protected function initialize (InputInterface $ input , OutputInterface $ output )
8994 {
9095 $ this ->output = $ output ;
@@ -100,7 +105,7 @@ protected function initialize(InputInterface $input, OutputInterface $output)
100105 *
101106 * @return $this
102107 *
103- * @throws \RuntimeException if the Symfony archive could not be downloaded
108+ * @throws \RuntimeException If the Symfony archive could not be downloaded
104109 */
105110 protected function download ()
106111 {
@@ -189,6 +194,13 @@ protected function download()
189194 return $ this ;
190195 }
191196
197+ /**
198+ * Checks the project name.
199+ *
200+ * @return $this
201+ *
202+ * @throws \RuntimeException If there is already a projet in the specified directory
203+ */
192204 protected function checkProjectName ()
193205 {
194206 if (is_dir ($ this ->projectDir ) && !$ this ->isEmptyDirectory ($ this ->projectDir )) {
@@ -206,7 +218,9 @@ protected function checkProjectName()
206218 * Returns the Guzzle client configured according to the system environment
207219 * (e.g. it takes into account whether it should use a proxy server or not).
208220 *
209- * @return Client
221+ * @return Client The configured Guzzle client
222+ *
223+ * @throws \RuntimeException If the php-curl is not installed or the allow_url_fopen ini setting is not set
210224 */
211225 protected function getGuzzleClient ()
212226 {
@@ -234,9 +248,9 @@ protected function getGuzzleClient()
234248 * Extracts the compressed Symfony file (ZIP or TGZ) using the
235249 * native operating system commands if available or PHP code otherwise.
236250 *
237- * @return DownloadCommand
251+ * @return $this
238252 *
239- * @throws \RuntimeException if the downloaded archive could not be extracted
253+ * @throws \RuntimeException If the downloaded archive could not be extracted
240254 */
241255 protected function extract ()
242256 {
@@ -341,7 +355,7 @@ protected function createGitIgnore()
341355 * Returns the full Symfony version number of the project by getting
342356 * it from the composer.lock file.
343357 *
344- * @return string
358+ * @return string The installed Symfony version
345359 */
346360 protected function getInstalledSymfonyVersion ()
347361 {
@@ -360,6 +374,10 @@ protected function getInstalledSymfonyVersion()
360374
361375 /**
362376 * Checks if the installer has enough permissions to create the project.
377+ *
378+ * @return $this
379+ *
380+ * @throws IOException If the installer does not have enough permissions to write to the project parent directory
363381 */
364382 protected function checkPermissions ()
365383 {
@@ -399,7 +417,7 @@ protected function formatSize($bytes)
399417 * @param \Requirement $requirement The Symfony requirements
400418 * @param int $lineSize The maximum line length
401419 *
402- * @return string
420+ * @return string The formatted error message
403421 */
404422 protected function getErrorMessage (\Requirement $ requirement , $ lineSize = 70 )
405423 {
@@ -416,7 +434,7 @@ protected function getErrorMessage(\Requirement $requirement, $lineSize = 70)
416434 /**
417435 * Generates a good random value for Symfony's 'secret' option.
418436 *
419- * @return string
437+ * @return string The randomly generated secret
420438 */
421439 protected function generateRandomSecret ()
422440 {
@@ -431,7 +449,7 @@ protected function generateRandomSecret()
431449 * Returns the executed command with all its arguments
432450 * (e.g. "symfony new blog 2.8.1").
433451 *
434- * @return string
452+ * @return string The executed command with all its arguments
435453 */
436454 protected function getExecutedCommand ()
437455 {
@@ -458,7 +476,7 @@ protected function getExecutedCommand()
458476 *
459477 * @param string $dir the path of the directory to check
460478 *
461- * @return bool
479+ * @return bool Whether the given directory is empty
462480 */
463481 protected function isEmptyDirectory ($ dir )
464482 {
@@ -470,7 +488,7 @@ protected function isEmptyDirectory($dir)
470488 /**
471489 * Checks that the asked version is in the 3.x branch.
472490 *
473- * @return bool
491+ * @return bool Wheter is Symfony3
474492 */
475493 protected function isSymfony3 ()
476494 {
@@ -502,7 +520,7 @@ protected function checkInstallerVersion()
502520 }
503521
504522 /**
505- * @return boolean Whether the installed version is the latest one
523+ * @return bool Whether the installed version is the latest one
506524 */
507525 protected function isInstallerUpdated ()
508526 {
@@ -515,9 +533,9 @@ protected function isInstallerUpdated()
515533 /**
516534 * Returns the contents obtained by making a GET request to the given URL.
517535 *
518- * @param string $url
536+ * @param string $url The URL to get the contents from
519537 *
520- * @return string
538+ * @return string The obtained contents of $url
521539 */
522540 protected function getUrlContents ($ url )
523541 {
@@ -526,6 +544,11 @@ protected function getUrlContents($url)
526544 return $ client ->get ($ url )->getBody ()->getContents ();
527545 }
528546
547+ /**
548+ * Enables the signal handler.
549+ *
550+ * @throws AbortException If the execution has been aborted with SIGINT signal.
551+ */
529552 private function enableSignalHandler ()
530553 {
531554 if (!function_exists ('pcntl_signal ' )) {
0 commit comments