yieldPushContent{$expression}; ?>"; } /** * Compile the push statements into valid PHP. * * @param string $expression * @return string */ protected function compilePush($expression) { return "startPush{$expression}; ?>"; } /** * Compile the push-once statements into valid PHP. * * @param string $expression * @return string */ protected function compilePushOnce($expression) { $parts = explode(',', $this->stripParentheses($expression), 2); [$stack, $id] = [$parts[0], $parts[1] ?? '']; $id = trim($id) ?: "'".(string) Str::uuid()."'"; return 'hasRenderedOnce('.$id.')): $__env->markAsRenderedOnce('.$id.'); $__env->startPush('.$stack.'); ?>'; } /** * Compile the end-push statements into valid PHP. * * @return string */ protected function compileEndpush() { return 'stopPush(); ?>'; } /** * Compile the end-push-once statements into valid PHP. * * @return string */ protected function compileEndpushOnce() { return 'stopPush(); endif; ?>'; } /** * Compile the prepend statements into valid PHP. * * @param string $expression * @return string */ protected function compilePrepend($expression) { return "startPrepend{$expression}; ?>"; } /** * Compile the prepend-once statements into valid PHP. * * @param string $expression * @return string */ protected function compilePrependOnce($expression) { $parts = explode(',', $this->stripParentheses($expression), 2); [$stack, $id] = [$parts[0], $parts[1] ?? '']; $id = trim($id) ?: "'".(string) Str::uuid()."'"; return 'hasRenderedOnce('.$id.')): $__env->markAsRenderedOnce('.$id.'); $__env->startPrepend('.$stack.'); ?>'; } /** * Compile the end-prepend statements into valid PHP. * * @return string */ protected function compileEndprepend() { return 'stopPrepend(); ?>'; } /** * Compile the end-prepend-once statements into valid PHP. * * @return string */ protected function compileEndprependOnce() { return 'stopPrepend(); endif; ?>'; } }