Eloquent\Phony\Reflection\FeatureDetector::isSupported PHP Method

isSupported() public method

Returns true if the specified feature is supported by the current runtime environment.
public isSupported ( string $feature ) : boolean
$feature string The feature.
return boolean True if supported.
    public function isSupported($feature)
    {
        if (!array_key_exists($feature, $this->supported)) {
            if (!isset($this->features[$feature])) {
                throw new UndefinedFeatureException($feature);
            }
            $this->supported[$feature] = (bool) call_user_func($this->features[$feature], $this);
        }
        return $this->supported[$feature];
    }

Usage Example

示例#1
0
 /**
  * Construct a new generator spy factory.
  *
  * @param CallEventFactory $callEventFactory The call event factory to use.
  * @param FeatureDetector  $featureDetector  The feature detector to use.
  */
 public function __construct(CallEventFactory $callEventFactory, FeatureDetector $featureDetector)
 {
     $this->callEventFactory = $callEventFactory;
     $this->isGeneratorImplicitNextSupported = $featureDetector->isSupported('generator.implicit-next');
     $this->isGeneratorReturnSupported = $featureDetector->isSupported('generator.return');
     $this->isHhvm = $featureDetector->isSupported('runtime.hhvm');
 }
All Usage Examples Of Eloquent\Phony\Reflection\FeatureDetector::isSupported