Pinq\Iterators\Generators\GeneratorScheme::compatibleWith PHP Méthode

compatibleWith() public static méthode

public static compatibleWith ( $phpVersion )
    public static function compatibleWith($phpVersion)
    {
        // HHVM does not support foreach by reference on iterators.
        // This is used extensively by the generator classes,
        // hence fallback to the standard iterator scheme.
        return version_compare($phpVersion, '5.5.0', '>=') && strpos($phpVersion, 'hhvm') === false && strpos($phpVersion, 'hiphop') === false;
    }

Usage Example

Exemple #1
0
 /**
  * @return IIteratorScheme[]
  */
 public static function getAvailableSchemes()
 {
     if (self::$schemesInPriorityOrder === null) {
         if (Generators\GeneratorScheme::compatibleWith(PHP_VERSION)) {
             self::$schemesInPriorityOrder[] = new Generators\GeneratorScheme();
         }
         if (Standard\IteratorScheme::compatibleWith(PHP_VERSION)) {
             self::$schemesInPriorityOrder[] = new Standard\IteratorScheme();
         }
     }
     return self::$schemesInPriorityOrder;
 }