code: public function getMetadata($key = null)
      {
          if (null === $key) {
              return $this->metadata;
          }
  
          if (false === array_key_exists($key, $this->metadata)) {
              return array();
          }
  
          return $this->metadata[$key];
      }
docs: {@inheritdoc}