ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
League\Flysystem\Plugin\GetWithMetadata Class Reference
+ Inheritance diagram for League\Flysystem\Plugin\GetWithMetadata:
+ Collaboration diagram for League\Flysystem\Plugin\GetWithMetadata:

Public Member Functions

 getMethod ()
 Get the method name. More...
 
 handle ($path, array $metadata)
 Get metadata for an object with required metadata. More...
 
- Public Member Functions inherited from League\Flysystem\Plugin\AbstractPlugin
 setFilesystem (FilesystemInterface $filesystem)
 Set the Filesystem object. More...
 

Additional Inherited Members

- Protected Attributes inherited from League\Flysystem\Plugin\AbstractPlugin
 $filesystem
 

Detailed Description

Definition at line 7 of file GetWithMetadata.php.

Member Function Documentation

◆ getMethod()

League\Flysystem\Plugin\GetWithMetadata::getMethod ( )

Get the method name.

Returns
string

Implements League\Flysystem\PluginInterface.

Definition at line 14 of file GetWithMetadata.php.

15  {
16  return 'getWithMetadata';
17  }

◆ handle()

League\Flysystem\Plugin\GetWithMetadata::handle (   $path,
array  $metadata 
)

Get metadata for an object with required metadata.

Parameters
string$pathpath to file
array$metadatametadata keys
Exceptions
InvalidArgumentException
Returns
array|false metadata

Definition at line 29 of file GetWithMetadata.php.

References $key, $keys, and $path.

30  {
31  $object = $this->filesystem->getMetadata($path);
32 
33  if ( ! $object) {
34  return false;
35  }
36 
37  $keys = array_diff($metadata, array_keys($object));
38 
39  foreach ($keys as $key) {
40  if ( ! method_exists($this->filesystem, $method = 'get' . ucfirst($key))) {
41  throw new InvalidArgumentException('Could not fetch metadata: ' . $key);
42  }
43 
44  $object[$key] = $this->filesystem->{$method}($path);
45  }
46 
47  return $object;
48  }
$path
Definition: aliased.php:25
$keys
$metadata['__DYNAMIC:1__']
$key
Definition: croninfo.php:18

The documentation for this class was generated from the following file: