27
27
28
28
class FlysystemCloudinaryAdapter implements FilesystemAdapter
29
29
{
30
+ public array |false $ meta ;
31
+
32
+ public bool $ copied ;
33
+
34
+ public bool $ deleted ;
35
+
30
36
private const EXTRA_METADATA_FIELDS = [
31
37
'version ' ,
32
38
'width ' ,
@@ -338,7 +344,7 @@ public function read(string $path): string
338
344
/**
339
345
* {@inheritDoc}
340
346
*/
341
- public function readStream ($ path ): array |false
347
+ public function readStream ($ path ): array |false /** @phpstan-ignore-line */
342
348
{
343
349
$ path = $ this ->ensureFolderIsPrefixed (trim ($ path , '/ ' ));
344
350
@@ -472,7 +478,7 @@ private function getMetadata(string $path, string $type): FileAttributes
472
478
throw UnableToRetrieveMetadata::create ($ path , $ type , '' , $ exception );
473
479
}
474
480
475
- $ attributes = $ this ->mapToFileAttributes ($ result, $ path );
481
+ $ attributes = $ this ->mapToFileAttributes ($ result );
476
482
477
483
if (! $ attributes instanceof FileAttributes) {
478
484
throw UnableToRetrieveMetadata::create ($ path , $ type );
@@ -497,7 +503,7 @@ private function extractExtraMetadata(array $metadata): array
497
503
{
498
504
$ extracted = [];
499
505
500
- foreach (static ::EXTRA_METADATA_FIELDS as $ field ) {
506
+ foreach (self ::EXTRA_METADATA_FIELDS as $ field ) {
501
507
if (isset ($ metadata [$ field ]) && $ metadata [$ field ] !== '' ) {
502
508
$ extracted [$ field ] = $ metadata [$ field ];
503
509
}
@@ -649,20 +655,19 @@ public function directoryExists(string $path): bool
649
655
do {
650
656
$ response = (array ) $ this ->cloudinary ->adminApi ()->subFolders ($ needle , [
651
657
'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 */
653
659
]);
654
660
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 */
658
663
$ folders_found = array_filter (
659
664
$ folders ,
660
665
function ($ e ) use ($ path ) {
661
666
return $ e ['path ' ] == $ path ;
662
667
}
663
668
);
664
669
665
- return count ($ folders_found );
670
+ return count ($ folders_found ) > 0 ;
666
671
}
667
672
668
673
public function deleteDirectory (string $ path ): void
@@ -690,12 +695,12 @@ public function getVisibility($path): string
690
695
return $ this ->visibility ($ path )->visibility ();
691
696
}
692
697
693
- public function getTimestamp ($ path ): string
698
+ public function getTimestamp ($ path ): int
694
699
{
695
700
return $ this ->lastModified ($ path )->lastModified ();
696
701
}
697
702
698
- public function getSize ($ path ): string
703
+ public function getSize ($ path ): int
699
704
{
700
705
return $ this ->fileSize ($ path )->fileSize ();
701
706
}
0 commit comments