CompilesRawPhp.php 620B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace Illuminate\View\Compilers\Concerns;
  3. trait CompilesRawPhp
  4. {
  5. /**
  6. * Compile the raw PHP statements into valid PHP.
  7. *
  8. * @param string $expression
  9. * @return string
  10. */
  11. protected function compilePhp($expression)
  12. {
  13. if ($expression) {
  14. return "<?php {$expression}; ?>";
  15. }
  16. return '@php';
  17. }
  18. /**
  19. * Compile the unset statements into valid PHP.
  20. *
  21. * @param string $expression
  22. * @return string
  23. */
  24. protected function compileUnset($expression)
  25. {
  26. return "<?php unset{$expression}; ?>";
  27. }
  28. }