Source for file meta.php

Documentation is available at meta.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Platform
  4.  * @subpackage  GitHub
  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.  * GitHub API Meta class.
  14.  *
  15.  * @package     Joomla.Platform
  16.  * @subpackage  GitHub
  17.  * @since       13.1
  18.  */
  19. class JGithubMeta extends JGithubObject
  20. {
  21.     /**
  22.      * Method to get the authorized IP addresses for services
  23.      *
  24.      * @return  array  Authorized IP addresses
  25.      *
  26.      * @since   13.1
  27.      * @throws  DomainException
  28.      */
  29.     public function getMeta()
  30.     {
  31.         // Build the request path.
  32.         $path '/meta';
  33.  
  34.         $githubIps $this->processResponse($this->client->get($this->fetchUrl($path))200);
  35.  
  36.         /*
  37.          * The response body returns the IP addresses in CIDR format
  38.          * Decode the response body and strip the subnet mask information prior to
  39.          * returning the data to the user.  We're assuming quite a bit here that all
  40.          * masks will be /32 as they are as of the time of development.
  41.          */
  42.  
  43.         $authorizedIps array();
  44.  
  45.         foreach ($githubIps as $key => $serviceIps)
  46.         {
  47.             // The first level contains an array of IPs based on the service
  48.             $authorizedIps[$keyarray();
  49.  
  50.             foreach ($serviceIps as $serviceIp)
  51.             {
  52.                 // The second level is each individual IP address, strip the mask here
  53.                 $authorizedIps[$key][substr($serviceIp0-3);
  54.             }
  55.         }
  56.  
  57.         return $authorizedIps;
  58.     }
  59. }

Documentation generated on Tue, 19 Nov 2013 15:08:10 +0100 by phpDocumentor 1.4.3