Get the display callback for the connection.

@param  \Closure|null  $callback
@return \Closure
346606
protected function getCallback($callback)
	{
		if ( ! is_null($callback)) return $callback;

		$me = $this;

		return function($line) use ($me) { $me->display($line); };
	}
617125
public function open($callback = null)
    {
        StatementManager::clear($this->db);
        $this->db->open();
        return $this->db->isConnected();
    }
806153
public function getOnce($key, Closure $callback)
    {
        if ($this->has($key)) {
            return $this->cookies[$key];
        } else {
            $value = $callback();
            $this->set($key, $value);

            return $value;
        }
    }
120053
public function start(Closure $callback)
    {
        $this->output = $callback;

        $this->cooldown();

        $this->process->start($callback);

        return $this;
    }
1309026
public function detect(Closure $callback, $consoleArgs = null)
    {
        if ($consoleArgs) {
            return $this->detectConsoleEnvironment($callback, $consoleArgs);
        }

        return $this->detectWebEnvironment($callback);
    }
1236483
private function getCallback($callback)
    {
        if (is_callable($callback)) {
            if (is_array($callback)) {
                $callback = function (Edge $edge) use ($callback) {
                    return call_user_func($callback, $edge);
                };
            }
            return $callback;
        }

        static $methods = array(
            self::ORDER_WEIGHT => 'getWeight',
            self::ORDER_CAPACITY => 'getCapacity',
            self::ORDER_CAPACITY_REMAINING => 'getCapacityRemaining',
            self::ORDER_FLOW => 'getFlow'
        );

        if (!is_int($callback) || !isset($methods[$callback])) {
            throw new InvalidArgumentException('Invalid callback given');
        }

        $method = $methods[$callback];

        return function (Edge $edge) use ($method) {
            return $edge->$method();
        };
    }
1110398
public function after(Closure $callback = null)
    {
        if ($callback && $this->booted()) {
            $this->container->call($callback);
        }

        $this->eventDispatcher->listen(BootedAll::class, $callback);
        $this->eventDispatcher->listen('antares.extension: booted', $callback);
        $this->eventDispatcher->listen(ComponentsBooted::class, $callback);
    }
141471
public function findCallback(Closure $callback, $columns = ['*'])
    {
        return $this->postProcess( parent::findCallback($callback, $columns) );
    }
1253531
public function callback(Closure $callback)
    {
        foreach ($this->getInnerIterator() as $key => $value) {
            yield $callback($value, $key);
        }
    }
992562
public function setCallback($callback = NULL) {

		if (NULL !== $callback) {

			// taken from http://www.geekality.net/2011/08/03/valid-javascript-identifier/
			$pattern = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*+$/u';

			foreach (explode('.', $callback) as $part) {
				if (!preg_match($pattern, $part)) {
					throw new \InvalidArgumentException(sprintf("The callback name '%s' is not valid.", $part));
				}
			}
		}

		$this->callback = $callback;

		return $this->update();

	}
904176
public static function make(\Closure $callback = null)
    {
        if (is_null(static::$instance)) {
            static::$instance = new static();
        }

        if ($callback instanceof \Closure) {
            return $callback(static::$instance);
        }

        return static::$instance;
    }
383897
public function filter(Closure $callback)
    {
        $filtered_map = new static;

        foreach ($this->items as $key => $item) {
            if ($callback($item) === true) {
                $filtered_map->setItem($key, $item);
            }
        }

        return $filtered_map;
    }
1130173
protected static function controllerCallback($callback)
    {
        $datas      = Structure::data($callback);
        $function   = $datas['function'];
        $parameters = $datas['parameters'];
        $class      = $datas['namespace'] . $datas['page'];

        return function() use($class, $function, $parameters)
        { 
            (new $class)->$function(...$parameters); 
        };
    }
1131004
protected function getCallbackReflection($callback) {
		if (is_string($callback) && strpos($callback, '::') !== false) {
			$callback = explode('::', $callback, 2);
		}
		switch (true) {
			case is_string($callback) && function_exists($callback):
			case $callback instanceof \Closure:
				$reflection_method = new \ReflectionFunction($callback);
				break;
			case is_object($callback) && method_exists($callback, '__invoke'):
				$callback = array($callback, '__invoke');
			case is_array($callback):
				$reflection_method = new \ReflectionMethod($callback[0], $callback[1]);
				break;
		// @codeCoverageIgnoreStart
			default:
				throw new \LogicException('Found something callable that we can\'t reflect');

		}
		// @codeCoverageIgnoreEnd
		return $reflection_method;
	}
148530
public function getJoinColumn(callable $callback = null)
    {
        $joinColumn = reset($this->joinColumns);

        if (is_callable($callback)) {
            $callback($joinColumn);
        }

        return $joinColumn;
    }
138512
protected function callback($callback, array $args = [])
    {
        if (isset($callback)) {
            if (is_callable($callback) && $callback instanceof \Closure) {
                // Set new object and append the callback with some data.
                $o = new \ArrayObject($args);
                $o->app = App::instance();
                $callback = $callback->bindTo($o);
            } elseif (is_string($callback) && strpos($callback, '@') !== false) {
                $fixcallback = explode('@', $callback, 2);
                $this->Controller = $fixcallback[0];

                if (is_callable(
                    $callback = [$fixcallback[0], (isset($fixcallback[1]) ? $fixcallback[1] : 'index')]
                )) {
                    $this->Method = $callback[1];
                } else {
                    throw new \Exception("Callable error on {$callback[0]} -> {$callback[1]} !");
                }
            }

            if (is_array($callback) && !is_object($callback[0])) {
                $callback[0] = new $callback[0];
            }

            if (isset($args[0]) && $args[0] == $this->fullArg) {
                array_shift($args);
            }

            // Finally, call the method.
            return call_user_func_array($callback, $args);
        }
        return false;
    }
427798
public function onCreateAndEdit(Closure $callback = null)
    {
        $this->onCreate($callback);
        $this->onEdit($callback);

        return $this;
    }