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