Skip to content
This repository has been archived by the owner on Feb 16, 2022. It is now read-only.

Commit

Permalink
Merge pull request #3 from rinvex/analysis-874Zoj
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
Omranic committed Jan 1, 2019
2 parents 7390678 + 4b8af4e commit df7d591
Showing 1 changed file with 26 additions and 17 deletions.
43 changes: 26 additions & 17 deletions src/NewCommand.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Cortex\Installer\Console;

use ZipArchive;
Expand Down Expand Up @@ -34,8 +36,9 @@ protected function configure()
/**
* Execute the command.
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
*
* @return void
*/
protected function execute(InputInterface $input, OutputInterface $output)
Expand Down Expand Up @@ -96,12 +99,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
/**
* Verify that the application does not already exist.
*
* @param string $directory
* @param string $directory
*
* @return void
*/
protected function verifyApplicationDoesntExist($directory)
{
if ((is_dir($directory) || is_file($directory)) && $directory != getcwd()) {
if ((is_dir($directory) || is_file($directory)) && $directory !== getcwd()) {
throw new RuntimeException('Application already exists!');
}
}
Expand All @@ -119,8 +123,9 @@ protected function makeFilename()
/**
* Download the temporary Zip to the given file.
*
* @param string $zipFile
* @param string $version
* @param string $zipFile
* @param string $version
*
* @return $this
*/
protected function download($zipFile, $version = 'master')
Expand All @@ -134,7 +139,7 @@ protected function download($zipFile, $version = 'master')
break;
}

$response = (new Client)->get('https://github.com/rinvex/cortex/archive/'.$filename);
$response = (new Client())->get('https://github.com/rinvex/cortex/archive/'.$filename);

file_put_contents($zipFile, $response->getBody());

Expand All @@ -144,13 +149,14 @@ protected function download($zipFile, $version = 'master')
/**
* Extract the Zip file into the given directory.
*
* @param string $zipFile
* @param string $directory
* @param string $zipFile
* @param string $directory
*
* @return $this
*/
protected function extract($zipFile, $directory)
{
$archive = new ZipArchive;
$archive = new ZipArchive();

$archive->open($zipFile);

Expand All @@ -164,7 +170,8 @@ protected function extract($zipFile, $directory)
/**
* Clean-up the Zip file.
*
* @param string $zipFile
* @param string $zipFile
*
* @return $this
*/
protected function cleanUp($zipFile)
Expand All @@ -179,17 +186,18 @@ protected function cleanUp($zipFile)
/**
* Make sure the storage and bootstrap cache directories are writable.
*
* @param string $appDirectory
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @param string $appDirectory
* @param \Symfony\Component\Console\Output\OutputInterface $output
*
* @return $this
*/
protected function prepareWritableDirectories($appDirectory, OutputInterface $output)
{
$filesystem = new Filesystem;
$filesystem = new Filesystem();

try {
$filesystem->chmod($appDirectory.DIRECTORY_SEPARATOR."bootstrap/cache", 0755, 0000, true);
$filesystem->chmod($appDirectory.DIRECTORY_SEPARATOR."storage", 0755, 0000, true);
$filesystem->chmod($appDirectory.DIRECTORY_SEPARATOR.'bootstrap/cache', 0755, 0000, true);
$filesystem->chmod($appDirectory.DIRECTORY_SEPARATOR.'storage', 0755, 0000, true);
} catch (IOExceptionInterface $e) {
$output->writeln('<comment>You should verify that the "storage" and "bootstrap/cache" directories are writable.</comment>');
}
Expand All @@ -200,7 +208,8 @@ protected function prepareWritableDirectories($appDirectory, OutputInterface $ou
/**
* Get the version that should be downloaded.
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Input\InputInterface $input
*
* @return string
*/
protected function getVersion(InputInterface $input)
Expand Down

0 comments on commit df7d591

Please sign in to comment.