Joomla Platform  13.1
Documentation des API du framework Joomla Platform
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
key.php
Aller à la documentation de ce fichier.
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 
10 defined('JPATH_PLATFORM') or die;
11 
12 /**
13  * Encryption key object for the Joomla Platform.
14  *
15  * @property-read string $type The key type.
16  *
17  * @package Joomla.Platform
18  * @subpackage Crypt
19  * @since 12.1
20  */
21 class JCryptKey
22 {
23  /**
24  * @var string The private key.
25  * @since 12.1
26  */
27  public $private;
28 
29  /**
30  * @var string The public key.
31  * @since 12.1
32  */
33  public $public;
34 
35  /**
36  * @var string The key type.
37  * @since 12.1
38  */
39  protected $type;
40 
41  /**
42  * Constructor.
43  *
44  * @param string $type The key type.
45  * @param string $private The private key.
46  * @param string $public The public key.
47  *
48  * @since 12.1
49  */
50  public function __construct($type, $private = null, $public = null)
51  {
52  // Set the key type.
53  $this->type = (string) $type;
54 
55  // Set the optional public/private key strings.
56  $this->private = isset($private) ? (string) $private : null;
57  $this->public = isset($public) ? (string) $public : null;
58  }
59 
60  /**
61  * Magic method to return some protected property values.
62  *
63  * @param string $name The name of the property to return.
64  *
65  * @return mixed
66  *
67  * @since 12.1
68  */
69  public function __get($name)
70  {
71  if ($name == 'type')
72  {
73  return $this->type;
74  }
75  else
76  {
77  trigger_error('Cannot access property ' . __CLASS__ . '::' . $name, E_USER_WARNING);
78  }
79  }
80 }