Comments out a context related spec.

@param  string  $message Description message.
@param  Closure $closure A test case closure.

@return
337095
public function xcontext($message, $closure, $timeout = null)
    {
        return $this->_block->context($message, $closure, $timeout, 'exclude');
    }
555709
public function xdescribe($message, $closure, $timeout = null)
    {
        return $this->_block->describe($message, $closure, $timeout, 'exclude');
    }
959863
public function share(Closure $closure)
    {
        return function($container) use ($closure)
        {
            // We'll simply declare a static variable within the Closures and if it has
            // not been set we will execute the given Closures to resolve this value
            // and return it back to these consumers of the method as an instance.
            static $object;

            if (is_null($object)) {
                $object = $closure($container);
            }

            return $object;
        };
    }
1149710
public function it($title, \Closure $closure = null)
    {
        $spec = new Spec($title, $closure, $this->current);
        $this->current->addSpec($spec);
    }
305933
public function filter(\Closure $closure)
    {
        $newInstance = new self();
        $newInstance->setArray(array_filter($this->array, $closure));
        return $newInstance;
    }
723407
public function xit($title, \Closure $closure = null)
    {
        $spec = new Spec($title, $closure, $this->current);
        $spec->setPending();
        $this->current->addSpec($spec);
    }
754581
public function after($number, Closure $closure)
    {
        $hash = spl_object_hash((object) $closure);

        if (isset ($this->delayed[$hash]))
        {
            $closure = $this->delayed[$hash];

            return $closure();
        }

        $this->delayed[$hash] = function() use($number, $closure)
        {
            static $tries = 0;

            $tries += 1;

            if ($tries === $number)
            {
                return $closure();
            }
        };
    }
587958
public static function dumpClosure(Closure $c) {
        $res = 'function (';
        $fun = new ReflectionFunction($c);
        $args = [];
        foreach($fun->getParameters() as $arg) {
            $str = '';
            if($arg->isArray()) {
                $str .= 'array ';
            } else if($arg->getClass()) {
                $str .= $arg->getClass()->name . ' ';
            }
            if($arg->isPassedByReference()){
                $str .= '&';
            }
            $str .= '$' . $arg->name;
            if ($arg->isOptional()) {
                $str .= ' = ' . var_export($arg->getDefaultValue(), true);
            }
            $args[] = $str;
        }
        $res .= implode(', ', $args);
        $res .= ') {' . PHP_EOL;
        $lines = file($fun->getFileName());
        for ($i = $fun->getStartLine(); $i < $fun->getEndLine(); $i++) {
            $res .= $lines[$i];
        }

        return rtrim($res, "\n ,");
    }
1060655
private function guess(\Closure $closure): Guess
    {
        $guesses = [];

        foreach ($this->guessers as $guesser) {
            if ($guess = $closure($guesser)) {
                $guesses[] = $guess;
            }
        }

        return Guess::getBestGuess($guesses);
    }
1202708
private function withPrimaryReadPreference(\Closure $closure)
    {
        $prevReadPref = $this->mongoCollection->getReadPreference();
        $this->mongoCollection->setReadPreference(\MongoClient::RP_PRIMARY);

        try {
            return $closure();
        } finally {
            $prevTags = ! empty($prevReadPref['tagsets']) ? $prevReadPref['tagsets'] : [];
            $this->mongoCollection->setReadPreference($prevReadPref['type'], $prevTags);
        }
    }
141265
public static function delegateNegated($entry, \Closure $closure)
    {
        $isNegated = function (&$property) {
            return $property[0] === '!' && $property = substr($property, 1);
        };

        $negated = is_scalar($entry) ? $isNegated($entry) : false;
        $result = $closure($entry);

        return $negated !== $result ? ($negated ? !$result : $result) : false;
    }
797435
public static function captureQueries(\Closure $closure)
    {
        DB::enableQueryLog();
        $closure();
        $logs = DB::getQueryLog();
        return array_map(function ($log) {
            return static::inlineBindings($log['query'], $log['bindings']);
        }, $logs);
    }
1362520
public function provideOpenLinkAttributes($context, Closure $closure)
    {
        $closure->bindTo($this);
        $this->extend($this->getContextExtendName($context), $closure);
        return $this;
    }
170364
public static function group($group, \Closure $closure)
    {
        self::$group = $group;
        call_user_func($closure, self::getInstance());
        self::$group = null;
    }
1342552
private function doReceive(\Closure $cb, ...$args)
    {
        $message = call_user_func_array($cb, $args);

        if (null !== $message && false == $message instanceof InteropMessage) {
            throw new \RuntimeException(sprintf(
                'Expected "%s" but got: "%s"', InteropMessage::class, is_object($message) ? get_class($message) : gettype($message)));
        }

        return $message;
    }
752156
public function validate(?Closure $closure = null)
  {
    /**
     * Create a new validation factory
     */
    $factory = new ValidatorFactory();
    $response = $factory->make($this->data(), isset($this->rules) ? $this->rules : []);

    if (is_callable($closure)) {
      $custom = call_user_func($closure, $response);

      if ($custom instanceOf Model) return $custom;

      if (is_array($custom)) {
        foreach($custom as $key => $unique) {
          $response->errors()->add($key, $unique);
        }
      }
    }

    if (count($response->errors()) > 0 || $response->fails()) {
      if ($this->headers->has('Content-Type') &&  str_contains(strtolower($this->headers->get('Content-Type')), 'json')) {
        Rest::response()->json($response->errors()->toArray(), 422);
        die();
      }

      $url = ($this->server->has('HTTPS') ? 'https://' : 'http://') . $this->server->get('HTTP_HOST');

      if ($this->server->has('HTTP_ORIGIN') && $this->server->get('HTTP_ORIGIN') == $url) {
        $referer = $this->headers->get('Referer');

        Redirect::to($referer)
            ->with('validation.errors', $response->errors())
            ->with('form.old', $this->all())
            ->code(302)
            ->send();
      } else {
        Rest::response()->json($response->errors()->toArray(), 422);
        die();
      }
    }
  }
1045590
public static function getOrSet($key, \Closure $closure, int $ttl = null, array $tags = [])
    {
        $item = self::getCacheService()->user()->getItem(self::key($key));
        if ($item->isHit()) {
            return $item->get();
        }

        $result = $closure();
        $item->set($result);
        if ($ttl) {
            $item->expiresAfter($ttl);
        }
        if ($tags && $item instanceof CacheItem) {
            $item->tag($tags);
        }
        self::getCacheService()->user()->save($item);
        return $result;
    }