@param callable $callable

@return DynamicAttribute
489335
public function dynamic($callable)
    {
        return $this->attributes[$this->attribute] = new self::$classMap['dynamic']($this->attribute, $this->entity, $callable);
    }
111967
public function map($callable)
    {
        if (!$this->isCallable($callable)) {
            throw new ArrayObjectException(ArrayObjectException::MSG_INVALID_PARAM, [
                '$callable',
                'a callable function or method'
            ]);
        }

        $this->val(array_map($callable, $this->val()));

        return $this;
    }
1123775
protected function parse($callable)
    {
        list($callable, $args) = $this->parseArgs($callable);

        if ($this->isClassMethod($callable)) {
            $callable = $this->parseClassMethod($callable);
        } elseif ($this->isMutatorMethod($callable)) {
            $callable = [$this, $callable];
        } elseif (!function_exists($callable)) {
            throw new InvalidCallableException("Function [{$callable}] not found.");
        }

        return [$callable, $args];
    }
199431
private function createReflection(callable $callable)
    {
        if (is_string($callable) && strpos($callable, '::')) {
            $callable = explode('::', $callable);
        }

        if (is_array($callable)) {
            return new ReflectionMethod($callable[0], $callable[1]);
        }

        if (is_object($callable) && method_exists($callable, '__invoke')) {
            return new ReflectionMethod($callable, '__invoke');
        }

        return new ReflectionFunction($callable);
    }
917658
private function getRefParamsFromCallable(callable $callable, $funcName)
    {
        if (is_string($callable)) {
            $ref       = new ReflectionFunction($callable);
            $refParams = $ref->getParameters();
        } elseif (is_array($callable)) {
            $ref       = new ReflectionMethod($callable[0], $callable[1]);
            $refParams = $ref->getParameters();
        } elseif (is_object($callable)) {
            $ref       = new ReflectionMethod($callable, '__invoke');
            $refParams = $ref->getParameters();
        } else {
            throw new MarkupException(sprintf('type of callable function %s() is not supported', $funcName));
        }

        return $refParams;
    }
1098887
public function extend($name, callable $callable)
    {
        $name = $name == '*' ? '*.*.*' : $name;
        $this->checkSegmentCount($name);
        $this->_extensions[$name] = $callable;

        return $this;
    }
896874
public function invoke(Callable $callable)
	{
		$reflection = $this->reflectCallable($callable);

		$args = [];

		foreach($reflection->getParameters() as $param) {
			$type = $param->getClass()->getName();

			if (in_array($type, $this->resolving)) {
				throw new \LogicException("Recursive dependency: $type is currently instatiating.");
			}

			$args[] = ($param->allowsNull() && !isset($this[$type])) ? null : $this[$type];
		}

		return call_user_func_array($callable, $args);
	}
779374
public static function getReflectionCallable($callable)
    {
        if (is_callable($callable, true)) {
            try {
                if (is_object($callable)) {
                    return new ReflectionFunction($callable);
                }
                if (is_array($callable)) {
                    return new ReflectionMethod($callable[0], $callable[1]);
                }
                if (strpos($callable, '::') === false) {
                    return new ReflectionFunction($callable);
                }
                return new ReflectionMethod($callable);
            } catch (ReflectionException $exception) {
            }
        }
        return false;
    }
100933
public function service($name, $callable) {

        $this->registry[$name] = function($c) use($callable) {
            static $object;

            if (null === $object) {
                $object = $callable($c);
            }

            return $object;
        };

        return $this;
    }
327191
public function share(Closure $callable) : Closure
    {
        return function () use ($callable) {
            static $object;
            $c = $this;

            if (is_null($object) && $callable instanceof Closure) {
                $object = $callable($c);
            }

            return $object;
        };
    }
1062278
public function find($callable = null)
    {
        /** @var Cursor $cursor */
        $cursor = new Cursor($this, array(
            'expressionClass'   => $this->definition->getExpressionClass(),
            'batchSize'         => $this->definition->getOption('batchSize'),
            'clientTimeout'     => $this->definition->getOption('cursorClientTimeout'),
            'serverTimeout'     => $this->definition->getOption('cursorServerTimeout'),
        ));

        if (is_callable($callable)) {
            $callable($cursor->getExpression());
        }

        return $cursor;
    }
