CommonPrefix.php 926 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace AsyncAws\S3\ValueObject;
  3. /**
  4. * Container for all (if there are any) keys between Prefix and the next occurrence of the string specified by a
  5. * delimiter. CommonPrefixes lists keys that act like subdirectories in the directory specified by Prefix. For example,
  6. * if the prefix is notes/ and the delimiter is a slash (/) as in notes/summer/july, the common prefix is notes/summer/.
  7. */
  8. final class CommonPrefix
  9. {
  10. /**
  11. * Container for the specified common prefix.
  12. */
  13. private $prefix;
  14. /**
  15. * @param array{
  16. * Prefix?: null|string,
  17. * } $input
  18. */
  19. public function __construct(array $input)
  20. {
  21. $this->prefix = $input['Prefix'] ?? null;
  22. }
  23. public static function create($input): self
  24. {
  25. return $input instanceof self ? $input : new self($input);
  26. }
  27. public function getPrefix(): ?string
  28. {
  29. return $this->prefix;
  30. }
  31. }