@param callable $func

@return bool
325923
public function transaction( $func ) {
		$level = $this->_transaction_level;
		$this->_transaction_level ++;
		if ( $level === 0 ) {
			$this->_error = null;
			try {
				$this->begin();
				$func();
				$this->commit();

				return true;
			} catch ( \Exception $e ) {
				$this->rollback();
				$this->app->log( $e );
				$this->_error = $e;
			} finally {
				$this->_transaction_level = $level;
			}
		} else {
			try {
				$func();

				return true;
			} finally {
				$this->_transaction_level = $level;
			}
		}

		return false;
	}
1284643
public static function getReflection(callable $func): \ReflectionFunctionAbstract
    {
        if (is_string($func) && strpos($func, "::") !== false) {
            list($classname, $method) = explode("::", $func, 2);
            $rc = new \ReflectionClass($classname);
            return $rc->getMethod($method);
        }
        return new \ReflectionFunction($func);
    }
426400
public function assert(callable $callback): bool
    {
        foreach ($this->items as $key => $item) {
            if ($callback($item, $key) === false) {
                return false;
            }
        }

        return true;
    }
258625
public function unpack(callable $func = null): self
    {
        $func = $func ?? static function (...$args) {
            yield from $args;
        };

        /** @psalm-suppress MixedArgument */
        return $this->map(static function (/* iterable */ $args = null) use ($func) {
            return $func(...$args ?? []);
        });
    }
1180566
public function map(callable $func) : self
    {
        $list = $this->list;

        foreach ($list as $index => $val) {
            $list[$index] = $func($val);
        }

        return new static($list);
    }
1364914
public function bind(callable $function) : Monadic
    {
        list($result, $output) = $function($this->result)->run();

        return self::of($result, flatten(extend($this->output, $output)));
    }
1156270
public function groupBy(callable $func)
    {
        $result = [];
        foreach ($this->each() as $k => $v) {
            $this->_groupBy($result, $k, $v, $func);
        }
        return $result;
    }
953154
public static function functionAvailable($func)
    {
        $disabled = explode(',', ini_get('disable_functions'));

        return function_exists($func) && !in_array($func, $disabled);
    }
920533
public static function call($key, callable $func)
    {
        $trace = debug_backtrace();
        if ($function = $trace[1]["function"]) {
            $key = $function . "_" . $key;
            if ($class = $trace[1]["class"]) {
                $key = str_replace("\\", "_", $class) . "_" . $key;
            }
        }

        if (static::check($key)) {
            return static::get($key);
        }

        $return = $func();

        static::set($key, $return);

        return $return;
    }
308090
public function any( callable $callback )
    {
        foreach( $this->collection as $entity ) {
            if( call_user_func( $callback, $entity) ) {
                return true;
            }
        }
        return false;
    }
299010
static function iterate($func)
	{
		$db = \App::get('db');

		$query = "SELECT cn FROM `#__xgroups`;";

		$db->setQuery($query);

		$result = $db->loadColumn();

		if ($result === false)
		{
			return false;
		}

		foreach ($result as $row)
		{
			call_user_func($func, $row);
		}

		return true;
	}
481287
public function call(callable $func, $args = null)
    {
        $pid = pcntl_fork();

        if ($pid == -1) {
            throw new \Exception("Failed to fork");
        }

        # If this is the child process, then run the requested function
        if (!$pid) {
            try {
                if ($args === null) {
                    $func();
                } else {
                    call_user_func_array($func, $args);
                }
            } catch(\Exception $e) {
                $memory = shmop_open($this->memoryKey, "c", 0644, static::SHARED_MEMORY_LIMIT);
                $errors = shmop_read($memory, 0, static::SHARED_MEMORY_LIMIT);
                $errors = trim($errors);
                if ($errors) {
                    $errors .= "\n";
                }
                $errors .= "Exception: " . $e->getMessage() . " (" . $e->getFile() . ":" . $e->getLine() . ")";
                shmop_write($memory, $errors, 0);
                shmop_close($memory);
                exit(1);
            }

            # Then we must exit or else we will end up the child process running the parent processes code
            die();
        }

        $this->threads[$pid] = $pid;

        return $pid;
    }
734552
protected function callableWithRoute(callable $callable)/*# : bool */
    {
        /* @var EventCapableAbstract $route */
        $route = $this->result->getRoute();
        $param = ['result' => $this->result];
        if ($route->trigger(Route::EVENT_BEFORE_HANDLER, $param)) {
            call_user_func($callable, $this->result);
            $route->trigger(Route::EVENT_AFTER_HANDLER, $param);
            return true;
        }
        $this->result->setHandler(null);
        return false;
    }
507365
public static function help(callable $callback = null){
        $callback
          ? is_callable($callback) && static::$help = $callback
          : static::$help && call_user_func(static::$help);
    }
747362
public function containsCallable(callable $callable)
	{
		foreach ($this->routes as $method) {
			foreach ($method as $entry)
			{
				if ($entry->callable === $callable) {
					return true;
				}
			}
		}

		return false;
	}
650403
public function setConvertValueFunction(callable $function)
    {
        $validator = $this->getCallableValidatorConvertValue();
        $validator->setCallableFunction($function);

        if ($validator->isValid() === false) {
            throw $validator->getException();
        }

        $this->convertValueFunction = $function;

        return $this;
    }
341089
public function find(callable $func)
    {
        $found = null;

        foreach ($this->elements as $key => $value) {
            if($func($value, $key)) {
                $found = $value;
                break;
            }
        }

        return $found;
    }