Util.php 717 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /*
  3. * This file is part of Raven.
  4. *
  5. * (c) Sentry Team
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. /**
  11. * Utilities
  12. *
  13. * @package raven
  14. */
  15. class Raven_Util
  16. {
  17. /**
  18. * Because we love Python, this works much like dict.get() in Python.
  19. *
  20. * Returns $var from $array if set, otherwise returns $default.
  21. *
  22. * @param array $array
  23. * @param string $var
  24. * @param mixed $default
  25. * @return mixed
  26. */
  27. public static function get($array, $var, $default = null)
  28. {
  29. if (isset($array[$var])) {
  30. return $array[$var];
  31. }
  32. return $default;
  33. }
  34. }