/** * Get all attributes of given name. * * @param string $name OID or attribute name * @return Attribute[] */ public function allOf($name) { $oid = AttributeType::attrNameToOID($name); $attrs = array_filter($this->_attributes, function (Attribute $attr) use($oid) { return $attr->oid() == $oid; }); return array_values($attrs); }
/** * Get the number of attributes of given type. * * @param string $name Attribute OID or name * @return int */ public function countOfType($name) { $oid = AttributeType::attrNameToOID($name); return array_sum(array_map(function (RDN $rdn) use($oid) { return count($rdn->allOf($oid)); }, $this->_rdns)); }