Converts a string distinguished name into its separate pieces.

@param string $dn
@param int $withAttributes Set to 0 to get the attribute names along with the value.
@return array
169436
public static function explodeDn($dn, $withAttributes = 1)
    {
        $pieces = ldap_explode_dn($dn, $withAttributes);

        if ($pieces === false || !isset($pieces['count']) || $pieces['count'] == 0) {
            throw new InvalidArgumentException(sprintf('Unable to parse DN "%s".', $dn));
        }
        for ($i = 0; $i < $pieces['count']; $i++) {
            $pieces[$i] = self::unescapeValue($pieces[$i]);
        }
        unset($pieces['count']);

        return $pieces;
    }
226717
public function getAttributes($without_deprecated = true)
    {
        $attributes = $this->getOption('attributes');

        if ($without_deprecated) {
            foreach ($attributes as $key => $attribute) {
                if ($attribute['deprecated']) {
                    unset($attributes[$key]);
                }
            }
        }

        return $attributes;
    }
1244163
function get_entry($dn, $attributes = array())
    {
        return parent::get_entry($dn, !empty($attributes) ? $attributes : $this->attributes);
    }
510862
@SuppressWarnings("unchecked")
    public String[] getAttributeNames() {

        List<String> names = new ArrayList<String>();
        Enumeration<String> keys = attributes.keys();
        while (keys.hasMoreElements()) {
            names.add((String) keys.nextElement());
        }
        String results[] = new String[names.size()];
        for (int i = 0; i < results.length; i++) {
            results[i] = (String) names.get(i);
        }
        return (results);

    }
732748
protected function getAttributeFormsInAllLocales(AttributeInterface $attribute, array $localeCodes): array
    {
        $attributeForm = $this->get('sylius.form_registry.attribute_type')->get($attribute->getType(), 'default');

        $forms = [];
        foreach ($localeCodes as $localeCode) {
            $forms[$localeCode] = $this
                ->get('form.factory')
                ->createNamed('value', $attributeForm, null, ['label' => $attribute->getName(), 'configuration' => $attribute->getConfiguration()])
                ->createView()
            ;
        }

        return $forms;
    }
976152
public function getGetterCodeDocumentationLines(JavaAttribute $attribute)
    {
        $lines = [];

        $lines[] = 'Get ' . $attribute->getLowerFullName();
        $lines[] = '';
        $lines[] = '@return ' . ('object' === $attribute->getType() ? $attribute->getEntitySubtype()->getName() : $attribute->getType());

        return $lines;
    }
219394
public function getAttributes($ignore = "")
    {
        $str = "";

        if (!empty($this->attributes)) {
            if (!is_array($ignore)) {
                $ignore = array($ignore);
            }

            $attributes = array_diff(array_keys($this->attributes), $ignore);

            foreach ($attributes as $attribute) {
                $str .= ' ' . $attribute;

                if ($this->attributes[$attribute] !== "") {
                    $str .= '="' . $this->filter($this->attributes[$attribute]) . '"';
                }
            }
        }

        return $str;
    }
44588
protected function _getIdempotencyAttributes($attributes)
    {
        $result = [];
        foreach ($attributes as $key => $value) {
            if ($value['idempotency']) {
                $result[] = $key;
            }
        }
        return implode('&', $result);
    }
1079554
public function getSingleRemoverCodeDocumentationParameterLines(PHPAttribute $attribute)
    {
        $lines = [];

        $lines[] = '@param ' . $attribute->getPhpSingleTypeBase() /*. ($attribute->getEntity()->getProject()->getBase() ? 'Base' : '')*/ . ' $' . $attribute->getSingleName();

        return $lines;
    }
1360313
function getAttributes($asString = false)
    {
        if ($asString) {
            return $this->_getAttrString($this->_attributes);
        } else {
            return $this->_attributes;
        }
    }
428833
protected function attributes($attributes)
    {
        if (!is_array($attributes)) {
            return $attributes;
        }

        $attr = '';
        foreach ($attributes as $attribute => $value) {
            if (is_int($attribute)) {
                $attribute = $value;
            }
            $attr .= ' ' . $attribute . '="' . $value . '"';
        }

        return $attr;
    }
204086
public static function getParentDn($dn)
    {
        $parts = self::explodeDn($dn, 0);
        if (count($parts) === 1) {
            throw new InvalidArgumentException(sprintf('DN "%s" has no parent.', $dn));
        }
        array_shift($parts);
    
        return self::implodeDn($parts);
    }
633058
private static function _attr_name($namev)
    {
        // list of known attribute aliases
        static $aliases = array(
            'gn'            => 'givenname',
            'rfc822mailbox' => 'email',
            'userid'        => 'uid',
            'emailaddress'  => 'email',
            'pkcs9email'    => 'email',
        );

        list($name, $limit) = explode(':', $namev, 2);
        $suffix = $limit ? ':'.$limit : '';
        $name   = strtolower($name);

        return (isset($aliases[$name]) ? $aliases[$name] : $name) . $suffix;
    }
713851
public function makeAttributesForOption ($attributes)
    {
        $attrs = '';
        if ($attributes) {
            foreach ($attributes as $key => $value) {
                $attrs .= "$key='" . $value . "'";
            }
        }
        return $attrs;
    }
1169688
public function toArray($withTranslations = true)
    {
        $attributes = parent::toArray();

        if ($withTranslations && $this->hasTranslatedAttributes()) {
            foreach ($this->getTranslatedAttributes() as $field) {
                if ($translations = $this->getTranslation()) {
                    $attributes[$field] = $translations->$field;
                }
            }
        }

        return $attributes;
    }
750315
public static function getAttributeNamesByClassName($className = '', $throwException = false)
    {
        $except = false;
        if (empty($className) === false) {
            $model = new $className;
            if ($model instanceof Model) {
                /** @var $model Model */
                return $model->attributeLabels();
            } else {
                $except = true;
            }
        }
        if ($throwException && $except) {
            throw new Exception;
        } else {
            return [];
        }
    }
817972
private static function parseDSN($dsn)
    {
        $matches = [];

        if (!preg_match(static::DSN_REGEX, $dsn, $matches)) {
            throw new PDOException(sprintf('Invalid DSN %s', $dsn));
        }

        return array_slice($matches, 1);
    }