Horde_Kolab_Storage_Factory::createNamespace PHP Méthode

createNamespace() public méthode

Create a namespace handler.
public createNamespace ( string $type, string $user, array $params = [] ) : Horde_Kolab_Storage_Folder_Namespace
$type string The namespace type.
$user string The current user.
$params array The parameters for the namespace.
Résultat Horde_Kolab_Storage_Folder_Namespace The namespace handler.
    public function createNamespace($type, $user, array $params = array())
    {
        $class = 'Horde_Kolab_Storage_Folder_Namespace_' . Horde_String::ucfirst($type);
        if (!class_exists($class)) {
            throw new Horde_Kolab_Storage_Exception(sprintf(Horde_Kolab_Storage_Translation::t('Invalid "namespace" type "%s"!'), $type));
        }
        return new $class($user, $params);
    }

Usage Example

Exemple #1
0
 /**
  * Retrieve the namespace information for this connection.
  *
  * @return Horde_Kolab_Storage_Folder_Namespace The initialized namespace handler.
  */
 public function getNamespace()
 {
     if ($this->_namespace === null) {
         if (isset($this->_params['namespaces'])) {
             $this->_namespace = $this->_factory->createNamespace('config', $this->getAuth(), $this->_params['namespaces']);
         } else {
             $this->_namespace = $this->_factory->createNamespace('fixed', $this->getAuth());
         }
     }
     return $this->_namespace;
 }
All Usage Examples Of Horde_Kolab_Storage_Factory::createNamespace