Constructs a new Hook, defining a closure to be ran prior to each of
the parent suite's nested suites and specs.

@param \Closure $closure The closure to be ran before each spec
323082
public function beforeEach(\Closure $closure)
    {
        $key = 'beforeEach';
        $beforeEach = new Hook($key, $closure, $this->current);
        $this->current->setHook($key, $beforeEach);
    }
652767
public function apply($closure)
    {
        foreach ($this->_data as $key => $val) {
            $this->_data[$key] = $closure($val, $key, $this);
        }
        return $this;
    }
1343782
public function orFilter(Closure $closure)
    {
        $query = $this->newNestedInstance($closure);

        $filter = $this->grammar->compileOr($query->getQuery());

        return $this->rawFilter($filter);
    }
1110595
public function afterEach(\Closure $closure)
    {
        $key = 'afterEach';
        $afterEach = new Hook($key, $closure, $this->current);
        $this->current->setHook($key, $afterEach);
    }
614060
public function share(Closure $closure)
		{
			return function($Eventable) 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($Eventable);
				}
				return $object;
			};
		}
335683
public function before(\Closure $closure = null)
    {
        if (null !== $closure) {
            $this->before[] = $closure;

            return $this;
        }

        return $this->before[] = new ExprBuilder($this->node);
    }
307206
public function each(Closure $closure)
    {
        foreach ($this->stack as &$item) {
            $closure($item);
        }

        return $this;
    }
601863
public function resolve($closure)
    {
        if (is_array($closure)) {
            $reflection = new \ReflectionMethod($closure[0], $closure[1]);
        } else {
            $reflection = new \ReflectionFunction($closure);
        }

        $arguments = $reflection->getParameters();

        $arguments = array_map(function ($argument) {
            return isset($this->bindMaps[$argument->name]) ? $this->bindMaps[$argument->name] : null;
        }, $arguments);

        return @call_user_func_array($closure, $arguments);
    }
392290
public function it($example, \Closure $closure = null)
    {
        if ($closure === null) {
            $that = $this;
            $closure = function() use ($that) { $that->pending(); };
        }
        $example = new Example($example, $closure);
        $example->setParent($this->__stack->top());
        $this->__stack->top()->add($example);
        return $example;
    }
884859
public function object(string $key, callable $closure)
    {
        $this->checkKey($key);
        $this->definitions['instance'][$key] = $closure;
    }
744321
public function extend($abstract, Closure $closure)
    {
        $abstract = $this->getAlias($abstract);

        if (isset($this->deferredServices[$abstract])) {
            $this->loadDeferredProvider($abstract);
        }

        return parent::extend($abstract, $closure);
    }
821089
private function buildName(\Closure $closure)
    {
        $reflection = new \ReflectionFunction($closure);

        // Quite hackish, but it seems there's no better way to get if a closure is static
        $bind = @\Closure::bind($closure, new \stdClass);
        $static =
            $bind === null
            || (new \ReflectionFunction($bind))->getClosureThis() === null;

        $arguments = array_map('strval', array_map(
            [ClosureParamStringForm::class, 'fromReflectionParameter'],
            $reflection->getParameters()
        ));

        $name = $static ? 'static function (' : 'function (';

        return $name.implode($arguments, ', ').')';
    }
1279441
public function handle(Closure $closure)
    {
        $result = \call_user_func($closure, $this->getMessage(), [$this, 'fail'], [$this, 'alert']);

        $attributes = [
            'result_code' => is_null($this->alert) && is_null($this->fail) ? static::SUCCESS : static::FAIL,
            'err_code_des' => $this->alert,
        ];

        if (is_null($this->alert) && is_string($result)) {
            $attributes += [
                'appid' => $this->app['config']->app_id,
                'mch_id' => $this->app['config']->mch_id,
                'nonce_str' => uniqid(),
                'prepay_id' => $result,
            ];
        }

        return $this->respondWith($attributes, true)->toResponse();
    }
49146
private function getSourceCode(\Closure $closure) {

		$reflection = new \ReflectionFunction($closure);

		$file = $reflection->getFileName();
		$source = file($file, FILE_IGNORE_NEW_LINES);

		$startLine = $reflection->getStartLine();
		$endLine = $reflection->getEndLine() - 1;

		return implode(
			PHP_EOL,
			array_slice($source, $startLine, $endLine - $startLine)
		);

	}
687429
public function apply($closure)
    {
        foreach ($this as $key => $val) {
            $this->offsetSet($key, $closure($val, $key, $this));
        }
        return $this;
    }
764936
protected function setClosure(Shell $shell, \Closure $closure)
    {
        if (self::shouldBindClosure()) {
            $that = $shell->getBoundObject();
            if (\is_object($that)) {
                $closure = $closure->bindTo($that, \get_class($that));
            } else {
                $closure = $closure->bindTo(null, $shell->getBoundClass());
            }
        }

        $this->closure = $closure;
    }
512458
function sortCustom(callable $closure) {
        $args = $this->baseStorageArgs;
        $args[] = parent::sortCustom($closure)->all();
        
        return (new static(...$args));
    }