Skip to content

Commit

Permalink
Fix concat_space [WEB-759]
Browse files Browse the repository at this point in the history
  • Loading branch information
IllyaMoskvin committed Jul 20, 2019
1 parent 737ad4e commit 2c6d79a
Show file tree
Hide file tree
Showing 40 changed files with 171 additions and 163 deletions.
9 changes: 9 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ return PhpCsFixer\Config::create()
'single_item_single_line' => true,
'single_line' => false,
],
'class_keyword_remove' => false,
'combine_consecutive_issets' => false,
'combine_consecutive_unsets' => false,
// 'combine_nested_dirname' => true,
// 'comment_to_phpdoc' => true,
'compact_nullable_typehint' => true,
'concat_space' => [
'spacing' => 'one',
],
])
->setFinder($finder)
;
2 changes: 1 addition & 1 deletion app/Console/Commands/Docs/CreateEndpointDocs.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function handle()
}
}

$doc .= "> Generated by `php artisan docs:endpoints` on " .Carbon::now() ."\n";
$doc .= "> Generated by `php artisan docs:endpoints` on " . Carbon::now() . "\n";

Storage::disk('local')->put('ENDPOINTS.md', $doc);

Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Docs/CreateFieldsDocs.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function handle()
}
}

$doc .= "> Generated by `php artisan docs:fields` on " .Carbon::now() ."\n";
$doc .= "> Generated by `php artisan docs:fields` on " . Carbon::now() . "\n";

Storage::disk('local')->put('FIELDS.md', $doc);

Expand Down
16 changes: 8 additions & 8 deletions app/Console/Commands/Docs/CreateSwaggerDoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ public function handle()
$doc .= " \"info\": {\n";
$doc .= " \"title\": \"Art Institution of Chicago API\",\n";
$doc .= " \"description\": \"An API for an aggregator of Art Institute of Chicago public data. ";
$doc .= "This documentation was generated by `php artisan docs:swagger` on " .Carbon::now() ."\",\n";
$doc .= "This documentation was generated by `php artisan docs:swagger` on " . Carbon::now() . "\",\n";
$doc .= " \"termsOfService\": \"http://www.artic.edu/terms/terms-and-conditions\",\n";
$doc .= " \"contact\": {\n";
$doc .= " \"email\": \"museumtechnology@artic.edu\"\n";
$doc .= " },\n";
$doc .= " \"license\": {\n";
$doc .= " \"name\": \"\"\n";
$doc .= " },\n";
$doc .= " \"version\": \"" .config('aic.version', '1.0.0') ."\"\n";
$doc .= " \"version\": \"" . config('aic.version', '1.0.0') . "\"\n";
$doc .= " },\n";
$doc .= " \"host\": \"" .parse_url(config('app.url'), PHP_URL_HOST) ."\",\n";
$doc .= " \"host\": \"" . parse_url(config('app.url'), PHP_URL_HOST) . "\",\n";
$doc .= " \"basePath\": \"/api/v1\",\n";
$doc .= " \"schemes\": [\n";
$doc .= " \"http\"\n";
Expand Down Expand Up @@ -172,14 +172,14 @@ public function handle()

foreach ($params as $param => $description)
{
$doc .= " \"" .$param ."\": {\n";
$doc .= " \"name\": \"" .$param ."\",\n";
$doc .= " \"" . $param . "\": {\n";
$doc .= " \"name\": \"" . $param . "\",\n";
$doc .= " \"in\": \"query\",\n";
$doc .= " \"description\": \"" .$description ."\",\n";
$doc .= " \"description\": \"" . $description . "\",\n";
$doc .= " \"schema\": {\n";
$doc .= " \"type\": \"" .($param == 'limit' || $param == 'page' ? 'integer' : 'string') ."\"\n";
$doc .= " \"type\": \"" . ($param == 'limit' || $param == 'page' ? 'integer' : 'string') . "\"\n";
$doc .= " }\n";
$doc .= " }" .($description !== end($params) ? "," : "") ."\n";
$doc .= " }" . ($description !== end($params) ? "," : "") . "\n";
}

