PageRenderTime 32ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/pear/PHP/Compat/Function/is_a.php

http://akelosframework.googlecode.com/
PHP | 47 lines | 15 code | 4 blank | 28 comment | 5 complexity | 841a0381fb313eb15c875e6a9505a559 MD5 | raw file
Possible License(s): LGPL-2.1
  1. <?php
  2. // +----------------------------------------------------------------------+
  3. // | PHP Version 4 |
  4. // +----------------------------------------------------------------------+
  5. // | Copyright (c) 1997-2004 The PHP Group |
  6. // +----------------------------------------------------------------------+
  7. // | This source file is subject to version 3.0 of the PHP license, |
  8. // | that is bundled with this package in the file LICENSE, and is |
  9. // | available at through the world-wide-web at |
  10. // | http://www.php.net/license/3_0.txt. |
  11. // | If you did not receive a copy of the PHP license and are unable to |
  12. // | obtain it through the world-wide-web, please send a note to |
  13. // | license@php.net so we can mail you a copy immediately. |
  14. // +----------------------------------------------------------------------+
  15. // | Authors: Aidan Lister <aidan@php.net> |
  16. // +----------------------------------------------------------------------+
  17. //
  18. // $Id: is_a.php,v 1.16 2005/01/26 04:55:13 aidan Exp $
  19. /**
  20. * Replace function is_a()
  21. *
  22. * @category PHP
  23. * @package PHP_Compat
  24. * @link http://php.net/function.is_a
  25. * @author Aidan Lister <aidan@php.net>
  26. * @version $Revision: 1.16 $
  27. * @since PHP 4.2.0
  28. * @require PHP 4.0.0 (user_error) (is_subclass_of)
  29. */
  30. if (!function_exists('is_a')) {
  31. function is_a($object, $class)
  32. {
  33. if (!is_object($object)) {
  34. return false;
  35. }
  36. if (get_class($object) == strtolower($class)) {
  37. return true;
  38. } else {
  39. return is_subclass_of($object, $class);
  40. }
  41. }
  42. }
  43. ?>