Adldap\Objects\BatchModification::get PHP Method

get() public method

Returns the built batch modification array.
public get ( ) : array | null
return array | null
    public function get()
    {
        $attrib = $this->attribute;
        $modtype = $this->type;
        $values = $this->values;
        switch ($modtype) {
            case LDAP_MODIFY_BATCH_REMOVE_ALL:
                // A values key cannot be provided when
                // a remove all type is selected.
                return compact('attrib', 'modtype');
            case LDAP_MODIFY_BATCH_REMOVE:
                return compact('attrib', 'modtype', 'values');
            case LDAP_MODIFY_BATCH_ADD:
                return compact('attrib', 'modtype', 'values');
            case LDAP_MODIFY_BATCH_REPLACE:
                return compact('attrib', 'modtype', 'values');
            default:
                // If the modtype isn't recognized, we'll return null.
                return;
        }
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Adds a modification to the models modifications array.
  *
  * @param BatchModification $modification
  *
  * @return $this
  */
 public function addModification(BatchModification $modification)
 {
     $batch = $modification->get();
     if (is_array($batch)) {
         $this->modifications[] = $batch;
     }
     return $this;
 }