GravTrait.php 679 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * @package Grav\Common
  4. *
  5. * @copyright Copyright (C) 2015 - 2019 Trilby Media, LLC. All rights reserved.
  6. * @license MIT License; see LICENSE file for details.
  7. */
  8. namespace Grav\Common;
  9. /**
  10. * @deprecated 1.4 Use Grav::instance() instead.
  11. */
  12. trait GravTrait
  13. {
  14. protected static $grav;
  15. /**
  16. * @return Grav
  17. * @deprecated 1.4 Use Grav::instance() instead.
  18. */
  19. public static function getGrav()
  20. {
  21. user_error(__TRAIT__ . ' is deprecated since Grav 1.4, use Grav::instance() instead', E_USER_DEPRECATED);
  22. if (!self::$grav) {
  23. self::$grav = Grav::instance();
  24. }
  25. return self::$grav;
  26. }
  27. }