diff --git a/README.md b/README.md index 8ce7d8c..4d3ef28 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md) [![Build Status](https://img.shields.io/travis/RamyTalal/Exporter/master.svg?style=flat-square)](https://travis-ci.org/RamyTalal/Exporter) [![Quality Score](https://img.shields.io/scrutinizer/g/RamyTalal/Exporter.svg?style=flat-square)](https://scrutinizer-ci.com/g/RamyTalal/Exporter) -[![StyleCI](https://styleci.io/repos/54327422/shield?branch=master)](https://styleci.io/repos/80513668) +[![StyleCI](https://styleci.io/repos/54327422/shield?branch=master)](https://styleci.io/repos/54327422) [![Total Downloads](https://img.shields.io/packagist/dt/RamyTalal/Exporter.svg?style=flat-square)](https://packagist.org/packages/RamyTalal/Exporter) Export the Laravel environment file to a capable web server format. diff --git a/src/Console/Command/Export.php b/src/Console/Command/Export.php index fb43a92..a644b1b 100644 --- a/src/Console/Command/Export.php +++ b/src/Console/Command/Export.php @@ -2,9 +2,9 @@ namespace Talal\Exporter\Console\Command; +use Talal\Exporter\Exporter; use Illuminate\Console\Command; use Illuminate\Filesystem\Filesystem; -use Talal\Exporter\Exporter; class Export extends Command { @@ -46,7 +46,7 @@ public function __construct(Filesystem $filesystem) public function handle() { $fileContents = $this->filesystem->get( - $this->laravel->basePath() . '/' . $this->option('file') + $this->laravel->basePath().'/'.$this->option('file') ); $this->export($fileContents); @@ -65,6 +65,7 @@ protected function export($fileContents) if (! class_exists($server)) { $this->error('The provided server is not exportable.'); + return 0; } diff --git a/src/Exporter.php b/src/Exporter.php index d713910..33b9430 100644 --- a/src/Exporter.php +++ b/src/Exporter.php @@ -21,23 +21,23 @@ public function __construct(Output $output) $this->setOutput($output); } - /** - * Set the output converter - * - * @param Output $output - */ - public function setOutput(Output $output) + /** + * Set the output converter. + * + * @param Output $output + */ + public function setOutput(Output $output) { $this->output = $output; } - /** - * Return the converted environment variables - * - * @return string - */ - public function output() : string + /** + * Return the converted environment variables. + * + * @return string + */ + public function output() : string { return $this->output->generate(); } -} \ No newline at end of file +} diff --git a/src/Output/Apache.php b/src/Output/Apache.php index deb8987..fbec2d2 100644 --- a/src/Output/Apache.php +++ b/src/Output/Apache.php @@ -5,14 +5,14 @@ class Apache extends Output { /** - * @inheritdoc + * {@inheritdoc} */ public function generate() : string { $output = ''; foreach ($this->keys as $key => $match) { - $output .= sprintf('SetEnv %s "%s"', $match, $this->values[$key]) . PHP_EOL; + $output .= sprintf('SetEnv %s "%s"', $match, $this->values[$key]).PHP_EOL; } return rtrim($output, PHP_EOL); diff --git a/src/Output/Bash.php b/src/Output/Bash.php index 7e98e76..63e8e33 100644 --- a/src/Output/Bash.php +++ b/src/Output/Bash.php @@ -5,14 +5,14 @@ class Bash extends Output { /** - * @inheritdoc + * {@inheritdoc} */ public function generate() : string { $output = ''; foreach ($this->keys as $key => $match) { - $output .= sprintf('export %s="%s"', $match, $this->values[$key]) . PHP_EOL; + $output .= sprintf('export %s="%s"', $match, $this->values[$key]).PHP_EOL; } return rtrim($output, PHP_EOL); diff --git a/src/Output/Iis.php b/src/Output/Iis.php index 3c6f10c..13114d2 100644 --- a/src/Output/Iis.php +++ b/src/Output/Iis.php @@ -5,7 +5,7 @@ class Iis extends Output { /** - * @inheritdoc + * {@inheritdoc} */ public function generate() : string { diff --git a/src/Output/Lighttpd.php b/src/Output/Lighttpd.php index 2a814bf..2012748 100644 --- a/src/Output/Lighttpd.php +++ b/src/Output/Lighttpd.php @@ -5,7 +5,7 @@ class Lighttpd extends Output { /** - * @inheritdoc + * {@inheritdoc} */ public function generate() : string { @@ -15,9 +15,9 @@ public function generate() : string $lines[] = sprintf("\t\"%s\" => \"%s\"", $match, $this->values[$key]); } - $output = 'setenv.add-environment = (' . PHP_EOL; - $output .= implode(',' . PHP_EOL, $lines); - $output .= PHP_EOL . ')'; + $output = 'setenv.add-environment = ('.PHP_EOL; + $output .= implode(','.PHP_EOL, $lines); + $output .= PHP_EOL.')'; return $output; } diff --git a/src/Output/Nginx.php b/src/Output/Nginx.php index 715674e..fe321f6 100644 --- a/src/Output/Nginx.php +++ b/src/Output/Nginx.php @@ -5,14 +5,14 @@ class Nginx extends Output { /** - * @inheritdoc + * {@inheritdoc} */ public function generate() : string { $output = ''; foreach ($this->keys as $key => $match) { - $output .= sprintf('fastcgi_param %s "%s";', $match, $this->values[$key]) . PHP_EOL; + $output .= sprintf('fastcgi_param %s "%s";', $match, $this->values[$key]).PHP_EOL; } return rtrim($output, PHP_EOL); diff --git a/tests/ExporterTest.php b/tests/ExporterTest.php index 4a3b525..3507753 100644 --- a/tests/ExporterTest.php +++ b/tests/ExporterTest.php @@ -2,21 +2,21 @@ namespace Talal\Exporter\Tests; -use PHPUnit\Framework\TestCase; use Talal\Exporter\Exporter; +use PHPUnit\Framework\TestCase; use Talal\Exporter\Output\Nginx; class ExporterTest extends TestCase { public function testHasValidEnvironment() { - $fileContents = <<generate(); - $expected = <<generate(); - $expected = <<generate(); - $expected = << diff --git a/tests/Output/LighttpdTest.php b/tests/Output/LighttpdTest.php index 2528f9d..274feb4 100644 --- a/tests/Output/LighttpdTest.php +++ b/tests/Output/LighttpdTest.php @@ -9,7 +9,7 @@ class LighttpdTest extends TestCase { public function testGeneratedOutput() { - $fileContents = <<generate(); - $expected = << "value1", "key2" => "value2" diff --git a/tests/Output/NginxTest.php b/tests/Output/NginxTest.php index 9d8458a..b13a485 100644 --- a/tests/Output/NginxTest.php +++ b/tests/Output/NginxTest.php @@ -9,7 +9,7 @@ class NginxTest extends TestCase { public function testGeneratedOutput() { - $fileContents = <<generate(); - $expected = <<