pocketmine\metadata\MetadataStore::getMetadata PHP Метод

getMetadata() публичный Метод

Returns all metadata values attached to an object. If multiple have attached metadata, each will value will be included.
public getMetadata ( mixed $subject, string $metadataKey ) : MetadataValue[]
$subject mixed
$metadataKey string
Результат MetadataValue[]
    public function getMetadata($subject, $metadataKey)
    {
        $key = $this->disambiguate($subject, $metadataKey);
        if (isset($this->metadataMap[$key])) {
            return $this->metadataMap[$key];
        } else {
            return [];
        }
    }

Usage Example

Пример #1
0
 public function getMetadata($block, $metadataKey)
 {
     if (!$block instanceof Block) {
         throw new \InvalidArgumentException("Object must be a Block");
     }
     if ($block->getLevel() === $this->owningLevel) {
         return parent::getMetadata($block, $metadataKey);
     } else {
         throw new \InvalidStateException("Block does not belong to world " . $this->owningLevel->getName());
     }
 }