$doc .= " },\n";
Expand Down
8 changes: 4 additions & 4 deletions app/Console/Commands/Import/ImportDigitalLabels.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,22 @@ public function handle()

private function sourceExhibitionJson()
{
return env('DIGITAL_LABELS_JSON_ROOT') .'/public/exhibitions';
return env('DIGITAL_LABELS_JSON_ROOT') . '/public/exhibitions';
}

private function sourceLabelJson($id)
{
return env('DIGITAL_LABELS_JSON_ROOT') ."/public/experience/{$id}/content/published";
return env('DIGITAL_LABELS_JSON_ROOT') . "/public/experience/{$id}/content/published";
}

private function exhibitionJson()
{
return $this->folderName .'/exhibitions.json';
return $this->folderName . '/exhibitions.json';
}

private function labelJson($id)
{
return $this->folderName ."/label-{$id}.json";
return $this->folderName . "/label-{$id}.json";
}

private function downloadLabels()
Expand Down
17 changes: 8 additions & 9 deletions app/Console/Commands/Import/ImportUlan.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function handle()
// Then, loop through them in a memory-friendly way
foreach( $agents->cursor() as $agent ) {

$this->info('Trying agent #' .$agent->citi_id .', ' .$agent->title);
$this->info('Trying agent #' . $agent->citi_id . ', ' . $agent->title);

// Query ulan service with birth date
$result = $this->fetchUlan($agent, $agent->birth_date, null);
Expand Down Expand Up @@ -64,13 +64,12 @@ public function handle()

private function fetchUlan($agent, $birth_date = 0, $death_date = 0)
{
$url = env('ULAN_DATA_SERVICE_URL') .
'?q=' . urlencode($agent->title) .
($birth_date ? '&by=' . $birth_date : '') .
($death_date ? '&dy=' . $death_date : '');

return $this->fetch( env('ULAN_DATA_SERVICE_URL')
.'?q=' .urlencode($agent->title)
.($birth_date ? '&by=' .$birth_date : '')
.($death_date ? '&dy=' .$death_date : ''),
true);

return $this->fetch($url, true);
}

private function updateUlan($agent, $result, $message = '')
Expand All @@ -80,7 +79,7 @@ private function updateUlan($agent, $result, $message = '')
if (count($result->results) == 1)
{

$this->info('... exact name matched ' .$message .' ' .$result->results[0]->uri);
$this->info('... exact name matched ' . $message . ' ' . $result->results[0]->uri);
$agent->ulan_uri = $result->results[0]->uri;
$agent->save();
return true;
Expand All @@ -106,7 +105,7 @@ private function updateUlan($agent, $result, $message = '')
if (count($uris) == 1)
{

$this->info('... exact name matched distinct results' .$message);
$this->info('... exact name matched distinct results' . $message);
$agent->ulan_uri = $uris[0];
$agent->save();
return true;
Expand Down
6 changes: 3 additions & 3 deletions app/Console/Commands/Prototype/PrototypeMostSimilar.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function results($artworkIds = [], $limit = 5)

foreach ($artworkIds as $id => $name)
{
$ret .= "<h2><a href=\"" .env('WEBSITE_ROOT') ."/artworks/{$id}\">{$name}</a></h2>\n";
$ret .= "<h2><a href=\"" . env('WEBSITE_ROOT') . "/artworks/{$id}\">{$name}</a></h2>\n";

$artw = Artwork::find($id);
$responses = $this->query($artw);
Expand All @@ -127,7 +127,7 @@ public function results($artworkIds = [], $limit = 5)
if (!in_array($item->id, $ids))
{
$ret .= "<tr class='clickable-row' data-href='http://www-2018.artic.edu/artworks/{$item->id}'>";
$ret .= "<td style=\"padding:0 8px\"><img src=\"" .($item->thumbnail->url ?? '') ."/full/75,/0/default.jpg\" /></td>";
$ret .= "<td style=\"padding:0 8px\"><img src=\"" . ($item->thumbnail->url ?? '') . "/full/75,/0/default.jpg\" /></td>";
$ret .= "<td style=\"padding:0 8px\">{$item->id}</td>";
$ret .= "<td style=\"padding:0 8px\">{$item->main_reference_number}</td>";
$ret .= "<td style=\"padding:0 8px\">{$item->title}</td>";
Expand Down Expand Up @@ -282,7 +282,7 @@ protected function curl($query)
$queryString = json_encode($query);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, config('app.url') ."/api/v1/msearch");
curl_setopt($ch, CURLOPT_URL, config('app.url') . "/api/v1/msearch");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $queryString);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
Expand Down
4 changes: 2 additions & 2 deletions app/Console/Commands/Prototype/PrototypeSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ public function results($queries = [], $limit = 5)
foreach ($queries as $query)
{
$ret .= "<h2>{$query}</h2>\n";
$response = file_get_contents(config('app.url') .'/api/v1/artworks/search?limit=' .$limit .'&fields=thumbnail,id,title,main_reference_number&q=' .urlencode($query));
$response = file_get_contents(config('app.url') . '/api/v1/artworks/search?limit=' . $limit . '&fields=thumbnail,id,title,main_reference_number&q=' . urlencode($query));

$ret .= "<table>\n";

foreach (json_decode($response)->data as $item)
{
$ret .= "<tr class='clickable-row' data-href='http://www-2018.artic.edu/artworks/{$item->id}'>";
$ret .= "<td style=\"padding:0 8px\"><img src=\"" .($item->thumbnail->url ?? '') ."/full/75,/0/default.jpg\" /></td>";
$ret .= "<td style=\"padding:0 8px\"><img src=\"" . ($item->thumbnail->url ?? '') . "/full/75,/0/default.jpg\" /></td>";
$ret .= "<td style=\"padding:0 8px\">{$item->id}</td>";
$ret .= "<td style=\"padding:0 8px\">{$item->main_reference_number}</td>";
$ret .= "<td style=\"padding:0 8px\">{$item->title}</td>";
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Report/ReportNoTerms.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function handle()
'artist_id',
]);

$response = file_get_contents(config('app.url') .'/api/v1/artworks/search?limit=500&query%5Bbool%5D%5Bmust_not%5D%5B%5D%5Bexists%5D%5Bfield%5D=style_id&query%5Bbool%5D%5Bmust_not%5D%5B%5D%5Bexists%5D%5Bfield%5D=classification_id&query%5Bbool%5D%5Bmust_not%5D%5B%5D%5Bexists%5D%5Bfield%5D=artist_id&fields=id,title,artist_id,classification_id,style_id,main_reference_number');
$response = file_get_contents(config('app.url') . '/api/v1/artworks/search?limit=500&query%5Bbool%5D%5Bmust_not%5D%5B%5D%5Bexists%5D%5Bfield%5D=style_id&query%5Bbool%5D%5Bmust_not%5D%5B%5D%5Bexists%5D%5Bfield%5D=classification_id&query%5Bbool%5D%5Bmust_not%5D%5B%5D%5Bexists%5D%5Bfield%5D=artist_id&fields=id,title,artist_id,classification_id,style_id,main_reference_number');

foreach (json_decode($response)->data as $artwork)
{
Expand Down
8 changes: 4 additions & 4 deletions app/Console/Helpers/Indexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ public function destroy($index = null, $yes = false)
}

// Return false if the user bails out
if (!$yes && !$this->confirm("The " .$index ." index already exists. Do you wish to delete it?"))
if (!$yes && !$this->confirm("The " . $index . " index already exists. Do you wish to delete it?"))
{
return false;
}
else
{

$this->info('Deleting ' .$index .' index...');
$this->info('Deleting ' . $index . ' index...');
}

// @TODO: Catch exceptions?
Expand All @@ -56,7 +56,7 @@ public function baseUrl()
$port = env('ELASTICSEARCH_PORT', 9200);
$scheme = env('ELASTICSEARCH_SCHEME', null);

return $scheme .'://' .$host .':' .$port;
return $scheme . '://' . $host . ':' . $port;

}

Expand All @@ -76,7 +76,7 @@ private function done($return = [])

}

return "There was an error: " .print_r($return, true);
return "There was an error: " . print_r($return, true);

}

