GravTrait.php 624 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * @package Grav.Common
  4. *
  5. * @copyright Copyright (C) 2015 - 2018 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. */
  18. public static function getGrav()
  19. {
  20. if (!self::$grav) {
  21. self::$grav = Grav::instance();
  22. }
  23. user_error(__TRAIT__ . ' is deprecated since Grav 1.4, use Grav::instance() instead', E_USER_DEPRECATED);
  24. return self::$grav;
  25. }
  26. }