You are here

protected static function RequestTree::isRequestDone in Subrequests 8

Check if a request and all its possible children are done.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The request.

Return value

bool TRUE if is done. FALSE otherwise.

1 call to RequestTree::isRequestDone()
RequestTree::isDone in src/Blueprint/RequestTree.php
Is the request tree done?

File

src/Blueprint/RequestTree.php, line 190

Class

RequestTree
Contains the hierarchical information of the requests.

Namespace

Drupal\subrequests\Blueprint

Code

protected static function isRequestDone(Request $request) {

  // If one request is not done, the whole tree is not done.
  if (!$request->attributes
    ->get(static::SUBREQUEST_DONE)) {
    return FALSE;
  }

  // If the request has children, then make sure those are done too.

  /** @var static $sub_tree */
  if ($sub_tree = $request->attributes
    ->get(static::SUBREQUEST_TREE)) {
    if (!$sub_tree
      ->isDone()) {
      return FALSE;
    }
  }
  return TRUE;
}