Skip to content

Commit

Permalink
Lint code [API-397]
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhiltri committed Sep 28, 2023
1 parent f3fbad0 commit dcc03bd
Show file tree
Hide file tree
Showing 75 changed files with 49 additions and 127 deletions.
1 change: 0 additions & 1 deletion app/Behaviors/ImportsData.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Behaviors;

use Illuminate\Support\Facades\DB;

use Carbon\Carbon;
use Sentry\State\Scope;

Expand Down
1 change: 0 additions & 1 deletion app/Console/Commands/Bulk/BulkImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Console\Commands\Bulk;

use Illuminate\Support\Facades\DB;

use Aic\Hub\Foundation\AbstractCommand as BaseCommand;

class BulkImport extends BaseCommand
Expand Down
1 change: 0 additions & 1 deletion app/Console/Commands/Dump/AbstractDumpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Illuminate\Support\Facades\Storage;
use App\Library\Shell;
use Exception;

use App\Console\Commands\BaseCommand;

abstract class AbstractDumpCommand extends BaseCommand
Expand Down
1 change: 0 additions & 1 deletion app/Console/Commands/Dump/DumpExportGettingStarted.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Console\Commands\Dump;

use Illuminate\Support\Facades\Storage;

use League\Csv\Writer;

class DumpExportGettingStarted extends AbstractDumpCommand
Expand Down
3 changes: 0 additions & 3 deletions app/Console/Commands/Import/AbstractImportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
use Carbon\Carbon;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

use Aic\Hub\Foundation\AbstractCommand as BaseCommand;

use App\Behaviors\ImportsData;

use Illuminate\Support\Str;

abstract class AbstractImportCommand extends BaseCommand
Expand Down
2 changes: 0 additions & 2 deletions app/Console/Commands/Import/ImportMobile.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
namespace App\Console\Commands\Import;

use Illuminate\Support\Facades\Storage;

use App\Models\Mobile\Artwork as MobileArtwork;
use App\Models\Mobile\Sound;
use App\Models\Mobile\Tour;
use App\Models\Mobile\TourStop;

use App\Transformers\Traits\ConvertsToHtml;

class ImportMobile extends AbstractImportCommand
Expand Down
1 change: 0 additions & 1 deletion app/Console/Commands/Import/ImportSites.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Console\Commands\Import;

use Illuminate\Support\Facades\Storage;

use App\Models\StaticArchive\Site;
use App\Transformers\Inbound\StaticArchive\Site as SiteTransformer;

Expand Down
1 change: 0 additions & 1 deletion app/Console/Commands/Migrations/AbstractCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Illuminate\Database\Schema\Blueprint;
use App\Library\Migrations\MigrationCreator;
use ColinODell\Indentation\Indentation;

use Aic\Hub\Foundation\AbstractCommand as BaseCommand;

abstract class AbstractCommand extends BaseCommand
Expand Down
1 change: 0 additions & 1 deletion app/Console/Commands/Report/ReportMigrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Console\Commands\Report;

use App\Library\Shell;

use Aic\Hub\Foundation\AbstractCommand as BaseCommand;

class ReportMigrations extends BaseCommand
Expand Down
1 change: 0 additions & 1 deletion app/Console/Commands/Search/ScoutImportAll.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Console\Commands\Search;

use Illuminate\Support\Facades\Config;

use Aic\Hub\Foundation\AbstractCommand as BaseCommand;

class ScoutImportAll extends BaseCommand
Expand Down
1 change: 0 additions & 1 deletion app/Console/Commands/Search/ScoutImportCsv.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use League\Csv\Reader;
use Illuminate\Support\Facades\Storage;

use Aic\Hub\Foundation\AbstractCommand as BaseCommand;

class ScoutImportCsv extends BaseCommand
Expand Down
1 change: 0 additions & 1 deletion app/Console/Commands/Search/ScoutImportSince.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Carbon\Carbon;
use Illuminate\Support\Facades\Schema;

use Aic\Hub\Foundation\AbstractCommand as BaseCommand;

class ScoutImportSince extends BaseCommand
Expand Down
1 change: 0 additions & 1 deletion app/Console/Commands/Search/ScoutSince.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Console\Commands\Search;

use Carbon\Carbon;

use Aic\Hub\Foundation\AbstractCommand as BaseCommand;

class ScoutSince extends BaseCommand
Expand Down
1 change: 0 additions & 1 deletion app/Console/Commands/Search/SearchAudit.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Carbon\Carbon;
use Elasticsearch;