Expand Down
14 changes: 7 additions & 7 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ protected function schedule(Schedule $schedule)
protected function commands()
{

$this->load(__DIR__.'/Commands');
$this->load(__DIR__.'/Commands/Docs');
$this->load(__DIR__.'/Commands/Import');
$this->load(__DIR__.'/Commands/Prototype');
$this->load(__DIR__.'/Commands/Report');
$this->load(__DIR__.'/Commands/Search');
$this->load(__DIR__.'/Commands/Update');
$this->load(__DIR__ . '/Commands');
$this->load(__DIR__ . '/Commands/Docs');
$this->load(__DIR__ . '/Commands/Import');
$this->load(__DIR__ . '/Commands/Prototype');
$this->load(__DIR__ . '/Commands/Report');
$this->load(__DIR__ . '/Commands/Search');
$this->load(__DIR__ . '/Commands/Update');

}
}
2 changes: 1 addition & 1 deletion app/Helpers/ColorHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

function hexToHsl($hex)
{
$hex = [$hex[0].$hex[1], $hex[2].$hex[3], $hex[4].$hex[5]];
$hex = [$hex[0] . $hex[1], $hex[2] . $hex[3], $hex[4] . $hex[5]];
$rgb = array_map(function($part) {
return hexdec($part) / 255;
}, $hex);
Expand Down
10 changes: 5 additions & 5 deletions app/Helpers/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ function getLakeUri($lake_id)
. '/' . substr($lake_id, 0, 2)
. '/' . substr($lake_id, 2, 2)
. '/' . substr($lake_id, 4, 2)
. '/' .substr($lake_id, 6, 2)
. '/' .$lake_id;
. '/' . substr($lake_id, 6, 2)
. '/' . $lake_id;
}


