Server : LiteSpeed System : Linux server 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64 User : alsaif ( 1057) PHP Version : 7.4.33 Disable Function : show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/alsaif/domains/alsaif.group/private_html/libraries/joomla/github/ |
<?php
/**
* @package Joomla.Platform
* @subpackage GitHub
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
/**
* GitHub API Meta class.
*
* @since 3.2.0
* @deprecated 4.0 Use the `joomla/github` package via Composer instead
*/
class JGithubMeta extends JGithubObject
{
/**
* Method to get the authorized IP addresses for services
*
* @return array Authorized IP addresses
*
* @since 3.2.0
* @throws DomainException
*/
public function getMeta()
{
// Build the request path.
$path = '/meta';
$githubIps = $this->processResponse($this->client->get($this->fetchUrl($path)), 200);
/*
* The response body returns the IP addresses in CIDR format
* Decode the response body and strip the subnet mask information prior to
* returning the data to the user. We're assuming quite a bit here that all
* masks will be /32 as they are as of the time of development.
*/
$authorizedIps = array();
foreach ($githubIps as $key => $serviceIps)
{
// The first level contains an array of IPs based on the service
$authorizedIps[$key] = array();
foreach ($serviceIps as $serviceIp)
{
// The second level is each individual IP address, strip the mask here
$authorizedIps[$key][] = substr($serviceIp, 0, -3);
}
}
return $authorizedIps;
}
}