PageRenderTime 45ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/libraries/joomla/crypt/key.php

https://bitbucket.org/asosso/joomla25
PHP | 80 lines | 25 code | 7 blank | 48 comment | 2 complexity | 208044a47da603da0b5998993986974b MD5 | raw file
Possible License(s): LGPL-2.1
  1. <?php
  2. /**
  3. * @package Joomla.Platform
  4. * @subpackage Crypt
  5. *
  6. * @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
  7. * @license GNU General Public License version 2 or later; see LICENSE
  8. */
  9. defined('JPATH_PLATFORM') or die;
  10. /**
  11. * Encryption key object for the Joomla Platform.
  12. *
  13. * @property-read string $type The key type.
  14. *
  15. * @package Joomla.Platform
  16. * @subpackage Crypt
  17. * @since 12.1
  18. */
  19. class JCryptKey
  20. {
  21. /**
  22. * @var string The private key.
  23. * @since 12.1
  24. */
  25. public $private;
  26. /**
  27. * @var string The public key.
  28. * @since 12.1
  29. */
  30. public $public;
  31. /**
  32. * @var string The key type.
  33. * @since 12.1
  34. */
  35. protected $type;
  36. /**
  37. * Constructor.
  38. *
  39. * @param string $type The key type.
  40. * @param string $private The private key.
  41. * @param string $public The public key.
  42. *
  43. * @since 12.1
  44. */
  45. public function __construct($type, $private = null, $public = null)
  46. {
  47. // Set the key type.
  48. $this->type = (string) $type;
  49. // Set the optional public/private key strings.
  50. $this->private = isset($private) ? (string) $private : null;
  51. $this->public = isset($public) ? (string) $public : null;
  52. }
  53. /**
  54. * Magic method to return some protected property values.
  55. *
  56. * @param string $name The name of the property to return.
  57. *
  58. * @return mixed
  59. *
  60. * @since 12.1
  61. */
  62. public function __get($name)
  63. {
  64. if ($name == 'type')
  65. {
  66. return $this->type;
  67. }
  68. else
  69. {
  70. trigger_error('Cannot access property ' . __CLASS__ . '::' . $name, E_USER_WARNING);
  71. }
  72. }
  73. }