public function getMetadata($type)
    {
        // Handle special cases here: name and path to file.
        if ($type == self::METADATA_NAME) {
            return $this->name;
        }
        if ($type == self::METADATA_FILE) {
            return $this->file;
        }

        if (!array_key_exists($type, $this->metadata)) {
            throw new \Erebot\InvalidValueException(
                'Invalid metadata type "' . $type . '"'
            );
        }
        return $this->metadata[$type];
    }