src/Objects/Ldap/Entry.php
private function applyAttributes($attributes)
    {
        if (array_key_exists('count', $attributes) && $attributes['count'] > 0) {
            $keys = array_keys($attributes);

            foreach ($keys as $key) {
                if (is_array($attributes[$key]) && array_key_exists(0, $attributes[$key])) {
                    // If the entry has multiple attributes, we'll make sure we loop through each one
                    if (array_key_exists('count', $attributes[$key]) && $attributes[$key]['count'] > 1) {
                        $data = [];

                        for ($i = 0; $i <= $attributes[$key]['count']; $i++) {
                            $data[] = $attributes[$key][$i];
                        }

                        $this->setAttribute($key, array_filter($data));
                    } else {
                        // Looks like only one attribute exists, let's set it
                        $this->setAttribute($key, $attributes[$key][0]);
                    }
                }
            }

            $this->applyExtraAttributes();
        }
    }
private function applyAttributes($attributes)
    {
        if (array_key_exists('count', $attributes) && $attributes['count'] > 0) {
            $keys = array_keys($attributes);

            foreach ($keys as $key) {
                if (is_array($attributes[$key]) && array_key_exists(0, $attributes[$key])) {
                    // If the entry has multiple attributes, we'll make sure we loop through each one
                    if (array_key_exists('count', $attributes[$key]) && $attributes[$key]['count'] > 1) {
                        $data = [];

                        for ($i = 0; $i <= $attributes[$key]['count']; $i++) {
                            $data[] = $attributes[$key][$i];
                        }

                        $this->setAttribute($key, array_filter($data));
                    } else {
                        // Looks like only one attribute exists, let's set it
                        $this->setAttribute($key, $attributes[$key][0]);
                    }
                }
            }

            $this->applyExtraAttributes();
        }
    }
private function applyAttributes ( $ attributes ) { if ( array_key_exists ( 'count' , $ attributes ) && $ attributes [ 'count' ] > 0 ) { $ keys = array_keys ( $ attributes ) ; foreach ( $ keys as $ key ) { if ( is_array ( $ attributes [ $ key ] ) && array_key_exists ( 0 , $ attributes [ $ key ] ) ) { // If the entry has multiple attributes, we'll make sure we loop through each one if ( array_key_exists ( 'count' , $ attributes [ $ key ] ) && $ attributes [ $ key ] [ 'count' ] > 1 ) { $ data = [ ] ; for ( $ i = 0 ; $ i <= $ attributes [ $ key ] [ 'count' ] ; $ i ++ ) { $ data [ ] = $ attributes [ $ key ] [ $ i ] ; } $ this -> setAttribute ( $ key , array_filter ( $ data ) ) ; } else { // Looks like only one attribute exists, let's set it $ this -> setAttribute ( $ key , $ attributes [ $ key ] [ 0 ] ) ; } } } $ this -> applyExtraAttributes ( ) ; } }
Applies the proper object attributes if they exist.

@param array $attributes
Applies the proper object attributes if they exist .