1 <?php
2 /**
3 * @package Joomla.Platform
4 * @subpackage GitHub
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 * GitHub API package class for the Joomla Platform.
14 *
15 * @since 3.3 (CMS)
16 * @deprecated 4.0 Use the `joomla/github` package via Composer instead
17 */
18 abstract class JGithubPackage extends JGithubObject
19 {
20 /**
21 * @var string
22 * @since 3.3 (CMS)
23 */
24 protected $name = '';
25
26 /**
27 * @var array
28 * @since 3.3 (CMS)
29 */
30 protected $packages = array();
31
32 /**
33 * Magic method to lazily create API objects
34 *
35 * @param string $name Name of property to retrieve
36 *
37 * @return JGithubPackage GitHub API package object.
38 *
39 * @since 3.3 (CMS)
40 * @throws RuntimeException
41 */
42 public function __get($name)
43 {
44 if (false == in_array($name, $this->packages))
45 {
46 throw new RuntimeException(sprintf('%1$s - Unknown package %2$s', __METHOD__, $name));
47 }
48
49 if (false == isset($this->$name))
50 {
51 $className = 'JGithubPackage' . ucfirst($this->name) . ucfirst($name);
52
53 $this->$name = new $className($this->options, $this->client);
54 }
55
56 return $this->$name;
57 }
58 }
59