Skip to content

Commit

Permalink
Replace Arr::get() with isset() in DownloadsDocument
Browse files Browse the repository at this point in the history
  • Loading branch information
jlevers committed Apr 20, 2024
1 parent d460956 commit 9572ff0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/Traits/DownloadsDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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]),
Expand All @@ -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']);
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/UploadsDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}'");
Expand Down

0 comments on commit 9572ff0

Please sign in to comment.