function BatchTestHelper::stack
Same name and namespace in other branches
- 11.x core/modules/system/tests/modules/batch_test/src/BatchTestHelper.php \Drupal\batch_test\BatchTestHelper::stack()
Helper function: Stores or retrieves traced execution data.
File
-
core/
modules/ system/ tests/ modules/ batch_test/ src/ BatchTestHelper.php, line 26
Class
- BatchTestHelper
- Batch helper for testing batches.
Namespace
Drupal\batch_testCode
public function stack($data = NULL, $reset = FALSE) : array|null {
$state = \Drupal::state();
if ($reset) {
$state->delete('batch_test.stack');
}
if (!isset($data)) {
return $state->get('batch_test.stack');
}
$stack = $state->get('batch_test.stack');
$stack[] = $data;
$state->set('batch_test.stack', $stack);
return NULL;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.