Expand All @@ -150,7 +150,7 @@ function allModels()
//skip current and parent folder entries
if ($file == '.' || $file == '..') continue;

$sourcepath = $dir .DIRECTORY_SEPARATOR .$file;
$sourcepath = $dir . DIRECTORY_SEPARATOR . $file;

if (is_dir($sourcepath))
{
Expand All @@ -160,10 +160,10 @@ function allModels()
foreach($sourcefiles as $sourcefile)
{

if (!is_dir($sourcepath .DIRECTORY_SEPARATOR .$sourcefile))
if (!is_dir($sourcepath . DIRECTORY_SEPARATOR . $sourcefile))
{

$models[] = $namespace .$file .'\\' .preg_replace('/\.php$/', '', $sourcefile);
$models[] = $namespace . $file . '\\' . preg_replace('/\.php$/', '', $sourcefile);

}

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/DocsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function index()
$content = Storage::get($this->filename);
$markup = Markdown::parse($content);
$markup = preg_replace_callback('/<h2>(\w+)<\/h2>/i', function ($title) {
return '<h2 id="' .strtolower($title[1]) .'">' .$title[1] .'</h2>';
return '<h2 id="' . strtolower($title[1]) . '">' . $title[1] . '</h2>';
}, $markup);
return view('docs', ['content' => $markup]);
}
Expand Down
Loading

0 comments on commit 2c6d79a

Please sign in to comment.