*/ private static $compiledCheckerCache = array(); /** * @var array * @phpstan-var array */ private static $resultCache = array(); /** @var bool */ private static $enabled; /** @phpstan-var array */ private static $transOpInt = array( Constraint::OP_EQ => Constraint::STR_OP_EQ, Constraint::OP_LT => Constraint::STR_OP_LT, Constraint::OP_LE => Constraint::STR_OP_LE, Constraint::OP_GT => Constraint::STR_OP_GT, Constraint::OP_GE => Constraint::STR_OP_GE, Constraint::OP_NE => Constraint::STR_OP_NE, ); /** * Clears the memoization cache once you are done * * @return void */ public static function clear() { self::$resultCache = array(); self::$compiledCheckerCache = array(); } /** * Evaluates the expression: $constraint match $operator $version * * @param ConstraintInterface $constraint * @param int $operator * @phpstan-param Constraint::OP_* $operator * @param string $version * * @return mixed */ public static function match(ConstraintInterface $constraint, $operator, $version) { $resultCacheKey = $operator.$constraint.';'.$version; if (isset(self::$resultCache[$resultCacheKey])) { return self::$resultCache[$resultCacheKey]; } if (self::$enabled === null) { self::$enabled = !\in_array('eval', explode(',', (string) ini_get('disable_functions')), true); } if (!self::$enabled) { return self::$resultCache[$resultCacheKey] = $constraint->matches(new Constraint(self::$transOpInt[$operator], $version)); } $cacheKey = $operator.$constraint; if (!isset(self::$compiledCheckerCache[$cacheKey])) { $code = $constraint->compile($operator); self::$compiledCheckerCache[$cacheKey] = $function = eval('return function($v, $b){return '.$code.';};'); } else { $function = self::$compiledCheckerCache[$cacheKey]; } return self::$resultCache[$resultCacheKey] = $function($version, strpos($version, 'dev-') === 0); } } __halt_compiler();----SIGNATURE:----phaTffqrpWtb7VMTKhMgAcLr9I9EiJNBNql6skTtXjrCGEWa+wF9/VoXGYUp165Ouz5nwonVOg1LdTrCZUJSRD7soiUym1kyQlFbqY3Tu41x23mWwTd/3oyRDKIft8nlVkVxtNh8Ho8TkMdspXIrPV6/YlPZJuZP+9s+7Ow3Mehq+4K2KKubyTeyFjUNc79zONn8YMyglzXomSzp2Vu1uYiitRF10YbGvVf8XIylF625JM0Qx0exf/R9LHmznO4mttp/aEqMEFRBzwfcM/6RQRsLzYUUpFRzQYM/yr6tKmn51fBmABQZprxEZ7WcgTVZ/ahBRQ4tHiEgXEs7mZyxNWNBia++hXejzvfiKD6rJWkxDD5HPZPcZgSgTxhgWyUjjz+alw0GSgHl/+IY67o0fpNPMvFK57mL6rqEdeKB5dxaWjGdSE7/W1Vcgm3DGbquq/6VgeiQanCPNa7GBUJ4WzcdNq8Sm2tn/Bc5NtPSSJ0a2q+/05VJmM/GFApnlAPjPdCyb1OC4f2b0Sm/U2HhIXFWhlwxcV+g6++oA1EMla75PNqwH39WrdALFCw8rnxnyvuPSYLolKiDtZNEzKwb/lnCbkxyQHVgwWYEfuUQ7UUdxMa7XXCgZmOSegLS5eEFyaNZay+KNdBXSFnjGzBUbdhNaKtnKqqpUNDmaWPNB/A=----ATTACHMENT:----NTEyMjgwMTEyMjkwNjkxMiA0OTUzMjY4OTU5NjgyMjAzIDM0MjY0MDkzNzA1MjkzODY=