ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
GetWithMetadata.php
Go to the documentation of this file.
1 <?php
2 
4 
6 
8 {
14  public function getMethod()
15  {
16  return 'getWithMetadata';
17  }
18 
29  public function handle($path, array $metadata)
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  }
49 }
$path
Definition: aliased.php:25
$keys
$metadata['__DYNAMIC:1__']
handle($path, array $metadata)
Get metadata for an object with required metadata.
$key
Definition: croninfo.php:18