From 9572ff09a5113ea66c639f8d6bf4f1508a7b02e5 Mon Sep 17 00:00:00 2001 From: Jesse Evers Date: Fri, 19 Apr 2024 20:24:24 -0400 Subject: [PATCH] Replace Arr::get() with isset() in DownloadsDocument --- src/Traits/DownloadsDocument.php | 5 ++--- src/Traits/UploadsDocument.php | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Traits/DownloadsDocument.php b/src/Traits/DownloadsDocument.php index 8e9a5936c..644f25cc7 100644 --- a/src/Traits/DownloadsDocument.php +++ b/src/Traits/DownloadsDocument.php @@ -8,7 +8,6 @@ use GuzzleHttp\Exception\ClientException; use GuzzleHttp\Psr7\Header; use GuzzleHttp\Psr7\InflateStream; -use Illuminate\Support\Arr; use InvalidArgumentException; use OpenSpout\Reader\CSV\Options; use OpenSpout\Reader\CSV\Reader as CSVReader; @@ -191,7 +190,7 @@ protected static function documentTypeInfo(string $documentTypeName): array // Check feeds first because the file is smaller $feedTypes = json_decode(file_get_contents(RESOURCE_DIR.'/feeds.json'), true); - if (Arr::get($feedTypes, $documentTypeName)) { + if (isset($feedTypes[$documentTypeName])) { $documentTypeInfo = [ 'name' => $documentTypeName, 'contentType' => ContentType::from($feedTypes[$documentTypeName]), @@ -201,7 +200,7 @@ protected static function documentTypeInfo(string $documentTypeName): array if (! $documentTypeInfo) { $reportTypes = json_decode(file_get_contents(RESOURCE_DIR.'/reports.json'), true); - if (Arr::get($reportTypes, $documentTypeName)) { + if (isset($reportTypes[$documentTypeName])) { $documentTypeInfo = $reportTypes[$documentTypeName]; $documentTypeInfo['name'] = $documentTypeName; $documentTypeInfo['contentType'] = ContentType::from($documentTypeInfo['contentType']); diff --git a/src/Traits/UploadsDocument.php b/src/Traits/UploadsDocument.php index e46ed7c74..c2413a252 100644 --- a/src/Traits/UploadsDocument.php +++ b/src/Traits/UploadsDocument.php @@ -40,7 +40,7 @@ public function upload( public static function getContentType(string $feedType, ?string $charset = null): string { $feedTypes = json_decode(file_get_contents(RESOURCE_DIR.'/feeds.json'), true); - $contentType = $feedTypes[$feedType]; + $contentType = $feedTypes[$feedType] ?? null; if (! $contentType) { throw new RuntimeException("Unknown feed type '{$feedType}'");