{@inheritdoc}

@return void
515071
public function evaluate(FlowQuery $flowQuery, array $arguments)
    {
        $sortOrder = 'ASC';
        if (!empty($arguments[0]) && in_array($arguments[0], ['ASC', 'DESC'], true)) {
            $sortOrder = $arguments[0];
        }
        
        $nodes = $flowQuery->getContext();

        $indexPathCache = [];

        /** @var NodeInterface $node */
        foreach ($nodes as $node) {
            // Collect the list of sorting indices for all parents of the node and the node itself
            $nodeIdentifier = $node->getIdentifier();
            $indexPath = [$node->getIndex()];
            while ($node = $node->getParent()) {
                $indexPath[] = $node->getIndex();
            }
            $indexPathCache[$nodeIdentifier] = $indexPath;
        }

        $flip = $sortOrder === 'DESC' ? -1 : 1;

        usort($nodes, function (NodeInterface $a, NodeInterface $b) use ($indexPathCache, $flip) {
            if ($a === $b) {
                return 0;
            }

            // Compare index path starting from the site root until a difference is found
            $aIndexPath = $indexPathCache[$a->getIdentifier()];
            $bIndexPath = $indexPathCache[$b->getIdentifier()];
            while (count($aIndexPath) > 0 && count($bIndexPath) > 0) {
                $diff = (array_pop($aIndexPath) - array_pop($bIndexPath));
                if ($diff !== 0) {
                    return $flip * $diff < 0 ? -1 : 1;
                }
            }

            return 0;
        });

        $flowQuery->setContext($nodes);
    }
414952
public function init($request, $response)
    {
        $this->request = $request;
        $this->response = $response;

        $this->c()->set('request', $request);
        $this->c()->set('response', $response);
    }
590639
public function init(): void
    {
        parent::init();

        foreach (['useTablePrefix', 'showOnly', 'generalSchema', 'fixHistory'] as $property) {
            if ($this->$property !== true) {
                if ($this->$property === 'true' || $this->$property === 1) {
                    $this->$property = true;
                }

                $this->$property = (bool)$this->$property;
            }
        }
    }
861833
private function doBeforeCompile(): void
	{
		$builder = $this->getContainerBuilder();
		$dispatcher = $builder->getDefinition($this->prefix('dispatcher'));

		$subscribers = $builder->findByType(EventSubscriberInterface::class);
		foreach ($subscribers as $name => $subscriber) {
			$dispatcher->addSetup('addSubscriber', [$subscriber]);
		}
	}
997412
public function handle(): void
    {
        // Log
        $this->getService('logging')->debug(sprintf('%s / Initialization', __METHOD__));

        // Event
        $this->getService('events')->trigger('_berlioz.core.app.handle.before', $this);

        // Get router
        /** @var \Berlioz\Core\Services\Routing\RouterInterface $router */
        $router = $this->getService('routing');

        // Get route set from cache
        if ($this->getConfig()->hasCacheEnabled() && $this->hasService('caching') && $this->getService('caching')->has(self::CACHE_KEY_ROUTING)) {
            /** @var \Berlioz\Core\Services\Routing\RouteSetInterface $routeSet */
            $routeSet = $this->getService('caching')->get(self::CACHE_KEY_ROUTING);

            // Define route set from cache
            $router->setRouteSet($routeSet);

            // Log
            $this->getService('logging')->debug(sprintf('%s / Router gotten from cache', __METHOD__));
        } else {
            // Register routes ans exceptions
            $this->register();

            // Log
            $this->getService('logging')->debug(sprintf('%s / Routes and exceptions declared', __METHOD__));

            if ($this->getConfig()->hasCacheEnabled() && $this->hasService('caching')) {
                $this->getService('caching')->set(self::CACHE_KEY_ROUTING, $router->getRouteSet());

                // Log
                $this->getService('logging')->debug(sprintf('%s / Router saved in cache', __METHOD__));
            }
        }

        // Handle router
        $response = $router->handle();

        // Debug
        $this->getService('logging')->debug(sprintf('%s / Done', __METHOD__));

        if ($response instanceof ResponseInterface) {
            // Headers
            if (!headers_sent()) {
                // Remove headers and add main header
                header_remove();
                header('HTTP/' . $response->getProtocolVersion() . ' ' . $response->getStatusCode() . ' ' . $response->getReasonPhrase(), false);

                // Headers
                foreach ($response->getHeaders() as $name => $values) {
                    $replace = true;
                    foreach ($values as $value) {
                        header(sprintf('%s: %s', $name, $value), $replace);
                        $replace = false;
                    }
                }
            }

            // Content
            print $response->getBody();
        } else {
            print $response;
        }

        // Log
        $this->getService('logging')->debug(sprintf('%s / Response printed', __METHOD__));

        // Event
        $this->getService('events')->trigger('_berlioz.core.app.handle.after', $this);
    }
