1 <?php
2 /**
3 * @package Joomla.Platform
4 * @subpackage Linkedin
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 use Joomla\Registry\Registry;
13
14 /**
15 * Linkedin API object class for the Joomla Platform.
16 *
17 * @since 13.1
18 */
19 abstract class JLinkedinObject
20 {
21 /**
22 * @var Registry Options for the Linkedin object.
23 * @since 13.1
24 */
25 protected $options;
26
27 /**
28 * @var JHttp The HTTP client object to use in sending HTTP requests.
29 * @since 13.1
30 */
31 protected $client;
32
33 /**
34 * @var JLinkedinOAuth The OAuth client.
35 * @since 13.1
36 */
37 protected $oauth;
38
39 /**
40 * Constructor.
41 *
42 * @param Registry $options Linkedin options object.
43 * @param JHttp $client The HTTP client object.
44 * @param JLinkedinOAuth $oauth The OAuth client.
45 *
46 * @since 13.1
47 */
48 public function __construct(Registry $options = null, JHttp $client = null, JLinkedinOAuth $oauth = null)
49 {
50 $this->options = isset($options) ? $options : new Registry;
51 $this->client = isset($client) ? $client : new JHttp($this->options);
52 $this->oauth = $oauth;
53 }
54
55 /**
56 * Method to convert boolean to string.
57 *
58 * @param boolean $bool The boolean value to convert.
59 *
60 * @return string String with the converted boolean.
61 *
62 * @since 13.1
63 */
64 public function booleanToString($bool)
65 {
66 if ($bool)
67 {
68 return 'true';
69 }
70 else
71 {
72 return 'false';
73 }
74 }
75
76 /**
77 * Get an option from the JLinkedinObject instance.
78 *
79 * @param string $key The name of the option to get.
80 *
81 * @return mixed The option value.
82 *
83 * @since 13.1
84 */
85 public function getOption($key)
86 {
87 return $this->options->get($key);
88 }
89
90 /**
91 * Set an option for the JLinkedinObject instance.
92 *
93 * @param string $key The name of the option to set.
94 * @param mixed $value The option value to set.
95 *
96 * @return JLinkedinObject This object for method chaining.
97 *
98 * @since 13.1
99 */
100 public function setOption($key, $value)
101 {
102 $this->options->set($key, $value);
103
104 return $this;
105 }
106 }
107