Joomla Platform  13.1
Documentation des API du framework Joomla Platform
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
auth.php
Aller à la documentation de ce fichier.
1 <?php
2 /**
3  * @package Joomla.Platform
4  * @subpackage Google
5  *
6  * @copyright Copyright (C) 2005 - 2013 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  * Google authentication class abstract
14  *
15  * @package Joomla.Platform
16  * @subpackage Google
17  * @since 12.3
18  */
19 abstract class JGoogleAuth
20 {
21  /**
22  * @var JRegistry Options for the Google authentication object.
23  * @since 12.3
24  */
25  protected $options;
26 
27  /**
28  * Abstract method to authenticate to Google
29  *
30  * @return boolean True on success.
31  *
32  * @since 12.3
33  */
34  abstract public function authenticate();
35 
36  /**
37  * Verify if the client has been authenticated
38  *
39  * @return boolean Is authenticated
40  *
41  * @since 12.3
42  */
43  abstract public function isAuthenticated();
44 
45  /**
46  * Abstract method to retrieve data from Google
47  *
48  * @param string $url The URL for the request.
49  * @param mixed $data The data to include in the request.
50  * @param array $headers The headers to send with the request.
51  * @param string $method The type of http request to send.
52  *
53  * @return mixed Data from Google.
54  *
55  * @since 12.3
56  */
57  abstract public function query($url, $data = null, $headers = null, $method = 'get');
58 
59  /**
60  * Get an option from the JGoogleAuth object.
61  *
62  * @param string $key The name of the option to get.
63  *
64  * @return mixed The option value.
65  *
66  * @since 12.3
67  */
68  public function getOption($key)
69  {
70  return $this->options->get($key);
71  }
72 
73  /**
74  * Set an option for the JGoogleAuth object.
75  *
76  * @param string $key The name of the option to set.
77  * @param mixed $value The option value to set.
78  *
79  * @return JGoogleAuth This object for method chaining.
80  *
81  * @since 12.3
82  */
83  public function setOption($key, $value)
84  {
85  $this->options->set($key, $value);
86 
87  return $this;
88  }
89 }