Horde_Kolab_Storage_Folder_Namespace::matchNamespace PHP Method

matchNamespace() public method

Match a folder name with the corresponding namespace.
public matchNamespace ( string $name ) : Horde_Kolab_Storage_Folder_Namespace_Element
$name string The name of the folder.
return Horde_Kolab_Storage_Folder_Namespace_Element The corresponding namespace.
    public function matchNamespace($name)
    {
        foreach ($this->_prefix_namespaces as $namespace) {
            if ($namespace->matches($name)) {
                return $namespace;
            }
        }
        if (!empty($this->_any)) {
            return $this->_any;
        }
        throw new Horde_Kolab_Storage_Exception(sprintf('Namespace of folder %s cannot be determined.', $name));
    }

Usage Example

Esempio n. 1
0
File: Data.php Progetto: horde/horde
 /**
  * Prepare an array representing the folder data.
  *
  * @return array The folder data.
  */
 public function toArray()
 {
     return array('folder' => $this->_path, 'type' => $this->_type->getType(), 'default' => $this->_type->isDefault(), 'owner' => $this->_namespace->getOwner($this->_path), 'name' => $this->_namespace->getTitle($this->_path), 'subpath' => $this->_namespace->getSubpath($this->_path), 'parent' => $this->_namespace->getParent($this->_path), 'namespace' => $this->_namespace->matchNamespace($this->_path)->getType(), 'prefix' => $this->_namespace->matchNamespace($this->_path)->getName(), 'delimiter' => $this->_namespace->matchNamespace($this->_path)->getDelimiter());
 }