Returns an LDAP compatible schema array for modifications.

@param array $attributes Attributes to be queried

@return array|bool
482773
public function ldapSchema(array $attributes)
    {
        // Check every attribute to see if it contains 8bit characters and then UTF8 encode them
        array_walk($attributes, [$this->utilities(), 'encode8bit']);

        $adldapSchema = new AdldapSchema($attributes);

        $ldapSchema = new LdapSchema($adldapSchema);

        if ($ldapSchema->countAttributes() === 0) {
            return false;
        }

        // Return a filtered array to remove NULL attributes
        return array_filter($ldapSchema->getAttributes(), function ($attribute) {
            // Only return the attribute if it is not null
            if ($attribute[0] !== null) {
                return $attribute;
            }
        });
    }
1361777
protected function addProtectedAttributesToArray(array $attributes)
    {
        if ($this->protectedView) {
            foreach ($this->getProtectable() as $key) {
                if (isset($attributes[$key])) {
                    $attributes[$key] = $this->protectionMask;
                }
            }
        }

        return $attributes;
    }
962287
public function updateSql(array $attributes)
    {
        $attrs = [];
        foreach ($attributes as $key => $value) {
            $attrs[$this->getModel()->convertToPrimaryKeyName($key)] = $value;
        }

        $sql = $this
            ->getQueryBuilder()
            ->update()
            ->table($this->getModel()->tableName())
            ->values($attrs)
            ->toSQL();

        return $sql;
    }
282790
public function getAttributes(): array
    {
        $search = array_column($this->map, 'attr');
        $result = ldap_read($this->ldap->getResource(), $this->ldap_dn, '(objectClass=*)', $search);
        $entries = ldap_get_entries($this->ldap->getResource(), $result);
        $attributes = $entries[0];

        $this->logger->info("get ldap user [{$this->ldap_dn}] attributes", [
            'category' => get_class($this),
            'params' => $attributes,
        ]);

        return $attributes;
    }
867560
protected function fillableFromArray(array $attributes)
    {
        if (count($this->fillable) > 0 && ! static::$unguarded) {
            return array_intersect_key($attributes, array_flip($this->fillable));
        }

        return $attributes;
    }
213987
public function formatAttributes(array $attributes) {
        foreach ($attributes as $key => $attr) {
            if ($attr instanceof Closure) {
                $attributes[$key] = call_user_func($attr, $this);

            } else if ($this->hasKeyword($attr)) {
                $attributes[$key] = $this->getKeyword($attr);

            } else if ($attr === true) {
                $attributes[$key] = $this->getKeyword($key);

            } else {
                $attributes[$key] = (string) $attr;
            }
        }

        return $attributes;
    }
548854
protected function mapExportAttributes($attributes)
    {
        return collect($attributes->toArray())->map(function($value, $key) {
            return $this->mapExportAttribute($value, $key);
        })->toArray();
    }
1148070
protected function mergeDefaultAttributes(array $attributes)
    {
        if ($this->schema && !empty($this->schema->getDefaultValues())) {
            $attributes = array_merge($this->schema->getDefaultValues(), $attributes);
        }

        return $attributes;
    }
1333459
public function prepareEntity($attributes)
    {
        $this->fieldAliases  = [];
        $attributes['class'] = $attributes['name'];
        $attributes['name']  = preg_replace('~^.*?(\w+)$~', '\1', $attributes['class']);
        $this->prefix        = 'COM_' . strtoupper($attributes['name']) . '_FIELD_';

        return $attributes;
    }
25209
public static function buildAttributes($attributes)
    {
        $options = array();
        foreach ($attributes as $attr => $val) {
            $options[] = "{$attr}=\"{$val}\"";
        }
        return implode(' ', $options);
    }
1085778
public function __toArray($attributes = array()){

        if( empty($attributes) ){
            $data = $this->_data;
        }else{

            $data = array();
            foreach( $attributes as $attribute ){
                if( isset($this->_data[$attribute]) ){
                    $data[$attribute] = $this->_data[$attribute];
                } else {
                    $data[$attribute] = NULL;
                }
            }

        }

        foreach( $data as $key => $item ){
            if( $item instanceof AppObject ){
                $item = $item->toArray();
                $data[$key] = $item;
            }
        }

        return $data;
    }
963698
protected static function prepareAttributes($attributes)
    {
        $prepared = array();
        if (is_string($attributes)) {
            return self::parseAttributes($attributes);

        } elseif (is_array($attributes)) {
            foreach ($attributes as $key => $value) {
                if (is_int($key)) {
                    $key = strtolower($value);
                    $prepared[$key] = $key;
                } else {
                    $prepared[strtolower($key)] = (string)$value;
                }
            }
        }
        return $prepared;
    }
841632
public static function attributes(array $attributes = array())
    {
        $formattedAttributes = array();

        foreach ($attributes as $name => $value) {
            if (is_null($value)) {
                continue;
            }
            $name = is_string($name) ? $name : $value;
            $formattedAttributes[$name] = $name . '="' . self::escape($value) . '"';
        }

        return $formattedAttributes ? ' ' . implode(' ', $formattedAttributes) : '';
    }
497279
public function user(array $attributes = [])
    {
        $model = $this->schema->userModel();

        return (new $model($attributes, $this->query))
            ->setAttribute($this->schema->objectClass(), $this->schema->userObjectClasses());
    }
48571
protected function filterAttributeValues(array $attributes)
    {
        return array_filter($attributes, function ($value) {
            if (is_array($value) && empty($value)) {
                return false;
            }

            return !($value === '' || $value === null);
        });
    }
780608
public function matchSingleResult(array $attributes) : array
    {
        return $this->asArray ? $this->matchAsArray($attributes) : $this->matchAsAttributes($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;
    }