IMP_Indices::__construct PHP Method

__construct() public method

Parameters are the same as add().
See also: add()
public __construct ( )
    public function __construct()
    {
        if (func_num_args()) {
            $args = func_get_args();
            call_user_func_array(array($this, 'add'), $args);
        }
    }

Usage Example

Example #1
0
 /**
  * Constructor.
  *
  * @param mixed  Two possible inputs:
  *   - 1 argument: Horde_Variables object. These GET/POST parameters are
  *     reserved in IMP:
  *     - buid: (string) BUID [Browser UID].
  *     - mailbox: (string) Base64url encoded mailbox.
  *     - muid: (string) MUID [Mailbox + UID].
  *     - uid: (string) UID [Actual mail UID].
  *   - 2 arguments: IMP_Mailbox object, IMP_Indices argument
  */
 public function __construct()
 {
     $args = func_get_args();
     switch (func_num_args()) {
         case 1:
             if ($args[0] instanceof Horde_Variables) {
                 if (isset($args[0]->mailbox) && strlen($args[0]->mailbox)) {
                     $this->mailbox = IMP_Mailbox::formFrom($args[0]->mailbox);
                     if (isset($args[0]->buid)) {
                         $this->buids = new IMP_Indices($this->mailbox, $args[0]->buid);
                         parent::__construct($this->mailbox->fromBuids($this->buids));
                     } elseif (isset($args[0]->uid)) {
                         parent::__construct($this->mailbox, $args[0]->uid);
                     }
                 }
                 if (isset($args[0]->muid)) {
                     parent::__construct($args[0]->muid);
                 }
             }
             break;
         case 2:
             if ($args[0] instanceof IMP_Mailbox && $args[1] instanceof IMP_Indices) {
                 $this->mailbox = $args[0];
                 $this->buids = $args[0]->toBuids($args[1]);
                 parent::__construct($args[1]);
             }
             break;
     }
     if (!isset($this->buids)) {
         $this->buids = new IMP_Indices();
     }
     if (!isset($this->mailbox)) {
         $this->mailbox = IMP_Mailbox::get('INBOX');
     }
 }
All Usage Examples Of IMP_Indices::__construct