use Aic\Hub\Foundation\AbstractCommand as BaseCommand;

class SearchAudit extends BaseCommand
Expand Down
2 changes: 0 additions & 2 deletions app/Console/Commands/Search/SearchInstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
namespace App\Console\Commands\Search;

use Elasticsearch;

use App\Console\Helpers\Indexer;

use Aic\Hub\Foundation\AbstractCommand as BaseCommand;

class SearchInstall extends BaseCommand
Expand Down
2 changes: 0 additions & 2 deletions app/Console/Commands/Search/SearchReindex.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
namespace App\Console\Commands\Search;

use Elasticsearch;

use App\Console\Helpers\Indexer;

use Aic\Hub\Foundation\AbstractCommand as BaseCommand;

class SearchReindex extends BaseCommand
Expand Down
5 changes: 2 additions & 3 deletions app/Console/Commands/Search/SearchUninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
namespace App\Console\Commands\Search;

use Elasticsearch;

use App\Console\Helpers\Indexer;

use Aic\Hub\Foundation\AbstractCommand as BaseCommand;

class SearchUninstall extends BaseCommand
Expand All @@ -22,7 +20,8 @@ public function handle()
{
$prefix = $this->argument('index') ?? config('elasticsearch.indexParams.index');

if (!$this->option('yes') &&
if (
!$this->option('yes') &&
!$this->confirm('This will delete all indexes with `' . $prefix . '` prefix. Are you sure?')
) {
return false;
Expand Down
1 change: 0 additions & 1 deletion app/Console/Commands/Update/UpdateNetx.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Console\Commands\Update;

use App\Models\Collections\Asset;

use Aic\Hub\Foundation\AbstractCommand as BaseCommand;

class UpdateNetx extends BaseCommand
Expand Down
1 change: 0 additions & 1 deletion app/Console/Commands/Update/UpdateResources.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Console\Commands\Update;

use App\Models\Collections\Artwork;

use Aic\Hub\Foundation\AbstractCommand as BaseCommand;

class UpdateResources extends BaseCommand
Expand Down
1 change: 0 additions & 1 deletion app/ElasticsearchEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App;

use Exception;

use Tamayo\LaravelScoutElastic\Engines\ElasticsearchEngine as BaseEngine;

class ElasticsearchEngine extends BaseEngine
Expand Down
4 changes: 0 additions & 4 deletions app/Http/Controllers/AbstractController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,20 @@
namespace App\Http\Controllers;

use Illuminate\Http\Request;

use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Request as RequestFacade;
use Closure;

use League\Fractal\Resource\Item;
use League\Fractal\Resource\Collection;

use Aic\Hub\Foundation\ResourceSerializer;
use Aic\Hub\Foundation\Exceptions\BigLimitException;
use Aic\Hub\Foundation\Exceptions\InvalidSyntaxException;
use Aic\Hub\Foundation\Exceptions\ItemNotFoundException;
use Aic\Hub\Foundation\Exceptions\TooManyIdsException;

use Aic\Hub\Foundation\AbstractController as BaseController;

abstract class AbstractController extends BaseController
Expand Down
3 changes: 0 additions & 3 deletions app/Http/Controllers/ArtworkController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
namespace App\Http\Controllers;

use Illuminate\Http\Request;

use League\Fractal\Resource\Item;
use League\Fractal\Serializer\ArraySerializer;

use App\Models\Collections\Artwork;
use App\Transformers\Outbound\Collections\ArtworkManifest;

use Aic\Hub\Foundation\Exceptions\InvalidSyntaxException;
use Aic\Hub\Foundation\Exceptions\ItemNotFoundException;

Expand Down
1 change: 0 additions & 1 deletion app/Http/Controllers/ImageSearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Aic\Hub\Foundation\Exceptions\DetailedException;
use Illuminate\Support\Facades\Route;
use App\Library\Shell;

use App\Http\Controllers\SearchController as BaseController;

class ImageSearchController extends BaseController
Expand Down
1 change: 0 additions & 1 deletion app/Http/Controllers/LinkedArtController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use App\Models\Collections\Asset;
use Aic\Hub\Foundation\Exceptions\InvalidSyntaxException;
use Aic\Hub\Foundation\Exceptions\TooManyIdsException;

use App\Http\Controllers\Controller as BaseController;

class LinkedArtController extends BaseController
Expand Down
1 change: 0 additions & 1 deletion app/Http/Controllers/LinkedArtSearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

use App\Http\Controllers\SearchController as BaseController;

class LinkedArtSearchController extends BaseController
Expand Down
1 change: 0 additions & 1 deletion app/Http/Controllers/RestrictedResourceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Gate;

use Aic\Hub\Foundation\Exceptions\UnauthorizedException;

class RestrictedResourceController extends ResourceController
Expand Down
3 changes: 0 additions & 3 deletions app/Http/Controllers/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
namespace App\Http\Controllers;

use Aic\Hub\Foundation\Exceptions\DetailedException;

use App\Http\Search\Request as SearchRequest;
use App\Http\Search\Response as SearchResponse;

use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Request as RequestFacade;
use Illuminate\Http\Request;
use Elasticsearch;

use Illuminate\Routing\Controller as BaseController;

class SearchController extends BaseController
Expand Down
15 changes: 8 additions & 7 deletions app/Http/Middleware/RestrictContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
namespace App\Http\Middleware;

use Carbon\Carbon;

use Closure;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Gate;
use Symfony\Component\HttpFoundation\Response;

use App\Models\BaseModel;
use App\Scopes\PublishedScope;

Expand Down Expand Up @@ -37,7 +34,8 @@ public static function getSearchRestrictForEndpoint($endpoint)
{
$restrictions = [];

if (in_array($endpoint, [
if (
in_array($endpoint, [
'articles',
'digital-catalogs',
'educator-resources',
Expand All @@ -50,14 +48,17 @@ public static function getSearchRestrictForEndpoint($endpoint)

// WEB-1929: Re-enable restriction when ready!
// 'events',
])) {
])
) {
$restrictions = array_merge($restrictions, PublishedScope::forSearch());
}

if (in_array($endpoint, [
if (
in_array($endpoint, [
'events',
'event-occurrences',
])) {
])
) {
$restrictions[] = [
'term' => [
'is_private' => false,
Expand Down
15 changes: 7 additions & 8 deletions app/Http/Search/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
use Aic\Hub\Foundation\Exceptions\BigLimitException;
use Aic\Hub\Foundation\Exceptions\DetailedException;
use Aic\Hub\Foundation\Exceptions\TooManyResultsException;

use App\Http\Middleware\RestrictContent;

use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Gate;

use Illuminate\Support\Facades\Request as RequestFacade;

class Request
Expand Down Expand Up @@ -934,11 +931,13 @@ private function getFuzzy(array $input, string $query = null, $isExact = false)
private function getColorParams(array $params, array $input)
{
// Exit early if the query is not an exact hex string
if (!(
strlen($input['q']) === 7 && preg_match('/^#[0-9a-f]{6}/i', $input['q'])
) || (
strlen($input['q']) === 4 && preg_match('/^#[0-9a-f]{3}/i', $input['q'])
)) {
if (
!(
strlen($input['q']) === 7 && preg_match('/^#[0-9a-f]{6}/i', $input['q'])
) || (
strlen($input['q']) === 4 && preg_match('/^#[0-9a-f]{3}/i', $input['q'])
)
) {
return false;
}

Expand Down
1 change: 0 additions & 1 deletion app/Library/Migrations/CreateIndexMigration.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Library\Migrations;

use Aic\Hub\Foundation\Concerns\HasAbstractProperties;

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
Expand Down
1 change: 0 additions & 1 deletion app/Library/Migrations/RenameColumnMigration.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Library\Migrations;

use Aic\Hub\Foundation\Concerns\HasAbstractProperties;

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
Expand Down
3 changes: 0 additions & 3 deletions app/Models/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
namespace App\Models;

use Carbon\Carbon;

use Aic\Hub\Foundation\AbstractModel;

use App\BelongsToManyOrOne;
use App\Scopes\PublishedScope;
use App\Models\Collections\Exhibition;
Expand All @@ -22,7 +20,6 @@
use App\Models\Web\PrintedCatalog;
use App\Models\Web\Highlight;
use App\Models\Web\StaticPage;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
Expand Down
1 change: 0 additions & 1 deletion app/Models/Collections/Artwork.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use App\Models\CollectionsModel;
use App\Models\ElasticSearchable;
use App\Models\HasRelationships;

use Illuminate\Support\Str;

/**
Expand Down
Loading

0 comments on commit dcc03bd

Please sign in to comment.