DrewM\Morse\Morse::featureExists PHP Method

featureExists() public static method

Tests if the named feature exists in the current environment.
public static featureExists ( string $featureID ) : boolean | null
$featureID string The identifier for the feature, e.g. 'db/pdo'.
return boolean | null Returns true or false, or null if an error occured.
    public static function featureExists($featureID)
    {
        if (array_key_exists($featureID, self::$resultCache)) {
            return self::$resultCache[$featureID];
        }
        try {
            $feature = self::instantiateFromFeatureID($featureID);
            if (is_callable($feature)) {
                self::$resultCache[$featureID] = call_user_func($feature);
                return self::$resultCache[$featureID];
            }
        } catch (\Exception $e) {
            return null;
        }
        return null;
    }

Usage Example

Beispiel #1
0
 public function testIntl()
 {
     $result = Morse::featureExists('text/intl');
     $this->assertTrue($result === true || $result === false);
 }
All Usage Examples Of DrewM\Morse\Morse::featureExists