public function Message::getMetadata in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/zendframework/zend-stdlib/src/Message.php \Zend\Stdlib\Message::getMetadata()
 
Retrieve all metadata or a single metadatum as specified by key
Parameters
null|string|int $key:
null|mixed $default:
Return value
mixed
Throws
Exception\InvalidArgumentException
Overrides MessageInterface::getMetadata
1 call to Message::getMetadata()
- Message::toString in vendor/
zendframework/ zend-stdlib/ src/ Message.php  
File
- vendor/
zendframework/ zend-stdlib/ src/ Message.php, line 63  
Class
Namespace
Zend\StdlibCode
public function getMetadata($key = null, $default = null) {
  if (null === $key) {
    return $this->metadata;
  }
  if (!is_scalar($key)) {
    throw new Exception\InvalidArgumentException('Non-scalar argument provided for key');
  }
  if (array_key_exists($key, $this->metadata)) {
    return $this->metadata[$key];
  }
  return $default;
}