As an action, execute the given callback.

@param \Closure $callback

@return \PAGI\Node\NodeActionCommand
557245
public function execute(\Closure $callback)
    {
        $this->action = self::NODE_ACTION_EXECUTE;
        $this->data['callback'] = $callback;
        return $this;
    }
901260
public function transaction( Closure $callback ) {
		$show_error = $this->wpdb->show_errors;

		// Prevent the wpdb errors.
		$this->wpdb->hide_errors();

		$this->beginTransaction();

		try {
			// We'll simply execute the given callback within a try / catch block
			// and if we catch any exception we can rollback the transaction
			// so that none of the changes are persisted to the database.
			$result = $callback( $this );

			$this->commit();
		} catch ( \Exception $e ) {
			// If we catch an exception, we will roll back so nothing gets messed
			// up in the database. Then we'll re-throw the exception so it can
			// be handled how the developer sees fit for their applications.
			$this->rollBack();

			throw $e;
		}

		$this->wpdb->show_errors( $show_error );

		return $result;
	}
673179
protected function appendIterator(\Closure $callback = null)
    {
        $iterator = new \AppendIterator();

        $paths = (array) parent::getArrayCopy();

        $clousre = function ($path) use ($callback, $iterator) {
            $iterator->append($callback($path));
        };

        foreach ($this as $path) {
            if ($this->isSubdir($path)) {
                continue;
            }

            $clousre($path);
        }

        return $iterator;
    }
750076
public function setCallback($callback)
    {
        // If the provided $value is not a closure, make it one now for easy resolution.
        if (!is_callable($callback)) {
            $callback = function () use ($callback) {
                return $callback;
            };
        }

        if ($this->protected) {
            return $this;
        }

        $this->callback = $callback;

        return $this;
    }
1305045
public function command($signature, Closure $callback)
    {
        $command = new ClosureCommand($signature, $callback);

        Artisan::starting(function ($artisan) use ($command) {
            $artisan->add($command);
        });

        return $command;
    }
922709
public function jumpAfterEval(\Closure $callback)
    {
        $this->action = self::NODE_ACTION_JUMP_TO;
        $this->data['nodeEval'] = $callback;
        return $this;
    }
786401
public function executeFor($id, Closure $callback): void
    {
        $callback(
            $this->newQuery()->findOrFail($id)
        );
    }
459955
public function runCallback(\Closure $callback)
    {
        // Check if a legacy stack callback is already running.
        if ($this->runningCallback) {
            throw new RuntimeException('Started recursive callback in legacy kernel.');
        }

        // Set the callback as running.
        $this->runningCallback = true;

        // Change current directory to the legacy stack.
        $platformHome = getcwd();
        // @todo Must get innomatic_legacy path from configuration.
        chdir($platformHome . '/innomatic_legacy');

        try {
            // Start the legacy Root Container and the legacy autoloader.
            require_once getcwd().'/innomatic/core/classes/innomatic/core/RootContainer.php';
            $rootContainer = \Innomatic\Core\RootContainer::instance('\Innomatic\Core\RootContainer');

            // Add the Symfony service container
            $rootContainer->setServiceContainer($this->container);

            // Start the legacy Innomatic Container.
            $innomatic = \Innomatic\Core\InnomaticContainer::instance('\Innomatic\Core\InnomaticContainer');

            // Set the Innomatic interface type to console.
            $innomatic->setInterface(\Innomatic\Core\InnomaticContainer::INTERFACE_CONSOLE);
            $home = \Innomatic\Core\RootContainer::instance('\Innomatic\Core\RootContainer')
                ->getHome()
                . 'innomatic/';

            // Start Innomatic.
            $innomatic->bootstrap($home, $home . 'core/conf/innomatic.ini');
            
            // Run the callback in the legacy core.
            $result = $innomatic->runCallback($callback);
        } catch (Exception $e) {
            // Go back to the new platform home.
            chdir($platformHome);
        
            // Clean the callback running state.
            $this->runningCallback = false;
            throw $e;
        }

        // Go back to the new platform home.
        chdir($platformHome);

        // Clean the callback running state.
        $this->runningCallback = false;

        return $result;
    }
610430
public function loop($data, Closure $callback)
    {
        TypeChecker::isIterable($data);

        foreach ($data as $key => $value) {
            $builder = new static();
            $callback($builder, $value, $key);
            $this->addNotification($builder->getNotification());
        }

        return $this;
    }
984000
public function beforeSending(Closure $callback): self
    {
        return tap($this, function () use ($callback) {
            $this->beforeSendingCallbacks[] = $callback;
        });
    }
618738
public function missing(Closure $callback)
	{
		$this->error(function(NotFoundHttpException $e) use ($callback)
		{
			return call_user_func($callback, $e);
		});
	}
1290914
public function group($name, \Closure $callback)
    {
        $this->currentGroup = $name;

        $callback($this);

        $this->currentGroup = null;

        return $this;
    }
37786
public function extend($driver, \Closure $callback)
    {
        $this->customCreators[$driver] = $callback->bindTo($this, $this);

        return $this;
    }
1208936
public function onSuccess(Closure $callback)
    {
        return $this->then(function (Container $container) use ($callback) {
            if (0 === $this->exitCode) {
                $container->call($callback);
            }
        });
    }
474292
public function pretend(Closure $callback)
    {
        return $this->withFreshQueryLog(function () use ($callback) {
            $this->pretending = true;

            // Basically to make the database connection "pretend", we will just return
            // the default values for all the query methods, then we will return an
            // array of queries that were "executed" within the Closure callback.
            $callback($this);

            $this->pretending = false;

            return $this->queryLog;
        });
    }
1051635
public function walk(Closure $callback) {
		foreach($this->_data as &$data) {
			$data = $callback($data);
		}
		unset($data);
		
		return $this;
	}
1211746
public function then(\Closure $callback)
    {
        if ($this->ready) {
            return null;
        }

        $this->ready = true;

        if (!$this->checkDomain() || !$this->checkPath() || !$this->checkSecurity()) {
            return null;
        }

        $oNS = parent::$prefixNS;
        $oPP = parent::$prefixPath;

        if ($this->ns) {
            parent::$prefixNS = $this->ns;
        }

        if ($this->path) {
            parent::$prefixPath = rtrim($this->currentPrefixPath, '/');
        }

        call_user_func_array($callback, $this->arguments);

        parent::$prefixNS = $oNS;
        parent::$prefixPath = $oPP;
    }