コールバック関数を用いてアプリケーション変数を設定します。

特性上、アプリケーション変数が削除されない限り、コールバック関数は一度しか呼ばれません。

@param	string		$name		アプリケーション変数名
@param	callable	$call_back	値を出力するコールバック関数
@return	mixed		設定した値
761690
public static function LasyClassVarAccessCallback ($name, $call_back) {
		if (!static::HasClassVar($name)) {
			static::$_ApplicationVariableTrait_Data[$name] = $call_back();
			static::$_ApplicationVariableTrait_ConstList[implode('=>', Arrays::AdjustArray($name))] = false;
		}
		return static::$_ApplicationVariableTrait_Data[$name];
	}
1045000
public function getCallbackAttributes()
    {
        if ($this->callbackAttributes)
            return $this->callbackAttributes;
        if ($this->getParent())
            return $this->getParent()->getCallbackAttributes();
        return null;
    }
916546
public static function libRepo($name, $callback = false) {
		
		if ($callback !== false and is_callable($callback)) {
			static::$libs_callbacks[$name] = $callback;
		} else {
			return static::$libs_callbacks[$name];
		}
		
	}
811342
public function addCallback($name, $callback, $prio = 10)
    {
        if (!is_callable($callback)) {
            throw new \Exception("Callback not callable.", 3);
            return false;
        }
        $key = $this->getCallbackKey($callback);
        if (!isset(self::$_baseRealCallbacks[$key])) {
            self::$_baseRealCallbacks[$key] = $callback;
        }

        $this->_callbacks[$name][$prio][] = $key;
        ksort($this->_callbacks[$name]);

        return $this;
    }
362741
public CommandCallback findCommandCallback(String name, ClassLoader cl) {
        synchronized (callbackCache) {
            
            if (!callbackCache.containsKey(name)) {
                try {
                    CommandCallback commandCallbackInstance = (CommandCallback) Class.forName(name, true, cl).newInstance();
                    return commandCallbackInstance;
                    //                            callbackCache.put(name, commandCallbackInstance);
                } catch (Exception ex) {
                    throw new IllegalArgumentException("Unknown Command implementation with name '" + name + "'");
                }

            } else {
                CommandCallback cmdCallback = callbackCache.get(name);
                if (!cmdCallback.getClass().getClassLoader().equals(cl)) {
                    callbackCache.remove(name);
                    try {
                        CommandCallback commandCallbackInstance = (CommandCallback) Class.forName(name, true, cl).newInstance();
                        callbackCache.put(name, commandCallbackInstance);
                    } catch (Exception ex) {
                        throw new IllegalArgumentException("Unknown Command implementation with name '" + name + "'");
                    }
                }
            }

        }
        return callbackCache.get(name);
    }
822819
private function get_controller_callable( $method_name ) {
		// Let's see if we have a current controller instanciated
		if ( is_object( $this->controller ) && !is_null( $this->controller ) ) {

			// Define a callable method as an array
			$callable = array( $this->controller, $method_name ); // Give the controller class and the name of the method

			// Check if the method is actually callable/exists
			if ( is_callable( $callable, false ) ) {
				return $callable;
			}
		}

		return false;
	}
1289985
public function resolveCallableFromCache(string $name, callable $closure)
    {
        if($this->cache->has(self::CACHE_CALLABLE . $name)) {
            return $this->cache->get(self::CACHE_CALLABLE . $name);
        }

        $resolved = $this->resolveCallable($name, $closure);

        //cache closure
        $this->store(self::CACHE_CALLABLE . $name, $resolved);

        return $resolved;
    }
691477
protected function parseMiddleware($name)
    {
        list($name, $parameters) = array_pad(explode(':', $name, 2), 2, null);

        //
        $callable = isset($this->middleware[$name]) ? $this->middleware[$name] : $name;

        if (is_null($parameters)) {
            return $callable;
        }

        // When the callable is a string, we will add back the parameters before returning.
        else if (is_string($callable)) {
            return $callable .':' .$parameters;
        }

        // A callback with parameters; we should create a proper middleware closure for it.
        $parameters = explode(',', $parameters);

        return function ($passable, $stack) use ($callable, $parameters)
        {
            return call_user_func_array(
                $callable, array_merge(array($passable, $stack), $parameters)
            );
        };
    }
514346
public function make($name, callable $callback) {
        $blueprint = new Blueprint($name, $this->config->getAdminURIPrefix());
        $callback($blueprint);
        $this->blueprints[$blueprint->getName()] = $blueprint;

        if($blueprint->hasPrimaryToolbarItem()) {
            $this->navigation->add($blueprint->getPrimaryToolbarItem());
        }
    }
452801
public function addRuleCallback($name, Callable $callback)
    {
        if (!is_string($name)) {
            throw new \InvalidArgumentException('Rule must be a string');
        }

        $rule = $this->createRuleCallback($name, $callback);
        $this->addRule($rule);
    }
729840
public function of(string $name, callable $callback = null): BuilderContract
    {
        if (! isset($this->names[$name])) {
            $this->names[$name] = $this->make($callback);
            $this->names[$name]->name = $name;
        }

        return $this->names[$name];
    }
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;
    }
71173
public static function __callstatic($name, $params)
    {
        if (array_key_exists($name, TextColorManager::getKnownColors())) {
            return TextColorManager::$name($params);
        }

        if (BackgroundColorManager::isBackgroundCall($name)) {
            return BackgroundColorManager::$name($params);
        }

        if (in_array($name, BorderManager::getKnownBorders())) {
            return BorderManager::$name($params);
        }

        if (in_array($name, StructureManager::getDisplayableStructures())) {
            return StructureManager::$name($params);
        }

        if (array_key_exists($name, StyleManager::getKnownStyles())) {
            return StyleManager::$name($params);
        }

        if (FigletManager::isFigletCall($name)) {
            return FigletManager::$name($params);
        }

        throw new Exception("Unknown function name $name");
    }
752876
public static function isCallable($name, $syntax_only = false, &$callable_name = null)
    {
        $result = is_callable($name, $syntax_only, $callable_name);
        if (is_array($name)) {
            $callable_name = is_object($name[0]) ? str_replace('::', '->', $callable_name) : $callable_name;
        }
        return $result;
    }
675103
public function when($name, callable $callback, callable $default = null, array $context = [])
    {
        if ($this->isActive($name, $context)) {
            return $callback($this->params($name), $context);
        } elseif ($default) {
            return $default($this->params($name), $context);
        }

        return $this;
    }
907965
protected function defineDate($app_name, $ext_name)
	{
		$app_callable = function ($date) {
			if ($date instanceof UTCDateTime) {
				// NOTE: Generates new DateTime to workaround issue with unserialize
				// of UTCDateTime::toDateTime() object
				return new \DateTime('@' . $date->toDateTime()->getTimestamp());
			}
			return null;
		};

		$ext_callable = function ($date) {
			if (empty($date)) {
				return null;
			}

			$date = $date instanceof \DateTime ? $date->getTimestamp() : strtotime($date);

			return new UTCDateTime($date * 1000);
		};

		$this->define($app_name, $ext_name, $app_callable, $ext_callable);
	}
437233
public function set(string $name, callable $callback): void
    {
        $this->services[$name] = function ($c) use ($callback) {
            static $object;

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

            return $object;
        };
    }