Formatting

This commit is contained in:
Nabeel Shahzad
2019-05-12 17:37:22 -05:00
parent 8d6621e2a8
commit d65b74d7a0
2 changed files with 39 additions and 47 deletions
+25 -28
View File
@@ -8,33 +8,30 @@ return PhpCsFixer\Config::create()
->setHideProgress(true) ->setHideProgress(true)
->setUsingCache(false) ->setUsingCache(false)
->setRiskyAllowed(true) ->setRiskyAllowed(true)
->setRules( ->setRules([
[ '@PSR2' => true,
'@PSR2' => true, 'strict_param' => true,
'strict_param' => true, 'no_php4_constructor' => true,
'no_php4_constructor' => true, 'no_extra_blank_lines' => true,
'no_extra_blank_lines' => true, 'no_superfluous_elseif' => true,
'no_superfluous_elseif' => true, 'single_line_comment_style' => false,
'single_line_comment_style' => false, 'simple_to_complex_string_variable' => true,
'phpdoc_summary' => false, 'array_syntax' => [
'phpdoc_no_empty_return' => false, 'syntax' => 'short',
'simple_to_complex_string_variable' => true, ],
'array_syntax' => [ 'binary_operator_spaces' => [
'syntax' => 'short', 'align_double_arrow' => true,
],
/*
'blank_line_before_statement' => [
'statements' => [
'declare',
'for',
'return',
'throw',
'try',
], ],
'binary_operator_spaces' => [ ],
'align_double_arrow' => true, */
], ])
'blank_line_before_statement' => [
'statements' => [
'declare',
'if',
'for',
'return',
'throw',
'try',
],
],
]
)
->setFinder($finder); ->setFinder($finder);
+14 -19
View File
@@ -30,6 +30,7 @@ class ExportService extends Service
{ {
$writer = Writer::createFromPath($path, 'w+'); $writer = Writer::createFromPath($path, 'w+');
CharsetConverter::addTo($writer, 'utf-8', 'iso-8859-15'); CharsetConverter::addTo($writer, 'utf-8', 'iso-8859-15');
return $writer; return $writer;
} }
@@ -39,9 +40,9 @@ class ExportService extends Service
* @param Collection $collection * @param Collection $collection
* @param ImportExport $exporter * @param ImportExport $exporter
* *
* @return string
* @throws \League\Csv\CannotInsertRecord * @throws \League\Csv\CannotInsertRecord
* *
* @return string
*/ */
protected function runExport(Collection $collection, ImportExport $exporter): string protected function runExport(Collection $collection, ImportExport $exporter): string
{ {
@@ -71,14 +72,13 @@ class ExportService extends Service
* *
* @param Collection $aircraft * @param Collection $aircraft
* *
* @return mixed
* @throws \League\Csv\CannotInsertRecord * @throws \League\Csv\CannotInsertRecord
* *
* @return mixed
*/ */
public function exportAircraft($aircraft) public function exportAircraft($aircraft)
{ {
$exporter = new AircraftExporter(); return $this->runExport($aircraft, new AircraftExporter());
return $this->runExport($aircraft, $exporter);
} }
/** /**
@@ -86,14 +86,13 @@ class ExportService extends Service
* *
* @param Collection $airports * @param Collection $airports
* *
* @return mixed
* @throws \League\Csv\CannotInsertRecord * @throws \League\Csv\CannotInsertRecord
* *
* @return mixed
*/ */
public function exportAirports($airports) public function exportAirports($airports)
{ {
$exporter = new AirportExporter(); return $this->runExport($airports, new AirportExporter());
return $this->runExport($airports, $exporter);
} }
/** /**
@@ -101,14 +100,13 @@ class ExportService extends Service
* *
* @param Collection $expenses * @param Collection $expenses
* *
* @return mixed
* @throws \League\Csv\CannotInsertRecord * @throws \League\Csv\CannotInsertRecord
* *
* @return mixed
*/ */
public function exportExpenses($expenses) public function exportExpenses($expenses)
{ {
$exporter = new ExpenseExporter(); return $this->runExport($expenses, new ExpenseExporter());
return $this->runExport($expenses, $exporter);
} }
/** /**
@@ -116,14 +114,13 @@ class ExportService extends Service
* *
* @param Collection $fares * @param Collection $fares
* *
* @return mixed
* @throws \League\Csv\CannotInsertRecord * @throws \League\Csv\CannotInsertRecord
* *
* @return mixed
*/ */
public function exportFares($fares) public function exportFares($fares)
{ {
$exporter = new FareExporter(); return $this->runExport($fares, new FareExporter());
return $this->runExport($fares, $exporter);
} }
/** /**
@@ -131,14 +128,13 @@ class ExportService extends Service
* *
* @param Collection $flights * @param Collection $flights
* *
* @return mixed
* @throws \League\Csv\CannotInsertRecord * @throws \League\Csv\CannotInsertRecord
* *
* @return mixed
*/ */
public function exportFlights($flights) public function exportFlights($flights)
{ {
$exporter = new FlightExporter(); return $this->runExport($flights, new FlightExporter());
return $this->runExport($flights, $exporter);
} }
/** /**
@@ -146,13 +142,12 @@ class ExportService extends Service
* *
* @param Collection $subfleets * @param Collection $subfleets
* *
* @return mixed
* @throws \League\Csv\CannotInsertRecord * @throws \League\Csv\CannotInsertRecord
* *
* @return mixed
*/ */
public function exportSubfleets($subfleets) public function exportSubfleets($subfleets)
{ {
$exporter = new SubfleetExporter(); return $this->runExport($subfleets, new SubfleetExporter());
return $this->runExport($subfleets, $exporter);
} }
} }