class TurtleLazyBuilder

Same name in other branches
  1. 11.x core/modules/big_pipe/tests/src/Unit/Render/FiberPlaceholderTest.php \Drupal\Tests\big_pipe\Unit\Render\TurtleLazyBuilder

Hierarchy

Expanded class hierarchy of TurtleLazyBuilder

File

core/modules/big_pipe/tests/src/Unit/Render/FiberPlaceholderTest.php, line 109

Namespace

Drupal\Tests\big_pipe\Unit\Render
View source
class TurtleLazyBuilder implements TrustedCallbackInterface {
    
    /**
     * #lazy_builder callback.
     *
     * Suspends its own execution twice to simulate long operation.
     *
     * @return array
     */
    public static function turtle() : array {
        if (\Fiber::getCurrent() !== NULL) {
            \Fiber::suspend();
        }
        if (\Fiber::getCurrent() !== NULL) {
            \Fiber::suspend();
        }
        return [
            '#markup' => '<span>Turtle is finally here. But how?</span>',
        ];
    }
    
    /**
     * {@inheritdoc}
     */
    public static function trustedCallbacks() {
        return [
            'turtle',
        ];
    }

}

Members

Title Sort descending Deprecated Modifiers Object type Summary Overriden Title
TrustedCallbackInterface::THROW_EXCEPTION constant Untrusted callbacks throw exceptions.
TrustedCallbackInterface::TRIGGER_SILENCED_DEPRECATION constant Untrusted callbacks trigger silenced E_USER_DEPRECATION errors.
TrustedCallbackInterface::TRIGGER_WARNING Deprecated constant Untrusted callbacks trigger E_USER_WARNING errors.
TurtleLazyBuilder::trustedCallbacks public static function Lists the trusted callbacks provided by the implementing class. Overrides TrustedCallbackInterface::trustedCallbacks
TurtleLazyBuilder::turtle public static function #lazy_builder callback.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.