CompilesStacks.php 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace Illuminate\View\Compilers\Concerns;
  3. trait CompilesStacks
  4. {
  5. /**
  6. * Compile the stack statements into the content.
  7. *
  8. * @param string $expression
  9. * @return string
  10. */
  11. protected function compileStack($expression)
  12. {
  13. return "<?php echo \$__env->yieldPushContent{$expression}; ?>";
  14. }
  15. /**
  16. * Compile the push statements into valid PHP.
  17. *
  18. * @param string $expression
  19. * @return string
  20. */
  21. protected function compilePush($expression)
  22. {
  23. return "<?php \$__env->startPush{$expression}; ?>";
  24. }
  25. /**
  26. * Compile the end-push statements into valid PHP.
  27. *
  28. * @return string
  29. */
  30. protected function compileEndpush()
  31. {
  32. return '<?php $__env->stopPush(); ?>';
  33. }
  34. /**
  35. * Compile the prepend statements into valid PHP.
  36. *
  37. * @param string $expression
  38. * @return string
  39. */
  40. protected function compilePrepend($expression)
  41. {
  42. return "<?php \$__env->startPrepend{$expression}; ?>";
  43. }
  44. /**
  45. * Compile the end-prepend statements into valid PHP.
  46. *
  47. * @return string
  48. */
  49. protected function compileEndprepend()
  50. {
  51. return '<?php $__env->stopPrepend(); ?>';
  52. }
  53. }