924340
public static function disconnect(): void
  {
    if (self::$mysqli!==null)
    {
      self::$mysqli->close();
      self::$mysqli = null;
    }
  }
1119962
public function process()
    {
        $this->processFields();

        $this->editableFields()->each(function (Field $field) {
            $field->placeholder($field->description());
            $field->setNewValue($this->getInput($field->elementName()));

            if ($field->hasValidNewValue()) {
                $field->applyFilter($this->query);
            }
        });

        if ($this->paginatorEnabled) {
            $this->paginator();
        }
    }
810772
public function initialize()
    {
        if ($this->initialized || ! $this->association) {
            return;
        }

        $this->doInitialize();

        $this->initialized = true;
    }
996166
public function execute()
    {
        if (!$this->isEmpty()) {
            $this->table->delete($this->context + $this->where)->run();
        }

        parent::execute();
    }
1158917
public function register()
  {
    $events = $this->register;

    foreach($events as $name => $event) {
      Events::listen($name, $event);
    }
  }
869287
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->startCommand($output);
        $plugins = $this
            ->pluginRepository
            ->findAll();

        /**
         * @var Plugin $plugin
         */
        foreach ($plugins as $plugin) {
            $this->printMessage(
                $output,
                'Plugin',
                $plugin->getNamespace() . ' - [Hash : ' . $plugin->getHash() . ']'
            );
        }

        $this->finishCommand($output);
    }
177598
public function executeUpdates($updates) {
    /** @var Updates $updates_object */
    $updates_object = new $this->updateClassName($this);
    $this->output->writeln("Executing updates...");

    /**
     * @var string $method_name
     * @var Update $update
     */
    foreach ($updates as $method_name => $update) {
      $this->output->writeln("-> $method_name: {$update->description}");
      call_user_func([$updates_object, $method_name]);
    }
  }
1012998
public function inject($object) : void
    {
        $reflection = new \ReflectionObject($object);

        $this->injectProperties($reflection, $object);
        $this->injectMethods($reflection, $object);
    }
810577
public function execute()
    {
        $this->addFromDeleteRels();

        $this->getModelsToDelete()->byRepo(function (Repo $repo, Models $models) {
            $repo->deleteModels($models);
        });

        $this->addFromInsertRels();

        $this->getModelsToInsert()->assertValid()->byRepo(function (Repo $repo, Models $models) {
            $repo->insertModels($models);
        });

        $this->addFromUpdateRels();

        $this->getModelsToUpdate()->assertValid()->byRepo(function (Repo $repo, Models $models) {
            $repo->updateModels($models);
        });
    }
810820
public function fireEvent(string $event): void
    {
        $this->log->debug('Event {event} has been fired.', ['event' => $event]);
        foreach ($this->event_handlers as $handler) {
            /** @var EventHandler $handler */
            if ($event === $handler->getEvent()) {
                $handler->execute();
            }
        }
    }
214308
public function process()
    {
        if (!$this->getForm()->isSubmitted()) {
            return;
        }

        parent::process();

        $this->processValues();

        if (
            $this->required &&
            count($this->values) == 0 &&
            $this->isSensitive()
        ) {
            $this->addMessage($this->getValidationMessage('required'));
        }
    }
49452
public function unserialize(/* mixed */ $data): void 
    {
        $values = unserialize($data);
        foreach ($values as $key=>$value) {
                $this->$key = $value;
        }
    }