Skip to content

Commit f105222

Browse files
committed
Merge branch 'main' into feature-php-8-2
2 parents eece84c + 8c081b5 commit f105222

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"guzzlehttp/guzzle": "^7.0.1",
2424
"illuminate/contracts": "^9.0",
2525
"spatie/laravel-package-tools": "^1.9.2",
26-
"cloudinary/cloudinary_php": "^2.9.0"
26+
"cloudinary/cloudinary_php": "^2.9.0",
27+
"nesbot/carbon": "^2.64.0"
2728
},
2829
"require-dev": {
2930
"laravel/pint": "^1.0",

src/FlysystemCloudinaryAdapter.php

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@
2727

2828
class FlysystemCloudinaryAdapter implements FilesystemAdapter
2929
{
30+
public array|false $meta;
31+
32+
public bool $copied;
33+
34+
public bool $deleted;
35+
3036
private const EXTRA_METADATA_FIELDS = [
3137
'version',
3238
'width',
@@ -338,7 +344,7 @@ public function read(string $path): string
338344
/**
339345
* {@inheritDoc}
340346
*/
341-
public function readStream($path): array|false
347+
public function readStream($path): array|false /** @phpstan-ignore-line */
342348
{
343349
$path = $this->ensureFolderIsPrefixed(trim($path, '/'));
344350

@@ -472,7 +478,7 @@ private function getMetadata(string $path, string $type): FileAttributes
472478
throw UnableToRetrieveMetadata::create($path, $type, '', $exception);
473479
}
474480

475-
$attributes = $this->mapToFileAttributes($result, $path);
481+
$attributes = $this->mapToFileAttributes($result);
476482

477483
if (! $attributes instanceof FileAttributes) {
478484
throw UnableToRetrieveMetadata::create($path, $type);
@@ -497,7 +503,7 @@ private function extractExtraMetadata(array $metadata): array
497503
{
498504
$extracted = [];
499505

500-
foreach (static::EXTRA_METADATA_FIELDS as $field) {
506+
foreach (self::EXTRA_METADATA_FIELDS as $field) {
501507
if (isset($metadata[$field]) && $metadata[$field] !== '') {
502508
$extracted[$field] = $metadata[$field];
503509
}
@@ -649,20 +655,19 @@ public function directoryExists(string $path): bool
649655
do {
650656
$response = (array) $this->cloudinary->adminApi()->subFolders($needle, [
651657
'max_results' => 4,
652-
'next_cursor' => isset($response['next_cursor']) ? $response['next_cursor'] : null,
658+
'next_cursor' => isset($response['next_cursor']) ? $response['next_cursor'] : null, /** @phpstan-ignore-line */
653659
]);
654660

655-
$folders = array_merge($folders, $response['folders']);
656-
} while (array_key_exists('next_cursor', $response) && ! is_null($response['next_cursor']));
657-
661+
$folders = array_merge($folders, $response['folders']); /** @phpstan-ignore-line */
662+
} while (array_key_exists('next_cursor', $response) && ! is_null($response['next_cursor'])); /** @phpstan-ignore-line */
658663
$folders_found = array_filter(
659664
$folders,
660665
function ($e) use ($path) {
661666
return $e['path'] == $path;
662667
}
663668
);
664669

665-
return count($folders_found);
670+
return count($folders_found) > 0;
666671
}
667672

668673
public function deleteDirectory(string $path): void
@@ -690,12 +695,12 @@ public function getVisibility($path): string
690695
return $this->visibility($path)->visibility();
691696
}
692697

693-
public function getTimestamp($path): string
698+
public function getTimestamp($path): int
694699
{
695700
return $this->lastModified($path)->lastModified();
696701
}
697702

698-
public function getSize($path): string
703+
public function getSize($path): int
699704
{
700705
return $this->fileSize($path)->fileSize();
701706
}

0 commit comments

Comments
 (0)