Horde_Registry::hasFeature PHP Method

hasFeature() public method

Does the application have the queried feature?
public hasFeature ( string $id, string $app = null ) : boolean
$id string Feature ID.
$app string The application to check (defaults to current app).
return boolean True if the application has the feature.
    public function hasFeature($id, $app = null)
    {
        if (empty($app)) {
            $app = $this->getApp();
        }
        try {
            $api = $this->getApiInstance($app, 'application');
        } catch (Horde_Exception $e) {
            return false;
        }
        return !empty($api->features[$id]);
    }

Usage Example

コード例 #1
0
ファイル: Connector.php プロジェクト: horde/horde
 /**
  * Return if the backend collection has the requested feature.
  *
  * @param string $feature     The requested feature.
  * @param string $collection  The requested collection id.
  *
  * @return boolean
  * @since 2.6.0
  */
 public function hasFeature($feature, $collection)
 {
     if (empty($this->_capabilities[$collection]) || !array_key_exists($feature, $this->_capabilities[$collection])) {
         $this->_capabilities[$collection][$feature] = $this->_registry->hasFeature($feature, $this->_getAppFromCollectionId($collection));
     }
     return $this->_capabilities[$collection][$feature];
 }