381912
public function annotate(callable $callable) {
		$fn = null;
		$invoke = function () {};

		// TODO can this be *any* cleaner?
		if(is_array($callable)) {
			// support shorthand array callable form
			// callable arrays will always have 2 elements--otherwise they don't pass the typehint
			$cls = new ReflectionClass($callable[0]);
			$fn = $cls->getMethod($callable[1]);
			$invoke = function ($args) use($fn, $callable) {
				return function () use($fn, $callable, $args) {
					return $fn->invokeArgs($callable[0], $args);
				};
			};
		} else if(!($callable instanceof \Closure)) {
			// support magic __invoke method form
			$cls = new ReflectionClass($callable);
			$fn = $cls->getMethod('__invoke');
			$invoke = function ($args) use($fn, $callable) {
				return function () use($fn, $callable, $args) {
					return $fn->invokeArgs($callable, $args);
				};
			};
		} else {
			// support all other callables
			$fn = new ReflectionFunction($callable);
			$invoke = function ($args) use($fn) {
				return function () use($fn, $args) {
					return $fn->invokeArgs($args);
				};
			};
		}

		$cacheId = sha1($fn->__toString());
		if(array_key_exists($cacheId, $this->fnCache)) {
			return $this->fnCache[$cacheId];
		}

		$args = $this->getArgs($fn);
		$annotated = $invoke($args);
		$this->fnCache[$cacheId] = $annotated;
		return $annotated;
	}
971854
public function map($callable)
    {
        // Contain the map within a higher-order callable
        // that enforces type-correctness for the $callable
        $this->frames = array_map(function ($frame) use ($callable) {
            $frame = call_user_func($callable, $frame);

            if (!$frame instanceof Frame) {
                throw new UnexpectedValueException(
                    "Callable to " . __METHOD__ . " must return a Frame object"
                );
            }

            return $frame;
        }, $this->frames);

        return $this;
    }
879265
private function validCallable($callable)
    {
        if (is_callable($callable)) {
            if ($callable instanceof \Closure) {
                $callable = $callable->bindTo($this->container);
            }

            return $callable;
        } elseif (is_string($callable) && count(explode(':', $callable)) == 2) {
            return $callable;
        }

        $this->addedExceptions['\InvalidArgumentException'] = 'Callable inválido';
        return false;
    }
1243892
public function filter(?callable $callable = null)
	{
		if($callable === null)
		{
			return new static(array_filter($this->items));
		}

		return new static(array_filter($this->items, $callable, ARRAY_FILTER_USE_BOTH));
	}
252242
public function insert(
        callable $callable,
        /*# int */ $priority,
        /*# bool */ $sort = true
    ) {
        static $MAX = 9999999;

        if ($priority > 100 || $priority < 0) {
            throw new Exception\InvalidArgumentException(
                Message::get(Message::INVALID_EVENT_PRIORITY, $priority),
                Message::INVALID_EVENT_PRIORITY
            );
        }

        // key
        $key  = $priority * 10000000 + $MAX--;
        $this->queue[$key] = ['data' => $callable, 'priority' => $priority ];

        // sort by priority
        if ($sort) {
            $this->sort();
        }
    }
1120854
static function makeReflectFromCallable(callable $callable)
    {
        if ( $callable instanceof ipInvokableCallback )
            $callable = $callable->getCallable();

        if ( is_array($callable) )
            // [className_orObject, 'method_name']
            $reflection = new \ReflectionMethod($callable[0], $callable[1]);

        if ( is_string($callable) ) {
            if ( strpos($callable, '::') )
                // 'classname::method'
                $reflection = new \ReflectionMethod($callable);
            else
                // 'function_name'
                $reflection = new \ReflectionFunction($callable);
        }

        if ( method_exists($callable, '__invoke') ) {
            // Closure and Invokable
            if ($callable instanceof \Closure)
                $reflection = new \ReflectionFunction($callable);
            else
                $reflection = new \ReflectionMethod($callable, '__invoke');
        }

        if (! isset($reflection) )
            throw new \ReflectionException;

        return $reflection;
    }