hasMethod() public method

Determine if a method has been registered with the registry.
public hasMethod ( string $method, string $app = null ) : mixed
$method string The full name of the method to check for.
$app string Only check this application.
return mixed The application implementing $method if we have it, false if the method doesn't exist.
コード例 #1
0
ファイル: RootCollection.php プロジェクト: horde/horde
 /**
  * Returns an array with all the child nodes
  *
  * @return DAV\INode[]
  */
 public function getChildren()
 {
     $apps = $this->_collections;
     foreach ($this->_registry->listApps() as $app) {
         if ($this->_registry->hasMethod('browse', $app)) {
             $apps[] = new Horde_Dav_Collection($app, array(), $this->_registry, $this->_mimedb);
         }
     }
     return $apps;
 }
コード例 #2
0
ファイル: Connector.php プロジェクト: horde/horde
 /**
  * Delete a folder.
  *
  * @param string $class  The EAS collection class.
  * @param string $id     The folder id
  *
  * @since 2.12.0
  */
 public function deleteFolder($class, $id)
 {
     switch ($class) {
         case Horde_ActiveSync::CLASS_TASKS:
             if (!$this->_registry->horde->getPreference($this->_registry->hasInterface('tasks'), 'activesync_no_multiplex')) {
                 throw new Horde_ActiveSync_Exception('Deleting addressbooks not supported by the contacts API.', Horde_ActiveSync_Exception::UNSUPPORTED);
             }
             $this->_registry->tasks->deleteTasklist($id);
             break;
         case Horde_ActiveSync::CLASS_CONTACTS:
             if (!$this->_registry->hasMethod('contacts/deleteAddressbook') || !$this->_registry->horde->getPreference($this->_registry->hasInterface('contacts'), 'activesync_no_multiplex')) {
                 throw new Horde_ActiveSync_Exception('Deleting addressbooks not supported by the contacts API.', Horde_ActiveSync_Exception::UNSUPPORTED);
             }
             $this->_registry->contacts->deleteAddressbook($id);
             break;
         case Horde_ActiveSync::CLASS_CALENDAR:
             if (!$this->_registry->hasMethod('calendar/deleteCalendar') || !$this->_registry->horde->getPreference($this->_registry->hasInterface('calendar'), 'activesync_no_multiplex')) {
                 throw new Horde_ActiveSync_Exception('Deleting calendars not supported by the calendar API.', Horde_ActiveSync_Exception::UNSUPPORTED);
             }
             $this->_registry->calendar->deleteCalendar($id);
             break;
         case Horde_ActiveSync::CLASS_NOTES:
             if (!$this->_registry->hasMethod('notes/deleteNotepad') || !$this->_registry->horde->getPreference($this->_registry->hasInterface('notes'), 'activesync_no_multiplex')) {
                 throw new Horde_ActiveSync_Exception('Deleting notepads not supported by the notes API.', Horde_ActiveSync_Exception::UNSUPPORTED);
             }
             $this->_registry->notes->deleteNotepad($id);
             break;
     }
 }
コード例 #3
0
ファイル: Horde.php プロジェクト: raz0rsdge/horde
 /**
  * Returns an unsorted file list of the specified directory.
  *
  * @param string $path          The path of the directory.
  * @param string|array $filter  Regular expression(s) to filter
  *                              file/directory name on.
  * @param boolean $dotfiles     Show dotfiles?
  * @param boolean $dironly      Show only directories?
  *
  * @return array  File list.
  * @throws Horde_Vfs_Exception
  */
 protected function _listFolder($path, $filter = null, $dotfiles = true, $dironly = false)
 {
     $list = array();
     if ($path == '/') {
         try {
             $apps = $this->_registry->listApps(null, false, Horde_Perms::READ);
         } catch (Horde_Exception $e) {
             throw new Horde_Vfs_Exception($e->getMessage());
         }
         foreach ($apps as $app) {
             if ($this->_registry->hasMethod('browse', $app)) {
                 $file = array('name' => $app, 'date' => time(), 'type' => '**dir', 'size' => -1);
                 $list[] = $file;
             }
         }
         return $list;
     }
     if (substr($path, 0, 1) == '/') {
         $path = substr($path, 1);
     }
     $pieces = explode('/', $path);
     try {
         $items = $this->_registry->callByPackage($pieces[0], 'browse', array('path' => $path, 'properties' => array('name', 'browseable', 'contenttype', 'contentlength', 'modified')));
     } catch (Horde_Exception $e) {
         throw new Horde_Vfs_Exception($e->getMessage());
     }
     if (!is_array(reset($items))) {
         /* We return an object's content. */
         throw new Horde_Vfs_Exception('Unknown error');
     }
     foreach ($items as $sub_path => $i) {
         if ($dironly && !$i['browseable']) {
             continue;
         }
         $name = basename($sub_path);
         if ($this->_filterMatch($filter, $name)) {
             continue;
         }
         $type = class_exists('Horde_Mime_Magic') ? Horde_Mime_Magic::mimeToExt(empty($i['contenttype']) ? 'application/octet-stream' : $i['contenttype']) : '**none';
         $file = array('name' => $name, 'date' => empty($i['modified']) ? 0 : $i['modified'], 'type' => $i['browseable'] ? '**dir' : $type, 'size' => empty($i['contentlength']) ? 0 : $i['contentlength']);
         $list[] = $file;
     }
     return $list;
 }