Get the number of attributes of given type.

@param string $name Attribute OID or name
@return int
425990
public function countOfType(string $name): int
    {
        $oid = AttributeType::attrNameToOID($name);
        return array_sum(
            array_map(
                function (RDN $rdn) use ($oid) {
                    return count($rdn->allOf($oid));
                }, $this->_rdns));
    }
396498
public function getAttrib($name)
	{
		return isset($this->attributes[$name]) ? $this->attributes[$name] : null;
	}
1167719
public function getAttribute($name)
    {
        $name = $this->convertToPrimaryKeyName($name);

        if ($this->hasAttribute($name)) {
            return $this->attributes->getAttribute($name);
        } elseif (isset($this->related[$name])) {
            return $this->related[$name];
        }
    }
334180
public function getAttribute($attributes, $name) {
        foreach($attributes as $a) {
            if ($a->key == $name) {
                return $a->value;
            }
        }
        return null;
    }
517151
public static function getTypeFromName(string $name): int
    {
        $type = array_search(strtoupper(trim($name)), self::$names);
        if (false === $type || !is_int($type)) {
            throw new \InvalidArgumentException(sprintf('RData type "%s" is not defined.', $name));
        }

        return $type;
    }
1103302
protected function getAppendsAttribute($name)
    {
        $method = "get" . ucfirst(camel_case($name)) . "Attribute";
        $value = method_exists($this, $method) ? $this->$method(NULL) : NULL;
        return $this->setAttributeType($name, $value);
    }
46159
public static function getTypeByName($name)
    {
        /** @noinspection PhpUndefinedMethodInspection */
        $typeRec = static::whereName($name)->get(['type'])->first();

        return (isset($typeRec, $typeRec['type'])) ? $typeRec['type'] : null;
    }
273029
public static function getClassFromName(string $name): int
    {
        $class = array_search(strtoupper($name), self::$classes, true);

        if (false === $class || !is_int($class)) {
            throw new \InvalidArgumentException(sprintf('Class: "%s" is not defined.', $name));
        }

        return $class;
    }
1316873
public function staticPartLength($name)
    {
        $nestedTypes = $this->nestedTypes($name);

        if ($nestedTypes === false) {
            $nestedTypes = ['[1]'];
        }
        $count = 32;

        foreach ($nestedTypes as $type) {
            $num = mb_substr($type, 1, 1);

            if (!is_numeric($num)) {
                $num = 1;
            } else {
                $num = intval($num);
            }
            $count *= $num;
        }

        return $count;
    }
698091
public function staticArrayLength($name)
    {
        $nestedTypes = $this->nestedTypes($name);

        if ($nestedTypes === false) {
            return 1;
        }
        $match = [];

        if (preg_match('/[0-9]{1,}/', $nestedTypes[count($nestedTypes) - 1], $match) === 1) {
            return (int) $match[0];
        }
        return 1;
    }
1093295
public function findKey($name): ?int
    {
        $keyword = $this->getKeyword($name);

        if (! (\is_numeric($name) && $keyword->hasIn($this->items))) {
            return (string) $keyword->searchIn($this->items);
        }

        return $name;
    }
167144
public function getParameterValue($name)
    {
        return (isset($this->attributes[$name])) ? $this->attributes[$name] : null;
    }
511041
public function get_attribute( $name ) {
		if ( $method = $this->has_map_method( $name ) ) {
			return $this->attributes[ self::OBJECT_KEY ]->{$this->{$method}()};
		}

		if ( $method = $this->has_compute_method( $name ) ) {
			return $this->{$method}();
		}

		if ( isset( $this->attributes[ self::TABLE_KEY ][ $name ] ) ) {
			return $this->attributes[ self::TABLE_KEY ][ $name ];
		}

		if ( isset( $this->defaults[ $name ] ) ) {
			return $this->defaults[ $name ];
		}

		return null;
	}
1000900
public function getAttribute($name): string
    {
        if ($this->attributes->length === 0) { // Performance optimization
            return '';
        }
        $value = parent::getAttribute($name);
        return $value !== '' ? (strstr($value, 'html5-dom-document-internal-entity') !== false ? $this->updateResult($value) : $value) : '';
    }
273435
public function attribute($name)
    {
        if (isset($this->properties[$name])) {
            return $this->object->$name;
        }

        $getterName = 'get' . ucfirst($name);
        if (isset($this->getters[$getterName])) {
            return $this->object->$getterName();
        }

        throw new \InvalidArgumentException("Unsupported attribute '$name' for " . \get_class($this->object));
    }
21887
public function getAttr(string $name): string {
        $node = $this->collection()->first();

        if (!($node instanceof \DOMElement)) {
            return '';
        }

        $result = $node->getAttribute($name);

        if (empty($result)) {
            return '';
        }

        return $result;
    }
64317
public static function getTermIdbyName($name, $type = self::TYPE_TAG)
    {
        $tag = get_term_by('name', $name, $type);
        return ($tag) ? $tag->term_id : 0;
    }