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

53
.php_cs
View File

@ -8,33 +8,30 @@ return PhpCsFixer\Config::create()
->setHideProgress(true)
->setUsingCache(false)
->setRiskyAllowed(true)
->setRules(
[
'@PSR2' => true,
'strict_param' => true,
'no_php4_constructor' => true,
'no_extra_blank_lines' => true,
'no_superfluous_elseif' => true,
'single_line_comment_style' => false,
'phpdoc_summary' => false,
'phpdoc_no_empty_return' => false,
'simple_to_complex_string_variable' => true,
'array_syntax' => [
'syntax' => 'short',
->setRules([
'@PSR2' => true,
'strict_param' => true,
'no_php4_constructor' => true,
'no_extra_blank_lines' => true,
'no_superfluous_elseif' => true,
'single_line_comment_style' => false,
'simple_to_complex_string_variable' => true,
'array_syntax' => [
'syntax' => 'short',
],
'binary_operator_spaces' => [
'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);

View File

@ -30,6 +30,7 @@ class ExportService extends Service
{
$writer = Writer::createFromPath($path, 'w+');
CharsetConverter::addTo($writer, 'utf-8', 'iso-8859-15');
return $writer;
}
@ -39,9 +40,9 @@ class ExportService extends Service
* @param Collection $collection
* @param ImportExport $exporter
*
* @return string
* @throws \League\Csv\CannotInsertRecord
*
* @return string
*/
protected function runExport(Collection $collection, ImportExport $exporter): string
{
@ -71,14 +72,13 @@ class ExportService extends Service
*
* @param Collection $aircraft
*
* @return mixed
* @throws \League\Csv\CannotInsertRecord
*
* @return mixed
*/
public function exportAircraft($aircraft)
{
$exporter = new AircraftExporter();
return $this->runExport($aircraft, $exporter);
return $this->runExport($aircraft, new AircraftExporter());
}
/**
@ -86,14 +86,13 @@ class ExportService extends Service
*
* @param Collection $airports
*
* @return mixed
* @throws \League\Csv\CannotInsertRecord
*
* @return mixed
*/
public function exportAirports($airports)
{
$exporter = new AirportExporter();
return $this->runExport($airports, $exporter);
return $this->runExport($airports, new AirportExporter());
}
/**
@ -101,14 +100,13 @@ class ExportService extends Service
*
* @param Collection $expenses
*
* @return mixed
* @throws \League\Csv\CannotInsertRecord
*
* @return mixed
*/
public function exportExpenses($expenses)
{
$exporter = new ExpenseExporter();
return $this->runExport($expenses, $exporter);
return $this->runExport($expenses, new ExpenseExporter());
}
/**
@ -116,14 +114,13 @@ class ExportService extends Service
*
* @param Collection $fares
*
* @return mixed
* @throws \League\Csv\CannotInsertRecord
*
* @return mixed
*/
public function exportFares($fares)
{
$exporter = new FareExporter();
return $this->runExport($fares, $exporter);
return $this->runExport($fares, new FareExporter());
}
/**
@ -131,14 +128,13 @@ class ExportService extends Service
*
* @param Collection $flights
*
* @return mixed
* @throws \League\Csv\CannotInsertRecord
*
* @return mixed
*/
public function exportFlights($flights)
{
$exporter = new FlightExporter();
return $this->runExport($flights, $exporter);
return $this->runExport($flights, new FlightExporter());
}
/**
@ -146,13 +142,12 @@ class ExportService extends Service
*
* @param Collection $subfleets
*
* @return mixed
* @throws \League\Csv\CannotInsertRecord
*
* @return mixed
*/
public function exportSubfleets($subfleets)
{
$exporter = new SubfleetExporter();
return $this->runExport($subfleets, $exporter);
return $this->runExport($subfleets, new SubfleetExporter());
}
}