Spade
Mini Shell
PKk��[�CàZZHelper/VersionHelper.phpnu�[���<?php
/**
* @package Joomla.Administrator
* @subpackage mod_version
*
* @copyright (C) 2012 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace Joomla\Module\Version\Administrator\Helper;
use Joomla\CMS\Version;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Helper for mod_version
*
* @since 1.6
*/
class VersionHelper
{
/**
* Get the Joomla version number.
*
* @return string String containing the current Joomla version.
*
* @since 5.1.0
*/
public function getVersionString()
{
$version = new Version();
return '‎' . $version->getShortVersion();
}
/**
* Get the Joomla version number.
*
* @return string String containing the current Joomla version.
*
* @deprecated 5.1.0 will be removed in 7.0
* Use the non-static method getVersionString
* Example:
Factory::getApplication()->bootModule('mod_version',
'administrator')
* ->getHelper('VersionHelper')
* ->getVersionString()
*/
public static function getVersion()
{
return (new self())->getVersionString();
}
}
PKk��[T%�0//Dispatcher/Dispatcher.phpnu�[���<?php
/**
* @package Joomla.Administrator
* @subpackage mod_version
*
* @copyright (C) 2024 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace Joomla\Module\Version\Administrator\Dispatcher;
use Joomla\CMS\Dispatcher\AbstractModuleDispatcher;
use Joomla\CMS\Helper\HelperFactoryAwareInterface;
use Joomla\CMS\Helper\HelperFactoryAwareTrait;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Dispatcher class for mod_version
*
* @since 5.1.0
*/
class Dispatcher extends AbstractModuleDispatcher implements
HelperFactoryAwareInterface
{
use HelperFactoryAwareTrait;
/**
* Returns the layout data.
*
* @return array
*
* @since 5.1.0
*/
protected function getLayoutData()
{
$data = parent::getLayoutData();
$data['version'] =
$this->getHelperFactory()->getHelper('VersionHelper')->getVersionString();
return $data;
}
}
PK��[P���>�>LdapClient.phpnu�[���<?php
/**
* Part of the Joomla Framework LDAP Package
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Ldap;
/**
* LDAP client class
*
* @since 1.0
* @deprecated The joomla/ldap package is deprecated
*/
class LdapClient
{
/**
* Hostname of LDAP server
*
* @var string
* @since 1.0
*/
public $host;
/**
* Authorization Method to use
*
* @var boolean
* @since 1.0
*/
public $auth_method;
/**
* Port of LDAP server
*
* @var integer
* @since 1.0
*/
public $port;
/**
* Base DN (e.g. o=MyDir)
*
* @var string
* @since 1.0
*/
public $base_dn;
/**
* User DN (e.g. cn=Users,o=MyDir)
*
* @var string
* @since 1.0
*/
public $users_dn;
/**
* Search String
*
* @var string
* @since 1.0
*/
public $search_string;
/**
* Use LDAP Version 3
*
* @var boolean
* @since 1.0
*/
public $use_ldapV3;
/**
* No referrals (server transfers)
*
* @var boolean
* @since 1.0
*/
public $no_referrals;
/**
* Negotiate TLS (encrypted communications)
*
* @var boolean
* @since 1.0
*/
public $negotiate_tls;
/**
* Ignore TLS Certificate (encrypted communications)
*
* @var boolean
* @since 1.5.0
*/
public $ignore_reqcert_tls;
/**
* Enable LDAP debug
*
* @var boolean
* @since 1.5.0
*/
public $ldap_debug;
/**
* Username to connect to server
*
* @var string
* @since 1.0
*/
public $username;
/**
* Password to connect to server
*
* @var string
* @since 1.0
*/
public $password;
/**
* LDAP Resource Identifier
*
* @var resource
* @since 1.0
*/
private $resource;
/**
* Current DN
*
* @var string
* @since 1.0
*/
private $dn;
/**
* Flag tracking whether the connection has been bound
*
* @var boolean
* @since 1.3.0
*/
private $isBound = false;
/**
* Constructor
*
* @param object $configObj An object of configuration variables
*
* @since 1.0
*/
public function __construct($configObj = null)
{
if (\is_object($configObj))
{
$vars = get_class_vars(\get_class($this));
foreach (array_keys($vars) as $var)
{
if (substr($var, 0, 1) != '_')
{
$param = $configObj->get($var);
if ($param)
{
$this->$var = $param;
}
}
}
}
}
/**
* Class destructor.
*
* @since 1.3.0
*/
public function __destruct()
{
$this->close();
}
/**
* Connect to an LDAP server
*
* @return boolean
*
* @since 1.0
*/
public function connect()
{
if ($this->host == '')
{
return false;
}
if ($this->ignore_reqcert_tls)
{
putenv('LDAPTLS_REQCERT=never');
}
if ($this->ldap_debug)
{
ldap_set_option(null, LDAP_OPT_DEBUG_LEVEL, 7);
}
$this->resource = ldap_connect($this->host, $this->port);
if (!$this->resource)
{
return false;
}
if ($this->use_ldapV3 && !ldap_set_option($this->resource,
LDAP_OPT_PROTOCOL_VERSION, 3))
{
return false;
}
if (!ldap_set_option($this->resource, LDAP_OPT_REFERRALS, (int)
$this->no_referrals))
{
return false;
}
if ($this->negotiate_tls &&
!ldap_start_tls($this->resource))
{
return false;
}
return true;
}
/**
* Close the connection
*
* @return void
*
* @since 1.0
*/
public function close()
{
if ($this->isConnected())
{
$this->unbind();
}
$this->resource = null;
}
/**
* Sets the DN with some template replacements
*
* @param string $username The username
* @param string $nosub ...
*
* @return void
*
* @since 1.0
*/
public function setDn($username, $nosub = 0)
{
if ($this->users_dn == '' || $nosub)
{
$this->dn = $username;
}
elseif (\strlen($username))
{
$this->dn = str_replace('[username]', $username,
$this->users_dn);
}
else
{
$this->dn = '';
}
}
/**
* Get the configured DN
*
* @return string
*
* @since 1.0
*/
public function getDn()
{
return $this->dn;
}
/**
* Anonymously binds to LDAP directory
*
* @return boolean
*
* @since 1.0
*/
public function anonymous_bind()
{
if (!$this->isConnected())
{
if (!$this->connect())
{
return false;
}
}
$this->isBound = ldap_bind($this->resource);
return $this->isBound;
}
/**
* Binds to the LDAP directory
*
* @param string $username The username
* @param string $password The password
* @param string $nosub ...
*
* @return boolean
*
* @since 1.0
*/
public function bind($username = null, $password = null, $nosub = 0)
{
if (!$this->isConnected())
{
if (!$this->connect())
{
return false;
}
}
if ($username === null)
{
$username = $this->username;
}
if ($password === null)
{
$password = $this->password;
}
$this->setDn($username, $nosub);
$this->isBound = ldap_bind($this->resource, $this->getDn(),
$password);
return $this->isBound;
}
/**
* Unbinds from the LDAP directory
*
* @return boolean
*
* @since 1.3.0
*/
public function unbind()
{
if ($this->isBound && $this->resource &&
\is_resource($this->resource))
{
return ldap_unbind($this->resource);
}
return true;
}
/**
* Perform an LDAP search using comma separated search strings
*
* @param string $search search string of search values
*
* @return array Search results
*
* @since 1.0
*/
public function simple_search($search)
{
$results = explode(';', $search);
foreach ($results as $key => $result)
{
$results[$key] = '(' . $result . ')';
}
return $this->search($results);
}
/**
* Performs an LDAP search
*
* @param array $filters Search Filters (array of strings)
* @param string $dnoverride DN Override
* @param array $attributes An array of attributes to return (if
empty, all fields are returned).
*
* @return array Multidimensional array of results
*
* @since 1.0
*/
public function search(array $filters, $dnoverride = null, array
$attributes = array())
{
$result = array();
if (!$this->isBound || !$this->isConnected())
{
return $result;
}
if ($dnoverride)
{
$dn = $dnoverride;
}
else
{
$dn = $this->base_dn;
}
foreach ($filters as $searchFilter)
{
$searchResult = ldap_search($this->resource, $dn, $searchFilter,
$attributes);
if ($searchResult && ($count =
ldap_count_entries($this->resource, $searchResult)) > 0)
{
for ($i = 0; $i < $count; $i++)
{
$result[$i] = array();
if (!$i)
{
$firstentry = ldap_first_entry($this->resource, $searchResult);
}
else
{
$firstentry = ldap_next_entry($this->resource, $firstentry);
}
// Load user-specified attributes
$attributeResult = ldap_get_attributes($this->resource,
$firstentry);
// LDAP returns an array of arrays, fit this into attributes result
array
foreach ($attributeResult as $ki => $ai)
{
if (\is_array($ai))
{
$subcount = $ai['count'];
$result[$i][$ki] = array();
for ($k = 0; $k < $subcount; $k++)
{
$result[$i][$ki][$k] = $ai[$k];
}
}
}
$result[$i]['dn'] = ldap_get_dn($this->resource,
$firstentry);
}
}
}
return $result;
}
/**
* Replace attribute values with new ones
*
* @param string $dn The DN which contains the attribute you
want to replace
* @param string $attribute The attribute values you want to replace
*
* @return boolean
*
* @since 1.0
*/
public function replace($dn, $attribute)
{
if (!$this->isBound || !$this->isConnected())
{
return false;
}
return ldap_mod_replace($this->resource, $dn, $attribute);
}
/**
* Modify an LDAP entry
*
* @param string $dn The DN which contains the attribute you
want to modify
* @param string $attribute The attribute values you want to modify
*
* @return boolean
*
* @since 1.0
*/
public function modify($dn, $attribute)
{
if (!$this->isBound || !$this->isConnected())
{
return false;
}
return ldap_modify($this->resource, $dn, $attribute);
}
/**
* Delete attribute values from current attributes
*
* @param string $dn The DN which contains the attribute you
want to remove
* @param string $attribute The attribute values you want to remove
*
* @return boolean
*
* @since 1.0
*/
public function remove($dn, $attribute)
{
if (!$this->isBound || !$this->isConnected())
{
return false;
}
return ldap_mod_del($this->resource, $dn, $attribute);
}
/**
* Compare value of attribute found in entry specified with DN
*
* @param string $dn The DN which contains the attribute you
want to compare
* @param string $attribute The attribute whose value you want to
compare
* @param string $value The value you want to check against the
LDAP attribute
*
* @return boolean|integer Boolean result of the comparison or -1 on
error
*
* @since 1.0
*/
public function compare($dn, $attribute, $value)
{
if (!$this->isBound || !$this->isConnected())
{
return false;
}
return ldap_compare($this->resource, $dn, $attribute, $value);
}
/**
* Read attributes of a given DN
*
* @param string $dn The DN of the object you want to read
*
* @return array|boolean Array of attributes for the given DN or boolean
false on failure
*
* @since 1.0
*/
public function read($dn)
{
if (!$this->isBound || !$this->isConnected())
{
return false;
}
$base = substr($dn, strpos($dn, ',') + 1);
$cn = substr($dn, 0, strpos($dn, ','));
$result = ldap_read($this->resource, $base, $cn);
if ($result === false)
{
return false;
}
return ldap_get_entries($this->resource, $result);
}
/**
* Delete an entry from a directory
*
* @param string $dn The DN of the object you want to delete
*
* @return boolean
*
* @since 1.0
*/
public function delete($dn)
{
if (!$this->isBound || !$this->isConnected())
{
return false;
}
return ldap_delete($this->resource, $dn);
}
/**
* Add entries to LDAP directory
*
* @param string $dn The DN where you want to put the object
* @param array $entries An array of arrays describing the object to
add
*
* @return boolean
*
* @since 1.0
*/
public function create($dn, array $entries)
{
if (!$this->isBound || !$this->isConnected())
{
return false;
}
return ldap_add($this->resource, $dn, $entries);
}
/**
* Add attribute values to current attributes
*
* @param string $dn The DN of the entry to add the attribute
* @param array $entry An array of arrays with attributes to add
*
* @return boolean
*
* @since 1.0
*/
public function add($dn, array $entry)
{
if (!$this->isBound || !$this->isConnected())
{
return false;
}
return ldap_mod_add($this->resource, $dn, $entry);
}
/**
* Modify the name of an entry
*
* @param string $dn The DN of the entry at the moment
* @param string $newdn The DN of the entry should be (only
cn=newvalue)
* @param string $newparent The full DN of the parent (null by
default)
* @param boolean $deleteolddn Delete the old values (default)
*
* @return boolean
*
* @since 1.0
*/
public function rename($dn, $newdn, $newparent, $deleteolddn)
{
if (!$this->isBound || !$this->isConnected())
{
return false;
}
return ldap_rename($this->resource, $dn, $newdn, $newparent,
$deleteolddn);
}
/**
* Escape a string
*
* @param string $value The subject string
* @param string $ignore Characters to ignore when escaping.
* @param integer $flags The context the escaped string will be used
in LDAP_ESCAPE_FILTER or LDAP_ESCAPE_DN
*
* @return string
*
* @since 1.2.0
*/
public function escape($value, $ignore = '', $flags = 0)
{
return ldap_escape($value, $ignore, $flags);
}
/**
* Return the LDAP error message of the last LDAP command
*
* @return string
*
* @since 1.0
*/
public function getErrorMsg()
{
if (!$this->isBound || !$this->isConnected())
{
return '';
}
return ldap_error($this->resource);
}
/**
* Check if the connection is established
*
* @return boolean
*
* @since 1.3.0
*/
public function isConnected()
{
return $this->resource && \is_resource($this->resource);
}
/**
* Converts a dot notation IP address to net address (e.g. for Netware,
etc)
*
* @param string $ip IP Address (e.g. xxx.xxx.xxx.xxx)
*
* @return string
*
* @since 1.0
*/
public static function ipToNetAddress($ip)
{
$parts = explode('.', $ip);
$address = '1#';
foreach ($parts as $int)
{
$tmp = dechex($int);
if (\strlen($tmp) != 2)
{
$tmp = '0' . $tmp;
}
$address .= '\\' . $tmp;
}
return $address;
}
/**
* Extract readable network address from the LDAP encoded networkAddress
attribute.
*
* Please keep this document block and author attribution in place.
*
* Novell Docs, see:
http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5624.html#sdk5624
* for Address types:
http://developer.novell.com/ndk/doc/ndslib/index.html?page=/ndk/doc/ndslib/schm_enu/data/sdk4170.html
* LDAP Format, String:
* taggedData = uint32String "#" octetstring
* byte 0 = uint32String = Address Type: 0= IPX Address; 1 = IP Address
* byte 1 = char = "#" - separator
* byte 2+ = octetstring - the ordinal value of the address
* Note: with eDirectory 8.6.2, the IP address (type 1) returns
* correctly, however, an IPX address does not seem to. eDir 8.7 may
correct this.
* Enhancement made by Merijn van de Schoot:
* If addresstype is 8 (UDP) or 9 (TCP) do some additional parsing like
still returning the IP address
*
* @param string $networkaddress The network address
*
* @return array
*
* @author Jay Burrell, Systems & Networks, Mississippi State
University
* @since 1.0
*/
public static function ldapNetAddr($networkaddress)
{
$addr = '';
$addrtype = (int) substr($networkaddress, 0, 1);
// Throw away bytes 0 and 1 which should be the addrtype and the
"#" separator
$networkaddress = substr($networkaddress, 2);
if (($addrtype == 8) || ($addrtype = 9))
{
// TODO 1.6: If UDP or TCP, (TODO fill addrport and) strip portnumber
information from address
$networkaddress = substr($networkaddress, (\strlen($networkaddress) -
4));
}
$addrtypes = array(
'IPX',
'IP',
'SDLC',
'Token Ring',
'OSI',
'AppleTalk',
'NetBEUI',
'Socket',
'UDP',
'TCP',
'UDP6',
'TCP6',
'Reserved (12)',
'URL',
'Count',
);
$len = \strlen($networkaddress);
if ($len > 0)
{
for ($i = 0; $i < $len; $i++)
{
$byte = substr($networkaddress, $i, 1);
$addr .= \ord($byte);
if (($addrtype == 1) || ($addrtype == 8) || ($addrtype = 9))
{
// Dot separate IP addresses...
$addr .= '.';
}
}
if (($addrtype == 1) || ($addrtype == 8) || ($addrtype = 9))
{
// Strip last period from end of $addr
$addr = substr($addr, 0, \strlen($addr) - 1);
}
}
else
{
$addr .= 'Address not available.';
}
return array('protocol' => $addrtypes[$addrtype],
'address' => $addr);
}
/**
* Generates a LDAP compatible password
*
* @param string $password Clear text password to encrypt
* @param string $type Type of password hash, either md5 or SHA
*
* @return string
*
* @since 1.0
*/
public static function generatePassword($password, $type =
'md5')
{
switch (strtolower($type))
{
case 'sha':
return '{SHA}' . base64_encode(pack('H*',
sha1($password)));
case 'md5':
default:
return '{MD5}' . base64_encode(pack('H*',
md5($password)));
}
}
}
PKNc�[q�Z��AbstractApplication.phpnu�[���<?php
/**
* Part of the Joomla Framework Application Package
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Application;
use Joomla\Input\Input;
use Joomla\Registry\Registry;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
/**
* Joomla Framework Base Application Class
*
* @since 1.0
*/
abstract class AbstractApplication implements LoggerAwareInterface
{
/**
* The application configuration object.
*
* @var Registry
* @since 1.0
*/
protected $config;
/**
* The application input object.
*
* @var Input
* @since 1.0
*/
public $input;
/**
* A logger.
*
* @var LoggerInterface
* @since 1.0
*/
private $logger;
/**
* Class constructor.
*
* @param Input $input An optional argument to provide dependency
injection for the application's input object. If the argument is an
* Input object that object will become the
application's input object, otherwise a default input object is
created.
* @param Registry $config An optional argument to provide dependency
injection for the application's config object. If the argument
* is a Registry object that object will
become the application's config object, otherwise a default config
* object is created.
*
* @since 1.0
*/
public function __construct(Input $input = null, Registry $config = null)
{
$this->input = $input instanceof Input ? $input : new Input;
$this->config = $config instanceof Registry ? $config : new Registry;
// Set the execution datetime and timestamp;
$this->set('execution.datetime', gmdate('Y-m-d
H:i:s'));
$this->set('execution.timestamp', time());
$this->set('execution.microtimestamp', microtime(true));
$this->initialise();
}
/**
* Method to close the application.
*
* @param integer $code The exit code (optional; default is 0).
*
* @return void
*
* @codeCoverageIgnore
* @since 1.0
*/
public function close($code = 0)
{
exit($code);
}
/**
* Method to run the application routines. Most likely you will want to
instantiate a controller
* and execute it, or perform some sort of task directly.
*
* @return mixed
*
* @since 1.0
*/
abstract protected function doExecute();
/**
* Execute the application.
*
* @return void
*
* @since 1.0
*/
public function execute()
{
// @event onBeforeExecute
// Perform application routines.
$this->doExecute();
// @event onAfterExecute
}
/**
* Returns a property of the object or the default value if the property
is not set.
*
* @param string $key The name of the property.
* @param mixed $default The default value (optional) if none is set.
*
* @return mixed The value of the configuration.
*
* @since 1.0
*/
public function get($key, $default = null)
{
return $this->config->get($key, $default);
}
/**
* Get the logger.
*
* @return LoggerInterface
*
* @since 1.0
*/
public function getLogger()
{
// If a logger hasn't been set, use NullLogger
if (! ($this->logger instanceof LoggerInterface))
{
$this->logger = new NullLogger;
}
return $this->logger;
}
/**
* Custom initialisation method.
*
* Called at the end of the AbstractApplication::__construct method.
* This is for developers to inject initialisation code for their
application classes.
*
* @return void
*
* @codeCoverageIgnore
* @since 1.0
*/
protected function initialise()
{
}
/**
* Modifies a property of the object, creating it if it does not already
exist.
*
* @param string $key The name of the property.
* @param mixed $value The value of the property to set (optional).
*
* @return mixed Previous value of the property
*
* @since 1.0
*/
public function set($key, $value = null)
{
$previous = $this->config->get($key);
$this->config->set($key, $value);
return $previous;
}
/**
* Sets the configuration for the application.
*
* @param Registry $config A registry object holding the
configuration.
*
* @return AbstractApplication Returns itself to support chaining.
*
* @since 1.0
*/
public function setConfiguration(Registry $config)
{
$this->config = $config;
return $this;
}
/**
* Set the logger.
*
* @param LoggerInterface $logger The logger.
*
* @return AbstractApplication Returns itself to support chaining.
*
* @since 1.0
*/
public function setLogger(LoggerInterface $logger)
{
$this->logger = $logger;
return $this;
}
}
PKNc�[N�K�YYAbstractCliApplication.phpnu�[���<?php
/**
* Part of the Joomla Framework Application Package
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Application;
use Joomla\Input;
use Joomla\Registry\Registry;
/**
* Base class for a Joomla! command line application.
*
* @since 1.0
* @deprecated 2.0 Use the `joomla/console` package instead
*/
abstract class AbstractCliApplication extends AbstractApplication
{
/**
* Output object
*
* @var Cli\CliOutput
* @since 1.0
*/
protected $output;
/**
* CLI Input object
*
* @var Cli\CliInput
* @since 1.6.0
*/
protected $cliInput;
/**
* Class constructor.
*
* @param Input\Cli $input An optional argument to provide
dependency injection for the application's input object. If the
* argument is an Input\Cli object that
object will become the application's input object, otherwise
* a default input object is created.
* @param Registry $config An optional argument to provide
dependency injection for the application's config object. If the
* argument is a Registry object that
object will become the application's config object, otherwise
* a default config object is created.
* @param Cli\CliOutput $output An optional argument to provide
dependency injection for the application's output object. If the
* argument is a Cli\CliOutput object
that object will become the application's input object, otherwise
* a default output object is created.
* @param Cli\CliInput $cliInput An optional argument to provide
dependency injection for the application's CLI input object. If the
* argument is a Cli\CliInput object
that object will become the application's input object, otherwise
* a default input object is created.
*
* @since 1.0
*/
public function __construct(Input\Cli $input = null, Registry $config =
null, Cli\CliOutput $output = null, Cli\CliInput $cliInput = null)
{
// Close the application if we are not executed from the command line.
// @codeCoverageIgnoreStart
if (!\defined('STDOUT') || !\defined('STDIN') ||
!isset($_SERVER['argv']))
{
$this->close();
}
// @codeCoverageIgnoreEnd
$this->output = ($output instanceof Cli\CliOutput) ? $output : new
Cli\Output\Stdout;
// Set the CLI input object.
$this->cliInput = ($cliInput instanceof Cli\CliInput) ? $cliInput :
new Cli\CliInput;
// Call the constructor as late as possible (it runs `initialise`).
parent::__construct($input instanceof Input\Input ? $input : new
Input\Cli, $config);
// Set the current directory.
$this->set('cwd', getcwd());
}
/**
* Get an output object.
*
* @return Cli\CliOutput
*
* @since 1.0
*/
public function getOutput()
{
return $this->output;
}
/**
* Get a CLI input object.
*
* @return Cli\CliInput
*
* @since 1.6.0
*/
public function getCliInput()
{
return $this->cliInput;
}
/**
* Write a string to standard output.
*
* @param string $text The text to display.
* @param boolean $nl True (default) to append a new line at the end
of the output string.
*
* @return AbstractCliApplication Instance of $this to allow chaining.
*
* @since 1.0
*/
public function out($text = '', $nl = true)
{
$this->getOutput()->out($text, $nl);
return $this;
}
/**
* Get a value from standard input.
*
* @return string The input string from standard input.
*
* @codeCoverageIgnore
* @since 1.0
*/
public function in()
{
return $this->getCliInput()->in();
}
}
PKNc�[]t?1a1aAbstractDaemonApplication.phpnu�[���<?php
/**
* Part of the Joomla Framework Application Package
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Application;
use Joomla\Input;
use Joomla\Registry\Registry;
use Psr\Log\LoggerAwareInterface;
/**
* Class to turn Cli applications into daemons. It requires CLI and PCNTL
support built into PHP.
*
* @link https://secure.php.net/manual/en/book.pcntl.php
* @link https://secure.php.net/manual/en/features.commandline.php
* @since 1.0
* @deprecated 2.0 Deprecated without replacement
*/
abstract class AbstractDaemonApplication extends AbstractCliApplication
implements LoggerAwareInterface
{
/**
* @var array The available POSIX signals to be caught by default.
* @link https://secure.php.net/manual/pcntl.constants.php
* @since 1.0
*/
protected static $signals = array(
'SIGHUP',
'SIGINT',
'SIGQUIT',
'SIGILL',
'SIGTRAP',
'SIGABRT',
'SIGIOT',
'SIGBUS',
'SIGFPE',
'SIGUSR1',
'SIGSEGV',
'SIGUSR2',
'SIGPIPE',
'SIGALRM',
'SIGTERM',
'SIGSTKFLT',
'SIGCLD',
'SIGCHLD',
'SIGCONT',
'SIGTSTP',
'SIGTTIN',
'SIGTTOU',
'SIGURG',
'SIGXCPU',
'SIGXFSZ',
'SIGVTALRM',
'SIGPROF',
'SIGWINCH',
'SIGPOLL',
'SIGIO',
'SIGPWR',
'SIGSYS',
'SIGBABY',
'SIG_BLOCK',
'SIG_UNBLOCK',
'SIG_SETMASK',
);
/**
* @var boolean True if the daemon is in the process of exiting.
* @since 1.0
*/
protected $exiting = false;
/**
* @var integer The parent process id.
* @since 1.0
*/
protected $parentId = 0;
/**
* @var integer The process id of the daemon.
* @since 1.0
*/
protected $processId = 0;
/**
* @var boolean True if the daemon is currently running.
* @since 1.0
*/
protected $running = false;
/**
* Class constructor.
*
* @param Input\Cli $input An optional argument to provide
dependency injection for the application's input object. If the
* argument is an Input\Cli object that
object will become the application's input object, otherwise
* a default input object is created.
* @param Registry $config An optional argument to provide
dependency injection for the application's config object. If the
* argument is a Registry object that
object will become the application's config object, otherwise
* a default config object is created.
* @param Cli\CliOutput $output An optional argument to provide
dependency injection for the application's output object. If the
* argument is a Cli\CliOutput object
that object will become the application's input object, otherwise
* a default output object is created.
* @param Cli\CliInput $cliInput An optional argument to provide
dependency injection for the application's CLI input object. If the
* argument is a Cli\CliInput object
that object will become the application's input object, otherwise
* a default input object is created.
*
* @since 1.0
*/
public function __construct(Cli $input = null, Registry $config = null,
Cli\CliOutput $output = null, Cli\CliInput $cliInput = null)
{
// Verify that the process control extension for PHP is available.
// @codeCoverageIgnoreStart
if (!\defined('SIGHUP'))
{
$this->getLogger()->error('The PCNTL extension for PHP is not
available.');
throw new \RuntimeException('The PCNTL extension for PHP is not
available.');
}
// Verify that POSIX support for PHP is available.
if (!\function_exists('posix_getpid'))
{
$this->getLogger()->error('The POSIX extension for PHP is not
available.');
throw new \RuntimeException('The POSIX extension for PHP is not
available.');
}
// @codeCoverageIgnoreEnd
// Call the parent constructor.
parent::__construct($input, $config, $output, $cliInput);
// Set some system limits.
@set_time_limit($this->get('max_execution_time', 0));
if ($this->get('max_memory_limit') !== null)
{
ini_set('memory_limit',
$this->get('max_memory_limit', '256M'));
}
// Flush content immediately.
ob_implicit_flush();
}
/**
* Method to handle POSIX signals.
*
* @param integer $signal The received POSIX signal.
*
* @return void
*
* @since 1.0
* @see pcntl_signal()
* @throws \RuntimeException
*/
public function signal($signal)
{
// Log all signals sent to the daemon.
$this->getLogger()->debug('Received signal: ' . $signal);
// Let's make sure we have an application instance.
if (!is_subclass_of($this, __CLASS__))
{
$this->getLogger()->emergency('Cannot find the application
instance.');
throw new \RuntimeException('Cannot find the application
instance.');
}
// @event onReceiveSignal
switch ($signal)
{
case SIGINT:
case SIGTERM:
// Handle shutdown tasks
if ($this->running && $this->isActive())
{
$this->shutdown();
}
else
{
$this->close();
}
break;
case SIGHUP:
// Handle restart tasks
if ($this->running && $this->isActive())
{
$this->shutdown(true);
}
else
{
$this->close();
}
break;
case SIGCHLD:
// A child process has died
while ($this->pcntlWait($signal, WNOHANG || WUNTRACED) > 0)
{
usleep(1000);
}
break;
case SIGCLD:
while ($this->pcntlWait($signal, WNOHANG) > 0)
{
$signal = $this->pcntlChildExitStatus($signal);
}
break;
default:
break;
}
}
/**
* Check to see if the daemon is active. This does not assume that $this
daemon is active, but
* only if an instance of the application is active as a daemon.
*
* @return boolean True if daemon is active.
*
* @since 1.0
*/
public function isActive()
{
// Get the process id file location for the application.
$pidFile = $this->get('application_pid_file');
// If the process id file doesn't exist then the daemon is obviously
not running.
if (!is_file($pidFile))
{
return false;
}
// Read the contents of the process id file as an integer.
$fp = fopen($pidFile, 'r');
$pid = fread($fp, filesize($pidFile));
$pid = (int) $pid;
fclose($fp);
// Check to make sure that the process id exists as a positive integer.
if (!$pid)
{
return false;
}
// Check to make sure the process is active by pinging it and ensure it
responds.
if (!posix_kill($pid, 0))
{
// No response so remove the process id file and log the situation.
@ unlink($pidFile);
$this->getLogger()->warning('The process found based on PID
file was unresponsive.');
return false;
}
return true;
}
/**
* Load an object or array into the application configuration object.
*
* @param mixed $data Either an array or object to be loaded into the
configuration object.
*
* @return AbstractDaemonApplication Instance of $this to allow
chaining.
*
* @since 1.0
*/
public function loadConfiguration($data)
{
/*
* Setup some application metadata options. This is useful if we ever
want to write out startup scripts
* or just have some sort of information available to share about things.
*/
// The application author name. This string is used in generating
startup scripts and has
// a maximum of 50 characters.
$tmp = (string) $this->get('author_name', 'Joomla
Framework');
$this->set('author_name', (\strlen($tmp) > 50) ?
substr($tmp, 0, 50) : $tmp);
// The application author email. This string is used in generating
startup scripts.
$tmp = (string) $this->get('author_email',
'admin@joomla.org');
$this->set('author_email', filter_var($tmp,
FILTER_VALIDATE_EMAIL));
// The application name. This string is used in generating startup
scripts.
$tmp = (string) $this->get('application_name',
'JApplicationDaemon');
$this->set('application_name', (string)
preg_replace('/[^A-Z0-9_-]/i', '', $tmp));
// The application description. This string is used in generating
startup scripts.
$tmp = (string) $this->get('application_description',
'A generic Joomla Framework application.');
$this->set('application_description', filter_var($tmp,
FILTER_SANITIZE_STRING));
/*
* Setup the application path options. This defines the default
executable name, executable directory,
* and also the path to the daemon process id file.
*/
// The application executable daemon. This string is used in generating
startup scripts.
$tmp = (string) $this->get('application_executable',
basename($this->input->executable));
$this->set('application_executable', $tmp);
// The home directory of the daemon.
$tmp = (string) $this->get('application_directory',
\dirname($this->input->executable));
$this->set('application_directory', $tmp);
// The pid file location. This defaults to a path inside the /tmp
directory.
$name = $this->get('application_name');
$tmp = (string) $this->get('application_pid_file',
strtolower('/tmp/' . $name . '/' . $name .
'.pid'));
$this->set('application_pid_file', $tmp);
/*
* Setup the application identity options. It is important to remember
if the default of 0 is set for
* either UID or GID then changing that setting will not be attempted as
there is no real way to "change"
* the identity of a process from some user to root.
*/
// The user id under which to run the daemon.
$tmp = (int) $this->get('application_uid', 0);
$options = array('options' => array('min_range'
=> 0, 'max_range' => 65000));
$this->set('application_uid', filter_var($tmp,
FILTER_VALIDATE_INT, $options));
// The group id under which to run the daemon.
$tmp = (int) $this->get('application_gid', 0);
$options = array('options' => array('min_range'
=> 0, 'max_range' => 65000));
$this->set('application_gid', filter_var($tmp,
FILTER_VALIDATE_INT, $options));
// Option to kill the daemon if it cannot switch to the chosen identity.
$tmp = (bool) $this->get('application_require_identity', 1);
$this->set('application_require_identity', $tmp);
/*
* Setup the application runtime options. By default our execution time
limit is infinite obviously
* because a daemon should be constantly running unless told otherwise.
The default limit for memory
* usage is 128M, which admittedly is a little high, but remember it is a
"limit" and PHP's memory
* management leaves a bit to be desired :-)
*/
// The maximum execution time of the application in seconds. Zero is
infinite.
$tmp = $this->get('max_execution_time');
if ($tmp !== null)
{
$this->set('max_execution_time', (int) $tmp);
}
// The maximum amount of memory the application can use.
$tmp = $this->get('max_memory_limit', '256M');
if ($tmp !== null)
{
$this->set('max_memory_limit', (string) $tmp);
}
return $this;
}
/**
* Execute the daemon.
*
* @return void
*
* @since 1.0
*/
public function execute()
{
// @event onBeforeExecute
// Enable basic garbage collection.
gc_enable();
$this->getLogger()->info('Starting ' . $this->name);
// Set off the process for becoming a daemon.
if ($this->daemonize())
{
// Declare ticks to start signal monitoring. When you declare ticks,
PCNTL will monitor
// incoming signals after each tick and call the relevant signal handler
automatically.
declare(ticks = 1);
// Start the main execution loop.
while (true)
{
// Perform basic garbage collection.
$this->gc();
// Don't completely overload the CPU.
usleep(1000);
// Execute the main application logic.
$this->doExecute();
}
}
else
{
// We were not able to daemonize the application so log the failure and
die gracefully.
$this->getLogger()->info('Starting ' . $this->name .
' failed');
}
// @event onAfterExecute
}
/**
* Restart daemon process.
*
* @return void
*
* @codeCoverageIgnore
* @since 1.0
*/
public function restart()
{
$this->getLogger()->info('Stopping ' . $this->name);
$this->shutdown(true);
}
/**
* Stop daemon process.
*
* @return void
*
* @codeCoverageIgnore
* @since 1.0
*/
public function stop()
{
$this->getLogger()->info('Stopping ' . $this->name);
$this->shutdown();
}
/**
* Method to change the identity of the daemon process and resources.
*
* @return boolean True if identity successfully changed
*
* @since 1.0
* @see posix_setuid()
*/
protected function changeIdentity()
{
// Get the group and user ids to set for the daemon.
$uid = (int) $this->get('application_uid', 0);
$gid = (int) $this->get('application_gid', 0);
// Get the application process id file path.
$file = $this->get('application_pid_file');
// Change the user id for the process id file if necessary.
if ($uid && (fileowner($file) != $uid) && (!@
chown($file, $uid)))
{
$this->getLogger()->error('Unable to change user ownership of
the process id file.');
return false;
}
// Change the group id for the process id file if necessary.
if ($gid && (filegroup($file) != $gid) && (!@
chgrp($file, $gid)))
{
$this->getLogger()->error('Unable to change group ownership
of the process id file.');
return false;
}
// Set the correct home directory for the process.
if ($uid && ($info = posix_getpwuid($uid)) &&
is_dir($info['dir']))
{
system('export HOME="' . $info['dir'] .
'"');
}
// Change the user id for the process necessary.
if ($uid && (posix_getuid($file) != $uid) && (!@
posix_setuid($uid)))
{
$this->getLogger()->error('Unable to change user ownership of
the proccess.');
return false;
}
// Change the group id for the process necessary.
if ($gid && (posix_getgid($file) != $gid) && (!@
posix_setgid($gid)))
{
$this->getLogger()->error('Unable to change group ownership
of the proccess.');
return false;
}
// Get the user and group information based on uid and gid.
$user = posix_getpwuid($uid);
$group = posix_getgrgid($gid);
$this->getLogger()->info('Changed daemon identity to ' .
$user['name'] . ':' . $group['name']);
return true;
}
/**
* Method to put the application into the background.
*
* @return boolean
*
* @since 1.0
* @throws \RuntimeException
*/
protected function daemonize()
{
// Is there already an active daemon running?
if ($this->isActive())
{
$this->getLogger()->emergency($this->name . ' daemon is
still running. Exiting the application.');
return false;
}
// Reset Process Information
$this->safeMode = !!@ ini_get('safe_mode');
$this->processId = 0;
$this->running = false;
// Detach process!
try
{
// Check if we should run in the foreground.
if (!$this->input->get('f'))
{
// Detach from the terminal.
$this->detach();
}
else
{
// Setup running values.
$this->exiting = false;
$this->running = true;
// Set the process id.
$this->processId = (int) posix_getpid();
$this->parentId = $this->processId;
}
}
catch (\RuntimeException $e)
{
$this->getLogger()->emergency('Unable to fork.');
return false;
}
// Verify the process id is valid.
if ($this->processId < 1)
{
$this->getLogger()->emergency('The process id is invalid; the
fork failed.');
return false;
}
// Clear the umask.
@ umask(0);
// Write out the process id file for concurrency management.
if (!$this->writeProcessIdFile())
{
$this->getLogger()->emergency('Unable to write the pid file
at: ' . $this->get('application_pid_file'));
return false;
}
// Attempt to change the identity of user running the process.
if (!$this->changeIdentity())
{
// If the identity change was required then we need to return false.
if ($this->get('application_require_identity'))
{
$this->getLogger()->critical('Unable to change process
owner.');
return false;
}
$this->getLogger()->warning('Unable to change process
owner.');
}
// Setup the signal handlers for the daemon.
if (!$this->setupSignalHandlers())
{
return false;
}
// Change the current working directory to the application working
directory.
@ chdir($this->get('application_directory'));
return true;
}
/**
* This is truly where the magic happens. This is where we fork the
process and kill the parent
* process, which is essentially what turns the application into a daemon.
*
* @return void
*
* @since 1.0
* @throws \RuntimeException
*/
protected function detach()
{
$this->getLogger()->debug('Detaching the ' .
$this->name . ' daemon.');
// Attempt to fork the process.
$pid = $this->fork();
// If the pid is positive then we successfully forked, and can close this
application.
if ($pid)
{
// Add the log entry for debugging purposes and exit gracefully.
$this->getLogger()->debug('Ending ' . $this->name .
' parent process');
$this->close();
}
else
{
// We are in the forked child process.
// Setup some protected values.
$this->exiting = false;
$this->running = true;
// Set the parent to self.
$this->parentId = $this->processId;
}
}
/**
* Method to fork the process.
*
* @return integer The child process id to the parent process, zero to
the child process.
*
* @since 1.0
* @throws \RuntimeException
*/
protected function fork()
{
// Attempt to fork the process.
$pid = $this->pcntlFork();
// If the fork failed, throw an exception.
if ($pid === -1)
{
throw new \RuntimeException('The process could not be
forked.');
}
if ($pid === 0)
{
// Update the process id for the child.
$this->processId = (int) posix_getpid();
}
else
{
// Log the fork in the parent.
$this->getLogger()->debug('Process forked ' . $pid);
}
// Trigger the onFork event.
$this->postFork();
return $pid;
}
/**
* Method to perform basic garbage collection and memory management in the
sense of clearing the
* stat cache. We will probably call this method pretty regularly in our
main loop.
*
* @return void
*
* @codeCoverageIgnore
* @since 1.0
*/
protected function gc()
{
// Perform generic garbage collection.
gc_collect_cycles();
// Clear the stat cache so it doesn't blow up memory.
clearstatcache();
}
/**
* Method to attach the AbstractDaemonApplication signal handler to the
known signals. Applications
* can override these handlers by using the pcntl_signal() function and
attaching a different
* callback method.
*
* @return boolean
*
* @since 1.0
* @see pcntl_signal()
*/
protected function setupSignalHandlers()
{
// We add the error suppression for the loop because on some platforms
some constants are not defined.
foreach (self::$signals as $signal)
{
// Ignore signals that are not defined.
if (!\defined($signal) || !\is_int(\constant($signal)) ||
(\constant($signal) === 0))
{
// Define the signal to avoid notices.
$this->getLogger()->debug('Signal "' . $signal .
'" not defined. Defining it as null.');
\define($signal, null);
// Don't listen for signal.
continue;
}
// Attach the signal handler for the signal.
if (!$this->pcntlSignal(\constant($signal), array($this,
'signal')))
{
$this->getLogger()->emergency(sprintf('Unable to reroute
signal handler: %s', $signal));
return false;
}
}
return true;
}
/**
* Method to shut down the daemon and optionally restart it.
*
* @param boolean $restart True to restart the daemon on exit.
*
* @return void
*
* @since 1.0
*/
protected function shutdown($restart = false)
{
// If we are already exiting, chill.
if ($this->exiting)
{
return;
}
// If not, now we are.
$this->exiting = true;
// If we aren't already daemonized then just kill the application.
if (!$this->running && !$this->isActive())
{
$this->getLogger()->info('Process was not daemonized yet,
just halting current process');
$this->close();
}
// Only read the pid for the parent file.
if ($this->parentId == $this->processId)
{
// Read the contents of the process id file as an integer.
$fp = fopen($this->get('application_pid_file'),
'r');
$pid = fread($fp,
filesize($this->get('application_pid_file')));
$pid = (int) $pid;
fclose($fp);
// Remove the process id file.
@ unlink($this->get('application_pid_file'));
// If we are supposed to restart the daemon we need to execute the same
command.
if ($restart)
{
$this->close(exec(implode(' ', $GLOBALS['argv'])
. ' > /dev/null &'));
}
else
{
// If we are not supposed to restart the daemon let's just kill
-9.
passthru('kill -9 ' . $pid);
$this->close();
}
}
}
/**
* Method to write the process id file out to disk.
*
* @return boolean
*
* @since 1.0
*/
protected function writeProcessIdFile()
{
// Verify the process id is valid.
if ($this->processId < 1)
{
$this->getLogger()->emergency('The process id is
invalid.');
return false;
}
// Get the application process id file path.
$file = $this->get('application_pid_file');
if (empty($file))
{
$this->getLogger()->error('The process id file path is
empty.');
return false;
}
// Make sure that the folder where we are writing the process id file
exists.
$folder = \dirname($file);
if (!is_dir($folder) && !@ mkdir($folder,
$this->get('folder_permission', 0755)))
{
$this->getLogger()->error('Unable to create directory: '
. $folder);
return false;
}
// Write the process id file out to disk.
if (!file_put_contents($file, $this->processId))
{
$this->getLogger()->error('Unable to write proccess id file:
' . $file);
return false;
}
// Make sure the permissions for the proccess id file are accurate.
if (!chmod($file, $this->get('file_permission', 0644)))
{
$this->getLogger()->error('Unable to adjust permissions for
the proccess id file: ' . $file);
return false;
}
return true;
}
/**
* Method to handle post-fork triggering of the onFork event.
*
* @return void
*
* @since 1.0
*/
protected function postFork()
{
// @event onFork
}
/**
* Method to return the exit code of a terminated child process.
*
* @param integer $status The status parameter is the status parameter
supplied to a successful call to pcntl_waitpid().
*
* @return integer The child process exit code.
*
* @codeCoverageIgnore
* @see pcntl_wexitstatus()
* @since 1.0
*/
protected function pcntlChildExitStatus($status)
{
return pcntl_wexitstatus($status);
}
/**
* Method to return the exit code of a terminated child process.
*
* @return integer On success, the PID of the child process is returned
in the parent's thread
* of execution, and a 0 is returned in the child's
thread of execution. On
* failure, a -1 will be returned in the parent's
context, no child process
* will be created, and a PHP error is raised.
*
* @codeCoverageIgnore
* @see pcntl_fork()
* @since 1.0
*/
protected function pcntlFork()
{
return pcntl_fork();
}
/**
* Method to install a signal handler.
*
* @param integer $signal The signal number.
* @param callable $handler The signal handler which may be the name
of a user created function,
* or method, or either of the two global
constants SIG_IGN or SIG_DFL.
* @param boolean $restart Specifies whether system call restarting
should be used when this
* signal arrives.
*
* @return boolean True on success.
*
* @codeCoverageIgnore
* @see pcntl_signal()
* @since 1.0
*/
protected function pcntlSignal($signal, $handler, $restart = true)
{
return pcntl_signal($signal, $handler, $restart);
}
/**
* Method to wait on or return the status of a forked child.
*
* @param integer $status Status information.
* @param integer $options If wait3 is available on your system
(mostly BSD-style systems),
* you can provide the optional options
parameter.
*
* @return integer The process ID of the child which exited, -1 on error
or zero if WNOHANG
* was provided as an option (on wait3-available
systems) and no child was available.
*
* @codeCoverageIgnore
* @see pcntl_wait()
* @since 1.0
*/
protected function pcntlWait(&$status, $options = 0)
{
return pcntl_wait($status, $options);
}
}
PKNc�[R��llAbstractWebApplication.phpnu�[���<?php
/**
* Part of the Joomla Framework Application Package
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Application;
use Joomla\Input\Input;
use Joomla\Registry\Registry;
use Joomla\Session\Session;
use Joomla\Uri\Uri;
/**
* Base class for a Joomla! Web application.
*
* @since 1.0
*/
abstract class AbstractWebApplication extends AbstractApplication
{
/**
* Character encoding string.
*
* @var string
* @since 1.0
*/
public $charSet = 'utf-8';
/**
* Response mime type.
*
* @var string
* @since 1.0
*/
public $mimeType = 'text/html';
/**
* HTTP protocol version.
*
* @var string
* @since 1.9.0
*/
public $httpVersion = '1.1';
/**
* The body modified date for response headers.
*
* @var \DateTime
* @since 1.0
*/
public $modifiedDate;
/**
* The application client object.
*
* @var Web\WebClient
* @since 1.0
*/
public $client;
/**
* The application response object.
*
* @var object
* @since 1.0
*/
protected $response;
/**
* The application session object.
*
* @var Session
* @since 1.0
*/
private $session;
/**
* A map of integer HTTP response codes to the full HTTP Status for the
headers.
*
* @var array
* @since 1.6.0
* @link
https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
*/
private $responseMap = array(
100 => 'HTTP/{version} 100 Continue',
101 => 'HTTP/{version} 101 Switching Protocols',
102 => 'HTTP/{version} 102 Processing',
200 => 'HTTP/{version} 200 OK',
201 => 'HTTP/{version} 201 Created',
202 => 'HTTP/{version} 202 Accepted',
203 => 'HTTP/{version} 203 Non-Authoritative Information',
204 => 'HTTP/{version} 204 No Content',
205 => 'HTTP/{version} 205 Reset Content',
206 => 'HTTP/{version} 206 Partial Content',
207 => 'HTTP/{version} 207 Multi-Status',
208 => 'HTTP/{version} 208 Already Reported',
226 => 'HTTP/{version} 226 IM Used',
300 => 'HTTP/{version} 300 Multiple Choices',
301 => 'HTTP/{version} 301 Moved Permanently',
302 => 'HTTP/{version} 302 Found',
303 => 'HTTP/{version} 303 See other',
304 => 'HTTP/{version} 304 Not Modified',
305 => 'HTTP/{version} 305 Use Proxy',
306 => 'HTTP/{version} 306 (Unused)',
307 => 'HTTP/{version} 307 Temporary Redirect',
308 => 'HTTP/{version} 308 Permanent Redirect',
400 => 'HTTP/{version} 400 Bad Request',
401 => 'HTTP/{version} 401 Unauthorized',
402 => 'HTTP/{version} 402 Payment Required',
403 => 'HTTP/{version} 403 Forbidden',
404 => 'HTTP/{version} 404 Not Found',
405 => 'HTTP/{version} 405 Method Not Allowed',
406 => 'HTTP/{version} 406 Not Acceptable',
407 => 'HTTP/{version} 407 Proxy Authentication Required',
408 => 'HTTP/{version} 408 Request Timeout',
409 => 'HTTP/{version} 409 Conflict',
410 => 'HTTP/{version} 410 Gone',
411 => 'HTTP/{version} 411 Length Required',
412 => 'HTTP/{version} 412 Precondition Failed',
413 => 'HTTP/{version} 413 Payload Too Large',
414 => 'HTTP/{version} 414 URI Too Long',
415 => 'HTTP/{version} 415 Unsupported Media Type',
416 => 'HTTP/{version} 416 Range Not Satisfiable',
417 => 'HTTP/{version} 417 Expectation Failed',
418 => 'HTTP/{version} 418 I\'m a teapot',
421 => 'HTTP/{version} 421 Misdirected Request',
422 => 'HTTP/{version} 422 Unprocessable Entity',
423 => 'HTTP/{version} 423 Locked',
424 => 'HTTP/{version} 424 Failed Dependency',
426 => 'HTTP/{version} 426 Upgrade Required',
428 => 'HTTP/{version} 428 Precondition Required',
429 => 'HTTP/{version} 429 Too Many Requests',
431 => 'HTTP/{version} 431 Request Header Fields Too Large',
451 => 'HTTP/{version} 451 Unavailable For Legal Reasons',
500 => 'HTTP/{version} 500 Internal Server Error',
501 => 'HTTP/{version} 501 Not Implemented',
502 => 'HTTP/{version} 502 Bad Gateway',
503 => 'HTTP/{version} 503 Service Unavailable',
504 => 'HTTP/{version} 504 Gateway Timeout',
505 => 'HTTP/{version} 505 HTTP Version Not Supported',
506 => 'HTTP/{version} 506 Variant Also Negotiates',
507 => 'HTTP/{version} 507 Insufficient Storage',
508 => 'HTTP/{version} 508 Loop Detected',
510 => 'HTTP/{version} 510 Not Extended',
511 => 'HTTP/{version} 511 Network Authentication Required',
);
/**
* Class constructor.
*
* @param Input $input An optional argument to provide
dependency injection for the application's input object. If the
argument
* is an Input object that object will
become the application's input object, otherwise a default input
* object is created.
* @param Registry $config An optional argument to provide
dependency injection for the application's config object. If the
argument
* is a Registry object that object will
become the application's config object, otherwise a default config
* object is created.
* @param Web\WebClient $client An optional argument to provide
dependency injection for the application's client object. If the
argument
* is a Web\WebClient object that object
will become the application's client object, otherwise a default
client
* object is created.
*
* @since 1.0
*/
public function __construct(Input $input = null, Registry $config = null,
Web\WebClient $client = null)
{
$this->client = $client instanceof Web\WebClient ? $client : new
Web\WebClient;
// Setup the response object.
$this->response = new \stdClass;
$this->response->cachable = false;
$this->response->headers = array();
$this->response->body = array();
// Call the constructor as late as possible (it runs `initialise`).
parent::__construct($input, $config);
// Set the system URIs.
$this->loadSystemUris();
}
/**
* Execute the application.
*
* @return void
*
* @since 1.0
*/
public function execute()
{
// @event onBeforeExecute
// Perform application routines.
$this->doExecute();
// @event onAfterExecute
// If gzip compression is enabled in configuration and the server is
compliant, compress the output.
if ($this->get('gzip') &&
!ini_get('zlib.output_compression') &&
(ini_get('output_handler') != 'ob_gzhandler'))
{
$this->compress();
}
// @event onBeforeRespond
// Send the application response.
$this->respond();
// @event onAfterRespond
}
/**
* Checks the accept encoding of the browser and compresses the data
before
* sending it to the client if possible.
*
* @return void
*
* @since 1.0
*/
protected function compress()
{
// Supported compression encodings.
$supported = array(
'x-gzip' => 'gz',
'gzip' => 'gz',
'deflate' => 'deflate',
);
// Get the supported encoding.
$encodings = array_intersect($this->client->encodings,
array_keys($supported));
// If no supported encoding is detected do nothing and return.
if (empty($encodings))
{
return;
}
// Verify that headers have not yet been sent, and that our connection is
still alive.
if ($this->checkHeadersSent() || !$this->checkConnectionAlive())
{
return;
}
// Iterate through the encodings and attempt to compress the data using
any found supported encodings.
foreach ($encodings as $encoding)
{
if (($supported[$encoding] == 'gz') || ($supported[$encoding]
== 'deflate'))
{
// Verify that the server supports gzip compression before we attempt
to gzip encode the data.
// @codeCoverageIgnoreStart
if (!\extension_loaded('zlib') ||
ini_get('zlib.output_compression'))
{
continue;
}
// @codeCoverageIgnoreEnd
// Attempt to gzip encode the data with an optimal level 4.
$data = $this->getBody();
$gzdata = gzencode($data, 4, ($supported[$encoding] == 'gz')
? FORCE_GZIP : FORCE_DEFLATE);
// If there was a problem encoding the data just try the next encoding
scheme.
// @codeCoverageIgnoreStart
if ($gzdata === false)
{
continue;
}
// @codeCoverageIgnoreEnd
// Set the encoding headers.
$this->setHeader('Content-Encoding', $encoding);
$this->setHeader('Vary', 'Accept-Encoding');
$this->setHeader('X-Content-Encoded-By',
'Joomla');
// Replace the output with the encoded data.
$this->setBody($gzdata);
// Compression complete, let's break out of the loop.
break;
}
}
}
/**
* Method to send the application response to the client. All headers
will be sent prior to the main
* application output data.
*
* @return void
*
* @since 1.0
*/
protected function respond()
{
// Send the content-type header.
$this->setHeader('Content-Type', $this->mimeType .
'; charset=' . $this->charSet);
// If the response is set to uncachable, we need to set some appropriate
headers so browsers don't cache the response.
if (!$this->allowCache())
{
// Expires in the past.
$this->setHeader('Expires', 'Wed, 17 Aug 2005 00:00:00
GMT', true);
// Always modified.
$this->setHeader('Last-Modified', gmdate('D, d M Y
H:i:s') . ' GMT', true);
$this->setHeader('Cache-Control', 'no-store, no-cache,
must-revalidate, post-check=0, pre-check=0', false);
// HTTP 1.0
$this->setHeader('Pragma', 'no-cache');
}
else
{
// Expires.
$this->setHeader('Expires', gmdate('D, d M Y
H:i:s', time() + 900) . ' GMT');
// Last modified.
if ($this->modifiedDate instanceof \DateTime)
{
$this->modifiedDate->setTimezone(new
\DateTimeZone('UTC'));
$this->setHeader('Last-Modified',
$this->modifiedDate->format('D, d M Y H:i:s') . '
GMT');
}
}
$this->sendHeaders();
echo $this->getBody();
}
/**
* Redirect to another URL.
*
* If the headers have not been sent the redirect will be accomplished
using a "301 Moved Permanently"
* or "303 See Other" code in the header pointing to the new
location. If the headers have already been
* sent this will be accomplished using a JavaScript statement.
*
* @param string $url The URL to redirect to. Can only be
http/https URL
* @param integer $status The HTTP status code to be provided. 303 is
assumed by default.
*
* @return void
*
* @since 1.0
* @throws \InvalidArgumentException
*/
public function redirect($url, $status = 303)
{
// Check for relative internal links.
if (preg_match('#^index\.php#', $url))
{
$url = $this->get('uri.base.full') . $url;
}
// Perform a basic sanity check to make sure we don't have any CRLF
garbage.
$url = preg_split("/[\r\n]/", $url);
$url = $url[0];
/*
* Here we need to check and see if the URL is relative or absolute.
Essentially, do we need to
* prepend the URL with our base URL for a proper redirect. The
rudimentary way we are looking
* at this is to simply check whether or not the URL string has a valid
scheme or not.
*/
if (!preg_match('#^[a-z]+\://#i', $url))
{
// Get a Uri instance for the requested URI.
$uri = new Uri($this->get('uri.request'));
// Get a base URL to prepend from the requested URI.
$prefix = $uri->toString(array('scheme', 'user',
'pass', 'host', 'port'));
// We just need the prefix since we have a path relative to the root.
if ($url[0] == '/')
{
$url = $prefix . $url;
}
else
{
// It's relative to where we are now, so lets add that.
$parts = explode('/',
$uri->toString(array('path')));
array_pop($parts);
$path = implode('/', $parts) . '/';
$url = $prefix . $path . $url;
}
}
// If the headers have already been sent we need to send the redirect
statement via JavaScript.
if ($this->checkHeadersSent())
{
echo '<script>document.location.href=' .
json_encode($url) . ";</script>\n";
}
else
{
// We have to use a JavaScript redirect here because MSIE doesn't
play nice with utf-8 URLs.
if (($this->client->engine == Web\WebClient::TRIDENT) &&
!static::isAscii($url))
{
$html = '<html><head>';
$html .= '<meta http-equiv="content-type"
content="text/html; charset=' . $this->charSet . '"
/>';
$html .= '<script>document.location.href=' .
json_encode($url) . ';</script>';
$html .=
'</head><body></body></html>';
echo $html;
}
else
{
// Check if we have a boolean for the status variable for compatability
with v1 of the framework
// @deprecated 3.0
if (\is_bool($status))
{
$status = $status ? 301 : 303;
}
if (!\is_int($status) && !$this->isRedirectState($status))
{
throw new \InvalidArgumentException('You have not supplied a
valid HTTP status code');
}
// All other cases use the more efficient HTTP header for redirection.
$this->setHeader('Status', $status, true);
$this->setHeader('Location', $url, true);
}
}
// Set appropriate headers
$this->respond();
// Close the application after the redirect.
$this->close();
}
/**
* Set/get cachable state for the response. If $allow is set, sets the
cachable state of the
* response. Always returns the current state.
*
* @param boolean $allow True to allow browser caching.
*
* @return boolean
*
* @since 1.0
*/
public function allowCache($allow = null)
{
if ($allow !== null)
{
$this->response->cachable = (bool) $allow;
}
return $this->response->cachable;
}
/**
* Method to set a response header. If the replace flag is set then all
headers
* with the given name will be replaced by the new one. The headers are
stored
* in an internal array to be sent when the site is sent to the browser.
*
* @param string $name The name of the header to set.
* @param string $value The value of the header to set.
* @param boolean $replace True to replace any headers with the same
name.
*
* @return AbstractWebApplication Instance of $this to allow chaining.
*
* @since 1.0
*/
public function setHeader($name, $value, $replace = false)
{
// Sanitize the input values.
$name = (string) $name;
$value = (string) $value;
// If the replace flag is set, unset all known headers with the given
name.
if ($replace)
{
foreach ($this->response->headers as $key => $header)
{
if ($name == $header['name'])
{
unset($this->response->headers[$key]);
}
}
// Clean up the array as unsetting nested arrays leaves some junk.
$this->response->headers =
array_values($this->response->headers);
}
// Add the header to the internal array.
$this->response->headers[] = array('name' => $name,
'value' => $value);
return $this;
}
/**
* Method to get the array of response headers to be sent when the
response is sent
* to the client.
*
* @return array
*
* @since 1.0
*/
public function getHeaders()
{
return $this->response->headers;
}
/**
* Method to clear any set response headers.
*
* @return AbstractWebApplication Instance of $this to allow chaining.
*
* @since 1.0
*/
public function clearHeaders()
{
$this->response->headers = array();
return $this;
}
/**
* Send the response headers.
*
* @return AbstractWebApplication Instance of $this to allow chaining.
*
* @since 1.0
*/
public function sendHeaders()
{
if (!$this->checkHeadersSent())
{
foreach ($this->response->headers as $header)
{
if (strtolower($header['name']) == 'status')
{
// 'status' headers indicate an HTTP status, and need to be
handled slightly differently
$status = $this->getHttpStatusValue($header['value']);
$this->header($status, true, (int) $header['value']);
}
else
{
$this->header($header['name'] . ': ' .
$header['value']);
}
}
}
return $this;
}
/**
* Set body content. If body content already defined, this will replace
it.
*
* @param string $content The content to set as the response body.
*
* @return AbstractWebApplication Instance of $this to allow chaining.
*
* @since 1.0
*/
public function setBody($content)
{
$this->response->body = array((string) $content);
return $this;
}
/**
* Prepend content to the body content
*
* @param string $content The content to prepend to the response body.
*
* @return AbstractWebApplication Instance of $this to allow chaining.
*
* @since 1.0
*/
public function prependBody($content)
{
array_unshift($this->response->body, (string) $content);
return $this;
}
/**
* Append content to the body content
*
* @param string $content The content to append to the response body.
*
* @return AbstractWebApplication Instance of $this to allow chaining.
*
* @since 1.0
*/
public function appendBody($content)
{
$this->response->body[] = (string) $content;
return $this;
}
/**
* Return the body content
*
* @param boolean $asArray True to return the body as an array of
strings.
*
* @return mixed The response body either as an array or concatenated
string.
*
* @since 1.0
*/
public function getBody($asArray = false)
{
return $asArray ? $this->response->body : implode((array)
$this->response->body);
}
/**
* Method to get the application session object.
*
* @return Session The session object
*
* @since 1.0
*/
public function getSession()
{
if ($this->session === null)
{
throw new \RuntimeException('A \Joomla\Session\Session object has
not been set.');
}
return $this->session;
}
/**
* Check if a given value can be successfully mapped to a valid http
status value
*
* @param string|int $value The given status as int or string
*
* @return string
*
* @since 1.8.0
*/
protected function getHttpStatusValue($value)
{
$code = (int) $value;
if (array_key_exists($code, $this->responseMap))
{
$value = $this->responseMap[$code];
}
else
{
$value = 'HTTP/{version} ' . $code;
}
return str_replace('{version}', $this->httpVersion, $value);
}
/**
* Check if the value is a valid HTTP status code
*
* @param integer $code The potential status code
*
* @return boolean
*
* @since 1.8.1
*/
public function isValidHttpStatus($code)
{
return array_key_exists($code, $this->responseMap);
}
/**
* Method to check the current client connection status to ensure that it
is alive. We are
* wrapping this to isolate the connection_status() function from our code
base for testing reasons.
*
* @return boolean True if the connection is valid and normal.
*
* @codeCoverageIgnore
* @see connection_status()
* @since 1.0
*/
protected function checkConnectionAlive()
{
return connection_status() === CONNECTION_NORMAL;
}
/**
* Method to check to see if headers have already been sent. We are
wrapping this to isolate the
* headers_sent() function from our code base for testing reasons.
*
* @return boolean True if the headers have already been sent.
*
* @codeCoverageIgnore
* @see headers_sent()
* @since 1.0
*/
protected function checkHeadersSent()
{
return headers_sent();
}
/**
* Method to detect the requested URI from server environment variables.
*
* @return string The requested URI
*
* @since 1.0
*/
protected function detectRequestUri()
{
// First we need to detect the URI scheme.
if ($this->isSslConnection())
{
$scheme = 'https://';
}
else
{
$scheme = 'http://';
}
/*
* There are some differences in the way that Apache and IIS populate
server environment variables. To
* properly detect the requested URI we need to adjust our algorithm
based on whether or not we are getting
* information from Apache or IIS.
*/
$phpSelf =
$this->input->server->getString('PHP_SELF',
'');
$requestUri =
$this->input->server->getString('REQUEST_URI',
'');
// If PHP_SELF and REQUEST_URI are both populated then we will assume
"Apache Mode".
if (!empty($phpSelf) && !empty($requestUri))
{
// The URI is built from the HTTP_HOST and REQUEST_URI environment
variables in an Apache environment.
$uri = $scheme .
$this->input->server->getString('HTTP_HOST') .
$requestUri;
}
else
{
// If not in "Apache Mode" we will assume that we are in an
IIS environment and proceed.
// IIS uses the SCRIPT_NAME variable instead of a REQUEST_URI
variable... thanks, MS
$uri = $scheme .
$this->input->server->getString('HTTP_HOST') .
$this->input->server->getString('SCRIPT_NAME');
$queryHost =
$this->input->server->getString('QUERY_STRING',
'');
// If the QUERY_STRING variable exists append it to the URI string.
if (!empty($queryHost))
{
$uri .= '?' . $queryHost;
}
}
return trim($uri);
}
/**
* Method to send a header to the client. We are wrapping this to isolate
the header() function
* from our code base for testing reasons.
*
* @param string $string The header string.
* @param boolean $replace The optional replace parameter indicates
whether the header should
* replace a previous similar header, or add a
second header of the same type.
* @param integer $code Forces the HTTP response code to the
specified value. Note that
* this parameter only has an effect if the
string is not empty.
*
* @return void
*
* @codeCoverageIgnore
* @see header()
* @since 1.0
*/
protected function header($string, $replace = true, $code = null)
{
header(str_replace(\chr(0), '', $string), $replace, $code);
}
/**
* Checks if a state is a redirect state
*
* @param integer $state The HTTP status code.
*
* @return boolean
*
* @since 1.8.0
*/
protected function isRedirectState($state)
{
$state = (int) $state;
return $state > 299 && $state < 400 &&
array_key_exists($state, $this->responseMap);
}
/**
* Determine if we are using a secure (SSL) connection.
*
* @return boolean True if using SSL, false if not.
*
* @since 1.0
*/
public function isSslConnection()
{
$serverSSLVar =
$this->input->server->getString('HTTPS', '');
if (!empty($serverSSLVar) && strtolower($serverSSLVar) !==
'off')
{
return true;
}
$serverForwarderProtoVar =
$this->input->server->getString('HTTP_X_FORWARDED_PROTO',
'');
return !empty($serverForwarderProtoVar) &&
strtolower($serverForwarderProtoVar) === 'https';
}
/**
* Sets the session for the application to use, if required.
*
* @param Session $session A session object.
*
* @return AbstractWebApplication Returns itself to support chaining.
*
* @since 1.0
*/
public function setSession(Session $session)
{
$this->session = $session;
return $this;
}
/**
* Method to load the system URI strings for the application.
*
* @param string $requestUri An optional request URI to use instead of
detecting one from the
* server environment variables.
*
* @return void
*
* @since 1.0
*/
protected function loadSystemUris($requestUri = null)
{
// Set the request URI.
// @codeCoverageIgnoreStart
if (!empty($requestUri))
{
$this->set('uri.request', $requestUri);
}
else
{
$this->set('uri.request', $this->detectRequestUri());
}
// @codeCoverageIgnoreEnd
// Check to see if an explicit base URI has been set.
$siteUri = trim($this->get('site_uri'));
if ($siteUri != '')
{
$uri = new Uri($siteUri);
$path = $uri->toString(array('path'));
}
else
{
// No explicit base URI was set so we need to detect it. Start with the
requested URI.
$uri = new Uri($this->get('uri.request'));
$requestUri =
$this->input->server->getString('REQUEST_URI',
'');
// If we are working from a CGI SAPI with the
'cgi.fix_pathinfo' directive disabled we use PHP_SELF.
if (strpos(PHP_SAPI, 'cgi') !== false &&
!ini_get('cgi.fix_pathinfo') && !empty($requestUri))
{
// We aren't expecting PATH_INFO within PHP_SELF so this should
work.
$path =
\dirname($this->input->server->getString('PHP_SELF',
''));
}
else
{
// Pretty much everything else should be handled with SCRIPT_NAME.
$path =
\dirname($this->input->server->getString('SCRIPT_NAME',
''));
}
}
// Get the host from the URI.
$host = $uri->toString(array('scheme', 'user',
'pass', 'host', 'port'));
// Check if the path includes "index.php".
if (strpos($path, 'index.php') !== false)
{
// Remove the index.php portion of the path.
$path = substr_replace($path, '', strpos($path,
'index.php'), 9);
}
$path = rtrim($path, '/\\');
// Set the base URI both as just a path and as the full URI.
$this->set('uri.base.full', $host . $path . '/');
$this->set('uri.base.host', $host);
$this->set('uri.base.path', $path . '/');
// Set the extended (non-base) part of the request URI as the route.
if (stripos($this->get('uri.request'),
$this->get('uri.base.full')) === 0)
{
$this->set('uri.route',
substr_replace($this->get('uri.request'), '', 0,
\strlen($this->get('uri.base.full'))));
}
// Get an explicitly set media URI is present.
$mediaURI = trim($this->get('media_uri'));
if ($mediaURI)
{
if (strpos($mediaURI, '://') !== false)
{
$this->set('uri.media.full', $mediaURI);
$this->set('uri.media.path', $mediaURI);
}
else
{
// Normalise slashes.
$mediaURI = trim($mediaURI, '/\\');
$mediaURI = !empty($mediaURI) ? '/' . $mediaURI .
'/' : '/';
$this->set('uri.media.full',
$this->get('uri.base.host') . $mediaURI);
$this->set('uri.media.path', $mediaURI);
}
}
else
{
// No explicit media URI was set, build it dynamically from the base
uri.
$this->set('uri.media.full',
$this->get('uri.base.full') . 'media/');
$this->set('uri.media.path',
$this->get('uri.base.path') . 'media/');
}
}
/**
* Checks for a form token in the request.
*
* Use in conjunction with getFormToken.
*
* @param string $method The request method in which to look for the
token key.
*
* @return boolean True if found and valid, false otherwise.
*
* @since 1.0
*/
public function checkToken($method = 'post')
{
$token = $this->getFormToken();
if (!$this->input->$method->get($token, '',
'alnum'))
{
if ($this->getSession()->isNew())
{
// Redirect to login screen.
$this->redirect('index.php');
$this->close();
}
else
{
return false;
}
}
else
{
return true;
}
}
/**
* Method to determine a hash for anti-spoofing variable names
*
* @param boolean $forceNew If true, force a new token to be created
*
* @return string Hashed var name
*
* @since 1.0
*/
public function getFormToken($forceNew = false)
{
// @todo we need the user id somehow here
$userId = 0;
return md5($this->get('secret') . $userId .
$this->getSession()->getToken($forceNew));
}
/**
* Tests whether a string contains only 7bit ASCII bytes.
*
* You might use this to conditionally check whether a string
* needs handling as UTF-8 or not, potentially offering performance
* benefits by using the native PHP equivalent if it's just ASCII
e.g.;
*
* @param string $str The string to test.
*
* @return boolean True if the string is all ASCII
*
* @since 1.4.0
*/
public static function isAscii($str)
{
// Search for any bytes which are outside the ASCII range...
return preg_match('/(?:[^\x00-\x7F])/', $str) !== 1;
}
}
PKOc�[�ttCli/CliInput.phpnu�[���<?php
/**
* Part of the Joomla Framework Application Package
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Application\Cli;
/**
* Class CliInput
*
* @since 1.6.0
* @deprecated 2.0 Use the `joomla/console` package instead
*/
class CliInput
{
/**
* Get a value from standard input.
*
* @return string The input string from standard input.
*
* @codeCoverageIgnore
* @since 1.6.0
*/
public function in()
{
return rtrim(fread(STDIN, 8192), "\n\r");
}
}
PKOc�[3s�JCli/CliOutput.phpnu�[���<?php
/**
* Part of the Joomla Framework Application Package
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Application\Cli;
use Joomla\Application\Cli\Output\Processor\ProcessorInterface;
/**
* Class CliOutput
*
* @since 1.0
* @deprecated 2.0 Use the `joomla/console` package instead
*/
abstract class CliOutput
{
/**
* Color processing object
*
* @var ProcessorInterface
* @since 1.0
*/
protected $processor;
/**
* Constructor
*
* @param ProcessorInterface $processor The output processor.
*
* @since 1.1.2
*/
public function __construct(ProcessorInterface $processor = null)
{
$this->setProcessor(($processor instanceof ProcessorInterface) ?
$processor : new Output\Processor\ColorProcessor);
}
/**
* Set a processor
*
* @param ProcessorInterface $processor The output processor.
*
* @return Stdout Instance of $this to allow chaining.
*
* @since 1.0
*/
public function setProcessor(ProcessorInterface $processor)
{
$this->processor = $processor;
return $this;
}
/**
* Get a processor
*
* @return ProcessorInterface
*
* @since 1.0
* @throws \RuntimeException
*/
public function getProcessor()
{
if ($this->processor)
{
return $this->processor;
}
throw new \RuntimeException('A ProcessorInterface object has not
been set.');
}
/**
* Write a string to an output handler.
*
* @param string $text The text to display.
* @param boolean $nl True (default) to append a new line at the end
of the output string.
*
* @return void
*
* @since 1.0
* @codeCoverageIgnore
*/
abstract public function out($text = '', $nl = true);
}
PKOc�[~��u Cli/ColorProcessor.phpnu�[���<?php
/**
* Part of the Joomla Framework Application Package
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Application\Cli;
use \Joomla\Application\Cli\Output\Processor\ColorProcessor as
RealColorProcessor;
/**
* Class ColorProcessor.
*
* @since 1.0
* @deprecated 2.0 Use the `joomla/console` package instead
*/
class ColorProcessor extends RealColorProcessor
{
}
PKOc�[MS�**Cli/ColorStyle.phpnu�[���<?php
/**
* Part of the Joomla Framework Application Package
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Application\Cli;
/**
* Class ColorStyle
*
* @since 1.0
* @deprecated 2.0 Use the `joomla/console` package instead
*/
final class ColorStyle
{
/**
* Known colors
*
* @var array
* @since 1.0
*/
private static $knownColors = array(
'black' => 0,
'red' => 1,
'green' => 2,
'yellow' => 3,
'blue' => 4,
'magenta' => 5,
'cyan' => 6,
'white' => 7,
);
/**
* Known styles
*
* @var array
* @since 1.0
*/
private static $knownOptions = array(
'bold' => 1,
'underscore' => 4,
'blink' => 5,
'reverse' => 7,
);
/**
* Foreground base value
*
* @var integer
* @since 1.0
*/
private static $fgBase = 30;
/**
* Background base value
*
* @var integer
* @since 1.0
*/
private static $bgBase = 40;
/**
* Foreground color
*
* @var integer
* @since 1.0
*/
private $fgColor = 0;
/**
* Background color
*
* @var integer
* @since 1.0
*/
private $bgColor = 0;
/**
* Array of style options
*
* @var array
* @since 1.0
*/
private $options = array();
/**
* Constructor
*
* @param string $fg Foreground color.
* @param string $bg Background color.
* @param array $options Style options.
*
* @since 1.0
* @throws \InvalidArgumentException
*/
public function __construct($fg = '', $bg = '',
$options = array())
{
if ($fg)
{
if (array_key_exists($fg, static::$knownColors) == false)
{
throw new \InvalidArgumentException(
sprintf('Invalid foreground color "%1$s" [%2$s]',
$fg,
implode(', ', $this->getKnownColors())
)
);
}
$this->fgColor = static::$fgBase + static::$knownColors[$fg];
}
if ($bg)
{
if (array_key_exists($bg, static::$knownColors) == false)
{
throw new \InvalidArgumentException(
sprintf('Invalid background color "%1$s" [%2$s]',
$bg,
implode(', ', $this->getKnownColors())
)
);
}
$this->bgColor = static::$bgBase + static::$knownColors[$bg];
}
foreach ($options as $option)
{
if (array_key_exists($option, static::$knownOptions) == false)
{
throw new \InvalidArgumentException(
sprintf('Invalid option "%1$s" [%2$s]',
$option,
implode(', ', $this->getKnownOptions())
)
);
}
$this->options[] = $option;
}
}
/**
* Convert to a string.
*
* @return string
*
* @since 1.0
*/
public function __toString()
{
return $this->getStyle();
}
/**
* Create a color style from a parameter string.
*
* Example: fg=red;bg=blue;options=bold,blink
*
* @param string $string The parameter string.
*
* @return ColorStyle Instance of $this to allow chaining.
*
* @since 1.0
* @throws \RuntimeException
*/
public static function fromString($string)
{
$fg = '';
$bg = '';
$options = array();
$parts = explode(';', $string);
foreach ($parts as $part)
{
$subParts = explode('=', $part);
if (\count($subParts) < 2)
{
continue;
}
switch ($subParts[0])
{
case 'fg':
$fg = $subParts[1];
break;
case 'bg':
$bg = $subParts[1];
break;
case 'options':
$options = explode(',', $subParts[1]);
break;
default:
throw new \RuntimeException('Invalid option');
break;
}
}
return new self($fg, $bg, $options);
}
/**
* Get the translated color code.
*
* @return string
*
* @since 1.0
*/
public function getStyle()
{
$values = array();
if ($this->fgColor)
{
$values[] = $this->fgColor;
}
if ($this->bgColor)
{
$values[] = $this->bgColor;
}
foreach ($this->options as $option)
{
$values[] = static::$knownOptions[$option];
}
return implode(';', $values);
}
/**
* Get the known colors.
*
* @return string
*
* @since 1.0
*/
public function getKnownColors()
{
return array_keys(static::$knownColors);
}
/**
* Get the known options.
*
* @return array
*
* @since 1.0
*/
public function getKnownOptions()
{
return array_keys(static::$knownOptions);
}
}
PKOc�[h#�ff'Cli/Output/Processor/ColorProcessor.phpnu�[���<?php
/**
* Part of the Joomla Framework Application Package
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Application\Cli\Output\Processor;
use Joomla\Application\Cli\ColorStyle;
use Joomla\Application\Cli\Output\Stdout;
/**
* Class ColorProcessor.
*
* @since 1.0
* @deprecated 2.0 Use the `joomla/console` package instead
*/
class ColorProcessor implements ProcessorInterface
{
/**
* Flag to remove color codes from the output
*
* @var boolean
* @since 1.0
*/
public $noColors = false;
/**
* Regex to match tags
*
* @var string
* @since 1.0
*/
protected $tagFilter =
'/<([a-z=;]+)>(.*?)<\/\\1>/s';
/**
* Regex used for removing color codes
*
* @var string
* @since 1.0
*/
protected static $stripFilter = '/<[\/]?[a-z=;]+>/';
/**
* Array of ColorStyle objects
*
* @var array
* @since 1.0
*/
protected $styles = array();
/**
* Class constructor
*
* @param boolean $noColors Defines non-colored mode on construct
*
* @since 1.1.0
*/
public function __construct($noColors = null)
{
if ($noColors === null)
{
/*
* By default windows cmd.exe and PowerShell does not support
ANSI-colored output
* if the variable is not set explicitly colors should be disabled on
Windows
*/
$noColors = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN');
}
$this->noColors = $noColors;
$this->addPredefinedStyles();
}
/**
* Add a style.
*
* @param string $name The style name.
* @param ColorStyle $style The color style.
*
* @return ColorProcessor Instance of $this to allow chaining.
*
* @since 1.0
*/
public function addStyle($name, ColorStyle $style)
{
$this->styles[$name] = $style;
return $this;
}
/**
* Strip color tags from a string.
*
* @param string $string The string.
*
* @return string
*
* @since 1.0
*/
public static function stripColors($string)
{
return preg_replace(static::$stripFilter, '', $string);
}
/**
* Process a string.
*
* @param string $string The string to process.
*
* @return string
*
* @since 1.0
*/
public function process($string)
{
preg_match_all($this->tagFilter, $string, $matches);
if (!$matches)
{
return $string;
}
foreach ($matches[0] as $i => $m)
{
if (array_key_exists($matches[1][$i], $this->styles))
{
$string = $this->replaceColors($string, $matches[1][$i],
$matches[2][$i], $this->styles[$matches[1][$i]]);
}
// Custom format
elseif (strpos($matches[1][$i], '='))
{
$string = $this->replaceColors($string, $matches[1][$i],
$matches[2][$i], ColorStyle::fromString($matches[1][$i]));
}
}
return $string;
}
/**
* Replace color tags in a string.
*
* @param string $text The original text.
* @param string $tag The matched tag.
* @param string $match The match.
* @param ColorStyle $style The color style to apply.
*
* @return mixed
*
* @since 1.0
*/
private function replaceColors($text, $tag, $match, Colorstyle $style)
{
$replace = $this->noColors
? $match
: "\033[" . $style . 'm' . $match .
"\033[0m";
return str_replace('<' . $tag . '>' . $match .
'</' . $tag . '>', $replace, $text);
}
/**
* Adds predefined color styles to the ColorProcessor object
*
* @return Stdout Instance of $this to allow chaining.
*
* @since 1.0
*/
private function addPredefinedStyles()
{
$this->addStyle(
'info',
new ColorStyle('green', '', array('bold'))
);
$this->addStyle(
'comment',
new ColorStyle('yellow', '',
array('bold'))
);
$this->addStyle(
'question',
new ColorStyle('black', 'cyan')
);
$this->addStyle(
'error',
new ColorStyle('white', 'red')
);
return $this;
}
}
PKOc�[?<N}}+Cli/Output/Processor/ProcessorInterface.phpnu�[���<?php
/**
* Part of the Joomla Framework Application Package
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Application\Cli\Output\Processor;
/**
* Class ProcessorInterface.
*
* @since 1.1.0
* @deprecated 2.0 Use the `joomla/console` package instead
*/
interface ProcessorInterface
{
/**
* Process the provided output into a string.
*
* @param string $output The string to process.
*
* @return string
*
* @since 1.1.0
*/
public function process($output);
}
PKOc�[�����Cli/Output/Stdout.phpnu�[���<?php
/**
* Part of the Joomla Framework Application Package
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Application\Cli\Output;
use Joomla\Application\Cli\CliOutput;
/**
* Class Stdout.
*
* @since 1.0
* @deprecated 2.0 Use the `joomla/console` package instead
*/
class Stdout extends CliOutput
{
/**
* Write a string to standard output
*
* @param string $text The text to display.
* @param boolean $nl True (default) to append a new line at the end
of the output string.
*
* @return Stdout Instance of $this to allow chaining.
*
* @codeCoverageIgnore
* @since 1.0
*/
public function out($text = '', $nl = true)
{
fwrite(STDOUT, $this->getProcessor()->process($text) . ($nl ?
"\n" : null));
return $this;
}
}
PKOc�[��6�QQCli/Output/Xml.phpnu�[���<?php
/**
* Part of the Joomla Framework Application Package
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Application\Cli\Output;
use Joomla\Application\Cli\CliOutput;
/**
* Class Xml.
*
* @since 1.0
* @deprecated 2.0 Use the `joomla/console` package instead
*/
class Xml extends CliOutput
{
/**
* Write a string to standard output.
*
* @param string $text The text to display.
* @param boolean $nl True (default) to append a new line at the end
of the output string.
*
* @return void
*
* @since 1.0
* @throws \RuntimeException
* @codeCoverageIgnore
*/
public function out($text = '', $nl = true)
{
fwrite(STDOUT, $text . ($nl ? "\n" : null));
}
}
PKOc�[��u:B:BWeb/WebClient.phpnu�[���<?php
/**
* Part of the Joomla Framework Application Package
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Application\Web;
/**
* Class to model a Web Client.
*
* @property-read integer $platform The detected platform on which
the web client runs.
* @property-read boolean $mobile True if the web client is a
mobile device.
* @property-read integer $engine The detected rendering engine
used by the web client.
* @property-read integer $browser The detected browser used by
the web client.
* @property-read string $browserVersion The detected browser version
used by the web client.
* @property-read array $languages The priority order detected
accepted languages for the client.
* @property-read array $encodings The priority order detected
accepted encodings for the client.
* @property-read string $userAgent The web client's user
agent string.
* @property-read string $acceptEncoding The web client's accepted
encoding string.
* @property-read string $acceptLanguage The web client's accepted
languages string.
* @property-read array $detection An array of flags determining
whether or not a detection routine has been run.
* @property-read boolean $robot True if the web client is a
robot
* @property-read array $headers An array of all headers sent
by client
*
* @since 1.0
*/
class WebClient
{
const WINDOWS = 1;
const WINDOWS_PHONE = 2;
const WINDOWS_CE = 3;
const IPHONE = 4;
const IPAD = 5;
const IPOD = 6;
const MAC = 7;
const BLACKBERRY = 8;
const ANDROID = 9;
const LINUX = 10;
const TRIDENT = 11;
const WEBKIT = 12;
const GECKO = 13;
const PRESTO = 14;
const KHTML = 15;
const AMAYA = 16;
const IE = 17;
const FIREFOX = 18;
const CHROME = 19;
const SAFARI = 20;
const OPERA = 21;
const ANDROIDTABLET = 22;
const EDGE = 23;
const BLINK = 24;
const EDG = 25;
/**
* @var integer The detected platform on which the web client runs.
* @since 1.0
*/
protected $platform;
/**
* @var boolean True if the web client is a mobile device.
* @since 1.0
*/
protected $mobile = false;
/**
* @var integer The detected rendering engine used by the web client.
* @since 1.0
*/
protected $engine;
/**
* @var integer The detected browser used by the web client.
* @since 1.0
*/
protected $browser;
/**
* @var string The detected browser version used by the web client.
* @since 1.0
*/
protected $browserVersion;
/**
* @var array The priority order detected accepted languages for the
client.
* @since 1.0
*/
protected $languages = array();
/**
* @var array The priority order detected accepted encodings for the
client.
* @since 1.0
*/
protected $encodings = array();
/**
* @var string The web client's user agent string.
* @since 1.0
*/
protected $userAgent;
/**
* @var string The web client's accepted encoding string.
* @since 1.0
*/
protected $acceptEncoding;
/**
* @var string The web client's accepted languages string.
* @since 1.0
*/
protected $acceptLanguage;
/**
* @var boolean True if the web client is a robot.
* @since 1.0
*/
protected $robot = false;
/**
* @var array An array of flags determining whether or not a detection
routine has been run.
* @since 1.0
*/
protected $detection = array();
/**
* @var array An array of headers sent by client
* @since 1.3.0
*/
protected $headers;
/**
* Class constructor.
*
* @param string $userAgent The optional user-agent string to
parse.
* @param string $acceptEncoding The optional client accept encoding
string to parse.
* @param string $acceptLanguage The optional client accept language
string to parse.
*
* @since 1.0
*/
public function __construct($userAgent = null, $acceptEncoding = null,
$acceptLanguage = null)
{
// If no explicit user agent string was given attempt to use the implicit
one from server environment.
if (empty($userAgent) &&
isset($_SERVER['HTTP_USER_AGENT']))
{
$this->userAgent = $_SERVER['HTTP_USER_AGENT'];
}
else
{
$this->userAgent = $userAgent;
}
// If no explicit acceptable encoding string was given attempt to use the
implicit one from server environment.
if (empty($acceptEncoding) &&
isset($_SERVER['HTTP_ACCEPT_ENCODING']))
{
$this->acceptEncoding = $_SERVER['HTTP_ACCEPT_ENCODING'];
}
else
{
$this->acceptEncoding = $acceptEncoding;
}
// If no explicit acceptable languages string was given attempt to use
the implicit one from server environment.
if (empty($acceptLanguage) &&
isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
{
$this->acceptLanguage = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
}
else
{
$this->acceptLanguage = $acceptLanguage;
}
}
/**
* Magic method to get an object property's value by name.
*
* @param string $name Name of the property for which to return a
value.
*
* @return mixed The requested value if it exists.
*
* @since 1.0
*/
public function __get($name)
{
switch ($name)
{
case 'mobile':
case 'platform':
if (empty($this->detection['platform']))
{
$this->detectPlatform($this->userAgent);
}
break;
case 'engine':
if (empty($this->detection['engine']))
{
$this->detectEngine($this->userAgent);
}
break;
case 'browser':
case 'browserVersion':
if (empty($this->detection['browser']))
{
$this->detectBrowser($this->userAgent);
}
break;
case 'languages':
if (empty($this->detection['acceptLanguage']))
{
$this->detectLanguage($this->acceptLanguage);
}
break;
case 'encodings':
if (empty($this->detection['acceptEncoding']))
{
$this->detectEncoding($this->acceptEncoding);
}
break;
case 'robot':
if (empty($this->detection['robot']))
{
$this->detectRobot($this->userAgent);
}
break;
case 'headers':
if (empty($this->detection['headers']))
{
$this->detectHeaders();
}
break;
}
// Return the property if it exists.
if (isset($this->$name))
{
return $this->$name;
}
}
/**
* Detects the client browser and version in a user agent string.
*
* @param string $userAgent The user-agent string to parse.
*
* @return void
*
* @since 1.0
*/
protected function detectBrowser($userAgent)
{
// Attempt to detect the browser type. Obviously we are only worried
about major browsers.
if ((stripos($userAgent, 'MSIE') !== false) &&
(stripos($userAgent, 'Opera') === false))
{
$this->browser = self::IE;
$patternBrowser = 'MSIE';
}
elseif (stripos($userAgent, 'Trident') !== false)
{
$this->browser = self::IE;
$patternBrowser = ' rv';
}
elseif (stripos($userAgent, 'Edge') !== false)
{
$this->browser = self::EDGE;
$patternBrowser = 'Edge';
}
elseif (stripos($userAgent, 'Edg') !== false)
{
$this->browser = self::EDG;
$patternBrowser = 'Edg';
}
elseif ((stripos($userAgent, 'Firefox') !== false) &&
(stripos($userAgent, 'like Firefox') === false))
{
$this->browser = self::FIREFOX;
$patternBrowser = 'Firefox';
}
elseif (stripos($userAgent, 'OPR') !== false)
{
$this->browser = self::OPERA;
$patternBrowser = 'OPR';
}
elseif (stripos($userAgent, 'Chrome') !== false)
{
$this->browser = self::CHROME;
$patternBrowser = 'Chrome';
}
elseif (stripos($userAgent, 'Safari') !== false)
{
$this->browser = self::SAFARI;
$patternBrowser = 'Safari';
}
elseif (stripos($userAgent, 'Opera') !== false)
{
$this->browser = self::OPERA;
$patternBrowser = 'Opera';
}
// If we detected a known browser let's attempt to determine the
version.
if ($this->browser)
{
// Build the REGEX pattern to match the browser version string within
the user agent string.
$pattern = '#(?<browser>Version|' . $patternBrowser .
')[/ :]+(?<version>[0-9.|a-zA-Z.]*)#';
// Attempt to find version strings in the user agent string.
$matches = array();
if (preg_match_all($pattern, $userAgent, $matches))
{
// Do we have both a Version and browser match?
if (\count($matches['browser']) == 2)
{
// See whether Version or browser came first, and use the number
accordingly.
if (strripos($userAgent, 'Version') <
strripos($userAgent, $patternBrowser))
{
$this->browserVersion = $matches['version'][0];
}
else
{
$this->browserVersion = $matches['version'][1];
}
}
elseif (\count($matches['browser']) > 2)
{
$key = array_search('Version',
$matches['browser']);
if ($key)
{
$this->browserVersion = $matches['version'][$key];
}
}
else
{
// We only have a Version or a browser so use what we have.
$this->browserVersion = $matches['version'][0];
}
}
}
// Mark this detection routine as run.
$this->detection['browser'] = true;
}
/**
* Method to detect the accepted response encoding by the client.
*
* @param string $acceptEncoding The client accept encoding string to
parse.
*
* @return void
*
* @since 1.0
*/
protected function detectEncoding($acceptEncoding)
{
// Parse the accepted encodings.
$this->encodings = array_map('trim', (array)
explode(',', $acceptEncoding));
// Mark this detection routine as run.
$this->detection['acceptEncoding'] = true;
}
/**
* Detects the client rendering engine in a user agent string.
*
* @param string $userAgent The user-agent string to parse.
*
* @return void
*
* @since 1.0
*/
protected function detectEngine($userAgent)
{
if (stripos($userAgent, 'MSIE') !== false ||
stripos($userAgent, 'Trident') !== false)
{
// Attempt to detect the client engine -- starting with the most popular
... for now.
$this->engine = self::TRIDENT;
}
elseif (stripos($userAgent, 'Edge') !== false ||
stripos($userAgent, 'EdgeHTML') !== false)
{
$this->engine = self::EDGE;
}
elseif (stripos($userAgent, 'Edg') !== false)
{
$this->engine = self::BLINK;
}
elseif (stripos($userAgent, 'Chrome') !== false)
{
$result = explode('/', stristr($userAgent,
'Chrome'));
$version = explode(' ', $result[1]);
if ($version[0] >= 28)
{
$this->engine = self::BLINK;
}
else
{
$this->engine = self::WEBKIT;
}
}
elseif (stripos($userAgent, 'AppleWebKit') !== false ||
stripos($userAgent, 'blackberry') !== false)
{
if (stripos($userAgent, 'AppleWebKit') !== false)
{
$result = explode('/', stristr($userAgent,
'AppleWebKit'));
$version = explode(' ', $result[1]);
if ($version[0] === 537.36)
{
// AppleWebKit/537.36 is Blink engine specific, exception is Blink
emulated IEMobile, Trident or Edge
$this->engine = self::BLINK;
}
}
// Evidently blackberry uses WebKit and doesn't necessarily report
it. Bad RIM.
$this->engine = self::WEBKIT;
}
elseif (stripos($userAgent, 'Gecko') !== false &&
stripos($userAgent, 'like Gecko') === false)
{
// We have to check for like Gecko because some other browsers spoof
Gecko.
$this->engine = self::GECKO;
}
elseif (stripos($userAgent, 'Opera') !== false ||
stripos($userAgent, 'Presto') !== false)
{
$version = false;
if (preg_match('/Opera[\/| ]?([0-9.]+)/u', $userAgent,
$match))
{
$version = \floatval($match[1]);
}
if (preg_match('/Version\/([0-9.]+)/u', $userAgent, $match))
{
if (\floatval($match[1]) >= 10)
{
$version = \floatval($match[1]);
}
}
if ($version !== false && $version >= 15)
{
$this->engine = self::BLINK;
}
else
{
$this->engine = self::PRESTO;
}
}
elseif (stripos($userAgent, 'KHTML') !== false)
{
// *sigh*
$this->engine = self::KHTML;
}
elseif (stripos($userAgent, 'Amaya') !== false)
{
// Lesser known engine but it finishes off the major list from Wikipedia
:-)
$this->engine = self::AMAYA;
}
// Mark this detection routine as run.
$this->detection['engine'] = true;
}
/**
* Method to detect the accepted languages by the client.
*
* @param mixed $acceptLanguage The client accept language string to
parse.
*
* @return void
*
* @since 1.0
*/
protected function detectLanguage($acceptLanguage)
{
// Parse the accepted encodings.
$this->languages = array_map('trim', (array)
explode(',', $acceptLanguage));
// Mark this detection routine as run.
$this->detection['acceptLanguage'] = true;
}
/**
* Detects the client platform in a user agent string.
*
* @param string $userAgent The user-agent string to parse.
*
* @return void
*
* @since 1.0
*/
protected function detectPlatform($userAgent)
{
// Attempt to detect the client platform.
if (stripos($userAgent, 'Windows') !== false)
{
$this->platform = self::WINDOWS;
// Let's look at the specific mobile options in the Windows space.
if (stripos($userAgent, 'Windows Phone') !== false)
{
$this->mobile = true;
$this->platform = self::WINDOWS_PHONE;
}
elseif (stripos($userAgent, 'Windows CE') !== false)
{
$this->mobile = true;
$this->platform = self::WINDOWS_CE;
}
}
elseif (stripos($userAgent, 'iPhone') !== false)
{
// Interestingly 'iPhone' is present in all iOS devices so far
including iPad and iPods.
$this->mobile = true;
$this->platform = self::IPHONE;
// Let's look at the specific mobile options in the iOS space.
if (stripos($userAgent, 'iPad') !== false)
{
$this->platform = self::IPAD;
}
elseif (stripos($userAgent, 'iPod') !== false)
{
$this->platform = self::IPOD;
}
}
elseif (stripos($userAgent, 'iPad') !== false)
{
// In case where iPhone is not mentioed in iPad user agent string
$this->mobile = true;
$this->platform = self::IPAD;
}
elseif (stripos($userAgent, 'iPod') !== false)
{
// In case where iPhone is not mentioed in iPod user agent string
$this->mobile = true;
$this->platform = self::IPOD;
}
elseif (preg_match('/macintosh|mac os x/i', $userAgent))
{
// This has to come after the iPhone check because mac strings are also
present in iOS devices.
$this->platform = self::MAC;
}
elseif (stripos($userAgent, 'Blackberry') !== false)
{
$this->mobile = true;
$this->platform = self::BLACKBERRY;
}
elseif (stripos($userAgent, 'Android') !== false)
{
$this->mobile = true;
$this->platform = self::ANDROID;
/**
* Attempt to distinguish between Android phones and tablets
* There is no totally foolproof method but certain rules almost always
hold
* Android 3.x is only used for tablets
* Some devices and browsers encourage users to change their UA string
to include Tablet.
* Google encourages manufacturers to exclude the string Mobile from
tablet device UA strings.
* In some modes Kindle Android devices include the string Mobile but
they include the string Silk.
*/
if (stripos($userAgent, 'Android 3') !== false ||
stripos($userAgent, 'Tablet') !== false
|| stripos($userAgent, 'Mobile') === false ||
stripos($userAgent, 'Silk') !== false)
{
$this->platform = self::ANDROIDTABLET;
}
}
elseif (stripos($userAgent, 'Linux') !== false)
{
$this->platform = self::LINUX;
}
// Mark this detection routine as run.
$this->detection['platform'] = true;
}
/**
* Determines if the browser is a robot or not.
*
* @param string $userAgent The user-agent string to parse.
*
* @return void
*
* @since 1.0
*/
protected function detectRobot($userAgent)
{
if
(preg_match('/http|bot|bingbot|googlebot|robot|spider|slurp|crawler|curl|^$/i',
$userAgent))
{
$this->robot = true;
}
else
{
$this->robot = false;
}
$this->detection['robot'] = true;
}
/**
* Fills internal array of headers
*
* @return void
*
* @since 1.3.0
*/
protected function detectHeaders()
{
if (\function_exists('getallheaders'))
{
// If php is working under Apache, there is a special function
$this->headers = getallheaders();
}
else
{
// Else we fill headers from $_SERVER variable
$this->headers = array();
foreach ($_SERVER as $name => $value)
{
if (substr($name, 0, 5) == 'HTTP_')
{
$this->headers[str_replace(' ', '-',
ucwords(strtolower(str_replace('_', ' ', substr($name,
5)))))] = $value;
}
}
}
// Mark this detection routine as run.
$this->detection['headers'] = true;
}
}
PK4g�[�r�WWAbstraction/Api.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Abstraction;
use VDM\Joomla\Gitea\Utilities\Http;
use VDM\Joomla\Gitea\Utilities\Uri;
use VDM\Joomla\Gitea\Utilities\Response;
use VDM\Joomla\Interfaces\Git\ApiInterface;
/**
* The Gitea Api
*
* @since 3.2.0
*/
abstract class Api implements ApiInterface
{
/**
* The Http class
*
* @var Http
* @since 3.2.0
*/
protected Http $http;
/**
* The Uri class
*
* @var Uri
* @since 3.2.0
*/
protected Uri $uri;
/**
* The Response class
*
* @var Response
* @since 3.2.0
*/
protected Response $response;
/**
* The Url string
*
* @var string|null
* @since 3.2.0
*/
protected ?string $url = null;
/**
* The token string
*
* @var string|null
* @since 3.2.0
*/
protected ?string $token = null;
/**
* Constructor.
*
* @param Http $http The http class.
* @param Uri $uri The uri class.
* @param Response $response The response class.
*
* @since 3.2.0
**/
public function __construct(Http $http, Uri $uri, Response $response)
{
$this->http = $http;
$this->uri = $uri;
$this->response = $response;
}
/**
* Load/Reload API.
*
* @param string|null $url The url.
* @param token|null $token The token.
* @param bool $backup The backup swapping switch.
*
* @return void
* @since 3.2.0
**/
public function load_(?string $url = null, ?string $token = null, bool
$backup = true): void
{
// we keep the old values
// so we can reset after our call
// for the rest of the container
if ($backup)
{
if ($url !== null)
{
$this->url = $this->uri->getUrl();
}
if ($token !== null)
{
$this->token = $this->http->getToken();
}
}
if ($url !== null)
{
$this->uri->setUrl($url);
}
if ($token !== null)
{
$this->http->setToken($token);
}
}
/**
* Reset to previous toke, url it set
*
* @return void
* @since 3.2.0
**/
public function reset_(): void
{
if ($this->url !== null)
{
$this->uri->setUrl($this->url);
$this->url = null;
}
if ($this->token !== null)
{
$this->http->setToken($this->token);
$this->token = null;
}
}
/**
* Get the API url
*
* @return string
* @since 3.2.0
**/
public function api()
{
return $this->uri->api();
}
}
PK4g�[�#o,,Abstraction/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK4g�[l��Admin/Cron.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Admin;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Admin Cron
*
* @since 3.2.0
*/
class Cron extends Api
{
/**
* List cron tasks.
*
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(int $page = 1, int $limit = 10): ?array
{
// Build the request path.
$path = "/admin/cron";
// Set the query parameters.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Run cron task.
*
* @param string $task The cron task to run.
*
* @return string
* @since 3.2.0
**/
public function run(string $task): string
{
// Build the request path.
$path = "/admin/cron/{$task}";
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path)
), 204, 'success'
);
}
}
PK4g�[�#o,,Admin/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK4g�[�h��Admin/Organizations.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Admin;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Admin Organizations
*
* @since 3.2.0
*/
class Organizations extends Api
{
/**
* List all organizations.
*
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(int $page = 1, int $limit = 10): ?array
{
// Build the request path.
$path = "/admin/orgs";
// Set the query parameters.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
}
PK4g�[ƨw Admin/Unadopted.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Admin;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Admin Unadopted
*
* @since 3.2.0
*/
class Unadopted extends Api
{
/**
* List unadopted repositories.
*
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
* @param string $pattern Pattern of repositories to search for.
*
* @return array|null
* @since 3.2.0
**/
public function list(int $page = 1, int $limit = 10, string $pattern =
''): ?array
{
// Build the request path.
$path = "/admin/unadopted";
// Set the query parameters.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
if (!empty($pattern))
{
$uri->setVar('pattern', $pattern);
}
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Adopt unadopted files as a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
*
* @return string
* @since 3.2.0
**/
public function adopt(string $owner, string $repo): string
{
// Build the request path.
$path = "/admin/unadopted/{$owner}/{$repo}";
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), ''
), 204, 'success'
);
}
/**
* Delete unadopted files.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
*
* @return string
* @since 3.2.0
**/
public function delete(string $owner, string $repo): string
{
// Build the request path.
$path = "/admin/unadopted/{$owner}/{$repo}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}
PK4g�[�#o,,Admin/Users/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK4g�[Cy�UUAdmin/Users/Keys.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Admin\Users;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Admin Users Keys
*
* @since 3.2.0
*/
class Keys extends Api
{
/**
* Add a public key on behalf of a user.
*
* @param string $userName The user's display name.
* @param string $publicKey The public key to add.
* @param string $keyTitle Title of the key to add.
* @param bool $readOnly Whether the key has only read access
or read/write (optional).
* @param string|null $description Description of the key (optional).
*
* @return object|null
* @since 3.2.0
**/
public function add(
string $userName,
string $publicKey,
string $keyTitle,
bool $readOnly = false,
?string $description = null
): ?object
{
// Build the request path.
$path = "/admin/users/{$userName}/keys";
// Set the key data.
$data = new \stdClass();
$data->key = $publicKey;
$data->title = $keyTitle;
$data->read_only = $readOnly;
$data->description = $description;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 201
);
}
/**
* Delete a user's public key.
*
* @param string $username The user's display name.
* @param int $id The public key ID.
*
* @return string
* @since 3.2.0
**/
public function delete(string $username, int $id): string
{
// Build the request path.
$path = "/admin/users/{$username}/keys/{$id}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}
PK4g�[ai�WWAdmin/Users/Organization.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Admin\Users;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Admin Users Organization
*
* @since 3.2.0
*/
class Organization extends Api
{
/**
* Create an organization on behalf of a user.
*
* @param string $username The user's
display name.
* @param string $fullName The organization full
name.
* @param string|null $description The organization
description (optional).
* @param string|null $location The organization
location (optional).
* @param bool $repoAdminChangeTeamAccess Whether repo admin can
change team access (optional).
* @param string $visibility The organization
visibility (optional).
* @param string|null $website The organization
website (optional).
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $username,
string $fullName,
?string $description = null,
?string $location = null,
bool $repoAdminChangeTeamAccess = false,
string $visibility = 'public',
?string $website = null
): ?object
{
// Build the request path.
$path = "/admin/users/{$username}/orgs";
// Set the organization data.
$data = new \stdClass();
$data->full_name = $fullName;
$data->description = $description;
$data->location = $location;
$data->repo_admin_change_team_access = $repoAdminChangeTeamAccess;
$data->visibility = $visibility;
$data->website = $website;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 201
);
}
}
PK4g�[W���
�
Admin/Users/Repository.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Admin\Users;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Admin Users Repository
*
* @since 3.2.0
*/
class Repository extends Api
{
/**
* Create a repository on behalf of a user.
*
* @param string $username The user's display name.
* @param string $repoName The repository name.
* @param string|null $description The repository description
(optional).
* @param bool $auto_init Whether the repository should be
auto-initialized? (optional).
* @param string|null $default_branch Default branch of the repository
(optional).
* @param string|null $gitignores Gitignores to use (optional).
* @param string|null $issue_labels Label-Set to use (optional).
* @param string|null $license License to use (optional).
* @param bool $private Whether the repository is private
(optional).
* @param string|null $readme Readme of the repository to
create (optional).
* @param bool $template Whether the repository is template
(optional).
* @param string|null $trust_model TrustModel of the repository
(optional).
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $username,
string $repoName,
?string $description = null,
bool $auto_init = false,
?string $default_branch = null,
?string $gitignores = null,
?string $issue_labels = null,
?string $license = null,
bool $private = false,
?string $readme = null,
bool $template = false,
?string $trust_model = null
): ?object
{
// Build the request path.
$path = "/admin/users/{$username}/repos";
// Set the repository data.
$data = new \stdClass();
$data->name = $repoName;
$data->description = $description;
$data->auto_init = $auto_init;
$data->default_branch = $default_branch;
$data->gitignores = $gitignores;
$data->issue_labels = $issue_labels;
$data->license = $license;
$data->private = $private;
$data->readme = $readme;
$data->template = $template;
$data->trust_model = $trust_model;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 201
);
}
}
PK4g�[[N��Admin/Users.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Admin;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Admin Users
*
* @since 3.2.0
*/
class Users extends Api
{
/**
* List all users.
*
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(int $page = 1, int $limit = 10): ?array
{
// Build the request path.
$path = "/admin/users";
// build the URL
$url = $this->uri->get($path);
$url->setVar('page', $page);
$url->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($url)
);
}
/**
* Create a user with extended options.
*
* @param string $loginName The user's login name.
* @param string $email The user's email
address.
* @param string $password The user's password.
* @param string|null $username The username.
* @param string|null $fullName The user's full name
(optional).
* @param bool|null $mustChangePassword User must change password on
next login (optional).
* @param bool|null $restricted Restrict the user
(optional).
* @param bool|null $sendNotify Send a notification email to
the user (optional).
* @param int|null $sourceId Source ID (optional).
* @param string|null $visibility The user's visibility
(optional).
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $loginName,
string $email,
string $password,
string $username,
?string $fullName = null,
?bool $mustChangePassword = null,
?bool $restricted = null,
?bool $sendNotify = null,
?int $sourceId = null,
?string $visibility = null
): ?object
{
// Build the request path.
$path = "/admin/users";
// Set the user data.
$data = new \stdClass();
$data->login_name = $loginName;
$data->email = $email;
$data->password = $password;
$data->username = $username;
$data->full_name = $fullName;
$data->must_change_password = $mustChangePassword;
$data->restricted = $restricted;
$data->send_notify = $sendNotify;
$data->source_id = $sourceId;
$data->visibility = $visibility;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 201
);
}
/**
* Delete a user.
*
* @param string $username The user's display name.
*
* @return string
* @since 3.2.0
**/
public function delete(string $username): string
{
// Build the request path.
$path = "/admin/users/{$username}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Edit an existing user.
*
* @param string $username The user's display
name.
* @param string $loginName The user's login
name.
* @param int $sourceId The user's source
ID.
* @param bool $active Optional. Is the user
active? Default: false.
* @param bool $admin Optional. Is the user an
admin? Default: false.
* @param bool $allowCreateOrganization Optional. Can the user
create an organization? Default: false.
* @param bool $allowGitHook Optional. Can the user
create Git hooks? Default: false.
* @param bool $allowImportLocal Optional. Can the user
import local repositories? Default: false.
* @param string $description Optional. The user's
description. Default: ''.
* @param string $email Optional. The user's
email address. Default: ''.
* @param string $fullName Optional. The user's
full name. Default: ''.
* @param string $location Optional. The user's
location. Default: ''.
* @param int $maxRepoCreation Optional. Maximum
repositories the user can create. Default: 0.
* @param bool $mustChangePassword Optional. Must the user
change their password? Default: false.
* @param string $password Optional. The user's
password. Default: ''.
* @param bool $prohibitLogin Optional. Is the
user's login prohibited? Default: false.
* @param bool $restricted Optional. Is the user
restricted? Default: false.
* @param string $visibility Optional. The user's
visibility setting. Default: ''.
* @param string $website Optional. The user's
website. Default: ''.
*
* @return object|null
* @since 3.2.0
**/
public function edit(
string $username,
string $loginName,
int $sourceId,
bool $active = false,
bool $admin = false,
bool $allowCreateOrganization = false,
bool $allowGitHook = false,
bool $allowImportLocal = false,
string $description = '',
string $email = '',
string $fullName = '',
string $location = '',
int $maxRepoCreation = 0,
bool $mustChangePassword = false,
string $password = '',
bool $prohibitLogin = false,
bool $restricted = false,
string $visibility = '',
string $website = ''
): ?object
{
// Build the request path.
$path = "/admin/users/{$username}";
// Set the data.
$data = [
'login_name' => $loginName,
'source_id' => $sourceId,
'active' => $active,
'admin' => $admin,
'allow_create_organization' => $allowCreateOrganization,
'allow_git_hook' => $allowGitHook,
'allow_import_local' => $allowImportLocal,
'description' => $description,
'email' => $email,
'full_name' => $fullName,
'location' => $location,
'max_repo_creation' => $maxRepoCreation,
'must_change_password' => $mustChangePassword,
'password' => $password,
'prohibit_login' => $prohibitLogin,
'restricted' => $restricted,
'visibility' => $visibility,
'website' => $website
];
// Send the patch request.
return $this->response->get(
$this->http->patch(
$this->uri->get($path), json_encode($data)
)
);
}
}
PK4g�[����Factory.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea;
use Joomla\DI\Container;
use VDM\Joomla\Gitea\Service\Utilities;
use VDM\Joomla\Gitea\Service\Jcb;
use VDM\Joomla\Gitea\Service\Settings;
use VDM\Joomla\Gitea\Service\Organization;
use VDM\Joomla\Gitea\Service\User;
use VDM\Joomla\Gitea\Service\Repository;
use VDM\Joomla\Gitea\Service\Package;
use VDM\Joomla\Gitea\Service\Issue;
use VDM\Joomla\Gitea\Service\Notifications;
use VDM\Joomla\Gitea\Service\Miscellaneous;
use VDM\Joomla\Gitea\Service\Admin;
use VDM\Joomla\Interfaces\FactoryInterface;
use VDM\Joomla\Abstraction\Factory as ExtendingFactory;
/**
* Gitea Factory
*
* @since 3.2.0
*/
abstract class Factory extends ExtendingFactory implements FactoryInterface
{
/**
* Create a container object
*
* @return Container
* @since 3.2.0
*/
protected static function createContainer(): Container
{
return (new Container())
->registerServiceProvider(new Utilities())
->registerServiceProvider(new Jcb())
->registerServiceProvider(new Settings())
->registerServiceProvider(new Organization())
->registerServiceProvider(new User())
->registerServiceProvider(new Repository())
->registerServiceProvider(new Package())
->registerServiceProvider(new Issue())
->registerServiceProvider(new Notifications())
->registerServiceProvider(new Miscellaneous())
->registerServiceProvider(new Admin());
}
}
PK4g�[�#o,,
index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK4g�[x��ӹ�Issue/Comments.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Issue;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Issue Comments
*
* @since 3.2.0
*/
class Comments extends Api
{
/**
* List all comments on an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param int $page The page number to get, defaults to
1.
* @param int $limit The number of comments per page,
defaults to 10.
* @param string|null $since The date-time since when to get
comments, defaults to null.
* @param string|null $before The date-time before when to get
comments, defaults to null.
*
* @return array|null
* @since 3.2.0
**/
public function list(
string $owner,
string $repo,
int $index,
int $page = 1,
int $limit = 10,
?string $since = null,
?string $before = null
): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/comments";
// Build the URI.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Set the 'since' and 'before' parameters if not
null.
if ($since !== null)
{
$uri->setVar('since', $since);
}
if ($before !== null)
{
$uri->setVar('before', $before);
}
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Get a comment.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $commentId The comment ID.
*
* @return object|null
* @since 3.2.0
**/
public function get(string $owner, string $repo, int $commentId): ?object
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/issues/comments/{$commentId}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Delete a comment.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $commentId The comment ID.
*
* @return string
* @since 3.2.0
**/
public function delete(string $owner, string $repo, int $commentId):
string
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/issues/comments/{$commentId}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Edit a comment.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $commentId The comment ID.
* @param string $commentBody The new comment body.
*
* @return object|null
* @since 3.2.0
**/
public function edit(string $owner, string $repo, int $commentId, string
$commentBody): ?object
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/issues/comments/{$commentId}";
// Build the request data.
$data = new \stdClass();
$data->body = $commentBody;
// Send the patch request.
return $this->response->get(
$this->http->patch(
$this->uri->get($path), json_encode($data)
)
);
}
/**
* Add a comment to an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $issueIndex The issue index.
* @param string $commentBody The comment body.
*
* @return object|null
* @since 3.2.0
**/
public function add(string $owner, string $repo, int $issueIndex, string
$commentBody): ?object
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/issues/{$issueIndex}/comments";
// Build the request data.
$data = new \stdClass();
$data->body = $commentBody;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 201
);
}
}
PK4g�[�\�kkIssue/Deadline.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Issue;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Issue Deadline
*
* @since 3.2.0
*/
class Deadline extends Api
{
/**
* Set an issue deadline.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param string|null $dueDate The deadline date string in the
format YYYY-MM-DD or null to delete the deadline.
*
* @return object
* @since 3.2.0
**/
public function set(string $owner, string $repo, int $index, ?string
$dueDate): object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/deadline";
// Build the request data.
$data = new \stdClass();
$data->due_date = $dueDate;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
)
);
}
}
PK4g�[�#o,,Issue/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK4g�[o
ggIssue/Labels.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Issue;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Issue Labels
*
* @since 3.2.0
*/
class Labels extends Api
{
/**
* Get all of a repository's labels.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $page The page number of results to return
(1-based).
* @param int $limit The page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(string $owner, string $repo, int $page = 1, int
$limit = 10): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/labels";
// Get the URI object with the request path.
$uri = $this->uri->get($path);
// Add the page and limit query parameters if provided.
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Get an issue's labels.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
*
* @return array|null
* @since 3.2.0
**/
public function get(string $owner, string $repo, int $index): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/labels";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Replace an issue's labels.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param array $labels An array of labels to replace the
current issue labels.
*
* @return object
* @since 3.2.0
**/
public function replace(string $owner, string $repo, int $index, array
$labels): object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/labels";
// Build the request data.
$data = new \stdClass();
$data->labels = $labels;
// Send the put request.
return $this->response->get(
$this->http->put(
$this->uri->get($path), json_encode($data)
)
);
}
/**
* Add a label to an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param array $labels An array of label IDs to add.
*
* @return array|null
* @since 3.2.0
**/
public function add(string $owner, string $repo, int $index, array
$labels): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/labels";
// Build the request data.
$data = new \stdClass();
$data->labels = $labels;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
)
);
}
/**
* Remove a label from an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param int $labelId The ID of the label to remove.
*
* @return string
* @since 3.2.0
**/
public function remove(string $owner, string $repo, int $index, int
$labelId): string
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/issues/{$index}/labels/{$labelId}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Remove all labels from an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
*
* @return string
* @since 3.2.0
**/
public function clear(string $owner, string $repo, int $index): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/labels";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}
PK4g�[����Issue/Milestones.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Issue;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Issue Milestones
*
* @since 3.2.0
*/
class Milestones extends Api
{
/**
* Create a milestone.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param string $title The title of the milestone.
* @param string|null $description Optional. The description of the
milestone.
* @param string|null $dueOn Optional. The due date of the
milestone.
* @param string|null $state Optional. The state of the
milestone. Default is 'open'.
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $owner,
string $repo,
string $title,
?string $description = null,
?string $dueOn = null,
?string $state = 'open'
): ?object
{
// Set the lines data
$data = new \stdClass();
// Set all the required data.
$data->title = $title;
// Set all the optional data that has been provided.
if ($description !== null)
{
$data->description = $description;
}
if ($dueOn !== null)
{
$data->due_on = $dueOn;
}
if ($state !== null)
{
$data->state = $state;
}
// Build the request path.
$path = "/repos/{$owner}/{$repo}/milestones";
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path),
json_encode($data)
), 201
);
}
/**
* Get all of a repository's opened milestones.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param string|null $state Optional. Milestone state.
Recognized values are open, closed, and all. Defaults to "open".
* @param string|null $name Optional. Filter by milestone name.
* @param int|null $page Optional. Page number of results to
return (1-based).
* @param int|null $limit Optional. Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
string $owner,
string $repo,
?string $state = 'open',
?string $name = null,
?int $page = null,
?int $limit = null
): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/milestones";
// Build the URI.
$uri = $this->uri->get($path);
$uri->setVar('state', $state);
if ($name !== null)
{
$uri->setVar('name', $name);
}
if ($page !== null)
{
$uri->setVar('page', $page);
}
if ($limit !== null)
{
$uri->setVar('limit', $limit);
}
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Get a milestone.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param string $milestoneId The ID of the milestone.
*
* @return object|null
* @since 3.2.0
**/
public function get(string $owner, string $repo, string $milestoneId):
?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/milestones/{$milestoneId}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Delete a milestone.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param string $milestoneId The ID of the milestone to delete.
*
* @return string
* @since 3.2.0
**/
public function delete(string $owner, string $repo, string $milestoneId):
string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/milestones/{$milestoneId}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Update a milestone.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param string $milestoneId The ID of the milestone to update.
* @param string $title Optional. The new title of the
milestone.
* @param string $description Optional. The new description of the
milestone.
* @param string $dueOn Optional. The new due date of the
milestone.
* @param string $state Optional. The new state of the
milestone.
*
* @return object|null
* @since 3.2.0
**/
public function update(
string $owner,
string $repo,
string $milestoneId,
string $title = null,
string $description = null,
string $dueOn = null,
string $state = null
): ?object
{
// Set the lines data
$data = new \stdClass();
// Set all the optional data that has been provided.
if ($title !== null)
{
$data->title = $title;
}
if ($description !== null)
{
$data->description = $description;
}
if ($dueOn !== null)
{
$data->due_on = $dueOn;
}
if ($state !== null)
{
$data->state = $state;
}
// Build the request path.
$path = "/repos/{$owner}/{$repo}/milestones/{$milestoneId}";
// Send the patch request.
return $this->response->get(
$this->http->patch(
$this->uri->get($path),
json_encode($data)
)
);
}
}
PK4g�[j��!�
�
Issue/Reactions/Comment.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Issue\Reactions;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Issue Reactions Comment
*
* @since 3.2.0
*/
class Comment extends Api
{
/**
* Get a list of reactions from a comment of an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $commentId The comment ID.
*
* @return array|null
* @since 3.2.0
**/
public function list(string $owner, string $repo, int $commentId): ?array
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/issues/comments/{$commentId}/reactions";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Add a reaction to a comment of an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $commentId The comment ID.
* @param string $content The reaction to add, e.g.
"+1".
*
* @return object|null
* @since 3.2.0
**/
public function add(string $owner, string $repo, int $commentId, string
$content): ?object
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/issues/comments/{$commentId}/reactions";
// Build the request data.
$data = new \stdClass();
$data->content = $content;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
)
);
}
/**
* Remove a reaction from a comment of an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $commentId The comment ID.
* @param string $content The reaction to remove, e.g.
"+1".
*
* @return string
* @since 3.2.0
**/
public function remove(string $owner, string $repo, int $commentId, string
$content): string
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/issues/comments/{$commentId}/reactions";
// Build the URI.
$uri = $this->uri->get($path);
$uri->setVar('content', $content);
// Send the delete request.
return $this->response->get(
$this->http->delete($uri), 200, 'success'
);
}
}
PK4g�[�#o,,Issue/Reactions/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK4g�[�4v�Issue/Reactions.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Issue;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Issue Reactions
*
* @since 3.2.0
*/
class Reactions extends Api
{
/**
* Get a list reactions of an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param int $page The page to get, defaults to 1.
* @param int $limit The number of reactions per page,
defaults to 10.
*
* @return array|null
* @since 3.2.0
**/
public function list(string $owner, string $repo, int $index, int $page =
1, int $limit = 10): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/reactions";
// Build the URI.
$uri = $this->uri->get($path);
// Set the URI variables.
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Add a reaction to an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param string $content The name of the reaction to add.
*
* @return object|null
* @since 3.2.0
**/
public function add(string $owner, string $repo, int $index, string
$content): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/reactions";
// Build the request data.
$data = new \stdClass();
$data->content = $content;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
)
);
}
/**
* Remove a reaction from an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param string $content The name of the reaction to remove.
*
* @return string
* @since 3.2.0
**/
public function remove(string $owner, string $repo, int $index, string
$content): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/reactions";
// Build the URI.
$uri = $this->uri->get($path);
$uri->setVar('content', $content);
// Send the delete request.
return $this->response->get(
$this->http->delete($uri), 200, 'success'
);
}
}
PK4g�[�l��Issue/Repository/Comments.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Issue\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Issue Repository Comments
*
* @since 3.2.0
*/
class Comments extends Api
{
/**
* List all comments in a repository.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $page The page to get, defaults to 1.
* @param int $limit The number of comments per page,
defaults to 10.
* @param string|null $since The date-time string to filter updated
comments since, defaults to null.
* @param string|null $before The date-time string to filter updated
comments before, defaults to null.
*
* @return array|null
* @since 3.2.0
**/
public function list(string $owner, string $repo, int $page = 1, int
$limit = 10, ?string $since = null, ?string $before = null): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/comments";
// Build the URI.
$uri = $this->uri->get($path);
// Set the URI variables.
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
if ($since !== null)
{
$uri->setVar('since', $since);
}
if ($before !== null)
{
$uri->setVar('before', $before);
}
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
}
PK4g�[�#o,,Issue/Repository/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK5g�[=�-� Issue/Stopwatch.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Issue;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Issue Stopwatch
*
* @since 3.2.0
*/
class Stopwatch extends Api
{
/**
* Start stopwatch on an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
*
* @return string
* @since 3.2.0
**/
public function start(string $owner, string $repo, int $index): string
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/issues/{$index}/stopwatch/start";
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), ''
), 201, 'success'
);
}
/**
* Stop an issue's existing stopwatch.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
*
* @return string
* @since 3.2.0
**/
public function stop(string $owner, string $repo, int $index): string
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/issues/{$index}/stopwatch/stop";
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), ''
), 201, 'success'
);
}
/**
* Delete an issue's existing stopwatch.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
*
* @return string
* @since 3.2.0
**/
public function delete(string $owner, string $repo, int $index): string
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/issues/{$index}/stopwatch/delete";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}
PK5g�[{���
�
Issue/Subscriptions.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Issue;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Issue Subscriptions
*
* @since 3.2.0
*/
class Subscriptions extends Api
{
/**
* Get users who subscribed on an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param int|null $page Optional. Page number of results to
return (1-based).
* @param int|null $limit Optional. Page size of results.
*
* @return object|null
* @since 3.2.0
**/
public function get(
string $owner,
string $repo,
int $index,
?int $page = null,
?int $limit = null
): ?object
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/issues/{$index}/subscriptions";
// Set the query parameters.
$uri = $this->uri->get($path);
if ($page !== null)
{
$uri->setVar('page', $page);
}
if ($limit !== null)
{
$uri->setVar('limit', $limit);
}
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Check if user is subscribed to an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
*
* @return object|null
* @since 3.2.0
**/
public function check(string $owner, string $repo, int $index): ?object
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/issues/{$index}/subscriptions/check";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Subscribe user to issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param string $user The username to subscribe.
*
* @return string
* @since 3.2.0
**/
public function subscribe(string $owner, string $repo, int $index, string
$user): string
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/issues/{$index}/subscriptions/{$user}";
// Send the put request.
return $this->response->get_(
$this->http->put(
$this->uri->get($path), ''
), [200 => 'already subscribed', 201 =>
'success']
);
}
/**
* Unsubscribe user from issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param string $user The username to unsubscribe.
*
* @return string
* @since 3.2.0
**/
public function unsubscribe(string $owner, string $repo, int $index,
string $user): string
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/issues/{$index}/subscriptions/{$user}";
// Send the delete request.
return $this->response->get_(
$this->http->delete(
$this->uri->get($path)
), [200 => 'already unsubscribed', 201 =>
'success']
);
}
}
PK5g�[\_��Issue/Timeline.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Issue;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Issue Timeline
*
* @since 3.2.0
*/
class Timeline extends Api
{
/**
* List all comments and events on an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param string|null $since Optional. If provided, only comments
updated since the specified time are returned.
* @param int|null $page Optional. Page number of results to
return (1-based).
* @param int|null $limit Optional. Page size of results.
* @param string|null $before Optional. If provided, only comments
updated before the provided time are returned.
*
* @return array|null
* @since 3.2.0
**/
public function get(
string $owner,
string $repo,
int $index,
?string $since = null,
?int $page = null,
?int $limit = null,
?string $before = null
): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/timeline";
// Set the query parameters.
$uri = $this->uri->get($path);
if ($since !== null)
{
$uri->setVar('since', $since);
}
if ($page !== null)
{
$uri->setVar('page', $page);
}
if ($limit !== null)
{
$uri->setVar('limit', $limit);
}
if ($before !== null)
{
$uri->setVar('before', $before);
}
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
}
PK5g�[n&/�YYIssue/Times.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Issue;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Issue Times
*
* @since 3.2.0
*/
class Times extends Api
{
/**
* List an issue's tracked times.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param string $user Optional. Filter by user.
* @param string $since Optional. Show times updated after the
given time.
* @param string $before Optional. Show times updated before the
given time.
* @param int $page Optional. Page number of results to
return (1-based).
* @param int $limit Optional. Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
string $owner,
string $repo,
int $index,
string $user = null,
string $since = null,
string $before = null,
int $page = null,
int $limit = null
): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/times";
// Prepare the query parameters.
$uri = $this->uri->get($path);
if ($user !== null)
{
$uri->setVar('user', $user);
}
if ($since !== null)
{
$uri->setVar('since', $since);
}
if ($before !== null)
{
$uri->setVar('before', $before);
}
if ($page !== null)
{
$uri->setVar('page', $page);
}
if ($limit !== null)
{
$uri->setVar('limit', $limit);
}
// Send the get request with the query parameters.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Add tracked time to an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param int $time The tracked time in seconds.
* @param string $created Optional. The date and time of the
tracked time in RFC 3339 format.
* @param string $userName Optional. User who spent the time.
*
* @return object|null
* @since 3.2.0
**/
public function add(
string $owner,
string $repo,
int $index,
int $time,
string $created = null,
string $userName = null
): ?object
{
// Set the lines data
$data = new \stdClass();
// Set all the needed data.
$data->time = $time;
if ($created !== null)
{
$data->created = $created;
}
if ($userName !== null)
{
$data->user_name = $userName;
}
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/times";
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path),
json_encode($data)
)
);
}
/**
* Reset a tracked time of an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
*
* @return string
* @since 3.2.0
**/
public function reset(string $owner, string $repo, int $index): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/times";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Delete specific tracked time.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param int $id The ID of the tracked time to delete.
*
* @return string
* @since 3.2.0
**/
public function delete(string $owner, string $repo, int $index, int $id):
string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/times/{$id}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}
PK5g�[]%X�-�- Issue.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Issue
*
* @since 3.2.0
*/
class Issue extends Api
{
/**
* List a repository's issues.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param string $state The state of the issues to get,
defaults to 'open'.
* @param int $page The page to get, defaults to null.
* @param int $limit The number of issues per page,
defaults to null.
* @param string|null $labels Comma-separated list of labels,
defaults to null.
* @param string|null $q The search string, defaults to
null.
* @param string|null $type The type to filter by
(issues/pulls), defaults to null.
* @param string|null $milestones Comma-separated list of milestone
names or IDs, defaults to null.
* @param string|null $since Only show items updated after the
given time, defaults to null.
* @param string|null $before Only show items updated before the
given time, defaults to null.
* @param string|null $createdBy Only show items created by the
given user, defaults to null.
* @param string|null $assignedBy Only show items assigned to the
given user, defaults to null.
* @param string|null $mentionedBy Only show items where the given
user is mentioned, defaults to null.
*
* @return array|null
* @since 3.2.0
**/
public function list(
string $owner,
string $repo,
string $state = 'open',
int $page = 1,
int $limit = 10,
?string $labels = null,
?string $q = null,
?string $type = null,
?string $milestones = null,
?string $since = null,
?string $before = null,
?string $createdBy = null,
?string $assignedBy = null,
?string $mentionedBy = null
): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues";
// Build the URI.
$uri = $this->uri->get($path);
// Set the query parameters
$uri->setVar('state', $state);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
$uri->setVar('labels', $labels);
$uri->setVar('q', $q);
$uri->setVar('type', $type);
$uri->setVar('milestones', $milestones);
$uri->setVar('since', $since);
$uri->setVar('before', $before);
$uri->setVar('created_by', $createdBy);
$uri->setVar('assigned_by', $assignedBy);
$uri->setVar('mentioned_by', $mentionedBy);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Get an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
*
* @return object|null
* @since 3.2.0
**/
public function get(string $owner, string $repo, int $index): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Create an issue. If using deadline only the date will be taken into
account, and time of day ignored.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param string $issueTitle The issue title.
* @param array|null $assignees The array of assignees, defaults to
null.
* @param string|null $issueBody The issue body, defaults to null.
* @param bool|null $closed If the issue is closed, defaults to
null.
* @param string|null $dueDate The deadline for the issue, format:
"YYYY-MM-DD", defaults to null.
* @param array|null $labelIds The array of label IDs to attach to
the issue, defaults to null.
* @param int|null $milestoneId The milestone ID, defaults to null.
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $owner,
string $repo,
string $issueTitle,
?array $assignees = null,
?string $issueBody = null,
?bool $closed = null,
?string $dueDate = null,
?array $labelIds = null,
?int $milestoneId = null
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues";
// Build the request data.
$data = new \stdClass();
$data->title = $issueTitle;
$data->body = $issueBody;
$data->assignees = $assignees;
$data->closed = $closed;
$data->due_date = $dueDate;
$data->labels = $labelIds;
$data->milestone = $milestoneId;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
)
);
}
/**
* Search for issues across the repositories that the user has access to.
*
* @param string $q Search query.
* @param int $page Page number (default
1).
* @param int $limit Page size (default 10,
max 50).
* @param string|null $state Issue state (default
open).
* @param string|null $labels Label filter,
comma-separated.
* @param string|null $milestones Milestone filter,
comma-separated.
* @param int|null $priorityRepoId Repository to prioritize
in the results.
* @param string|null $type Filter by type
(issues/pulls).
* @param string|null $since Only show notifications
updated after the given time (RFC 3339 format).
* @param string|null $before Only show notifications
updated before the given time (RFC 3339 format).
* @param bool|null $assigned Filter assigned to you
(default false).
* @param bool|null $created Filter created by you
(default false).
* @param bool|null $mentioned Filter mentioning you
(default false).
* @param bool|null $reviewRequested Filter pulls requesting
your review (default false).
* @param string|null $owner Filter by owner.
* @param string|null $team Filter by team (requires
organization owner parameter).
*
* @return array|null
* @since 3.2.0
**/
public function search(
string $q,
int $page = 1,
int $limit = 10,
?string $state = 'open',
?string $labels = null,
?string $milestones = null,
?int $priorityRepoId = null,
?string $type = null,
?string $since = null,
?string $before = null,
?bool $assigned = null,
?bool $created = null,
?bool $mentioned = null,
?bool $reviewRequested = null,
?string $owner = null,
?string $team = null
): ?array
{
// Build the request path.
$path = "/repos/issues/search";
// Set the URL parameters.
$uri = $this->uri->get($path);
$uri->setVar('q', $q);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
$uri->setVar('state', $state);
if ($labels !== null)
{
$uri->setVar('labels', $labels);
}
if ($milestones !== null)
{
$uri->setVar('milestones', $milestones);
}
if ($priorityRepoId !== null)
{
$uri->setVar('priority_repo_id', $priorityRepoId);
}
if ($type !== null)
{
$uri->setVar('type', $type);
}
if ($since !== null)
{
$uri->setVar('since', $since);
}
if ($before !== null)
{
$uri->setVar('before', $before);
}
if ($assigned !== null)
{
$uri->setVar('assigned', $assigned);
}
if ($created !== null)
{
$uri->setVar('created', $created);
}
if ($mentioned !== null)
{
$uri->setVar('mentioned', $mentioned);
}
if ($reviewRequested !== null)
{
$uri->setVar('review_requested', $reviewRequested);
}
if ($owner !== null)
{
$uri->setVar('owner', $owner);
}
if ($team !== null)
{
$uri->setVar('team', $team);
}
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Edit an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param string|null $assignee The assignee, defaults to null.
* @param array|null $assignees The assignees, defaults to null.
* @param string|null $body The issue body, defaults to null.
* @param string|null $dueDate The due date, defaults to null.
* @param int|null $milestone The milestone, defaults to null.
* @param string|null $ref The reference, defaults to null.
* @param string|null $state The issue state, defaults to
null.
* @param string|null $title The issue title, defaults to
null.
* @param bool|null $unsetDueDate The flag to unset due date,
defaults to null.
*
* @return object|null
* @since 3.2.0
**/
public function edit(
string $owner,
string $repo,
int $index,
?string $assignee = null,
?array $assignees = null,
?string $body = null,
?string $dueDate = null,
?int $milestone = null,
?string $ref = null,
?string $state = null,
?string $title = null,
?bool $unsetDueDate = null
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}";
// Prepare the issue data.
$editIssueData = new \stdClass();
if ($assignee !== null || $assignees !== null)
{
$editIssueData->assignee = new \stdClass();
if ($assignee !== null)
{
$editIssueData->assignee->name = $assignee;
}
if ($assignees !== null)
{
$editIssueData->assignee->names = $assignees;
}
}
if ($body !== null)
{
$editIssueData->body = $body;
}
if ($dueDate !== null || $unsetDueDate !== null)
{
$editIssueData->dueDate = new \stdClass();
if ($dueDate !== null)
{
$editIssueData->dueDate->date = $dueDate;
}
if ($unsetDueDate !== null)
{
$editIssueData->dueDate->unset = $unsetDueDate;
}
}
if ($milestone !== null)
{
$editIssueData->milestone = $milestone;
}
if ($ref !== null)
{
$editIssueData->ref = $ref;
}
if ($state !== null)
{
$editIssueData->state = $state;
}
if ($title !== null)
{
$editIssueData->title = $title;
}
// Send the patch request.
return $this->response->get(
$this->http->patch(
$this->uri->get($path), json_encode($editIssueData)
)
);
}
/**
* Delete an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
*
* @return string
* @since 3.2.0
**/
public function delete(string $owner, string $repo, int $index): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}
PK5g�[��c��
Labels.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Labels
*
* @since 3.2.0
*/
class Labels extends Api
{
/**
* Create a label.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param string $labelName The name of the label.
* @param string $labelColor The color of the label, in
hexadecimal format with the leading '#'.
* @param string $labelDescription Optional. The description of the
label.
*
* @return object|null
* @since 3.2.0
**/
public function create(string $owner, string $repo, string $labelName,
string $labelColor, string $labelDescription = ''): ?object
{
// Set the lines data
$data = new \stdClass();
// Set all the needed data.
$data->name = $labelName;
$data->color = $labelColor;
if (!empty($labelDescription))
{
$data->description = $labelDescription;
}
// Build the request path.
$path = "/repos/{$owner}/{$repo}/labels";
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path),
json_encode($data)
), 201
);
}
/**
* Get a single label.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param string $id The ID of the label to retrieve.
*
* @return object|null
* @since 3.2.0
**/
public function get(string $owner, string $repo, string $id): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/labels/{$id}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Delete a label.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param string $id The ID of the label to delete.
*
* @return string
* @since 3.2.0
**/
public function delete(string $owner, string $repo, string $id): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/labels/{$id}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Update a label.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param string $id The ID of the label to update.
* @param string $labelName Optional. The new name of the
label.
* @param string $labelColor Optional. The new color of the
label, in hexadecimal format without the leading '#'.
* @param string $labelDescription Optional. The new description of
the label.
*
* @return object|null
* @since 3.2.0
**/
public function update(
string $owner,
string $repo,
string $id,
string $labelName = '',
string $labelColor = '',
string $labelDescription = ''
): ?object
{
// Set the lines data
$data = new \stdClass();
// Set all the optional data that has been provided.
if (!empty($labelName))
{
$data->name = $labelName;
}
if (!empty($labelColor))
{
$data->color = $labelColor;
}
if (!empty($labelDescription))
{
$data->description = $labelDescription;
}
// Build the request path.
$path = "/repos/{$owner}/{$repo}/labels/{$id}";
// Send the patch request.
return $this->response->get(
$this->http->patch(
$this->uri->get($path),
json_encode($data)
)
);
}
}
PK5g�[ՃMiscellaneous/Activitypub.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Miscellaneous;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Miscellaneous Activitypub
*
* @since 3.2.0
*/
class Activitypub extends Api
{
/**
* Returns the Person actor for a user.
*
* @param string $username The user's username.
*
* @return object|null
* @since 3.2.0
**/
public function get(string $username): ?object
{
// Build the request path.
$path = "/activitypub/user/{$username}";
// Send the GET request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Send to the user's inbox.
*
* @param string $username The user's username.
* @param object $postData The post data.
*
* @return string
* @since 3.2.0
**/
public function send(string $username, object $postData): string
{
// Build the request path.
$path = "/activitypub/user/{$username}/inbox";
// Send the POST request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($postData)
), 204, 'success'
);
}
}
PK5g�[��"���Miscellaneous/Gpg.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Miscellaneous;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Miscellaneous Gpg
*
* @since 3.2.0
*/
class Gpg extends Api
{
/**
* Get default signing-key.gpg.
*
* @return string|null
* @since 3.2.0
**/
public function get(): ?string
{
// Build the request path.
$path = "/signing-key.gpg";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
}
PK5g�[�#o,,Miscellaneous/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK5g�[� ����Miscellaneous/Markdown.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Miscellaneous;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Miscellaneous Markdown
*
* @since 3.2.0
*/
class Markdown extends Api
{
/**
* Render a markdown document as HTML.
*
* @param string $markdownText The markdown text to render.
* @param bool $isWikiPage Is it a wiki page?
* @param string $context Context to render.
* @param string $mode Mode to render.
*
* @return string|null
* @since 3.2.0
**/
public function render(
string $markdownText,
bool $isWikiPage = false,
string $context = 'string',
string $mode = 'string'
): ?string
{
// Build the request path.
$path = "/markdown";
// Set the markdown data.
$data = new \stdClass();
$data->Text = $markdownText;
$data->Wiki = $isWikiPage;
$data->Context = $context;
$data->Mode = $mode;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path),
json_encode($data),
['accept' => 'text/html']
)
);
}
/**
* Render raw markdown as HTML.
*
* @param string $rawMarkdown The raw markdown text to render.
*
* @return string|null
* @since 3.2.0
**/
public function raw(string $rawMarkdown): ?string
{
// Build the request path.
$path = "/markdown/raw";
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path),
$rawMarkdown,
['Content-Type' => 'text/plain',
'accept' => 'text/html']
)
);
}
}
PK5g�[��(���Miscellaneous/NodeInfo.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Miscellaneous;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Miscellaneous NodeInfo
*
* @since 3.2.0
*/
class NodeInfo extends Api
{
/**
* Returns the nodeinfo of the Gitea application.
*
* @return object|null
* @since 3.2.0
**/
public function get(): ?object
{
// Build the request path.
$path = "/nodeinfo";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
}
PK5g�[s$����Miscellaneous/Version.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Miscellaneous;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Miscellaneous Version
*
* @since 3.2.0
*/
class Version extends Api
{
/**
* Returns the version of the Gitea application.
*
* @return object|null
* @since 3.2.0
**/
public function get(): ?object
{
// Build the request path.
$path = "/version";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
}
PK5g�[�#o,,Notifications/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK5g�[q����Notifications/Repository.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Notifications;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Notifications Repository
*
* @since 3.2.0
*/
class Repository extends Api
{
/**
* List user's notification threads on a specific repo.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param bool $all Show notifications marked as read.
* @param array $statusTypes Show notifications with the provided
status types.
* @param array $subjectTypes Filter notifications by subject
type.
* @param string $since Show notifications updated after the
given time.
* @param string $before Show notifications updated before
the given time.
* @param int $page Page number of results to return
(1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function get(
string $owner,
string $repo,
bool $all = false,
array $statusTypes = [],
array $subjectTypes = [],
string $since = '',
string $before = '',
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/notifications";
// Configure the URI with query parameters.
$uri = $this->uri->get($path);
if ($all)
{
$uri->setVar('all', $all);
}
if (!empty($statusTypes))
{
$uri->setVar('status-types', implode(',',
$statusTypes));
}
if (!empty($subjectTypes))
{
$uri->setVar('subject-type', implode(',',
$subjectTypes));
}
if (!empty($since))
{
$uri->setVar('since', $since);
}
if (!empty($before))
{
$uri->setVar('before', $before);
}
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Mark notification threads as read, pinned, or unread on a specific
repo.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param bool|null $all Mark all notifications on this repo
(optional).
* @param array|null $statusTypes Mark notifications with the provided
status types (optional).
* @param string|null $toStatus Status to mark notifications as
(optional).
* @param string|null $lastReadAt Last point that notifications were
checked (optional).
*
* @return array|null
* @since 3.2.0
**/
public function update(
string $owner,
string $repo,
?bool $all = null,
?array $statusTypes = null,
?string $toStatus = null,
?string $lastReadAt = null
): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/notifications";
// Configure the URI with query parameters.
$uri = $this->uri->get($path);
if ($all !== null)
{
$uri->setVar('all', $all);
}
if ($statusTypes !== null)
{
$uri->setVar('status-types', implode(',',
$statusTypes));
}
if ($toStatus !== null)
{
$uri->setVar('to-status', $toStatus);
}
if ($lastReadAt !== null)
{
$uri->setVar('last_read_at', $lastReadAt);
}
// Send the put request.
return $this->response->get(
$this->http->put($uri, ''), 205
);
}
}
PK5g�[����> > Notifications/Thread.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Notifications;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Notifications Thread
*
* @since 3.2.0
*/
class Thread extends Api
{
/**
* Get notification thread by ID.
*
* @param int $id The notification thread ID.
*
* @return object|null
* @since 3.2.0
**/
public function get(int $id): ?object
{
// Build the request path.
$path = "/notifications/threads/{$id}";
// Get the URI with the path.
$uri = $this->uri->get($path);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Mark notification threads as read, pinned, or unread by ID.
*
* @param int $id The notification thread ID.
* @param string|null $lastReadAt Last point that notifications were
checked (optional).
* @param bool|null $all Mark all notifications on this repo
(optional).
* @param array|null $statusTypes Mark notifications with the
provided status types (optional).
* @param string|null $toStatus Status to mark notifications as
(optional).
*
* @return object|null
* @since 3.2.0
**/
public function mark(
int $id,
?string $lastReadAt = null,
?bool $all = null,
?array $statusTypes = null,
?string $toStatus = null
): ?object
{
// Build the request path.
$path = "/notifications/threads/{$id}";
// Configure the URI with query parameters.
$uri = $this->uri->get($path);
if ($lastReadAt !== null)
{
$uri->setVar('last_read_at', $lastReadAt);
}
if ($all !== null)
{
$uri->setVar('all', $all);
}
if ($statusTypes !== null)
{
$uri->setVar('status-types', implode(',',
$statusTypes));
}
if ($toStatus !== null)
{
$uri->setVar('to-status', $toStatus);
}
// Send the put request.
return $this->response->get(
$this->http->put($uri, ''), 205
);
}
}
PK5g�[4{���Notifications.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Notifications
*
* @since 3.2.0
*/
class Notifications extends Api
{
/**
* List user's notification threads.
*
* @param bool|null $all Show notifications marked as read
(optional).
* @param array|null $statusTypes Show notifications with the provided
status types (optional).
* @param array|null $subjectType Filter notifications by subject type
(optional).
* @param string|null $since Show notifications updated after the given
time (optional).
* @param string|null $before Show notifications updated before the
given time (optional).
* @param int $page Page number of results to return (optional).
* @param int $limit Page size of results (optional).
*
* @return array|null
* @since 3.2.0
**/
public function list(
?bool $all = null,
?array $statusTypes = null,
?array $subjectType = null,
?string $since = null,
?string $before = null,
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = "/notifications";
// Configure the URI with query parameters.
$uri = $this->uri->get($path);
if ($all !== null)
{
$uri->setVar('all', $all);
}
if ($statusTypes !== null)
{
$uri->setVar('status-types', implode(',',
$statusTypes));
}
if ($subjectType !== null)
{
$uri->setVar('subject-type', implode(',',
$subjectType));
}
if ($since !== null)
{
$uri->setVar('since', $since);
}
if ($before !== null)
{
$uri->setVar('before', $before);
}
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Mark notification threads as read, pinned, or unread.
*
* @param string|null $lastReadAt Describes the last point that
notifications were checked (optional).
* @param bool|null $all If true, mark all notifications
on this repo (optional).
* @param array|null $statusTypes Mark notifications with the
provided status types (optional).
* @param string|null $toStatus Status to mark notifications as
(optional).
*
* @return array|null
* @since 3.2.0
**/
public function update(
?string $lastReadAt = null,
?bool $all = null,
?array $statusTypes = null,
?string $toStatus = null
): ?array
{
// Build the request path.
$path = "/notifications";
// Configure the URI with query parameters.
$uri = $this->uri->get($path);
if ($lastReadAt !== null)
{
$uri->setVar('last_read_at', $lastReadAt);
}
if ($all !== null)
{
$uri->setVar('all', $all);
}
if ($statusTypes !== null)
{
$uri->setVar('status-types', implode(',',
$statusTypes));
}
if ($toStatus !== null)
{
$uri->setVar('to-status', $toStatus);
}
// Send the put request.
return $this->response->get(
$this->http->put($uri, ''), 205
);
}
/**
* Check if unread notifications exist.
*
* @return object|null
* @since 3.2.0
**/
public function check(): ?object
{
// Build the request path.
$path = "/notifications/new";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
}
PK5g�[�G�H]]Organization/Hooks.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Organization;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Organization Hooks
*
* @since 3.2.0
*/
class Hooks extends Api
{
/**
* List an organization's webhooks.
*
* @param string $orgName The organization name.
* @param int $page Page number of results to return
(1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
string $orgName,
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = "/orgs/{$orgName}/hooks";
// Get the URI and set query parameters.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Create a hook for an organization.
*
* @param string $org The organization name.
* @param string $type The type of hook (e.g. "gitea",
"slack", "discord", etc.).
* @param string $url The URL of the hook.
* @param string $secret Optional. The secret for the hook.
* @param bool $events Optional. The events that trigger the
hook.
* @param bool $active Optional. Whether the hook is active.
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $org,
string $type,
string $url,
string $secret = '',
bool $events = true,
bool $active = true
): ?object
{
// Set the lines data
$data = new \stdClass();
$data->type = $type;
$data->config = new \stdClass();
$data->config->url = $url;
$data->config->secret = $secret;
$data->events = [];
$data->active = $active;
// Build the request path.
$path = "/orgs/{$org}/hooks";
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path),
json_encode($data)
), 201
);
}
/**
* Get a hook for an organization.
*
* @param string $org The organization name.
* @param int $id The ID of the hook.
*
* @return object|null
* @since 3.2.0
**/
public function get(string $org, int $id): ?object
{
// Build the request path.
$path = "/orgs/{$org}/hooks/{$id}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Delete a hook for an organization.
*
* @param string $org The organization name.
* @param int $id The hook ID.
*
* @return string
* @since 3.2.0
**/
public function delete(string $org, int $id): string
{
// Build the request path.
$path = "/orgs/{$org}/hooks/{$id}";
// Send the DELETE request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Update a hook for an organization.
*
* @param string $orgName The organization name.
* @param int $hookId The ID of the hook.
* @param bool|null $active Optional. Whether the hook is
active.
* @param string|null $branchFilter Optional. Branch filter for the
hook.
* @param array|null $config Optional. Configuration for the
hook.
* @param array|null $events Optional. Events for the hook.
*
* @return object|null
* @since 3.2.0
**/
public function update(
string $orgName,
int $hookId,
?bool $active = null,
?string $branchFilter = null,
?array $config = null,
?array $events = null
): ?object
{
// Set the lines data
$data = new \stdClass();
if ($active !== null)
{
$data->active = $active;
}
if ($branchFilter !== null)
{
$data->branch_filter = $branchFilter;
}
if ($config !== null)
{
$data->config = (object) $config;
}
if ($events !== null)
{
$data->events = $events;
}
// Build the request path.
$path = "/orgs/{$orgName}/hooks/{$hookId}";
// Send the patch request.
return $this->response->get(
$this->http->patch(
$this->uri->get($path),
json_encode($data)
)
);
}
}
PK5g�[�#o,,Organization/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK5g�[��p�))Organization/Labels.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Organization;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Organization Labels
*
* @since 3.2.0
*/
class Labels extends Api
{
/**
* List an organization's labels.
*
* @param string $orgName The organization name.
* @param int $pageNum Page number of results to return
(1-based).
* @param int $pageSize Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
string $orgName,
int $pageNum = 1,
int $pageSize = 10
): ?array
{
// Build the request path.
$path = "/orgs/{$orgName}/labels";
// Build the URL
$url = $this->uri->get($path);
$url->setVar('page', $pageNum);
$url->setVar('limit', $pageSize);
// Send the get request.
return $this->response->get(
$this->http->get($url)
);
}
/**
* Create a label for an organization.
*
* @param string $org The organization name.
* @param string $name The name of the label.
* @param string $color The color of the label.
* @param string $description Optional. The description of the label.
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $org,
string $name,
string $color,
string $description = ''
): ?object
{
// Set the lines data
$data = new \stdClass();
$data->name = $name;
$data->color = $color;
$data->description = $description;
// Build the request path.
$path = "/orgs/{$org}/labels";
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path),
json_encode($data)
), 201
);
}
/**
* Get a single label for an organization.
*
* @param string $org The organization name.
* @param int $id The ID of the label.
*
* @return object|null
* @since 3.2.0
**/
public function get(string $org, int $id): ?object
{
// Build the request path.
$path = "/orgs/{$org}/labels/{$id}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Delete a label for an organization.
*
* @param string $org The organization name.
* @param int $id The ID of the label.
*
* @return string
* @since 3.2.0
**/
public function delete(string $org, int $id): string
{
// Build the request path.
$path = "/orgs/{$org}/labels/{$id}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Update a label for an organization.
*
* @param string $org The organization name.
* @param int $id The ID of the label.
* @param string $name Optional. The name of the label.
* @param string $color Optional. The color of the label.
* @param string $description Optional. The description of the
label.
*
* @return object|null
* @since 3.2.0
**/
public function update(
string $org,
int $id,
string $name = '',
string $color = '',
string $description = ''
): ?object
{
// Set the lines data
$data = new \stdClass();
if ($name) {
$data->name = $name;
}
if ($color) {
$data->color = $color;
}
if ($description) {
$data->description = $description;
}
// Build the request path.
$path = "/orgs/{$org}/labels/{$id}";
// Send the patch request.
return $this->response->get(
$this->http->patch(
$this->uri->get($path),
json_encode($data)
)
);
}
}
PK5g�[��ޭy y Organization/Members.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Organization;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Organization Members
*
* @since 3.2.0
*/
class Members extends Api
{
/**
* Get a list of members of an organization.
*
* @param string $orgName The organization name.
* @param int $page The page number.
* @param int $limit The number of members per page.
*
* @return array|null The organization members.
* @since 3.2.0
*/
public function list(
string $orgName,
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = "/orgs/{$orgName}/members";
// Get the URI and set query parameters.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Check if a user is a member of an organization.
*
* @param string $org The organization name.
* @param string $username The username.
*
* @return string Whether the user is a member of the organization.
* @since 3.2.0
*/
public function check(string $org, string $username): string
{
// Build the request path.
$path = "/orgs/{$org}/members/{$username}";
// Send the request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Remove a member from an organization.
*
* @param string $org The organization name.
* @param string $username The username of the user to remove.
*
* @return string Whether the user was successfully removed from the
organization.
* @since 3.2.0
*/
public function remove(string $org, string $username): string
{
// Build the request path.
$path = "/orgs/{$org}/members/{$username}";
// Send the request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}
PK5g�[��G�11Organization/PublicMembers.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Organization;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Organization Public Members
*
* @since 3.2.0
*/
class PublicMembers extends Api
{
/**
* List an organization's public members.
*
* @param string $orgName The organization name.
* @param int $page Page number of results to return
(1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(string $orgName, int $page = 1, int $limit = 10):
?array
{
// Build the request path.
$path = "/orgs/{$orgName}/public_members";
// Configure the request URI.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Check if a user is a public member of an organization.
*
* @param string $org The organization name.
* @param string $username The user's username.
*
* @return string|null
* @since 3.2.0
**/
public function check(string $org, string $username): ?string
{
// Build the request path.
$path = "/orgs/{$org}/public_members/{$username}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
), 204
);
}
/**
* Publicize a user's membership.
*
* @param string $org The organization name.
* @param string $username The user's username.
*
* @return string|null
* @since 3.2.0
**/
public function publicize(string $org, string $username): ?string
{
// Build the request path.
$path = "/orgs/{$org}/public_members/{$username}";
// Send the put request.
return $this->response->get(
$this->http->put(
$this->uri->get($path), ''
), 204
);
}
/**
* Conceal a user's membership.
*
* @param string $org The organization name.
* @param string $username The user's username.
*
* @return string
* @since 3.2.0
**/
public function conceal(string $org, string $username): string
{
// Build the request path.
$path = "/orgs/{$org}/public_members/{$username}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}
PK5g�[Ə���Organization/Repository.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Organization;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Organization Repository
*
* @since 3.2.0
*/
class Repository extends Api
{
/**
* List an organization's repos.
*
* @param string $org The organization name.
* @param int $pageNumber The page number.
* @param int $pageSize The page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
string $org,
int $pageNumber = 1,
int $pageSize = 10
): ?array
{
// Build the request path.
$path = "/orgs/{$org}/repos";
// Configure the request URI.
$uri = $this->uri->get($path);
$uri->setVar('page', $pageNumber);
$uri->setVar('limit', $pageSize);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Create a repository in an organization.
*
* @param string $org The organization name.
* @param string $repoName The name of the repository.
* @param string|null $description The description of the
repository (optional).
* @param bool|null $autoInit Whether the repository should
be auto-initialized (optional).
* @param string|null $defaultBranch Default branch of the
repository (optional).
* @param string|null $gitignores Gitignores to use (optional).
* @param string|null $issueLabels Label-set to use (optional).
* @param string|null $license License to use (optional).
* @param bool|null $private Whether the repository is
private (optional).
* @param string|null $readme Readme of the repository to
create (optional).
* @param bool|null $template Whether the repository is a
template (optional).
* @param string|null $trustModel Trust model of the repository
(optional).
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $org,
string $repoName,
?string $description = null,
?bool $autoInit = null,
?string $defaultBranch = null,
?string $gitignores = null,
?string $issueLabels = null,
?string $license = null,
?bool $private = null,
?string $readme = null,
?bool $template = null,
?string $trustModel = null
): ?object
{
// Build the request path.
$path = "/orgs/{$org}/repos";
// Set the repository data.
$data = new \stdClass();
$data->name = $repoName;
if ($description !== null)
{
$data->description = $description;
}
if ($autoInit !== null)
{
$data->auto_init = $autoInit;
}
if ($defaultBranch !== null)
{
$data->default_branch = $defaultBranch;
}
if ($gitignores !== null)
{
$data->gitignores = $gitignores;
}
if ($issueLabels !== null)
{
$data->issue_labels = $issueLabels;
}
if ($license !== null)
{
$data->license = $license;
}
if ($private !== null)
{
$data->private = $private;
}
if ($readme !== null)
{
$data->readme = $readme;
}
if ($template !== null)
{
$data->template = $template;
}
if ($trustModel !== null)
{
$data->trust_model = $trustModel;
}
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
)
);
}
}
PK5g�[�#o,,Organization/Teams/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK5g�[�r�
�
Organization/Teams/Members.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Organization\Teams;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Organization Teams Members
*
* @since 3.2.0
*/
class Members extends Api
{
/**
* List a team's members.
*
* @param int $teamId The team ID.
* @param int $pageNumber The page number of results to return
(1-based).
* @param int $pageSize The page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
int $teamId,
int $pageNumber = 1,
int $pageSize = 10
): ?array
{
// Build the request path.
$path = "/teams/{$teamId}/members";
// Get the URI object.
$uri = $this->uri->get($path);
// Add the query parameters for page number and page size.
$uri->setVar('page', $pageNumber);
$uri->setVar('limit', $pageSize);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* List a particular member of the team.
*
* @param int $id The team ID.
* @param string $username The user's username.
*
* @return object|null
* @since 3.2.0
**/
public function get(int $id, string $username): ?object
{
// Build the request path.
$path = "/teams/{$id}/members/{$username}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Add a team member.
*
* @param int $id The team ID.
* @param string $username The user's username.
*
* @return string
* @since 3.2.0
**/
public function add(int $id, string $username): string
{
// Build the request path.
$path = "/teams/{$id}/members/{$username}";
// Send the put request.
return $this->response->get(
$this->http->put(
$this->uri->get($path), ''
), 204, 'success'
);
}
/**
* Remove a team member.
*
* @param int $id The team ID.
* @param string $username The user's username.
*
* @return string
* @since 3.2.0
**/
public function remove(int $id, string $username): string
{
// Build the request path.
$path = "/teams/{$id}/members/{$username}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}
PK5g�[=>��!Organization/Teams/Repository.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Organization\Teams;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Organization Teams Repository
*
* @since 3.2.0
*/
class Repository extends Api
{
/**
* List a team's repos.
*
* @param int $teamId The team ID.
* @param int $pageNumber The page number of results to return
(1-based).
* @param int $pageSize The page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
int $teamId,
int $pageNumber = 1,
int $pageSize = 10
): ?array
{
// Build the request path.
$path = "/teams/{$teamId}/repos";
// Get the URI object.
$uri = $this->uri->get($path);
// Add the query parameters for page number and page size.
$uri->setVar('page', $pageNumber);
$uri->setVar('limit', $pageSize);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* List a particular repo of the team.
*
* @param int $teamId The team ID.
* @param string $organization The organization name.
* @param string $repository The repository name.
*
* @return object|null
* @since 3.2.0
**/
public function get(
int $teamId,
string $organization,
string $repository
): ?object
{
// Build the request path.
$path =
"/teams/{$teamId}/repos/{$organization}/{$repository}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Add a repository to a team.
*
* @param int $id The team ID.
* @param string $org The organization name.
* @param string $repo The repository name.
*
* @return string
* @since 3.2.0
**/
public function add(
int $id,
string $org,
string $repo
): string
{
// Build the request path.
$path = "/teams/{$id}/repos/{$org}/{$repo}";
// Send the put request.
return $this->response->get(
$this->http->put(
$this->uri->get($path), ''
),204, 'success'
);
}
/**
* Remove a repository from a team.
*
* @param int $id The team ID.
* @param string $org The organization name.
* @param string $repo The repository name.
*
* @return string
* @since 3.2.0
**/
public function remove(int $id, string $org, string $repo): string
{
// Build the request path.
$path = "/teams/{$id}/repos/{$org}/{$repo}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}
PK5g�[�0
^LLOrganization/Teams.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Organization;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Organization Teams
*
* @since 3.2.0
*/
class Teams extends Api
{
/**
* List an organization's teams.
*
* @param string $organization The organization name.
* @param int $pageNumber The page number of results to return
(1-based).
* @param int $pageSize The page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
string $organization,
int $pageNumber = 1,
int $pageSize = 10
): ?array
{
// Build the request path.
$path = "/orgs/{$organization}/teams";
// Get the URI object.
$uri = $this->uri->get($path);
// Add the query parameters for page number and page size.
$uri->setVar('page', $pageNumber);
$uri->setVar('limit', $pageSize);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Get a team.
*
* @param int $id The team ID.
*
* @return object|null
* @since 3.2.0
**/
public function get(int $id): ?object
{
// Build the request path.
$path = "/teams/{$id}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Create a team.
*
* @param string $organization The organization name.
* @param string $name The name of the team.
* @param string $description The description of the team.
* @param array $repoNames An array of repository names
for the team (optional).
* @param string $permission The team's permission
level (optional).
* @param array $units Units for the team
(optional).
* @param array $unitsMap Units map for the team
(optional).
* @param bool $canCreateOrgRepo Can create organization
repository flag (optional).
* @param bool $includesAllRepositories Includes all repositories
flag (optional).
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $organization,
string $name,
string $description,
array $repoNames = [],
string $permission = 'read',
array $units = [],
array $unitsMap = [],
bool $canCreateOrgRepo = null,
bool $includesAllRepositories = null
): ?object
{
// Build the request path.
$path = "/orgs/{$organization}/teams";
// Set the team data.
$data = new \stdClass();
$data->name = $name;
$data->description = $description;
$data->permission = $permission;
if (!empty($repoNames))
{
$data->repo_names = $repoNames;
}
if (!empty($units))
{
$data->units = $units;
}
if (!empty($unitsMap))
{
$data->units_map = (object)$unitsMap;
}
if ($canCreateOrgRepo !== null)
{
$data->can_create_org_repo = $canCreateOrgRepo;
}
if ($includesAllRepositories !== null)
{
$data->includes_all_repositories = $includesAllRepositories;
}
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 201
);
}
/**
* Search for teams within an organization.
*
* @param string $organization The organization name.
* @param string $keywords The search keywords.
* @param bool $includeDesc Include search within team
description (defaults to true).
* @param int $page The page number.
* @param int $limit The number of results per page.
*
* @return object|null
* @since 3.2.0
**/
public function search(
string $organization,
string $keywords,
bool $includeDesc = true,
int $page = 1,
int $limit = 10
): ?object
{
// Build the request path.
$path = "/orgs/{$organization}/teams/search";
// Configure the request URI.
$uri = $this->uri->get($path);
$uri->setVar('q', $keywords);
$uri->setVar('include_desc', $includeDesc);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Delete a team.
*
* @param int $id The team ID.
*
* @return string
* @since 3.2.0
**/
public function delete(int $id): string
{
// Build the request path.
$path = "/teams/{$id}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Edit a team.
*
* @param int $teamId The team ID.
* @param string|null $teamName The team name
(optional).
* @param string|null $teamDescription The team description
(optional).
* @param string|null $teamPermission The team's
permission level (optional).
* @param bool|null $canCreateOrgRepo Can team create
organization repositories (optional).
* @param bool|null $includesAllRepositories Include all
repositories (optional).
* @param array|null $units List of units
(optional).
* @param array|null $unitsMap Units map (optional).
*
* @return object|null
* @since 3.2.0
**/
public function edit(
int $teamId,
?string $teamName = null,
?string $teamDescription = null,
?string $teamPermission = null,
?bool $canCreateOrgRepo = null,
?bool $includesAllRepositories = null,
?array $units = null,
?array $unitsMap = null
): ?object
{
// Build the request path.
$path = "/teams/{$teamId}";
// Set the team data.
$data = new \stdClass();
if ($teamName !== null)
{
$data->name = $teamName;
}
if ($teamDescription !== null)
{
$data->description = $teamDescription;
}
if ($teamPermission !== null)
{
$data->permission = $teamPermission;
}
if ($canCreateOrgRepo !== null)
{
$data->can_create_org_repo = $canCreateOrgRepo;
}
if ($includesAllRepositories !== null)
{
$data->includes_all_repositories = $includesAllRepositories;
}
if ($units !== null)
{
$data->units = $units;
}
if ($unitsMap !== null)
{
$data->units_map = $unitsMap;
}
// Send the patch request.
return $this->response->get(
$this->http->patch(
$this->uri->get($path), json_encode($data)
)
);
}
}
PK5g�[�d�
Organization/User.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Organization;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Organization User
*
* @since 3.2.0
*/
class User extends Api
{
/**
* List the current user's organizations.
*
* @param int $pageNumber The page number of results to return
(1-based).
* @param int $pageSize The page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
int $pageNumber = 1,
int $pageSize = 10
): ?array
{
// Build the request path.
$path = "/user/orgs";
// Get the URI object.
$uri = $this->uri->get($path);
// Add the query parameters for page number and page size.
$uri->setVar('page', $pageNumber);
$uri->setVar('limit', $pageSize);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* List a user's organizations.
*
* @param string $username The user's username.
* @param int $pageNumber The page number of results to return
(1-based).
* @param int $pageSize The page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function get(
string $username,
int $pageNumber = 1,
int $pageSize = 10
): ?array
{
// Build the request path.
$path = "/users/{$username}/orgs";
// Get the URI object.
$uri = $this->uri->get($path);
// Add the query parameters for page number and page size.
$uri->setVar('page', $pageNumber);
$uri->setVar('limit', $pageSize);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Get user permissions in an organization.
*
* @param string $username The user's username.
* @param string $org The organization name.
*
* @return object|null
* @since 3.2.0
**/
public function permissions(string $username, string $org): ?object
{
// Build the request path.
$path = "/users/{$username}/orgs/{$org}/permissions";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
}
PK5g�[5�i�<<Organization.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Organization
*
* @since 3.2.0
*/
class Organization extends Api
{
/**
* Create an organization.
*
* @param string $login Required. The organization's
username.
* @param string $fullName Required. The full name of the
organization.
* @param string $email Required. The email of the organization.
* @param string $description Optional. The description of the
organization.
* @param bool $repoAdmin Optional. Whether the user has repository
admin access.
* @param bool $teamAdmin Optional. Whether the user has team admin
access.
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $login,
string $fullName,
string $email,
string $description = '',
bool $repoAdmin = false,
bool $teamAdmin = false
): ?object
{
// Set the lines data
$data = new \stdClass();
$data->username = $login;
$data->full_name = $fullName;
$data->email = $email;
$data->description = $description;
$data->repo_admin_change_team_access = $repoAdmin;
$data->team_admin_change_team_access = $teamAdmin;
// Build the request path.
$path = '/orgs';
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path),
json_encode($data)
), 201
);
}
/**
* Get an organization.
*
* @param string $org The organization name.
*
* @return object|null
* @since 3.2.0
**/
public function get(string $org): ?object
{
// Build the request path.
$path = "/orgs/{$org}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Get a list of organizations.
*
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = '/orgs';
// Get the URI and set query parameters.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Delete an organization.
*
* @param string $org The organization name.
*
* @return string
* @since 3.2.0
**/
public function delete(string $org): string
{
// Build the request path.
$path = "/orgs/{$org}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Edit an organization.
*
* @param string $org The organization name.
* @param string $fullName Optional. The full name of the
organization.
* @param string $location Optional. The location of the
organization.
* @param string $description Optional. The description of the
organization.
* @param bool $repoAdmin Optional. Whether the user has
repository admin access.
* @param string $visibility Optional. The visibility of the
organization (public, limited, or private).
* @param string $website Optional. The website of the
organization.
*
* @return object|null
* @since 3.2.0
**/
public function edit(
string $org,
?string $fullName = null,
?string $email = null,
?string $location = null,
?string $description = null,
?bool $repoAdmin = null,
?string $visibility = null,
?string $website = null
): ?object
{
// Set the lines data
$data = new \stdClass();
if ($fullName !== null)
{
$data->full_name = $fullName;
}
if ($location !== null)
{
$data->location = $location;
}
if ($description !== null)
{
$data->description = $description;
}
if ($repoAdmin !== null)
{
$data->repo_admin_change_team_access = $repoAdmin;
}
if ($visibility !== null)
{
$data->visibility = $visibility;
}
if ($website !== null)
{
$data->website = $website;
}
// Build the request path.
$path = "/orgs/{$org}";
// Send the patch request.
return $this->response->get(
$this->http->patch(
$this->uri->get($path),
json_encode($data)
)
);
}
}
PK5g�[6b(��Package/Files.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Package;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Package Files
*
* @since 3.2.0
*/
class Files extends Api
{
/**
* Gets all files of a package.
*
* @param string $owner The owner of the package.
* @param string $type The type of the package.
* @param string $name The name of the package.
* @param string $version The version of the package.
*
* @return object|null
* @since 3.2.0
**/
public function get(
string $owner,
string $type,
string $name,
string $version
): ?object
{
// Build the request path.
$path = "/packages/{$owner}/{$type}/{$name}/{$version}/files";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
}
PK5g�[�#o,,Package/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK5g�[���{88Package/Owner.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Package;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Package Owner
*
* @since 3.2.0
*/
class Owner extends Api
{
/**
* Gets all packages of an owner.
*
* @param string $owner The owner of the packages.
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
* @param string|null $type Package type filter (optional).
* @param string|null $name Filter Name filter (optional).
*
* @return array|null
* @since 3.2.0
**/
public function get(
string $owner,
int $page = 1,
int $limit = 10,
?string $type = null,
?string $nameFilter = null
): ?array
{
// Build the request path.
$path = "/packages/{$owner}";
// Configure the URI with query parameters.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
if ($type !== null)
{
$uri->setVar('type', $type);
}
if ($nameFilter !== null)
{
$uri->setVar('q', $nameFilter);
}
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
}
PK5g�[�h�(eePackage.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Package
*
* @since 3.2.0
*/
class Package extends Api
{
/**
* Gets a package.
*
* @param string $owner The owner of the package.
* @param string $type The type of the package.
* @param string $name The name of the package.
* @param string $version The version of the package.
*
* @return object|null
* @since 3.2.0
**/
public function get(
string $owner,
string $type,
string $name,
string $version
): ?object
{
// Build the request path.
$path = "/packages/{$owner}/{$type}/{$name}/{$version}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Delete a package.
*
* @param string $owner The owner of the package.
* @param string $type The type of the package.
* @param string $name The name of the package.
* @param string $version The version of the package.
*
* @return string
* @since 3.2.0
**/
public function delete(
string $owner,
string $type,
string $name,
string $version
): string
{
// Build the request path.
$path = "/packages/{$owner}/{$type}/{$name}/{$version}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}
PK5g�[��BBRepository/Archive.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Archive
*
* @since 3.2.0
*/
class Archive extends Api
{
/**
* Get an archive of a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $archive The archive format, e.g., "zip"
or "tar.gz".
*
* @return string
* @since 3.2.0
**/
public function get(
string $owner,
string $repo,
string $archive
): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/archive/{$archive}";
// Set the required variables to the URI.
$uri = $this->uri->get($path);
$uri->setVar('owner', $owner);
$uri->setVar('repo', $repo);
$uri->setVar('archive', $archive);
// Send the get request.
return $this->response->get(
$this->http->get($uri), 200, 'success'
);
}
}
PK5g�[������Repository/Assignees.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Assignees
*
* @since 3.2.0
*/
class Assignees extends Api
{
/**
* Return all users that have write access and can be assigned to issues.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
*
* @return array|null
* @since 3.2.0
**/
public function get(string $owner, string $repo): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/assignees";
// Set the required variables to the URI.
$uri = $this->uri->get($path);
$uri->setVar('owner', $owner);
$uri->setVar('repo', $repo);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
}
PK5g�[��Repository/Attachments.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Attachments
*
* @since 3.2.0
*/
class Attachments extends Api
{
/**
* List release's attachments.
*
* @param string $ownerName The owner name.
* @param string $repoName The repository name.
* @param int $releaseId The release ID.
*
* @return array|null
* @since 3.2.0
**/
public function list(
string $ownerName,
string $repoName,
int $releaseId
): ?array
{
// Build the request path.
$path =
"/repos/{$ownerName}/{$repoName}/releases/{$releaseId}/assets";
// Retrieve the URI object with the path.
$uri = $this->uri->get($path);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Create a release attachment.
*
* @param string $ownerName The owner name.
* @param string $repoName The repository name.
* @param int $releaseId The release ID.
* @param string $attachmentFile The attachment file content.
* @param string $attachmentName The attachment file name.
* @param string $contentType The attachment content type.
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $ownerName,
string $repoName,
int $releaseId,
string $attachmentFile,
string $attachmentName,
string $contentType
): ?object
{
// Build the request path.
$path =
"/repos/{$ownerName}/{$repoName}/releases/{$releaseId}/assets";
// Retrieve the URI object with the path.
$uri = $this->uri->get($path);
// Add the attachment name as a query parameter.
$uri->setVar('name', $attachmentName);
// Set the request headers.
$headers = [
"Content-Type: {$contentType}",
"Content-Disposition: attachment; filename={$attachmentName}"
];
// Send the post request.
return $this->response->get(
$this->http->post(
$uri, $attachmentFile, $headers
), 201
);
}
/**
* Get a release attachment.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $id The release ID.
* @param int $attachmentId The attachment ID.
*
* @return object|null
* @since 3.2.0
**/
public function get(
string $owner,
string $repo,
int $id,
int $attachmentId
): ?object
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/releases/{$id}/assets/{$attachmentId}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Delete a release attachment.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $id The release ID.
* @param int $attachmentId The attachment ID.
*
* @return string
* @since 3.2.0
**/
public function delete(
string $owner,
string $repo,
int $id,
int $attachmentId
): string
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/releases/{$id}/assets/{$attachmentId}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Edit a release attachment.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $id The release ID.
* @param int $attachmentId The attachment ID.
* @param string|null $name The new name of the attachment (optional).
*
* @return object|null
* @since 3.2.0
**/
public function edit(
string $owner,
string $repo,
int $id,
int $attachmentId,
?string $name = null
): ?object
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/releases/{$id}/assets/{$attachmentId}";
// Set the attachment data
$data = new \stdClass();
if ($name !== null)
{
$data->name = $name;
}
// Send the patch request.
return $this->response->get(
$this->http->patch(
$this->uri->get($path), json_encode($data)
)
);
}
}
PK5g�[�#o,,Repository/Branch/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK5g�[*��J5J5
Repository/Branch/Protection.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository\Branch;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Branch Protection
*
* @since 3.2.0
*/
class Protection extends Api
{
/**
* List branch protections for a repository.
*
* @param string $ownerName The owner name.
* @param string $repositoryName The repository name.
*
* @return array|null
* @since 3.2.0
**/
public function list(string $ownerName, string $repositoryName): ?array
{
// Build the request path.
$path =
"/repos/{$ownerName}/{$repositoryName}/branch_protections";
// Get the URI with the path.
$uri = $this->uri->get($path);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Create a branch protection for a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $branchName The name of the branch to protect.
* @param array $approvalsWhitelistUsernames An array of usernames that
can approve.
* @param array $approvalsWhitelistTeams An array of team names that
can approve.
* @param bool $blockOnOfficialReviewRequests Enable/disable blocking
on official review requests (optional, default false).
* @param bool $blockOnOutdatedBranch Enable/disable blocking on
outdated branch (optional, default false).
* @param bool $blockOnRejectedReviews Enable/disable blocking on
rejected reviews (optional, default false).
* @param bool $dismissStaleApprovals Enable/disable dismissing
stale approvals (optional, default false).
* @param bool $enableApprovalsWhitelist Enable/disable approvals
whitelist (optional, default false).
* @param bool $enableMergeWhitelist Enable/disable merge whitelist
(optional, default false).
* @param bool $enablePush Enable/disable push (optional, default
true).
* @param bool $enablePushWhitelist Enable/disable push whitelist
(optional, default false).
* @param bool $enableStatusCheck Enable/disable status check
(optional, default false).
* @param array $mergeWhitelistUsernames An array of usernames that can
merge (optional).
* @param array $mergeWhitelistTeams An array of team names that can
merge (optional).
* @param string $protectedFilePatterns Protected file patterns
(optional).
* @param bool $pushWhitelistDeployKeys Enable/disable push whitelist
deploy keys (optional, default false).
* @param array $pushWhitelistUsernames An array of usernames that can
push (optional).
* @param array $pushWhitelistTeams An array of team names that can
push (optional).
* @param bool $requireSignedCommits Enable/disable requiring signed
commits (optional, default false).
* @param int $requiredApprovals Number of required approvals
(optional, default 0).
* @param array $statusCheckContexts An array of status check
contexts (optional).
* @param string $unprotectedFilePatterns Unprotected file patterns
(optional).
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $owner,
string $repo,
string $branchName,
array $approvalsWhitelistUsernames,
array $approvalsWhitelistTeams,
bool $blockOnOfficialReviewRequests = false,
bool $blockOnOutdatedBranch = false,
bool $blockOnRejectedReviews = false,
bool $dismissStaleApprovals = false,
bool $enableApprovalsWhitelist = false,
bool $enableMergeWhitelist = false,
bool $enablePush = true,
bool $enablePushWhitelist = false,
bool $enableStatusCheck = false,
array $mergeWhitelistUsernames = [],
array $mergeWhitelistTeams = [],
string $protectedFilePatterns = '',
bool $pushWhitelistDeployKeys = false,
array $pushWhitelistUsernames = [],
array $pushWhitelistTeams = [],
bool $requireSignedCommits = false,
int $requiredApprovals = 0,
array $statusCheckContexts = [],
string $unprotectedFilePatterns = ''
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/branch_protections";
// Set the branch protection data.
$data = new \stdClass();
$data->branch_name = $branchName;
$data->approvals_whitelist_usernames = $approvalsWhitelistUsernames;
$data->approvals_whitelist_teams = $approvalsWhitelistTeams;
$data->block_on_official_review_requests =
$blockOnOfficialReviewRequests;
$data->block_on_outdated_branch = $blockOnOutdatedBranch;
$data->block_on_rejected_reviews = $blockOnRejectedReviews;
$data->dismiss_stale_approvals = $dismissStaleApprovals;
$data->enable_approvals_whitelist = $enableApprovalsWhitelist;
$data->enable_merge_whitelist = $enableMergeWhitelist;
$data->enable_push = $enablePush;
$data->enable_push_whitelist = $enablePushWhitelist;
$data->enable_status_check = $enableStatusCheck;
$data->merge_whitelist_usernames = $mergeWhitelistUsernames;
$data->merge_whitelist_teams = $mergeWhitelistTeams;
$data->protected_file_patterns = $protectedFilePatterns;
$data->push_whitelist_deploy_keys = $pushWhitelistDeployKeys;
$data->push_whitelist_usernames = $pushWhitelistUsernames;
$data->push_whitelist_teams = $pushWhitelistTeams;
$data->require_signed_commits = $requireSignedCommits;
$data->required_approvals = $requiredApprovals;
$data->status_check_contexts = $statusCheckContexts;
$data->unprotected_file_patterns = $unprotectedFilePatterns;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 201
);
}
/**
* Get a specific branch protection for the repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $branchName The branch protection name.
*
* @return object|null
* @since 3.2.0
**/
public function get(
string $owner,
string $repo,
string $branchName
): ?object
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/branch_protections/{$branchName}";
// Get the URI object with the given path.
$uri = $this->uri->get($path);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Delete a specific branch protection for the repository.
*
* @param string $ownerName The owner name.
* @param string $repoName The repository name.
* @param string $branchName The branch protection name.
*
* @return string
* @since 3.2.0
**/
public function delete(
string $ownerName,
string $repoName,
string $branchName
): string
{
// Build the request path.
$path =
"/repos/{$ownerName}/{$repoName}/branch_protections/{$branchName}";
// Set the required variables in the URI.
$this->uri->setVar('owner', $ownerName);
$this->uri->setVar('repo', $repoName);
$this->uri->setVar('name', $branchName);
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Edit a branch protection for a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $name The branch protection name.
* @param array|null $approvalsWhitelistTeams An array of team names
that are allowed to approve (optional).
* @param array|null $approvalsWhitelistUsernames An array of
usernames that are allowed to approve (optional).
* @param bool|null $blockOnOfficialReviewRequests Block when official
review requests are pending (optional).
* @param bool|null $blockOnOutdatedBranch Block when the branch is
outdated (optional).
* @param bool|null $blockOnRejectedReviews Block when reviews are
rejected (optional).
* @param bool|null $dismissStaleApprovals Dismiss stale approvals
when new commits are pushed (optional).
* @param bool|null $enableApprovalsWhitelist Enable/disable
approvals whitelist (optional).
* @param bool|null $enableMergeWhitelist Enable/disable merge
whitelist (optional).
* @param bool|null $enablePush Enable/disable push (optional).
* @param bool|null $enablePushWhitelist Enable/disable push
whitelist (optional).
* @param bool|null $enableStatusCheck Enable/disable status check
(optional).
* @param array|null $mergeWhitelistTeams An array of team names
that are allowed to merge (optional).
* @param array|null $mergeWhitelistUsernames An array of usernames
that are allowed to merge (optional).
* @param string|null $protectedFilePatterns A string pattern for
protected files (optional).
* @param bool|null $pushWhitelistDeployKeys Enable/disable push
whitelist for deploy keys (optional).
* @param array|null $pushWhitelistTeams An array of team names that
are allowed to push (optional).
* @param array|null $pushWhitelistUsernames An array of usernames
that are allowed to push (optional).
* @param bool|null $requireSignedCommits Require signed commits
(optional).
* @param int|null $requiredApprovals Number of required approvals
(optional).
* @param array|null $statusCheckContexts An array of status check
contexts (optional).
* @param string|null $unprotectedFilePatterns A string pattern for
unprotected files (optional).
*
* @return object|null
* @since 3.2.0
**/
public function edit(
string $owner,
string $repo,
string $name,
?array $approvalsWhitelistTeams = null,
?array $approvalsWhitelistUsernames = null,
?bool $blockOnOfficialReviewRequests = null,
?bool $blockOnOutdatedBranch = null,
?bool $blockOnRejectedReviews = null,
?bool $dismissStaleApprovals = null,
?bool $enableApprovalsWhitelist = null,
?bool $enableMergeWhitelist = null,
?bool $enablePush = null,
?bool $enablePushWhitelist = null,
?bool $enableStatusCheck = null,
?array $mergeWhitelistTeams = null,
?array $mergeWhitelistUsernames = null,
?string $protectedFilePatterns = null,
?bool $pushWhitelistDeployKeys = null,
?array $pushWhitelistTeams = null,
?array $pushWhitelistUsernames = null,
?bool $requireSignedCommits = null,
?int $requiredApprovals = null,
?array $statusCheckContexts = null,
?string $unprotectedFilePatterns = null
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/branch_protections/{$name}";
// Set the branch protection data.
$data = new \stdClass();
if ($approvalsWhitelistTeams !== null)
{
$data->approvals_whitelist_teams = $approvalsWhitelistTeams;
}
if ($approvalsWhitelistUsernames !== null)
{
$data->approvals_whitelist_usernames =
$approvalsWhitelistUsernames;
}
if ($blockOnOfficialReviewRequests !== null)
{
$data->block_on_official_review_requests =
$blockOnOfficialReviewRequests;
}
if ($blockOnOutdatedBranch !== null)
{
$data->block_on_outdated_branch = $blockOnOutdatedBranch;
}
if ($blockOnRejectedReviews !== null)
{
$data->block_on_rejected_reviews = $blockOnRejectedReviews;
}
if ($dismissStaleApprovals !== null)
{
$data->dismiss_stale_approvals = $dismissStaleApprovals;
}
if ($enableApprovalsWhitelist !== null)
{
$data->enable_approvals_whitelist = $enableApprovalsWhitelist;
}
if ($enableMergeWhitelist !== null)
{
$data->enable_merge_whitelist = $enableMergeWhitelist;
}
if ($enablePush !== null)
{
$data->enable_push = $enablePush;
}
if ($enablePushWhitelist !== null)
{
$data->enable_push_whitelist = $enablePushWhitelist;
}
if ($enableStatusCheck !== null)
{
$data->enable_status_check = $enableStatusCheck;
}
if ($mergeWhitelistTeams !== null)
{
$data->merge_whitelist_teams = $mergeWhitelistTeams;
}
if ($mergeWhitelistUsernames !== null)
{
$data->merge_whitelist_usernames = $mergeWhitelistUsernames;
}
if ($protectedFilePatterns !== null)
{
$data->protected_file_patterns = $protectedFilePatterns;
}
if ($pushWhitelistDeployKeys !== null)
{
$data->push_whitelist_deploy_keys = $pushWhitelistDeployKeys;
}
if ($pushWhitelistTeams !== null)
{
$data->push_whitelist_teams = $pushWhitelistTeams;
}
if ($pushWhitelistUsernames !== null)
{
$data->push_whitelist_usernames = $pushWhitelistUsernames;
}
if ($requireSignedCommits !== null)
{
$data->require_signed_commits = $requireSignedCommits;
}
if ($requiredApprovals !== null)
{
$data->required_approvals = $requiredApprovals;
}
if ($statusCheckContexts !== null)
{
$data->status_check_contexts = $statusCheckContexts;
}
if ($unprotectedFilePatterns !== null)
{
$data->unprotected_file_patterns = $unprotectedFilePatterns;
}
// Send the patch request.
return $this->response->get(
$this->http->patch(
$this->uri->get($path), json_encode($data)
)
);
}
}
PK5g�[�¶�..Repository/Branch.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Branch
*
* @since 3.2.0
*/
class Branch extends Api
{
/**
* List a repository's branches.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
string $owner,
string $repo,
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/branches";
// Set the required variables to the URI.
$uri = $this->uri->get($path);
$uri->setVar('owner', $owner);
$uri->setVar('repo', $repo);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Create a branch.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $branch_name The name of the new branch.
* @param string $old_branch The name of the existing branch from
which to create the new branch.
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $owner,
string $repo,
string $branch_name,
string $old_branch
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/branches";
// Set the branch data.
$data = new \stdClass();
$data->branch_name = $branch_name;
$data->old_branch = $old_branch;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 201
);
}
/**
* Retrieve a specific branch from a repository, including its effective
branch protection.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $branch The branch name.
*
* @return object|null
* @since 3.2.0
**/
public function get(string $owner, string $repo, string $branch): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/branches/{$branch}";
// Set the required variables to the URI.
$uri = $this->uri->get($path);
$uri->setVar('owner', $owner);
$uri->setVar('repo', $repo);
$uri->setVar('branch', $branch);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Delete a specific branch from a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $branch The branch name.
*
* @return string
* @since 3.2.0
**/
public function delete(
string $owner,
string $repo,
string $branch
): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/branches/{$branch}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}
PK5g�[|���Repository/Collaborator.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Collaborator
*
* @since 3.2.0
*/
class Collaborator extends Api
{
/**
* List a repository's collaborators.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $page The page number of results to return
(1-based).
* @param int $limit The page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(string $owner, string $repo, int $page = 1, int
$limit = 10): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/collaborators";
// Get the URI object for the path.
$uri = $this->uri->get($path);
// Set the page and limit variables.
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Check if a user is a collaborator of a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $collaborator The collaborator username.
*
* @return string
* @since 3.2.0
**/
public function check(
string $owner,
string $repo,
string $collaborator
): string
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/collaborators/{$collaborator}";
// Get the URI object for the path.
$uri = $this->uri->get($path);
// Send the get request.
return $this->response->get(
$this->http->get($uri), 204, 'success'
);
}
/**
* Add a collaborator to a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $collaborator The collaborator username.
* @param string $permission The permission level for the
collaborator (optional).
*
* @return string
* @since 3.2.0
**/
public function add(
string $owner,
string $repo,
string $collaborator,
string $permission = null
): string
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/collaborators/{$collaborator}";
// Get the URI object for the path.
$uri = $this->uri->get($path);
// Prepare the request body.
$body = new stdClass();
if ($permission !== null) {
$body->permission = $permission;
}
$bodyJson = json_encode($body);
// Send the put request.
return $this->response->get(
$this->http->put($uri, $bodyJson), 204, 'success'
);
}
/**
* Delete a collaborator from a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $collaborator The collaborator username.
*
* @return string
* @since 3.2.0
**/
public function delete(
string $owner,
string $repo,
string $collaborator
): string
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/collaborators/{$collaborator}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Get repository permissions for a user.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $collaborator The collaborator username.
*
* @return object|null
* @since 3.2.0
**/
public function permission(
string $owner,
string $repo,
string $collaborator
): ?object
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/collaborators/{$collaborator}/permission";
// Get the URI object for the path.
$uri = $this->uri->get($path);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
}
PK5g�[TC���Repository/Commits.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Commit
*
* @since 3.2.0
*/
class Commits extends Api
{
/**
* Get a list of all commits from a repository.
*
* @param string $owner The owner of the repo.
* @param string $repo The name of the repo.
* @param string|null $sha SHA or branch to start listing commits from
(usually 'master').
* @param string|null $path Filepath of a file/dir.
* @param bool|null $stat Include diff stats for every commit (disable for
speedup, default 'true').
* @param int|null $page Page number of results to return (1-based).
* @param int|null $limit Page size of results (ignored if used with
'path').
*
* @return array|null
* @since 3.2.0
*/
public function getList(
string $owner,
string $repo,
?string $sha = null,
?string $path = null,
?bool $stat = true,
?int $page = 1,
?int $limit = 10
): ?object
{
// Build the request path.
$uriPath = "/repos/{$owner}/{$repo}/commits";
// Set query parameters.
$uri = $this->uri->get($uriPath);
if ($sha !== null)
{
$uri->setVar('sha', $sha);
}
if ($path !== null)
{
$uri->setVar('path', $path);
}
if ($stat !== null)
{
$uri->setVar('stat', $stat ? 'true' :
'false');
}
if ($page !== null)
{
$uri->setVar('page', $page);
}
if ($limit !== null)
{
$uri->setVar('limit', $limit);
}
// Send the GET request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Get a single commit from a repository.
*
* @param string $owner The owner of the repo.
* @param string $repo The name of the repo.
* @param string $sha A git ref or commit sha.
*
* @return object|null
* @since 3.2.0
*/
public function getCommit(string $owner, string $repo, string $sha):
?object
{
// Build the request path.
$uriPath = "/repos/{$owner}/{$repo}/git/commits/{$sha}";
// Send the GET request.
return $this->response->get(
$this->http->get(
$this->uri->get($uriPath)
)
);
}
/**
* Get a commit's combined status, by branch/tag/commit reference.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $ref The branch, tag, or commit reference.
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
*
* @return object|null
* @since 3.2.0
**/
public function status(
string $owner,
string $repo,
string $ref,
int $page = 1,
int $limit = 10
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/commits/{$ref}/status";
// Set up the URI with the required parameters.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Get a commit's statuses, by branch/tag/commit reference.
*
* @param string $owner The owner of the repository.
* @param string $repo The name of the repository.
* @param string $ref The branch, tag, or commit reference.
* @param string $sort The type of sort. Available values: oldest,
recentupdate, leastupdate, leastindex, highestindex.
* @param string $state The type of state. Available values: pending,
success, error, failure, warning.
* @param int $page The page number of results to return (1-based).
Default value: 1.
* @param int $limit The page size of results. Default value: 10.
*
* @return array|null
* @since 3.2.0
*/
public function statuses(
string $owner,
string $repo,
string $ref,
string $sort = null,
string $state = null,
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/commits/{$ref}/statuses";
// Add query parameters to the URI.
$uri = $this->uri->get($path);
if ($sort !== null)
{
$uri->setVar('sort', $sort);
}
if ($state !== null)
{
$uri->setVar('state', $state);
}
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the GET request.
$response = $this->http->get($uri);
return $this->response->get($response);
}
/**
* Get a commit's diff or patch.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $sha The SHA hash of the commit.
* @param string $diffType The diff type, either 'diff' or
'patch'.
*
* @return string
* @since 3.2.0
**/
public function diff(
string $owner,
string $repo,
string $sha,
string $diffType
): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/git/commits/{$sha}";
// Set the diffType as a variable in the URI.
$this->uri->setVar('diffType', $diffType);
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
}
PK5g�[�Ywaz6z6Repository/Contents.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Interfaces\Git\Repository\ContentsInterface;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Contents
*
* @since 3.2.0
*/
class Contents extends Api implements ContentsInterface
{
/**
* Get a file from a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $filepath The file path.
* @param string|null $ref Optional. The name of the
commit/branch/tag.
* Default the repository's default
branch (usually master).
*
* @return mixed
* @since 3.2.0
**/
public function get(string $owner, string $repo, string $filepath, ?string
$ref = null)
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/raw/{$filepath}";
// Get the URI with the specified path.
$uri = $this->uri->get($path);
// Add the ref parameter if provided.
if ($ref !== null)
{
$uri->setVar('ref', $ref);
}
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Get the metadata and contents (if a file) of an entry in a repository,
* or a list of entries if a directory.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $filepath The file or directory path.
* @param string|null $ref Optional. The name of the
commit/branch/tag.
* Default the repository's default
branch (usually master).
*
* @return null|array|object
* @since 3.2.0
**/
public function metadata(string $owner, string $repo, string $filepath,
?string $ref = null): null|array|object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/contents/{$filepath}";
// Get the URI with the specified path.
$uri = $this->uri->get($path);
// Add the ref parameter if provided.
if ($ref !== null)
{
$uri->setVar('ref', $ref);
}
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Create a file in a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $filepath The file path.
* @param string $content The file content.
* @param string $message The commit message.
* @param string $branch The branch name. Defaults to the
repository's default branch.
* @param string|null $authorName The author's name.
* @param string|null $authorEmail The author's email.
* @param string|null $committerName The committer's name.
* @param string|null $committerEmail The committer's email.
* @param string|null $newBranch Whether to create a new branch.
Defaults to null.
* @param string|null $authorDate The author's date.
* @param string|null $committerDate The committer's date.
* @param bool|null $signoff Add a Signed-off-by trailer.
Defaults to null.
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $owner,
string $repo,
string $filepath,
string $content,
string $message,
string $branch = 'master',
?string $authorName = null,
?string $authorEmail = null,
?string $committerName = null,
?string $committerEmail = null,
?string $newBranch = null,
?string $authorDate = null,
?string $committerDate = null,
?bool $signoff = null
): ?object {
// Build the request path.
$path = "/repos/{$owner}/{$repo}/contents/{$filepath}";
// Set the post data
$data = new \stdClass();
$data->content = base64_encode($content);
$data->message = $message;
$data->branch = $branch;
if ($authorName !== null || $authorEmail !== null)
{
$data->author = new \stdClass();
if ($authorName !== null)
{
$data->author->name = $authorName;
}
if ($authorEmail !== null)
{
$data->author->email = $authorEmail;
}
}
if ($committerName !== null || $committerEmail !== null)
{
$data->committer = new \stdClass();
if ($committerName !== null)
{
$data->committer->name = $committerName;
}
if ($committerEmail !== null)
{
$data->committer->email = $committerEmail;
}
}
if ($newBranch !== null)
{
$data->new_branch = $newBranch;
}
if ($authorDate !== null || $committerDate !== null)
{
$data->dates = new \stdClass();
if ($authorDate !== null)
{
$data->dates->author = $authorDate;
}
if ($committerDate !== null)
{
$data->dates->committer = $committerDate;
}
}
if ($signoff !== null)
{
$data->signoff = $signoff;
}
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 201
);
}
/**
* Get the metadata of all the entries of the root directory.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string|null $ref The name of the commit/branch/tag. Default
the repository's default branch (usually master).
*
* @return array|null
* @since 3.2.0
**/
public function root(string $owner, string $repo, ?string $ref = null):
?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/contents";
// Get the URI with the specified path.
$uri = $this->uri->get($path);
// Add the 'ref' parameter if it's provided.
if ($ref !== null)
{
$uri->setVar('ref', $ref);
}
// Send the get request.
return $this->response->get(
$this->http->get(
$uri
)
);
}
/**
* Update a file in a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $filepath The file path.
* @param string $content The file content.
* @param string $message The commit message.
* @param string $sha The blob SHA of the file.
* @param string $branch The branch name. Defaults to the
repository's default branch.
* @param string|null $authorName The author name. Defaults to the
authenticated user.
* @param string|null $authorEmail The author email. Defaults to the
authenticated user.
* @param string|null $committerName The committer name. Defaults to
the authenticated user.
* @param string|null $committerEmail The committer email. Defaults to
the authenticated user.
* @param string|null $authorDate The author date.
* @param string|null $committerDate The committer date.
* @param string|null $fromPath The original file path to
move/rename.
* @param string|null $newBranch The new branch to create from the
specified branch.
* @param bool|null $signoff Add a Signed-off-by trailer.
*
* @return object|null
* @since 3.2.0
**/
public function update(
string $owner,
string $repo,
string $filepath,
string $content,
string $message,
string $sha,
string $branch = 'master',
?string $authorName = null,
?string $authorEmail = null,
?string $committerName = null,
?string $committerEmail = null,
?string $authorDate = null,
?string $committerDate = null,
?string $fromPath = null,
?string $newBranch = null,
?bool $signoff = null
): ?object {
// Build the request path.
$path = "/repos/{$owner}/{$repo}/contents/{$filepath}";
// Set the file data.
$data = new \stdClass();
$data->content = base64_encode($content);
$data->message = $message;
$data->branch = $branch;
$data->sha = $sha;
if ($authorName !== null || $authorEmail !== null)
{
$data->author = new \stdClass();
if ($authorName !== null)
{
$data->author->name = $authorName;
}
if ($authorEmail !== null)
{
$data->author->email = $authorEmail;
}
}
if ($committerName !== null || $committerEmail !== null)
{
$data->committer = new \stdClass();
if ($committerName !== null)
{
$data->committer->name = $committerName;
}
if ($committerEmail !== null)
{
$data->committer->email = $committerEmail;
}
}
if ($authorDate !== null || $committerDate !== null)
{
$data->dates = new \stdClass();
if ($authorDate !== null)
{
$data->dates->author = $authorDate;
}
if ($committerDate !== null)
{
$data->dates->committer = $committerDate;
}
}
if ($fromPath !== null)
{
$data->from_path = $fromPath;
}
if ($newBranch !== null)
{
$data->new_branch = $newBranch;
}
if ($signoff !== null)
{
$data->signoff = $signoff;
}
// Send the put request.
return $this->response->get(
$this->http->put(
$this->uri->get($path),
json_encode($data)
)
);
}
/**
* Delete a file in a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $filepath The file path.
* @param string $message The commit message.
* @param string $sha The blob SHA of the file.
* @param string|null $branch The branch name (optional).
* @param string|null $authorName The author name (optional).
* @param string|null $authorEmail The author email (optional).
* @param string|null $committerName The committer name (optional).
* @param string|null $committerEmail The committer email (optional).
* @param string|null $authorDate The author date (optional).
* @param string|null $committerDate The committer date (optional).
* @param string|null $newBranch The new branch name (optional).
* @param bool|null $signoff Add a Signed-off-by trailer
(optional).
*
* @return object|null
* @since 3.2.0
**/
public function delete(
string $owner,
string $repo,
string $filepath,
string $message,
string $sha,
?string $branch = null,
?string $authorName = null,
?string $authorEmail = null,
?string $committerName = null,
?string $committerEmail = null,
?string $authorDate = null,
?string $committerDate = null,
?string $newBranch = null,
?bool $signoff = null
): ?object {
// Build the request path.
$path = "/repos/{$owner}/{$repo}/contents/{$filepath}";
// Set the file data.
$data = new \stdClass();
$data->message = $message;
$data->sha = $sha;
if ($branch !== null) {
$data->branch = $branch;
}
if ($authorName !== null || $authorEmail !== null)
{
$data->author = new \stdClass();
if ($authorName !== null)
{
$data->author->name = $authorName;
}
if ($authorEmail !== null)
{
$data->author->email = $authorEmail;
}
}
if ($committerName !== null || $committerEmail !== null)
{
$data->committer = new \stdClass();
if ($committerName !== null)
{
$data->committer->name = $committerName;
}
if ($committerEmail !== null)
{
$data->committer->email = $committerEmail;
}
}
if ($authorDate !== null || $committerDate !== null)
{
$data->dates = new \stdClass();
if ($authorDate !== null)
{
$data->dates->author = $authorDate;
}
if ($committerDate !== null)
{
$data->dates->committer = $committerDate;
}
}
if ($newBranch !== null)
{
$data->new_branch = $newBranch;
}
if ($signoff !== null)
{
$data->signoff = $signoff;
}
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path), [], null,
json_encode($data)
)
);
}
/**
* Get the EditorConfig definitions of a file in a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $filepath The file path.
* @param string|null $ref The name of the commit/branch/tag.
*
* @return string|null
* @since 3.2.0
**/
public function editor(string $owner, string $repo, string $filepath,
string $ref = null): ?string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/editorconfig/{$filepath}";
// Set the request parameters.
$uri = $this->uri->get($path);
if ($ref !== null)
{
$uri->setVar('ref', $ref);
}
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Get the blob of a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $sha The SHA hash of the blob.
*
* @return object|null
* @since 3.2.0
**/
public function blob(string $owner, string $repo, string $sha): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/git/blobs/{$sha}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
}
PK5g�[��v��Repository/Forks.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Forks
*
* @since 3.2.0
*/
class Forks extends Api
{
/**
* List a repository's forks.
*
* @param string $owner The owner of the repo.
* @param string $repo The name of the repo.
* @param int $page The page number of results to return (1-based).
* @param int $limit The page size of results.
*
* @return array|null
* @since 3.2.0
*/
public function listForks(
string $owner,
string $repo,
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$uriPath = "/repos/{$owner}/{$repo}/forks";
// Set the query parameters.
$uri = $this->uri->get($uriPath);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Fork a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $forkName The name of the forked repository
(optional).
* @param string $organization The organization name (optional).
*
* @return object|null
* @since 3.2.0
**/
public function repo(
string $owner,
string $repo,
string $forkName = '',
string $organization = ''
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/forks";
// Set the fork data.
$data = new \stdClass();
if (!empty($forkName))
{
$data->name = $forkName;
}
if (!empty($organization))
{
$data->organization = $organization;
}
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path),
json_encode($data)
), 202
);
}
}
PK5g�[%�=�77Repository/Gpg.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Gpg
*
* @since 3.2.0
*/
class Gpg extends Api
{
/**
* Get signing-key.gpg for a given repository.
*
* @param string $ownerName The owner name.
* @param string $repoName The repository name.
*
* @return string
* @since 3.2.0
**/
public function get(string $ownerName, string $repoName): string
{
// Build the request path.
$path = "/repos/{$ownerName}/{$repoName}/signing-key.gpg";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
}
PK5g�[2b�<))Repository/Hooks/Git.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository\Hooks;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Hooks Git
*
* @since 3.2.0
*/
class Git extends Api
{
/**
* List the Git hooks in a repository.
*
* @param string $ownerName The owner name.
* @param string $repoName The repository name.
*
* @return array|null
* @since 3.2.0
**/
public function list(string $ownerName, string $repoName): ?array
{
// Build the request path.
$path = "/repos/{$ownerName}/{$repoName}/hooks/git";
// Get the URI object with the path.
$uri = $this->uri->get($path);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Get a Git hook.
*
* @param string $ownerName The owner name.
* @param string $repoName The repository name.
* @param int $hookId The Git hook ID.
*
* @return object|null
* @since 3.2.0
**/
public function get(
string $ownerName,
string $repoName,
int $hookId
): ?object
{
// Build the request path.
$path = "/repos/{$ownerName}/{$repoName}/hooks/git/{$hookId}";
// Get the URI object with the path.
$uri = $this->uri->get($path);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Delete a Git hook in a repository.
*
* @param string $ownerName The owner name.
* @param string $repositoryName The repository name.
* @param string $hookId The Git hook ID.
*
* @return string
* @since 3.2.0
**/
public function delete(
string $ownerName,
string $repositoryName,
string $hookId
): string
{
// Build the request path.
$path =
"/repos/{$ownerName}/{$repositoryName}/hooks/git/{$hookId}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Edit a Git hook in a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $hookId The Git hook ID.
* @param array $hookOptions The hook configuration.
*
* @return object|null
* @since 3.2.0
**/
public function edit(
string $owner,
string $repo,
string $hookId,
array $hookOptions
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/hooks/git/{$hookId}";
// Set the hook data.
$data = new \stdClass();
$data->config = (object) $hookOptions;
// Send the PATCH request.
return $this->response->get(
$this->http->patch(
$this->uri->get($path), json_encode($data)
)
);
}
}
PK5g�[�#o,,Repository/Hooks/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK5g�[o4����Repository/Hooks.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Hooks
*
* @since 3.2.0
*/
class Hooks extends Api
{
/**
* List the hooks in a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $page The page number of results to return
(1-based).
* @param int $limit The page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
string $owner,
string $repo,
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/hooks";
// Set up the URI with query parameters.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Create a hook in a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $type The hook type.
* @param array $config The hook configuration.
* @param bool $active The hook's active status
(optional, default: false).
* @param array|null $events The events for the hook (optional).
* @param string $branchFilter The branch filter (optional).
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $owner,
string $repo,
string $type,
array $config,
string $type,
array $config,
bool $active = false,
?array $events = null,
string $branchFilter = ''
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/hooks";
// Set the hook data.
$data = new \stdClass();
$data->type = $type;
$data->config = (object) $config;
$data->active = $active;
if ($events !== null)
{
$data->events = $events;
}
if (!empty($branchFilter))
{
$data->branch_filter = $branchFilter;
}
// Send the request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 201
);
}
/**
* Get a hook.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $hookId The hook ID.
*
* @return object|null
* @since 3.2.0
**/
public function get(
string $owner,
string $repo,
int $hookId
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/hooks/{$hookId}";
// Get the URI for the request path.
$uri = $this->uri->get($path);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Edit a hook in a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $id The hook ID.
* @param array $config The hook configuration.
* @param array $events The events to trigger the hook.
* @param bool $active Whether the hook is active.
*
* @return object|null
* @since 3.2.0
**/
public function edit(
string $owner,
string $repo,
int $id,
array $config,
array $events,
bool $active
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/hooks/{$id}";
// Set the hook data.
$data = new \stdClass();
$data->config = $config;
$data->events = $events;
$data->active = $active;
// Send the PATCH request.
return $this->response->get(
$this->http->patch(
$this->uri->get($path),
json_encode($data)
)
);
}
/**
* Test a push webhook.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $hookId The hook ID.
* @param string $ref The name of the commit/branch/tag
(optional).
*
* @return string
* @since 3.2.0
**/
public function test(
string $owner,
string $repo,
int $hookId,
string $ref = ''
): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/hooks/{$hookId}/tests";
// Get the URI for the request path.
$uri = $this->uri->get($path);
if (!empty($ref))
{
$uri->setVar('ref', $ref);
}
// Send the POST request.
return $this->response->get(
$this->http->post($uri), 204, 'success'
);
}
}
PK5g�[�#o,,Repository/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK5g�[�I kkRepository/Keys.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Keys
*
* @since 3.2.0
*/
class Keys extends Api
{
/**
* List a repository's keys.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int|null $keyId The key_id to search for. (Optional)
* @param string|null $fingerprint The fingerprint of the key. (Optional)
* @param int $page The page number of results to return.
(Default: 1)
* @param int $limit The page size of results. (Default: 10)
*
* @return array|null
* @since 3.2.0
*/
public function list(string $owner, string $repo, ?int $keyId = null,
?string $fingerprint = null, int $page = 1, int $limit = 10): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/keys";
// Prepare the URI.
$uri = $this->uri->get($path);
// Add the optional query parameters.
if ($keyId !== null)
{
$uri->setVar('key_id', $keyId);
}
if ($fingerprint !== null)
{
$uri->setVar('fingerprint', $fingerprint);
}
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the GET request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Add a key to a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $key The public key.
* @param string $title The title of the key.
* @param bool $readOnly Whether the key is read-only.
*
* @return object|null
* @since 3.2.0
**/
public function add(
string $owner,
string $repo,
string $key,
string $title,
bool $readOnly
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/keys";
// Set the key data.
$data = new \stdClass();
$data->key = $key;
$data->title = $title;
$data->read_only = $readOnly;
// Send the POST request.
return $this->response->get(
$this->http->post(
$this->uri->get($path),
json_encode($data)
), 201
);
}
/**
* Get a repository's key by id.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $id The key ID.
*
* @return object|null
* @since 3.2.0
*/
public function id(
string $owner,
string $repo,
int $id
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/keys/{$id}";
// Send the GET request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Delete a key from a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $id The key ID.
*
* @return string
* @since 3.2.0
**/
public function delete(
string $owner,
string $repo,
int $id
): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/keys/{$id}";
// Send the DELETE request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}
PK5g�[���kkRepository/Languages.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Languages
*
* @since 3.2.0
*/
class Languages extends Api
{
/**
* Get languages and number of bytes of code written in a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
*
* @return object|null
* @since 3.2.0
**/
public function getLanguages(string $owner, string $repo): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/languages";
// Build the URI.
$uri = $this->uri->get($path);
// Send the GET request.
return $this->response->get(
$this->http->get($uri)
);
}
}
PK5g�[M�ʹ�Repository/Media.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Media
*
* @since 3.2.0
*/
class Media extends Api
{
/**
* Get a file or its LFS object from a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $filepath The file path.
* @param string|null $ref The name of the commit/branch/tag. (Optional)
*
* @return string
* @since 3.2.0
*/
public function get(
string $owner,
string $repo,
string $filepath,
?string $ref = null
): string
{
// Build the request path.
$encodedFilepath = rawurlencode($filepath);
$path = "/repos/{$owner}/{$repo}/media/{$encodedFilepath}";
// Prepare the URI.
$uri = $this->uri->get($path);
// Add the 'ref' query parameter if provided.
if ($ref !== null)
{
$uri->setVar('ref', $ref);
}
// Send the GET request.
return $this->response->get(
$this->http->get($uri), 200, 'success'
);
}
}
PK5g�[C(y�Repository/Merge.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Merge
*
* @since 3.2.0
*/
class Merge extends Api
{
/**
* Check if a pull request has been merged.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $index The pull request index.
*
* @return string
* @since 3.2.0
**/
public function check(
string $owner,
string $repo,
int $index
): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/pulls/{$index}/merge";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Merge a pull request.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $index The pull request index.
* @param string|null $mergeMethod Merge method to use (optional).
* @param string|null $mergeCommitId Merge commit ID (optional).
* @param string|null $mergeMessageField Merge message field
(optional).
* @param string|null $mergeTitleField Merge title field (optional).
* @param bool|null $deleteBranchAfterMerge Delete branch after merge
(optional).
* @param bool|null $forceMerge Force merge (optional).
* @param string|null $headCommitId Head commit ID (optional).
* @param bool|null $mergeWhenChecksSucceed Merge when checks succeed
(optional).
*
* @return string
* @since 3.2.0
**/
public function pull(
string $owner,
string $repo,
int $index,
?string $mergeMethod = null,
?string $mergeCommitId = null,
?string $mergeMessageField = null,
?string $mergeTitleField = null,
?bool $deleteBranchAfterMerge = null,
?bool $forceMerge = null,
?string $headCommitId = null,
?bool $mergeWhenChecksSucceed = null
): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/pulls/{$index}/merge";
// Set the merge data.
$data = new \stdClass();
if ($mergeMethod !== null)
{
$data->do = $mergeMethod;
}
if ($mergeCommitId !== null)
{
$data->merge_commit_id = $mergeCommitId;
}
if ($mergeMessageField !== null)
{
$data->merge_message_field = $mergeMessageField;
}
if ($mergeTitleField !== null)
{
$data->merge_title_field = $mergeTitleField;
}
if ($deleteBranchAfterMerge !== null)
{
$data->delete_branch_after_merge = $deleteBranchAfterMerge;
}
if ($forceMerge !== null)
{
$data->force_merge = $forceMerge;
}
if ($headCommitId !== null)
{
$data->head_commit_id = $headCommitId;
}
if ($mergeWhenChecksSucceed !== null)
{
$data->merge_when_checks_succeed = $mergeWhenChecksSucceed;
}
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 200, 'success'
);
}
/**
* Cancel the scheduled auto merge for a pull request.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $index The pull request index.
*
* @return string
* @since 3.2.0
**/
public function cancel(
string $owner,
string $repo,
int $index
): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/pulls/{$index}/merge";
// Get the URI with the path.
$uri = $this->uri->get($path);
// Send the delete request.
return $this->response->get(
$this->http->delete($uri), 204, 'success'
);
}
}
PK5g�[E�[ZRepository/Mirror.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Mirror
*
* @since 3.2.0
*/
class Mirror extends Api
{
/**
* Sync a mirrored repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
*
* @return string
* @since 3.2.0
*/
public function sync(string $owner, string $repo): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/mirror-sync";
// Send the POST request.
return $this->response->get(
$this->http->post(
$this->uri->get($path)
), 200, 'success'
);
}
}
PK5g�[�f�<<Repository/Mirrors.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Mirrors
*
* @since 3.2.0
*/
class Mirrors extends Api
{
/**
* Get all push mirrors of the repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $page The page number of results to return (1-based).
* @param int $limit The page size of results.
*
* @return array|null
* @since 3.2.0
*/
public function get(
string $owner,
string $repo,
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/push_mirrors";
// Set query parameters.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Add a push mirror to the repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $remoteAddress The push mirror address.
* @param string|null $remoteUsername The push mirror user. (Optional)
* @param string|null $remotePassword The push mirror password.
(Optional)
* @param string $interval The interval for the push mirror.
* @param bool $syncOnCommit Sync on commit option.
*
* @return object|null
* @since 3.2.0
*/
public function add(
string $owner,
string $repo,
string $remoteAddress,
?string $remoteUsername = null,
?string $remotePassword = null,
string $interval,
bool $syncOnCommit
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/push_mirrors";
// Set the mirror data.
$data = new \stdClass();
$data->remote_address = $remoteAddress;
$data->interval = $interval;
$data->sync_on_commit = $syncOnCommit;
if ($remoteUsername !== null)
{
$data->remote_username = $remoteUsername;
}
if ($remotePassword !== null)
{
$data->remote_password = $remotePassword;
}
// Send the request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 201
);
}
/**
* Sync all push mirrored repositories.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
*
* @return string
* @since 3.2.0
*/
public function sync(
string $owner,
string $repo
): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/push_mirrors-sync";
// Send the request.
return $this->response->get(
$this->http->post(
$this->uri->get($path)
), 200, 'success'
);
}
/**
* Get push mirror of the repository by remoteName.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $name The remote name.
*
* @return object|null
* @since 3.2.0
*/
public function name(
string $owner,
string $repo,
string $name
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/push_mirrors/{$name}";
// Get the URI with the path.
$uri = $this->uri->get($path);
// Send the request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Delete a push mirror from a repository by remoteName.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $name The remote name.
*
* @return string
* @since 3.2.0
*/
public function delete(
string $owner,
string $repo,
string $name
): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/push_mirrors/{$name}";
// Get the URI with the path.
$uri = $this->uri->get($path);
// Send the request.
return $this->response->get(
$this->http->delete($uri), 204, 'success'
);
}
}
PK5g�[N{���Repository/Notes.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Notes
*
* @since 3.2.0
*/
class Notes extends Api
{
/**
* Get a note corresponding to a single commit from a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $commitSha The SHA hash of the commit.
*
* @return object|null
* @since 3.2.0
**/
public function get(
string $owner,
string $repo,
string $commitSha
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/git/notes/{$commitSha}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
}
PK5g�[�=9Έ
�
Repository/Patch.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Patch
*
* @since 3.2.0
*/
class Patch extends Api
{
/**
* Apply a diff patch to a repository.
*
* @param string $owner The owner of the repo.
* @param string $repo The name of the repo.
* @param array $options Options for updating files.
* $options = [
* 'description' => 'UpdateFileOptions',
* 'body' => [
* 'content' => 'string', // Content must
be base64 encoded.
* 'sha' => 'string', // The SHA for the
file that already exists.
* 'branch' => 'string', // Branch
(optional) to base this file from. If not given, the default branch is
used.
* 'new_branch' => 'string', // New branch
(optional) will make a new branch from branch before creating the file.
* 'from_path' => 'string', // From_path
(optional) is the path of the original file which will be moved/renamed to
the path in the URL.
* 'message' => 'string', // Message
(optional) for the commit of this file. If not supplied, a default message
will be used.
* 'author' => [ // Identity for a person's
identity like an author or committer.
* 'name' => 'string',
* 'email' => 'string($email)'
* ],
* 'committer' => [ // Identity for a person's
identity like an author or committer.
* 'name' => 'string',
* 'email' => 'string($email)'
* ],
* 'dates' => [ // Store dates for GIT_AUTHOR_DATE
and GIT_COMMITTER_DATE.
* 'author' => 'string($date-time)',
* 'committer' =>
'string($date-time)'
* ],
* 'signoff' => 'boolean' // Add a
Signed-off-by trailer by the committer at the end of the commit log
message.
* ]
* ]
*
* @return object|null
* @since 3.2.0
*/
public function applyDiffPatch(
string $owner,
string $repo,
array $option
): ?object
{
// Build the request path.
$uriPath = "/repos/{$owner}/{$repo}/diffpatch";
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($uriPath),
json_encode($options)
)
);
}
}
PK5g�[`����3�3Repository/Pulls.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Pulls
*
* @since 3.2.0
*/
class Pulls extends Api
{
/**
* List a repository's pull requests.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string|null $state State of pull request: open, closed, or all
(optional).
* @param string|null $sort Type of sort (optional).
* @param int|null $milestone ID of the milestone (optional).
* @param array|null $labels Label IDs (optional).
* @param int $page Page number of results to return (1-based, default:
1).
* @param int $limit Page size of results (default: 10).
*
* @return array|null
* @since 3.2.0
*/
public function list(
string $owner,
string $repo,
?string $state = null,
?string $sort = null,
?int $milestone = null,
?array $labels = null,
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/pulls";
// Set query parameters.
$this->uri->setVar('page', $page);
$this->uri->setVar('limit', $limit);
if ($state !== null)
{
$this->uri->setVar('state', $state);
}
if ($sort !== null)
{
$this->uri->setVar('sort', $sort);
}
if ($milestone !== null)
{
$this->uri->setVar('milestone', $milestone);
}
if ($labels !== null)
{
$this->uri->setVar('labels', implode(',',
$labels));
}
// Send the GET request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Create a pull request.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $title The title of the pull request.
* @param string $head The head branch.
* @param string $base The base branch.
* @param string|null $body The description of the pull request
(optional).
* @param string|null $assignee The assignee of the pull request
(optional).
* @param array|null $assignees Additional assignees (optional).
* @param array|null $labels Label IDs (optional).
* @param int|null $milestone ID of the milestone (optional).
* @param string|null $dueDate Due date of the pull request (optional).
*
* @return object|null
* @since 3.2.0
*/
public function create(
string $owner,
string $repo,
string $title,
string $head,
string $base,
?string $body = null,
?string $assignee = null,
?array $assignees = null,
?array $labels = null,
?int $milestone = null,
?string $dueDate = null
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/pulls";
// Set the pull request data.
$data = new \stdClass();
$data->title = $title;
$data->head = $head;
$data->base = $base;
if ($body !== null)
{
$data->body = $body;
}
if ($assignee !== null)
{
$data->assignee = $assignee;
}
if ($assignees !== null)
{
$data->assignees = $assignees;
}
if ($labels !== null)
{
$data->labels = $labels;
}
if ($milestone !== null)
{
$data->milestone = $milestone;
}
if ($dueDate !== null)
{
$data->due_date = $dueDate;
}
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 201
);
}
/**
* Get a pull request.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $index The pull request index.
*
* @return object|null
* @since 3.2.0
**/
public function get(string $owner, string $repo, int $index): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/pulls/{$index}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Update a pull request.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $index The pull request index.
* @param string|null $title The title of the pull request (optional).
* @param string|null $body The description of the pull request
(optional).
* @param string|null $assignee The assignee of the pull request
(optional).
* @param array|null $assignees Additional assignees (optional).
* @param string|null $base The base branch (optional).
* @param string|null $state The state of the pull request (optional).
* @param array|null $labels Label IDs (optional).
* @param int|null $milestone ID of the milestone (optional).
* @param string|null $dueDate Due date of the pull request (optional).
* @param bool|null $unsetDueDate Whether to unset the due date
(optional).
* @param bool|null $allowMaintainerEdit Allow maintainer to edit the
pull request (optional).
*
* @return object|null
* @since 3.2.0
*/
public function update(
string $owner,
string $repo,
int $index,
?string $title = null,
?string $body = null,
?string $assignee = null,
?array $assignees = null,
?string $base = null,
?string $state = null,
?array $labels = null,
?int $milestone = null,
?string $dueDate = null,
?bool $unsetDueDate = null,
?bool $allowMaintainerEdit = null
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/pulls/{$index}";
// Set the pull request data.
$data = new \stdClass();
if ($title !== null)
{
$data->title = $title;
}
if ($body !== null)
{
$data->body = $body;
}
if ($assignee !== null)
{
$data->assignee = $assignee;
}
if ($assignees !== null)
{
$data->assignees = $assignees;
}
if ($base !== null)
{
$data->base = $base;
}
if ($state !== null)
{
$data->state = $state;
}
if ($labels !== null)
{
$data->labels = $labels;
}
if ($milestone !== null)
{
$data->milestone = $milestone;
}
if ($dueDate !== null)
{
$data->due_date = $dueDate;
}
if ($unsetDueDate !== null)
{
$data->unset_due_date = $unsetDueDate;
}
if ($allowMaintainerEdit !== null)
{
$data->allow_maintainer_edit = $allowMaintainerEdit;
}
// Send the patch request.
return $this->response->get(
$this->http->patch(
$this->uri->get($path), json_encode($data)
), 201
);
}
/**
* Get a pull request diff or patch.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $index The pull request index.
* @param string $diffType The type of the requested data, either
"diff" or "patch".
* @param bool $binary Whether to include binary file changes. If
true, the diff is applicable with git apply.
*
* @return string
* @since 3.2.0
**/
public function diff(
string $owner,
string $repo,
int $index,
string $diffType,
bool $binary = false
): string
{
// Validate the diff type.
if (!in_array($diffType, ['diff', 'patch']))
{
throw new \InvalidArgumentException('Invalid diff type. Allowed
types are "diff" and "patch".');
}
// Build the request path.
$path = "/repos/{$owner}/{$repo}/pulls/{$index}.{$diffType}";
// Get the URI with the path.
$uri = $this->uri->get($path);
// Set the binary query parameter if required.
if ($binary)
{
$uri->setVar('binary', 'true');
}
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Get commits for a pull request.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $index The pull request index.
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function commits(
string $owner,
string $repo,
int $index,
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/pulls/{$index}/commits";
// Get the URI with the path.
$uri = $this->uri->get($path);
// Set the page and limit query parameters.
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Get changed files for a pull request.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $index The pull request index.
* @param string $skipTo Skip to the given file.
* @param string $whitespace Whitespace behavior.
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function files(
string $owner,
string $repo,
int $index,
?string $skipTo = null,
?string $whitespace = null,
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/pulls/{$index}/files";
// Get the URI with the path.
$uri = $this->uri->get($path);
// Set the skip-to, whitespace, page, and limit query parameters if
needed.
if ($skipTo !== null)
{
$uri->setVar('skip-to', $skipTo);
}
if ($whitespace !== null)
{
$uri->setVar('whitespace', $whitespace);
}
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Merge a pull request.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $index The pull request index.
* @param string|null $do Merge method.
* @param string|null $mergeCommitId Merge commit ID.
* @param string|null $mergeMessageField Merge message field.
* @param string|null $mergeTitleField Merge title field.
* @param bool|null $deleteBranchAfterMerge Whether to delete the
branch after merge.
* @param bool|null $forceMerge Whether to force merge.
* @param string|null $headCommitId Head commit ID.
* @param bool|null $mergeWhenChecksSucceed Whether to merge when
checks succeed.
*
* @return string
* @since 3.2.0
**/
public function merge(
string $owner,
string $repo,
int $index,
?string $do = null,
?string $mergeCommitId = null,
?string $mergeMessageField = null,
?string $mergeTitleField = null,
?bool $deleteBranchAfterMerge = null,
?bool $forceMerge = null,
?string $headCommitId = null,
?bool $mergeWhenChecksSucceed = null
): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/pulls/{$index}/merge";
// Set the merge data.
$data = new \stdClass();
if ($do !== null)
{
$data->do = $do;
}
if ($mergeCommitId !== null)
{
$data->merge_commit_id = $mergeCommitId;
}
if ($mergeMessageField !== null)
{
$data->merge_message_field = $mergeMessageField;
}
if ($mergeTitleField !== null)
{
$data->merge_title_field = $mergeTitleField;
}
if ($deleteBranchAfterMerge !== null)
{
$data->delete_branch_after_merge = $deleteBranchAfterMerge;
}
if ($forceMerge !== null)
{
$data->force_merge = $forceMerge;
}
if ($headCommitId !== null)
{
$data->head_commit_id = $headCommitId;
}
if ($mergeWhenChecksSucceed !== null)
{
$data->merge_when_checks_succeed = $mergeWhenChecksSucceed;
}
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 200, 'success'
);
}
/**
* Merge PR's baseBranch into headBranch.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $index The pull request index.
* @param string|null $style How to update the pull request. (Optional)
*
* @return string
* @since 3.2.0
*/
public function update(
string $owner,
string $repo,
int $index,
?string $style = null
): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/pulls/{$index}/update";
// Set the merge data.
$data = new \stdClass();
if ($style !== null)
{
$data->style = $style;
}
// Send the request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 200, 'success'
);
}
}
PK6g�[9��]xxRepository/Refs.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Refs
*
* @since 3.2.0
*/
class Refs extends Api
{
/**
* Get specified ref or filtered repository's refs.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
*
* @return array|null
* @since 3.2.0
**/
public function list(string $owner, string $repo): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/git/refs";
// Build the URI.
$uri = $this->uri->get($path);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Get specified ref.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $ref The ref name.
*
* @return array|null
* @since 3.2.0
**/
public function get(
string $owner,
string $repo,
string $ref
): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/git/refs/{$ref}";
// Build the URI.
$uri = $this->uri->get($path);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
}
PK6g�[,���Repository/Releases.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Releases
*
* @since 3.2.0
*/
class Releases extends Api
{
/**
* List a repo's releases.
*
* @param string $ownerName The owner name.
* @param string $repoName The repository name.
* @param bool|null $draft Filter (exclude/include) drafts (optional).
* @param bool|null $preRelease Filter (exclude/include) pre-releases
(optional).
* @param int $page Page number of results to return (1-based,
optional).
* @param int $limit Page size of results (optional).
*
* @return array|null
* @since 3.2.0
*/
public function list(
string $ownerName,
string $repoName,
?bool $draft = null,
?bool $preRelease = null,
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = "/repos/{$ownerName}/{$repoName}/releases";
// Set additional URI values.
$this->uri->setVar('page', $page);
$this->uri->setVar('limit', $limit);
if ($draft !== null)
{
$this->uri->setVar('draft', $draft);
}
if ($preRelease !== null)
{
$this->uri->setVar('pre-release', $preRelease);
}
// Send the request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Create a release.
*
* @param string $ownerName The owner name.
* @param string $repoName The repository name.
* @param string $tagName The tag name.
* @param string $targetCommitish The commitish value that determines
where the Git tag is created from.
* @param string $releaseName The name of the release.
* @param string $releaseBody The description of the release.
* @param bool $isDraft Whether the release is a draft.
* @param bool $isPrerelease Whether the release is a pre-release.
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $ownerName,
string $repoName,
string $tagName,
string $targetCommitish,
string $releaseName,
string $releaseBody,
bool $isDraft = false,
bool $isPrerelease = false
): ?object
{
// Build the request path.
$path = "/repos/{$ownerName}/{$repoName}/releases";
// Set the release data
$data = new \stdClass();
$data->tag_name = $tagName;
$data->target_commitish = $targetCommitish;
$data->name = $releaseName;
$data->body = $releaseBody;
$data->draft = $isDraft;
$data->prerelease = $isPrerelease;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 201
);
}
/**
* Get a release by ID.
*
* @param string $ownerName The owner name.
* @param string $repoName The repository name.
* @param int $releaseId The release ID.
*
* @return object|null
* @since 3.2.0
**/
public function get(
string $ownerName,
string $repoName,
int $releaseId
): ?object
{
// Build the request path.
$path =
"/repos/{$ownerName}/{$repoName}/releases/{$releaseId}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Delete a release by ID.
*
* @param string $ownerName The owner name.
* @param string $repoName The repository name.
* @param int $releaseId The release ID.
*
* @return string
* @since 3.2.0
**/
public function delete(
string $ownerName,
string $repoName,
int $releaseId
): string
{
// Build the request path.
$path =
"/repos/{$ownerName}/{$repoName}/releases/{$releaseId}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Update a release.
*
* @param string $ownerName The owner name.
* @param string $repoName The repository name.
* @param int $releaseId The release ID.
* @param string|null $tagName The tag name (optional).
* @param string|null $targetCommitish The commitish value that
determines where the Git tag is created from (optional).
* @param string|null $releaseName The name of the release (optional).
* @param string|null $description The description of the release
(optional).
* @param bool|null $isDraft Whether the release is a draft
(optional).
* @param bool|null $isPrerelease Whether the release is a pre-release
(optional).
*
* @return object|null
* @since 3.2.0
**/
public function update(
string $ownerName,
string $repoName,
int $releaseId,
?string $tagName = null,
?string $targetCommitish = null,
?string $releaseName = null,
?string $description = null,
?bool $isDraft = null,
?bool $isPrerelease = null
): ?object
{
// Build the request path.
$path =
"/repos/{$ownerName}/{$repoName}/releases/{$releaseId}";
// Set the release data
$data = new \stdClass();
if ($tagName !== null || $targetCommitish !== null || $releaseName !==
null || $description !== null || $isDraft !== null || $isPrerelease !==
null)
{
$data->editReleaseOption = new \stdClass();
if ($tagName !== null)
{
$data->editReleaseOption->tag_name = $tagName;
}
if ($targetCommitish !== null)
{
$data->editReleaseOption->target_commitish = $targetCommitish;
}
if ($releaseName !== null)
{
$data->editReleaseOption->name = $releaseName;
}
if ($description !== null)
{
$data->editReleaseOption->body = $description;
}
if ($isDraft !== null)
{
$data->editReleaseOption->draft = $isDraft;
}
if ($isPrerelease !== null)
{
$data->editReleaseOption->prerelease = $isPrerelease;
}
}
// Send the patch request.
return $this->response->get(
$this->http->patch(
$this->uri->get($path), json_encode($data)
)
);
}
/**
* Get a release by tag name.
*
* @param string $ownerName The owner name.
* @param string $repoName The repository name.
* @param string $tagName The tag name.
*
* @return object|null
* @since 3.2.0
**/
public function getByTag(
string $ownerName,
string $repoName,
string $tagName
): ?object
{
// Build the request path.
$path =
"/repos/{$ownerName}/{$repoName}/releases/tags/{$tagName}";
// Configure the URI with the path.
$this->uri->setVar('owner', $ownerName);
$this->uri->setVar('repo', $repoName);
$this->uri->setVar('tag', $tagName);
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Delete a release by tag name.
*
* @param string $ownerName The owner name.
* @param string $repoName The repository name.
* @param string $tagName The tag name.
*
* @return string
* @since 3.2.0
**/
public function deleteByTag(
string $ownerName,
string $repoName,
string $tagName
): string
{
// Build the request path.
$path =
"/repos/{$ownerName}/{$repoName}/releases/tags/{$tagName}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}
PK6g�[
�[
[
Repository/Remote.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Remote
*
* @since 3.2.0
*/
class Remote extends Api
{
/**
* Migrate a remote git repository.
*
* @param string $cloneAddr The URL to clone the repository
from.
* @param string $repoName The desired name for the new
repository.
* @param string $repoOwner The name of the user or organization
who will own the repo after migration.
* @param string $uid The ID of the user that will own the
new repository (deprecated).
* @param string $description The description for the new
repository (optional).
* @param bool $private Set the repository to private
(optional, default false).
* @param string|null $authToken Authentication token (optional).
* @param string|null $authUsername Authentication username
(optional).
* @param string|null $authPassword Authentication password
(optional).
* @param array $options Additional migration options
(optional).
*
* @return object|null
* @since 3.2.0
**/
public function migrate(
string $cloneAddr,
string $repoName,
string $repoOwner,
string $uid,
string $description = '',
bool $private = false,
?string $authToken = null,
?string $authUsername = null,
?string $authPassword = null,
array $options = []
): ?object
{
// Build the request path.
$path = "/repos/migrate";
// Set the repository migration data.
$data = new \stdClass();
$data->cloneAddr = $cloneAddr;
$data->repoName = $repoName;
$data->repoOwner = $repoOwner;
$data->uid = $uid;
$data->description = $description;
$data->private = $private;
if ($authToken !== null)
{
$data->authToken = $authToken;
}
if ($authUsername !== null)
{
$data->authUsername = $authUsername;
}
if ($authPassword !== null)
{
$data->authPassword = $authPassword;
}
foreach ($options as $key => $val)
{
$data->{$key} = $val;
}
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 201
);
}
}
PK6g�[���JJRepository/Reviewers.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Reviewers
*
* @since 3.2.0
*/
class Reviewers extends Api
{
/**
* Create review requests for a pull request.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $index The pull request index.
* @param array $reviewers Array of reviewers usernames.
* @param array|null $teamReviewers Array of team reviewers
(optional).
*
* @return array|null
* @since 3.2.0
**/
public function request(
string $owner,
string $repo,
int $index,
array $reviewers,
?array $teamReviewers = null
): ?array
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/pulls/{$index}/requested_reviewers";
// Set the review requests data.
$data = new \stdClass();
$data->reviewers = $reviewers;
if ($teamReviewers !== null)
{
$data->team_reviewers = $teamReviewers;
}
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 201
);
}
/**
* Cancel review requests for a pull request.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $index The pull request index.
* @param array $reviewers Array of reviewers usernames.
* @param array|null $teamReviewers Array of team reviewers
(optional).
*
* @return string
* @since 3.2.0
**/
public function cancel(
string $owner,
string $repo,
int $index,
array $reviewers,
?array $teamReviewers = null
): string
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/pulls/{$index}/requested_reviewers";
// Get the URI and set the required variables.
$uri = $this->uri->get($path);
$uri->setVar('reviewers', json_encode($reviewers));
if ($teamReviewers !== null)
{
$uri->setVar('teamReviewers',
json_encode($teamReviewers));
}
// Send the delete request.
return $this->response->get(
$this->http->delete($uri), 204, 'success'
);
}
/**
* Return all users that can be requested to review in this repo.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
*
* @return array|null
* @since 3.2.0
**/
public function get(string $owner, string $repo): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/reviewers";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
}
PK6g�[�8���Repository/Reviews.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Reviews
*
* @since 3.2.0
*/
class Reviews extends Api
{
/**
* List all reviews for a pull request.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $index The pull request index.
* @param int $page The page number of results to return (1-based).
* @param int $limit The page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
string $owner,
string $repo,
int $index,
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/pulls/{$index}/reviews";
// Get the URI.
$uri = $this->uri->get($path);
// Set query parameters.
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Create a review for a pull request.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $index The pull request index.
* @param string $body The review body text.
* @param string $event The review event type (APPROVE, REQUEST_CHANGES,
COMMENT).
* @param array|null $comments An array of CreatePullReviewComment
objects.
* @param string|null $commitId The commit ID.
*
* @return object|null
* @since 3.2.0
*/
public function create(
string $owner,
string $repo,
int $index,
string $body,
string $event,
?array $comments = null,
?string $commitId = null
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/pulls/{$index}/reviews";
// Set the review data.
$data = new \stdClass();
$data->body = $body;
$data->event = $event;
// Add comments if available.
if ($comments !== null)
{
$data->comments = $comments;
}
// Add commitId if available.
if ($commitId !== null)
{
$data->commit_id = $commitId;
}
// Send the request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
)
);
}
/**
* Get a specific review for a pull request.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $index The pull request index.
* @param int $id The review ID.
*
* @return object|null
* @since 3.2.0
*/
public function get(
string $owner,
string $repo,
int $index,
int $id
): ?object
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/pulls/{$index}/reviews/{$id}";
// Set the variables for the URI.
$uri = $this->uri->get($path);
$uri->setVar('owner', $owner);
$uri->setVar('repo', $repo);
$uri->setVar('index', $index);
$uri->setVar('id', $id);
// Send the request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Submit a pending review to a pull request.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $index The pull request index.
* @param int $id The review ID.
* @param string $body The review body text.
* @param string $event The review event type (APPROVE, REQUEST_CHANGES,
COMMENT).
*
* @return object|null
* @since 3.2.0
*/
public function submit(
string $owner,
string $repo,
int $index,
int $id,
string $body,
string $event
): ?object
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/pulls/{$index}/reviews/{$id}";
// Set the review data.
$data = new \stdClass();
$data->body = $body;
$data->event = $event;
// Send the request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
)
);
}
/**
* Delete a specific review from a pull request.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $index The pull request index.
* @param int $id The review ID.
*
* @return string
* @since 3.2.0
*/
public function delete(
string $owner,
string $repo,
int $index,
int $id
): string
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/pulls/{$index}/reviews/{$id}";
// Set the variables for the URI.
$uri = $this->uri->get($path);
$uri->setVar('owner', $owner);
$uri->setVar('repo', $repo);
$uri->setVar('index', $index);
$uri->setVar('id', $id);
// Send the delete request.
return $this->response->get(
$this->http->delete($uri), 204, 'success'
);
}
/**
* Get the comments of a specific review for a pull request.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $index The pull request index.
* @param int $id The review ID.
*
* @return array|null
* @since 3.2.0
*/
public function comments(
string $owner,
string $repo,
int $index,
int $id
): ?array
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/pulls/{$index}/reviews/{$id}/comments";
// Set the variables for the URI.
$uri = $this->uri->get($path);
$uri->setVar('owner', $owner);
$uri->setVar('repo', $repo);
$uri->setVar('index', $index);
$uri->setVar('id', $id);
// Send the request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Dismiss a review for a pull request.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $index The pull request index.
* @param int $id The review ID.
* @param string $message The dismissal message.
* @param bool $priors The flag to dismiss prior reviews.
*
* @return object|null
* @since 3.2.0
*/
public function dismiss(
string $owner,
string $repo,
int $index,
int $id,
string $message,
bool $priors = false
): ?object
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/pulls/{$index}/reviews/{$id}/dismissals";
// Set the dismissal data.
$data = new \stdClass();
$data->message = $message;
$data->priors = $priors;
// Send the request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
)
);
}
/**
* Cancel the dismissal of a review for a pull request.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $index The pull request index.
* @param int $id The review ID.
*
* @return object|null
* @since 3.2.0
*/
public function undismiss(
string $owner,
string $repo,
int $index,
int $id
): ?object
{
// Build the request path.
$path =
"/repos/{$owner}/{$repo}/pulls/{$index}/reviews/{$id}/undismissals";
// Send the request.
return $this->response->get(
$this->http->post(
$this->uri->get($path)
)
);
}
}
PK6g�[�}vC]]Repository/Stargazers.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Stargazers
*
* @since 3.2.0
*/
class Stargazers extends Api
{
/**
* List a repo's stargazers.
*
* @param string $ownerName The owner name.
* @param string $repoName The repository name.
* @param int $page The page number of results to return
(1-based).
* @param int $limit The page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
string $ownerName,
string $repoName,
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = "/repos/{$ownerName}/{$repoName}/stargazers";
// Set the page and limit values.
$this->uri->setVar('page', $page);
$this->uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
}
PK6g�[�e�177Repository/Statuses.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Statuses
*
* @since 3.2.0
*/
class Statuses extends Api
{
/**
* Get a commit's statuses.
*
* @param string $ownerName The owner name.
* @param string $repoName The repository name.
* @param string $commitSha The commit SHA.
* @param string $sort The type of sort.
* @param string $state The type of state.
* @param int $page The page number of results to return
(1-based).
* @param int $limit The page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function get(
string $ownerName,
string $repoName,
string $commitSha,
string $sort = 'recentupdate',
string $state = 'pending',
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path =
"/repos/{$ownerName}/{$repoName}/statuses/{$commitSha}";
// Prepare the URI with the path.
$uri = $this->uri->get($path);
// Set the query parameters.
$uri->setVar('sort', $sort);
$uri->setVar('state', $state);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Create a commit status.
*
* @param string $ownerName The owner name.
* @param string $repoName The repository name.
* @param string $commitSha The commit SHA.
* @param string $state The commit status state (error, failure,
pending, success, or warning).
* @param string|null $context The context of the status (optional).
* @param string|null $statusDescription The status description
(optional).
* @param string|null $targetUrl The URL of the associated build
status (optional).
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $ownerName,
string $repoName,
string $commitSha,
string $state,
?string $context = null,
?string $statusDescription = null,
?string $targetUrl = null
): ?object
{
// Build the request path.
$path =
"/repos/{$ownerName}/{$repoName}/statuses/{$commitSha}";
// Set the commit status data
$data = new \stdClass();
$data->state = $state;
if ($context !== null)
{
$data->context = $context;
}
if ($statusDescription !== null)
{
$data->description = $statusDescription;
}
if ($targetUrl !== null)
{
$data->target_url = $targetUrl;
}
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 201
);
}
}
PK6g�[j�1��Repository/Tags.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Tags
*
* @since 3.2.0
*/
class Tags extends Api
{
/**
* List a repository's tags
*
* @param string $owner The owner of the repo.
* @param string $repo The name of the repo.
* @param int|null $page The page number of results to return
(1-based).
* @param int|null $limit The page size of results, default maximum
page size is 10.
*
* @return array|null
* @since 3.2.0
**/
public function list(
string $owner,
string $repo,
?int $page = 1,
?int $limit = 10
): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/tags";
// Get the URI with the path.
$uri = $this->uri->get($path);
// Add query parameters if they are provided.
if ($page !== null)
{
$uri->setVar('page', $page);
}
if ($limit !== null)
{
$uri->setVar('limit', $limit);
}
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Get the tag of a repository by tag name.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $tag The tag name.
*
* @return object|null
* @since 3.2.0
**/
public function get(string $owner, string $repo, string $tag): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/tags/{$tag}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Get the tag object of an annotated tag (not lightweight tags).
*
* @param string $owner The owner of the repo.
* @param string $repo The name of the repo.
* @param string $sha The sha of the tag. The Git tags API only
supports annotated tag objects, not lightweight tags.
*
* @return object|null
* @since 3.2.0
**/
public function sha(
string $owner,
string $repo,
string $sha
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/git/tags/{$sha}";
// Get the URI with the path.
$uri = $this->uri->get($path);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Create a new git tag in a repository.
*
* @param string $owner The owner of the repo.
* @param string $repo The name of the repo.
* @param string $tagName The name of the tag.
* @param string $target The SHA of the git object this is
tagging.
* @param string $message The tag message.
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $owner,
string $repo,
string $tagName,
string $target,
string $message
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/tags";
// Set the tag data
$data = new \stdClass();
$data->tag_name = $tagName;
$data->target = $target;
$data->message = $message;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
)
);
}
/**
* Delete a repository's tag by name.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $tag The tag name.
*
* @return string
* @since 3.2.0
**/
public function delete(
string $owner,
string $repo,
string $tag
): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/tags/{$tag}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'succes'
);
}
}
PK6g�[j:J��Repository/Teams.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Teams
*
* @since 3.2.0
*/
class Teams extends Api
{
/**
* List a repository's teams.
*
* @param string $ownerOfRepo The owner name.
* @param string $nameOfRepo The repository name.
*
* @return array|null
* @since 3.2.0
**/
public function list(string $ownerOfRepo, string $nameOfRepo): ?array
{
// Build the request path.
$path = "/repos/{$ownerOfRepo}/{$nameOfRepo}/teams";
// Get the URI with the path.
$uri = $this->uri->get($path);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Check if a team is assigned to a repository.
*
* @param string $ownerOfRepo The owner name.
* @param string $nameOfRepo The repository name.
* @param string $teamName The team name.
*
* @return object|null
* @since 3.2.0
**/
public function check(
string $ownerOfRepo,
string $nameOfRepo,
string $teamName
): ?object
{
// Build the request path.
$path =
"/repos/{$ownerOfRepo}/{$nameOfRepo}/teams/{$teamName}";
// Get the URI with the path.
$uri = $this->uri->get($path);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Add a team to a repository.
*
* @param string $ownerName The owner name.
* @param string $repoName The repository name.
* @param string $teamName The team name.
*
* @return string
* @since 3.2.0
**/
public function add(
string $ownerName,
string $repoName,
string $teamName
): string
{
// Build the request path.
$path = "/repos/{$ownerName}/{$repoName}/teams/{$teamName}";
// Send the put request.
return $this->response->get(
$this->http->put(
$this->uri->get($path), ''
), 204, 'success'
);
}
/**
* Delete a team from a repository.
*
* @param string $ownerName The owner name.
* @param string $repoName The repository name.
* @param string $teamName The team name.
*
* @return string
* @since 3.2.0
**/
public function delete(
string $ownerName,
string $repoName,
string $teamName
): string
{
// Build the request path.
$path = "/repos/{$ownerName}/{$repoName}/teams/{$teamName}";
// Prepare the URI with the path.
$uri = $this->uri->get($path);
// Send the delete request.
return $this->response->get(
$this->http->delete($uri),
204, 'success'
);
}
}
PK6g�[�]77Repository/Templates.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Templates
*
* @since 3.2.0
*/
class Templates extends Api
{
/**
* Get available issue templates for a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
*
* @return array|null
* @since 3.2.0
**/
public function issue(string $owner, string $repo): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issue_templates";
// Get the URI.
$uri = $this->uri->get($path);
// Send the GET request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Create a repository using a template.
*
* @param string $templateOwner The template owner's name.
* @param string $templateRepo The template repository name.
* @param string $name The name of the new repository.
* @param array $options Optional. Additional options for the
new repository.
*
* @return object|null
* @since 3.2.0
**/
public function repo(
string $templateOwner,
string $templateRepo,
string $name,
array $options = []
): ?object
{
// Build the request path.
$path = "/repos/{$templateOwner}/{$templateRepo}/generate";
// Set the repo data.
$data = new \stdClass();
$data->name = $name;
foreach ($options as $key => $value)
{
if ($value !== null)
{
$data->{$key} = $value;
}
}
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path),
json_encode($data)
), 201
);
}
}
PK6g�[�gq��Repository/Times.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Times
*
* @since 3.2.0
*/
class Times extends Api
{
/**
* List a repo's tracked times.
*
* @param string $ownerName The owner name.
* @param string $repoName The repository name.
* @param string $user Optional filter by user (available for issue
managers).
* @param string $since Only show times updated after the given time.
This is a timestamp in RFC 3339 format.
* @param string $before Only show times updated before the given time.
This is a timestamp in RFC 3339 format.
* @param int $page The page number of results to return
(1-based).
* @param int $limit The page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
string $ownerName,
string $repoName,
string $user = null,
string $since = null,
string $before = null,
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = "/repos/{$ownerName}/{$repoName}/times";
// Set the query parameters.
$uri = $this->uri->get($path);
if ($user !== null)
{
$uri->setVar('user', $user);
}
if ($since !== null)
{
$uri->setVar('since', $since);
}
if ($before !== null)
{
$uri->setVar('before', $before);
}
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
}
PK6g�[�jtR��Repository/Topics.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Topics
*
* @since 3.2.0
*/
class Topics extends Api
{
/**
* Get the list of topics that a repository has.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $page The page number of results to return (1-based).
* @param int $limit The page size of results.
*
* @return object|null
* @since 3.2.0
**/
public function get(
string $owner,
string $repo,
int $page = 1,
int $limit = 10
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/topics";
// Set query parameters for pagination.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Replace the list of topics for a repository.
*
* @param string $ownerName The owner name.
* @param string $repoName The repository name.
* @param array $topicNames The new list of topics.
*
* @return string
* @since 3.2.0
**/
public function replace(
string $ownerName,
string $repoName,
array $topicNames
): string
{
// Build the request path.
$path = "/repos/{$ownerName}/{$repoName}/topics";
// Set the topics data.
$data = new \stdClass();
$data->topics = $topicNames;
// Send the put request.
return $this->response->get(
$this->http->put(
$this->uri->get($path),
json_encode($data)
), 204, 'success'
);
}
/**
* Add a topic to a repository.
*
* @param string $ownerName The owner name.
* @param string $repoName The repository name.
* @param string $topicName The topic to add.
*
* @return string
* @since 3.2.0
**/
public function add(
string $ownerName,
string $repoName,
string $topicName
): string
{
// Build the request path.
$path = "/repos/{$ownerName}/{$repoName}/topics/{$topicName}";
// Send the put request.
return $this->response->get(
$this->http->put(
$this->uri->get($path), ''
), 204, 'success'
);
}
/**
* Delete a topic from a repository.
*
* @param string $ownerName The owner name.
* @param string $repoName The repository name.
* @param string $topicName The topic to delete.
*
* @return string
* @since 3.2.0
**/
public function delete(
string $ownerName,
string $repoName,
string $topicName
): string
{
// Build the request path.
$path = "/repos/{$ownerName}/{$repoName}/topics/{$topicName}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Search topics via keyword.
*
* @param string $searchKeyword The keyword to search for.
* @param int $page The page number of results to return
(1-based).
* @param int $limit The page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function search(
string $searchKeyword,
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = "/topics/search";
// Set the query parameters.
$uri = $this->uri->get($path);
$uri->setVar('q', $searchKeyword);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
}
PK6g�[AV�j j Repository/Transfer.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Transfer
*
* @since 3.2.0
*/
class Transfer extends Api
{
/**
* Transfer a repo ownership.
*
* @param string $owner The current owner name.
* @param string $repo The repository name.
* @param string $newOwner The new owner's name.
* @param array|null $teamIDs Optional. The IDs of the teams that will be
granted access.
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $owner,
string $repo,
string $newOwner,
?array $teamIDs = null
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/transfer";
// Set the transfer data.
$data = new \stdClass();
$data->new_owner = $newOwner;
if ($teamIDs !== null)
{
$data->team_ids = $teamIDs;
}
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path),
json_encode($data)
), 202
);
}
/**
* Accept a repo transfer.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
*
* @return object|null
* @since 3.2.0
**/
public function accept(string $owner, string $repo): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/transfer/accept";
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path)
), 202
);
}
/**
* Reject a repo transfer.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
*
* @return object|null
* @since 3.2.0
**/
public function reject(string $owner, string $repo): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/transfer/reject";
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path)
)
);
}
}
PK6g�[�X��Repository/Trees.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Trees
*
* @since 3.2.0
*/
class Trees extends Api
{
/**
* Get the tree of a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $sha The commit SHA.
* @param bool $recursive Show all directories and files.
* @param int $page Page number.
* @param int $perPage Number of items per page.
*
* @return object|null
* @since 3.2.0
**/
public function get(
string $owner,
string $repo,
string $sha,
bool $recursive = false,
int $page = 1,
int $perPage = 30
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/git/trees/{$sha}";
// Set URI variables.
$uri = $this->uri->get($path);
$uri->setVar('recursive', $recursive);
$uri->setVar('page', $page);
$uri->setVar('per_page', $perPage);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
}
PK6g�[
�̆K
K
Repository/Watchers.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Watchers
*
* @since 3.2.0
*/
class Watchers extends Api
{
/**
* List a repo's watchers.
*
* @param string $ownerName The owner name.
* @param string $repoName The repository name.
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
string $ownerName,
string $repoName,
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = "/repos/{$ownerName}/{$repoName}/subscribers";
// Prepare the URI with the path.
$uri = $this->uri->get($path);
// Set the page and limit query parameters.
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Check if the current user is watching a repo.
*
* @param string $ownerName The owner name.
* @param string $repoName The repository name.
*
* @return object|null
* @since 3.2.0
**/
public function check(string $ownerName, string $repoName): ?object
{
// Build the request path.
$path = "/repos/{$ownerName}/{$repoName}/subscription";
// Prepare the URI with the path.
$uri = $this->uri->get($path);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Watch a repo.
*
* @param string $ownerName The owner name.
* @param string $repoName The repository name.
* @param bool $subscribed Determine if notifications should be
received from this repository.
* @param bool $ignored Determine if all notifications should be
blocked from this repository.
*
* @return object|null
* @since 3.2.0
**/
public function watch(
string $ownerName,
string $repoName,
bool $subscribed = true,
bool $ignored = false
): ?object
{
// Build the request path.
$path = "/repos/{$ownerName}/{$repoName}/subscription";
// Set the subscription data
$data = new \stdClass();
$data->subscribed = $subscribed;
$data->ignored = $ignored;
// Send the put request.
return $this->response->get(
$this->http->put(
$this->uri->get($path), json_encode($data)
)
);
}
/**
* Unwatch a repo.
*
* @param string $ownerName The owner name.
* @param string $repoName The repository name.
*
* @return string
* @since 3.2.0
**/
public function unwatch(string $ownerName, string $repoName): string
{
// Build the request path.
$path = "/repos/{$ownerName}/{$repoName}/subscription";
// Prepare the URI with the path.
$uri = $this->uri->get($path);
// Send the delete request.
return $this->response->get(
$this->http->delete($uri), 204, 'success'
);
}
}
PK6g�[�T:ܳ�Repository/Wiki.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository Wiki
*
* @since 3.2.0
*/
class Wiki extends Api
{
/**
* Create a wiki page.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $title The title of the wiki page.
* @param string $contentBase64 The base64 encoded content of the wiki
page.
* @param string|null $message Optional commit message summarizing the
change.
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $owner,
string $repo,
string $title,
string $contentBase64,
?string $message = null
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/wiki/new";
// Set the wiki data.
$data = new \stdClass();
$data->title = $title;
$data->content_base64 = $contentBase64;
if ($message !== null)
{
$data->message = $message;
}
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path),
json_encode($data)
), 201
);
}
/**
* Get a wiki page.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $pageName The name of the wiki page.
*
* @return object|null
* @since 3.2.0
**/
public function get(
string $owner,
string $repo,
string $pageName
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/wiki/page/{$pageName}";
// Set the URI.
$uri = $this->uri->get($path);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Get all wiki pages.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function pages(
string $owner,
string $repo,
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/wiki/pages";
// Set the URI.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Delete a wiki page.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $pageName The name of the wiki page.
*
* @return string
* @since 3.2.0
**/
public function delete(
string $owner,
string $repo,
string $pageName
): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/wiki/page/{$pageName}";
// Get the URI.
$uri = $this->uri->get($path);
// Send the delete request.
return $this->response->get(
$this->http->delete($uri), 204, 'success'
);
}
/**
* Edit a wiki page.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $pageName The name of the wiki page.
* @param string $title The new title of the wiki page.
* @param string $content The new content of the wiki page.
* @param string $message The optional commit message summarizing the
change.
*
* @return object|null
* @since 3.2.0
**/
public function edit(
string $owner,
string $repo,
string $pageName,
string $title,
string $content,
string $message = null
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/wiki/page/{$pageName}";
// Set the wiki data.
$data = new \stdClass();
$data->title = $title;
$data->content_base64 = base64_encode($content);
if ($message !== null)
{
$data->message = $message;
}
// Send the patch request.
return $this->response->get(
$this->http->patch(
$this->uri->get($path),
json_encode($data)
)
);
}
/**
* Get revisions of a wiki page.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $pageName The name of the wiki page.
* @param int $page The page number of results to return
(1-based).
*
* @return object|null
* @since 3.2.0
**/
public function revisions(
string $owner,
string $repo,
string $pageName,
int $page = 1
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/wiki/revisions/{$pageName}";
// Set the page number.
$this->uri->setVar('page', $page);
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
}
PK6g�[�ۚ�K0K0Repository.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Repository
*
* @since 3.2.0
*/
class Repository extends Api
{
/**
* Search for repositories.
*
* @param string $q The search query.
* @param array $options Additional search options
(optional).
* @param int $page The page number (optional).
* @param int $limit The number of items per page
(optional).
* @param string $sort The sort order (optional).
* @param string $order The order direction
(optional).
*
* @return object|null
* @since 3.2.0
**/
public function search(
string $q,
array $options = [],
int $page = 1,
int $limit = 10,
string $sort = 'alpha',
string $order = 'asc'
): ?object
{
// Build the request path.
$path = '/repos/search';
// Create the URI object and set URL values.
$uri = $this->uri->get($path);
$uri->setVar('q', $q);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
$uri->setVar('sort', $sort);
$uri->setVar('order', $order);
foreach ($options as $key => $val)
{
$uri->setVar($key, $val);
}
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Get a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
*
* @return object|null
* @since 3.2.0
**/
public function get(string $owner, string $repo): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Get a repository by owner and repo name.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
*
* @return object|null
* @since 3.2.0
**/
public function id(string $owner, string $repo): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Delete a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
*
* @return string
* @since 3.2.0
**/
public function delete(string $owner, string $repo): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Edit a repository's properties.
*
* @param string $owner The owner
name.
* @param string $repo The repository
name.
* @param string|null $description The repository
description (optional).
* @param string|null $website The repository
website (optional).
* @param bool|null $private Set the
repository to private (optional).
* @param bool|null $hasIssues Set the
repository to have issues (optional).
* @param bool|null $hasWiki Set the
repository to have a wiki (optional).
* @param bool|null $hasProjects Set the
repository to have projects (optional).
* @param bool|null $allowManualMerge Allow manual
merge of pull requests (optional).
* @param bool|null $allowMergeCommits Allow merge
commits for pull requests (optional).
* @param bool|null $allowRebase Allow
rebase-merging pull requests (optional).
* @param bool|null $allowRebaseExplicit Allow rebase
with explicit merge commits (optional).
* @param bool|null $allowRebaseUpdate Allow updating
pull request branch by rebase (optional).
* @param bool|null $allowSquashMerge Allow
squash-merging pull requests (optional).
* @param bool|null $archived
* @param bool|null $archived Set to true to
archive this repository (optional).
* @param bool|null $autodetectManualMerge Enable
AutodetectManualMerge (optional).
* @param string|null $defaultBranch Sets the
default branch for this repository (optional).
* @param bool|null $defaultDeleteBranchAfterMerge Set to true to
delete pr branch after merge by default (optional).
* @param string|null $defaultMergeStyle Set to a merge
style to be used by this repository (optional).
* @param bool|null $enablePrune Enable prune -
remove obsolete remote-tracking references (optional).
* @param object|null $externalTracker External
tracker settings (optional).
* @param object|null $externalWiki External wiki
settings (optional).
* @param bool|null $hasPullRequests Set the
repository to have pull requests (optional).
* @param bool|null $ignoreWhitespaceConflicts Ignore
whitespace for conflicts (optional).
* @param object|null $internalTracker Internal
tracker settings (optional).
* @param string|null $mirrorInterval Set the mirror
interval time (optional).
* @param bool|null $template Set to true to
make this repository a template (optional).
*
* @return object|null
* @since 3.2.0
**/
public function edit(
string $owner,
string $repo,
?string $description = null,
?string $website = null,
?bool $private = null,
?bool $hasIssues = null,
?bool $hasWiki = null,
?bool $hasProjects = null,
?bool $allowManualMerge = null,
?bool $allowMergeCommits = null,
?bool $allowRebase = null,
?bool $allowRebaseExplicit = null,
?bool $allowRebaseUpdate = null,
?bool $allowSquashMerge = null,
?bool $archived = null,
?bool $autodetectManualMerge = null,
?string $defaultBranch = null,
?bool $defaultDeleteBranchAfterMerge = null,
?string $defaultMergeStyle = null,
?bool $enablePrune = null,
?object $externalTracker = null,
?object $externalWiki = null,
?bool $hasPullRequests = null,
?bool $ignoreWhitespaceConflicts = null,
?object $internalTracker = null,
?string $mirrorInterval = null,
?bool $template = null
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}";
// Set the repository properties to update.
$data = new \stdClass();
if ($description !== null)
{
$data->description = $description;
}
if ($website !== null)
{
$data->website = $website;
}
if ($private !== null)
{
$data->private = $private;
}
if ($hasIssues !== null)
{
$data->has_issues = $hasIssues;
}
if ($hasWiki !== null)
{
$data->has_wiki = $hasWiki;
}
if ($hasProjects !== null)
{
$data->has_projects = $hasProjects;
}
// Add the additional properties to update.
if ($allowManualMerge !== null)
{
$data->allow_manual_merge = $allowManualMerge;
}
if ($allowMergeCommits !== null)
{
$data->allow_merge_commits = $allowMergeCommits;
}
if ($allowRebase !== null)
{
$data->allow_rebase = $allowRebase;
}
if ($allowRebaseExplicit !== null)
{
$data->allow_rebase_explicit = $allowRebaseExplicit;
}
if ($allowRebaseUpdate !== null)
{
$data->allow_rebase_update = $allowRebaseUpdate;
}
if ($allowSquashMerge !== null)
{
$data->allow_squash_merge = $allowSquashMerge;
}
if ($archived !== null)
{
$data->archived = $archived;
}
if ($autodetectManualMerge !== null)
{
$data->autodetect_manual_merge = $autodetectManualMerge;
}
if ($defaultBranch !== null)
{
$data->default_branch = $defaultBranch;
}
if ($defaultDeleteBranchAfterMerge !== null)
{
$data->default_delete_branch_after_merge =
$defaultDeleteBranchAfterMerge;
}
if ($defaultMergeStyle !==
null)
{
$data->default_merge_style = $defaultMergeStyle;
}
if ($enablePrune !== null)
{
$data->enable_prune = $enablePrune;
}
if ($externalTracker !== null)
{
$data->external_tracker = $externalTracker;
}
if ($externalWiki !== null)
{
$data->external_wiki = $externalWiki;
}
if ($hasPullRequests !== null)
{
$data->has_pull_requests = $hasPullRequests;
}
if ($ignoreWhitespaceConflicts !== null)
{
$data->ignore_whitespace_conflicts = $ignoreWhitespaceConflicts;
}
if ($internalTracker !== null)
{
$data->internal_tracker = $internalTracker;
}
if ($mirrorInterval !== null)
{
$data->mirror_interval = $mirrorInterval;
}
if ($template !== null)
{
$data->template = $template;
}
// Send the patch request.
return $this->response->get(
$this->http->patch(
$this->uri->get($path), json_encode($data)
)
);
}
/**
* Create a repository.
*
* @param string $name The name of the new repository.
* @param string|null $description Optional. The description of the
new repository.
* @param bool|null $private Optional. Set to true if the new
repository should be private.
* @param bool|null $autoInit Optional. Set to true to
initialize the repository with a README.
* @param string|null $defaultBranch Optional. Default branch of the
repository (used when initializes and in template).
* @param string|null $gitignores Optional. The desired .gitignore
templates to apply.
* @param string|null $issueLabels Optional. Label-Set to use.
* @param string|null $license Optional. The desired license for
the repository.
* @param string|null $readme Optional. Readme of the
repository to create.
* @param bool|null $template Optional. Set to true if the
repository is a template.
* @param string|null $trustModel Optional. TrustModel of the
repository.
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $name,
?string $description = null,
?bool $private = null,
?bool $autoInit = null,
?string $defaultBranch = null,
?string $gitignores = null,
?string $issueLabels = null,
?string $license = null,
?string $readme = null,
?bool $template = null,
?string $trustModel = null
): ?object {
// Build the request path.
$path = "/user/repos";
// Set the repo data.
$data = new \stdClass();
$data->name = $name;
if ($description !== null)
{
$data->description = $description;
}
if ($private !== null)
{
$data->private = $private;
}
if ($autoInit !== null)
{
$data->auto_init = $autoInit;
}
if ($defaultBranch !== null)
{
$data->default_branch = $defaultBranch;
}
if ($gitignores !== null)
{
$data->gitignores = $gitignores;
}
if ($issueLabels !== null)
{
$data->issue_labels = $issueLabels;
}
if ($license !== null)
{
$data->license = $license;
}
if ($readme !== null)
{
$data->readme = $readme;
}
if ($template !== null)
{
$data->template = $template;
}
if ($trustModel !== null)
{
$data->trust_model = $trustModel;
}
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path),
json_encode($data)
), 201
);
}
}
PK6g�[��k^��Service/Admin.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Gitea\Admin\Cron;
use VDM\Joomla\Gitea\Admin\Organizations;
use VDM\Joomla\Gitea\Admin\Unadopted;
use VDM\Joomla\Gitea\Admin\Users;
use VDM\Joomla\Gitea\Admin\Users\Keys;
use VDM\Joomla\Gitea\Admin\Users\Organization;
use VDM\Joomla\Gitea\Admin\Users\Repository;
/**
* The Gitea Admin Service
*
* @since 3.2.0
*/
class Admin implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 3.2.0
*/
public function register(Container $container)
{
$container->alias(Cron::class, 'Gitea.Admin.Cron')
->share('Gitea.Admin.Cron', [$this, 'getCron'],
true);
$container->alias(Organizations::class,
'Gitea.Admin.Organizations')
->share('Gitea.Admin.Organizations', [$this,
'getOrganizations'], true);
$container->alias(Unadopted::class,
'Gitea.Admin.Unadopted')
->share('Gitea.Admin.Unadopted', [$this,
'getUnadopted'], true);
$container->alias(Users::class, 'Gitea.Admin.Users')
->share('Gitea.Admin.Users', [$this, 'getUsers'],
true);
$container->alias(Keys::class, 'Gitea.Admin.Users.Keys')
->share('Gitea.Admin.Users.Keys', [$this,
'getKeys'], true);
$container->alias(Organization::class,
'Gitea.Admin.Users.Organization')
->share('Gitea.Admin.Users.Organization', [$this,
'getOrganization'], true);
$container->alias(Repository::class,
'Gitea.Admin.Users.Repository')
->share('Gitea.Admin.Users.Repository', [$this,
'getRepository'], true);
}
/**
* Get the Cron class
*
* @param Container $container The DI container.
*
* @return Cron
* @since 3.2.0
*/
public function getCron(Container $container): Cron
{
return new Cron(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Organizations class
*
* @param Container $container The DI container.
*
* @return Organizations
* @since 3.2.0
*/
public function getOrganizations(Container $container): Organizations
{
return new Organizations(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Unadopted class
*
* @param Container $container The DI container.
*
* @return Unadopted
* @since 3.2.0
*/
public function getUnadopted(Container $container): Unadopted
{
return new Unadopted(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Users class
*
* @param Container $container The DI container.
*
* @return Users
* @since 3.2.0
*/
public function getUsers(Container $container): Users
{
return new Users(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Keys class
*
* @param Container $container The DI container.
*
* @return Keys
* @since 3.2.0
*/
public function getKeys(Container $container): Keys
{
return new Keys(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Organization class
*
* @param Container $container The DI container.
*
* @return Organization
* @since 3.2.0
*/
public function getOrganization(Container $container): Organization
{
return new Organization(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Repository class
*
* @param Container $container The DI container.
*
* @return Repository
* @since 3.2.0
*/
public function getRepository(Container $container): Repository
{
return new Repository(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
}
PK6g�[�#o,,Service/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK6g�[�QVIIService/Issue.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Gitea\Issue as Issu;
use VDM\Joomla\Gitea\Issue\Comments;
use VDM\Joomla\Gitea\Issue\Repository\Comments as RepoComments;
use VDM\Joomla\Gitea\Issue\Deadline;
use VDM\Joomla\Gitea\Labels;
use VDM\Joomla\Gitea\Issue\Labels as IssueLabels;
use VDM\Joomla\Gitea\Issue\Milestones;
use VDM\Joomla\Gitea\Issue\Reactions;
use VDM\Joomla\Gitea\Issue\Reactions\Comment;
use VDM\Joomla\Gitea\Issue\Stopwatch;
use VDM\Joomla\Gitea\Issue\Subscriptions;
use VDM\Joomla\Gitea\Issue\Timeline;
use VDM\Joomla\Gitea\Issue\Times;
/**
* The Gitea Issue Service
*
* @since 3.2.0
*/
class Issue implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 3.2.0
*/
public function register(Container $container)
{
$container->alias(Issu::class, 'Gitea.Issue')
->share('Gitea.Issue', [$this, 'getIssue'],
true);
$container->alias(Comments::class, 'Gitea.Issue.Comments')
->share('Gitea.Issue.Comments', [$this,
'getComments'], true);
$container->alias(RepoComments::class,
'Gitea.Issue.Repository.Comments')
->share('Gitea.Issue.Repository.Comments', [$this,
'getRepoComments'], true);
$container->alias(Deadline::class, 'Gitea.Issue.Deadline')
->share('Gitea.Issue.Deadline', [$this,
'getDeadline'], true);
$container->alias(Labels::class, 'Gitea.Labels')
->share('Gitea.Labels', [$this, 'getLabels'],
true);
$container->alias(IssueLabels::class, 'Gitea.Issue.Labels')
->share('Gitea.Issue.Labels', [$this,
'getIssueLabels'], true);
$container->alias(Milestones::class,
'Gitea.Issue.Milestones')
->share('Gitea.Issue.Milestones', [$this,
'getMilestones'], true);
$container->alias(Reactions::class,
'Gitea.Issue.Reactions')
->share('Gitea.Issue.Reactions', [$this,
'getReactions'], true);
$container->alias(Comment::class,
'Gitea.Issue.Reactions.Comment')
->share('Gitea.Issue.Reactions.Comment', [$this,
'getComment'], true);
$container->alias(Stopwatch::class,
'Gitea.Issue.Stopwatch')
->share('Gitea.Issue.Stopwatch', [$this,
'getStopwatch'], true);
$container->alias(Subscriptions::class,
'Gitea.Issue.Subscriptions')
->share('Gitea.Issue.Subscriptions', [$this,
'getSubscriptions'], true);
$container->alias(Timeline::class, 'Gitea.Issue.Timeline')
->share('Gitea.Issue.Timeline', [$this,
'getTimeline'], true);
$container->alias(Times::class, 'Gitea.Issue.Times')
->share('Gitea.Issue.Times', [$this, 'getTimes'],
true);
}
/**
* Get the Issue class
*
* @param Container $container The DI container.
*
* @return Issu
* @since 3.2.0
*/
public function getIssue(Container $container): Issu
{
return new Issu(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Comments class
*
* @param Container $container The DI container.
*
* @return Comments
* @since 3.2.0
*/
public function getComments(Container $container): Comments
{
return new Comments(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Repository Comments class
*
* @param Container $container The DI container.
*
* @return RepoComments
* @since 3.2.0
*/
public function getRepoComments(Container $container): RepoComments
{
return new RepoComments(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Labels class
*
* @param Container $container The DI container.
*
* @return Labels
* @since 3.2.0
*/
public function getLabels(Container $container): Labels
{
return new Labels(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Issue Labels class
*
* @param Container $container The DI container.
*
* @return IssueLabels
* @since 3.2.0
*/
public function getIssueLabels(Container $container): IssueLabels
{
return new IssueLabels(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Milestones class
*
* @param Container $container The DI container.
*
* @return Milestones
* @since 3.2.0
*/
public function getMilestones(Container $container): Milestones
{
return new Milestones(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Reactions class
*
* @param Container $container The DI container.
*
* @return Reactions
* @since 3.2.0
*/
public function getReactions(Container $container): Reactions
{
return new Reactions(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Reactions Comment class
*
* @param Container $container The DI container.
*
* @return Comment
* @since 3.2.0
*/
public function getComment(Container $container): Comment
{
return new Comment(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Stopwatch class
*
* @param Container $container The DI container.
*
* @return Stopwatch
* @since 3.2.0
*/
public function getStopwatch(Container $container): Stopwatch
{
return new Stopwatch(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Subscriptions class
*
* @param Container $container The DI container.
*
* @return Subscriptions
* @since 3.2.0
*/
public function getSubscriptions(Container $container): Subscriptions
{
return new Subscriptions(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Timeline class
*
* @param Container $container The DI container.
*
* @return Timeline
* @since 3.2.0
*/
public function getTimeline(Container $container): Timeline
{
return new Timeline(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Times class
*
* @param Container $container The DI container.
*
* @return Times
* @since 3.2.0
*/
public function getTimes(Container $container): Times
{
return new Times(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
}
PK6g�[g)Έg g Service/Jcb.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Gitea\Utilities\Uri;
use VDM\Joomla\Gitea\Utilities\Http;
use VDM\Joomla\Utilities\Component\Helper;
/**
* The Gitea Utilities Service
*
* @since 3.2.0
*/
class Jcb implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 3.2.0
*/
public function register(Container $container)
{
$container->alias(Uri::class, 'Gitea.Dynamic.Uri')
->share('Gitea.Dynamic.Uri', [$this, 'getUri'],
true);
$container->alias(Http::class, 'Gitea.Utilities.Http')
->share('Gitea.Utilities.Http', [$this,
'getHttp'], true);
}
/**
* Get the Dynamic Uri class
*
* @param Container $container The DI container.
*
* @return Uri
* @since 3.2.0
*/
public function getUri(Container $container): Uri
{
// get the global gitea URL
$add_gitea_url =
Helper::getParams('com_componentbuilder')->get('add_custom_gitea_url',
1);
$gitea_url =
Helper::getParams('com_componentbuilder')->get('custom_gitea_url');
// only load this if we have a custom URL set
if ($add_gitea_url == 2 && !empty($gitea_url) &&
strpos($gitea_url, 'http') !== false)
{
return new Uri($gitea_url);
}
return $container->get('Gitea.Utilities.Uri');
}
/**
* Get the Http class
*
* @param Container $container The DI container.
*
* @return Http
* @since 3.2.0
*/
public function getHttp(Container $container): Http
{
$add_gitea_url =
Helper::getParams('com_componentbuilder')->get('add_custom_gitea_url',
1);
if ($add_gitea_url == 2)
{
return new Http(
Helper::getParams('com_componentbuilder')->get('custom_gitea_token')
);
}
else
{
return new Http(
Helper::getParams('com_componentbuilder')->get('gitea_token')
);
}
}
}
PK6g�[�>ceService/Miscellaneous.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Gitea\Miscellaneous\Activitypub;
use VDM\Joomla\Gitea\Miscellaneous\Gpg;
use VDM\Joomla\Gitea\Miscellaneous\Markdown;
use VDM\Joomla\Gitea\Miscellaneous\NodeInfo;
use VDM\Joomla\Gitea\Miscellaneous\Version;
/**
* The Gitea Miscellaneous Service
*
* @since 3.2.0
*/
class Miscellaneous implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 3.2.0
*/
public function register(Container $container)
{
$container->alias(Activitypub::class,
'Gitea.Miscellaneous.Activitypub')
->share('Gitea.Miscellaneous.Activitypub', [$this,
'getActivitypub'], true);
$container->alias(Gpg::class, 'Gitea.Miscellaneous.Gpg')
->share('Gitea.Miscellaneous.Gpg', [$this,
'getGpg'], true);
$container->alias(Markdown::class,
'Gitea.Miscellaneous.Markdown')
->share('Gitea.Miscellaneous.Markdown', [$this,
'getMarkdown'], true);
$container->alias(NodeInfo::class,
'Gitea.Miscellaneous.NodeInfo')
->share('Gitea.Miscellaneous.NodeInfo', [$this,
'getNodeInfo'], true);
$container->alias(Version::class,
'Gitea.Miscellaneous.Version')
->share('Gitea.Miscellaneous.Version', [$this,
'getVersion'], true);
}
/**
* Get the Activitypub class
*
* @param Container $container The DI container.
*
* @return Activitypub
* @since 3.2.0
*/
public function getActivitypub(Container $container): Activitypub
{
return new Activitypub(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Gpg class
*
* @param Container $container The DI container.
*
* @return Gpg
* @since 3.2.0
*/
public function getGpg(Container $container): Gpg
{
return new Gpg(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Markdown class
*
* @param Container $container The DI container.
*
* @return Markdown
* @since 3.2.0
*/
public function getMarkdown(Container $container): Markdown
{
return new Markdown(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the NodeInfo class
*
* @param Container $container The DI container.
*
* @return NodeInfo
* @since 3.2.0
*/
public function getNodeInfo(Container $container): NodeInfo
{
return new NodeInfo(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Version class
*
* @param Container $container The DI container.
*
* @return Version
* @since 3.2.0
*/
public function getVersion(Container $container): Version
{
return new Version(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
}
PK6g�[�s��
Service/Notifications.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Gitea\Notifications as Notifi;
use VDM\Joomla\Gitea\Notifications\Repository;
use VDM\Joomla\Gitea\Notifications\Thread;
/**
* The Gitea Notifications Service
*
* @since 3.2.0
*/
class Notifications implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 3.2.0
*/
public function register(Container $container)
{
$container->alias(Notifi::class, 'Gitea.Notifications')
->share('Gitea.Notifications', [$this,
'getNotifications'], true);
$container->alias(Repository::class,
'Gitea.Notifications.Repository')
->share('Gitea.Notifications.Repository', [$this,
'getRepository'], true);
$container->alias(Thread::class,
'Gitea.Notifications.Thread')
->share('Gitea.Notifications.Thread', [$this,
'getThread'], true);
}
/**
* Get the Notifications class
*
* @param Container $container The DI container.
*
* @return Notifi
* @since 3.2.0
*/
public function getNotifications(Container $container): Notifi
{
return new Notifi(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Repository class
*
* @param Container $container The DI container.
*
* @return Repository
* @since 3.2.0
*/
public function getRepository(Container $container): Repository
{
return new Repository(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Thread class
*
* @param Container $container The DI container.
*
* @return Thread
* @since 3.2.0
*/
public function getThread(Container $container): Thread
{
return new Thread(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
}
PK6g�[�)b+
Service/Organization.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Gitea\Organization as Org;
use VDM\Joomla\Gitea\Organization\Hooks;
use VDM\Joomla\Gitea\Organization\Labels;
use VDM\Joomla\Gitea\Organization\Members;
use VDM\Joomla\Gitea\Organization\PublicMembers as PublicMembers;
use VDM\Joomla\Gitea\Organization\Repository;
use VDM\Joomla\Gitea\Organization\Teams;
use VDM\Joomla\Gitea\Organization\Teams\Members as TeamsMembers;
use VDM\Joomla\Gitea\Organization\Teams\Repository as TeamsRepository;
use VDM\Joomla\Gitea\Organization\User;
/**
* The Gitea Organization Service
*
* @since 3.2.0
*/
class Organization implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 3.2.0
*/
public function register(Container $container)
{
$container->alias(Org::class, 'Gitea.Organization')
->share('Gitea.Organization', [$this,
'getOrganization'], true);
$container->alias(Hooks::class, 'Gitea.Organization.Hooks')
->share('Gitea.Organization.Hooks', [$this,
'getHooks'], true);
$container->alias(Labels::class,
'Gitea.Organization.Labels')
->share('Gitea.Organization.Labels', [$this,
'getLabels'], true);
$container->alias(Members::class,
'Gitea.Organization.Members')
->share('Gitea.Organization.Members', [$this,
'getMembers'], true);
$container->alias(PublicMembers::class,
'Gitea.Organization.Public.Members')
->share('Gitea.Organization.Public.Members', [$this,
'getPublicMembers'], true);
$container->alias(Repository::class,
'Gitea.Organization.Repository')
->share('Gitea.Organization.Repository', [$this,
'getRepository'], true);
$container->alias(Teams::class, 'Gitea.Organization.Teams')
->share('Gitea.Organization.Teams', [$this,
'getTeams'], true);
$container->alias(TeamsMembers::class,
'Gitea.Organization.Teams.Members')
->share('Gitea.Organization.Teams.Members', [$this,
'getTeamsMembers'], true);
$container->alias(TeamsRepository::class,
'Gitea.Organization.Teams.Repository')
->share('Gitea.Organization.Teams.Repository', [$this,
'getTeamsRepository'], true);
$container->alias(User::class, 'Gitea.Organization.User')
->share('Gitea.Organization.User', [$this,
'getUser'], true);
}
/**
* Get the Organization class
*
* @param Container $container The DI container.
*
* @return Org
* @since 3.2.0
*/
public function getOrganization(Container $container): Org
{
return new Org(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Hooks class
*
* @param Container $container The DI container.
*
* @return Hooks
* @since 3.2.0
*/
public function getHooks(Container $container): Hooks
{
return new Hooks(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Labels class
*
* @param Container $container The DI container.
*
* @return Labels
* @since 3.2.0
*/
public function getLabels(Container $container): Labels
{
return new Labels(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Members class
*
* @param Container $container The DI container.
*
* @return Members
* @since 3.2.0
*/
public function getMembers(Container $container): Members
{
return new Members(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Public Members class
*
* @param Container $container The DI container.
*
* @return PublicMembers
* @since 3.2.0
*/
public function getPublicMembers(Container $container): PublicMembers
{
return new PublicMembers(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Repository class
*
* @param Container $container The DI container.
*
* @return Repository
* @since 3.2.0
*/
public function getRepository(Container $container): Repository
{
return new Repository(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Teams class
*
* @param Container $container The DI container.
*
* @return Teams
* @since 3.2.0
*/
public function getTeams(Container $container): Teams
{
return new Teams(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Teams Members class
*
* @param Container $container The DI container.
*
* @return TeamsMembers
* @since 3.2.0
*/
public function getTeamsMembers(Container $container): TeamsMembers
{
return new TeamsMembers(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Teams Repository class
*
* @param Container $container The DI container.
*
* @return TeamsRepository
* @since 3.2.0
*/
public function getTeamsRepository(Container $container): TeamsRepository
{
return new TeamsRepository(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the User class
*
* @param Container $container The DI container.
*
* @return User
* @since 3.2.0
*/
public function getUser(Container $container): User
{
return new User(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
}
PK6g�['��{ { Service/Package.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Gitea\Package as Pack;
use VDM\Joomla\Gitea\Package\Files;
use VDM\Joomla\Gitea\Package\Owner;
/**
* The Gitea Package Service
*
* @since 3.2.0
*/
class Package implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 3.2.0
*/
public function register(Container $container)
{
$container->alias(Pack::class, 'Gitea.Package')
->share('Gitea.Package', [$this, 'getPackage'],
true);
$container->alias(Files::class, 'Gitea.Package.Files')
->share('Gitea.Package.Files', [$this,
'getFiles'], true);
$container->alias(Owner::class, 'Gitea.Package.Owner')
->share('Gitea.Package.Owner', [$this,
'getOwner'], true);
}
/**
* Get the Package class
*
* @param Container $container The DI container.
*
* @return Pack
* @since 3.2.0
*/
public function getPackage(Container $container): Pack
{
return new Pack(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Files class
*
* @param Container $container The DI container.
*
* @return Files
* @since 3.2.0
*/
public function getFiles(Container $container): Files
{
return new Files(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Owner class
*
* @param Container $container The DI container.
*
* @return Owner
* @since 3.2.0
*/
public function getOwner(Container $container): Owner
{
return new Owner(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
}
PK6g�[T�eUeUService/Repository.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Gitea\Repository as Repo;
use VDM\Joomla\Gitea\Repository\Archive;
use VDM\Joomla\Gitea\Repository\Assignees;
use VDM\Joomla\Gitea\Repository\Attachments;
use VDM\Joomla\Gitea\Repository\Branch;
use VDM\Joomla\Gitea\Repository\Branch\Protection;
use VDM\Joomla\Gitea\Repository\Collaborator;
use VDM\Joomla\Gitea\Repository\Commits;
use VDM\Joomla\Gitea\Repository\Contents;
use VDM\Joomla\Gitea\Repository\Forks;
use VDM\Joomla\Gitea\Repository\Gpg;
use VDM\Joomla\Gitea\Repository\Hooks;
use VDM\Joomla\Gitea\Repository\Hooks\Git;
use VDM\Joomla\Gitea\Repository\Keys;
use VDM\Joomla\Gitea\Repository\Languages;
use VDM\Joomla\Gitea\Repository\Media;
use VDM\Joomla\Gitea\Repository\Merge;
use VDM\Joomla\Gitea\Repository\Mirror;
use VDM\Joomla\Gitea\Repository\Mirrors;
use VDM\Joomla\Gitea\Repository\Notes;
use VDM\Joomla\Gitea\Repository\Patch;
use VDM\Joomla\Gitea\Repository\Pulls;
use VDM\Joomla\Gitea\Repository\Refs;
use VDM\Joomla\Gitea\Repository\Releases;
use VDM\Joomla\Gitea\Repository\Remote;
use VDM\Joomla\Gitea\Repository\Reviewers;
use VDM\Joomla\Gitea\Repository\Reviews;
use VDM\Joomla\Gitea\Repository\Stargazers;
use VDM\Joomla\Gitea\Repository\Statuses;
use VDM\Joomla\Gitea\Repository\Tags;
use VDM\Joomla\Gitea\Repository\Teams;
use VDM\Joomla\Gitea\Repository\Templates;
use VDM\Joomla\Gitea\Repository\Times;
use VDM\Joomla\Gitea\Repository\Topics;
use VDM\Joomla\Gitea\Repository\Transfer;
use VDM\Joomla\Gitea\Repository\Trees;
use VDM\Joomla\Gitea\Repository\Watchers;
use VDM\Joomla\Gitea\Repository\Wiki;
/**
* The Gitea Repository Service
*
* @since 3.2.0
*/
class Repository implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 3.2.0
*/
public function register(Container $container)
{
$container->alias(Repo::class, 'Gitea.Repository')
->share('Gitea.Repository', [$this,
'getRepository'], true);
$container->alias(Archive::class,
'Gitea.Repository.Archive')
->share('Gitea.Repository.Archive', [$this,
'getArchive'], true);
$container->alias(Assignees::class,
'Gitea.Repository.Assignees')
->share('Gitea.Repository.Assignees', [$this,
'getAssignees'], true);
$container->alias(Attachments::class,
'Gitea.Repository.Attachments')
->share('Gitea.Repository.Attachments', [$this,
'getAttachments'], true);
$container->alias(Branch::class, 'Gitea.Repository.Branch')
->share('Gitea.Repository.Branch', [$this,
'getBranch'], true);
$container->alias(Protection::class,
'Gitea.Repository.Branch.Protection')
->share('Gitea.Repository.Branch.Protection', [$this,
'getProtection'], true);
$container->alias(Collaborator::class,
'Gitea.Repository.Collaborator')
->share('Gitea.Repository.Collaborator', [$this,
'getCollaborator'], true);
$container->alias(Commits::class,
'Gitea.Repository.Commits')
->share('Gitea.Repository.Commits', [$this,
'getCommits'], true);
$container->alias(Contents::class,
'Gitea.Repository.Contents')
->share('Gitea.Repository.Contents', [$this,
'getContents'], true);
$container->alias(Forks::class, 'Gitea.Repository.Forks')
->share('Gitea.Repository.Forks', [$this,
'getForks'], true);
$container->alias(Gpg::class, 'Gitea.Repository.Gpg')
->share('Gitea.Repository.Gpg', [$this,
'getGpg'], true);
$container->alias(Hooks::class, 'Gitea.Repository.Hooks')
->share('Gitea.Repository.Hooks', [$this,
'getHooks'], true);
$container->alias(Git::class, 'Gitea.Repository.Hooks.Git')
->share('Gitea.Repository.Hooks.Git', [$this,
'getGit'], true);
$container->alias(Keys::class, 'Gitea.Repository.Keys')
->share('Gitea.Repository.Keys', [$this,
'getKeys'], true);
$container->alias(Languages::class,
'Gitea.Repository.Languages')
->share('Gitea.Repository.Languages', [$this,
'getLanguages'], true);
$container->alias(Media::class, 'Gitea.Repository.Media')
->share('Gitea.Repository.Media', [$this,
'getMedia'], true);
$container->alias(Merge::class, 'Gitea.Repository.Merge')
->share('Gitea.Repository.Merge', [$this,
'getMerge'], true);
$container->alias(Mirror::class, 'Gitea.Repository.Mirror')
->share('Gitea.Repository.Mirror', [$this,
'getMirror'], true);
$container->alias(Mirrors::class,
'Gitea.Repository.Mirrors')
->share('Gitea.Repository.Mirrors', [$this,
'getMirrors'], true);
$container->alias(Notes::class, 'Gitea.Repository.Notes')
->share('Gitea.Repository.Notes', [$this,
'getNotes'], true);
$container->alias(Patch::class, 'Gitea.Repository.Patch')
->share('Gitea.Repository.Patch', [$this,
'getPatch'], true);
$container->alias(Pulls::class, 'Gitea.Repository.Pulls')
->share('Gitea.Repository.Pulls', [$this,
'getPulls'], true);
$container->alias(Refs::class, 'Gitea.Repository.Refs')
->share('Gitea.Repository.Refs', [$this,
'getRefs'], true);
$container->alias(Releases::class,
'Gitea.Repository.Releases')
->share('Gitea.Repository.Releases', [$this,
'getReleases'], true);
$container->alias(Remote::class, 'Gitea.Repository.Remote')
->share('Gitea.Repository.Remote', [$this,
'getRemote'], true);
$container->alias(Reviewers::class,
'Gitea.Repository.Reviewers')
->share('Gitea.Repository.Reviewers', [$this,
'getReviewers'], true);
$container->alias(Reviews::class,
'Gitea.Repository.Reviews')
->share('Gitea.Repository.Reviews', [$this,
'getReviews'], true);
$container->alias(Stargazers::class,
'Gitea.Repository.Stargazers')
->share('Gitea.Repository.Stargazers', [$this,
'getStargazers'], true);
$container->alias(Statuses::class,
'Gitea.Repository.Statuses')
->share('Gitea.Repository.Statuses', [$this,
'getStatuses'], true);
$container->alias(Tags::class, 'Gitea.Repository.Tags')
->share('Gitea.Repository.Tags', [$this,
'getTags'], true);
$container->alias(Teams::class, 'Gitea.Repository.Teams')
->share('Gitea.Repository.Teams', [$this,
'getTeams'], true);
$container->alias(Templates::class,
'Gitea.Repository.Templates')
->share('Gitea.Repository.Templates', [$this,
'getTemplates'], true);
$container->alias(Times::class, 'Gitea.Repository.Times')
->share('Gitea.Repository.Times', [$this,
'getTimes'], true);
$container->alias(Topics::class, 'Gitea.Repository.Topics')
->share('Gitea.Repository.Topics', [$this,
'getTopics'], true);
$container->alias(Transfer::class,
'Gitea.Repository.Transfer')
->share('Gitea.Repository.Transfer', [$this,
'getTransfer'], true);
$container->alias(Trees::class, 'Gitea.Repository.Trees')
->share('Gitea.Repository.Trees', [$this,
'getTrees'], true);
$container->alias(Watchers::class,
'Gitea.Repository.Watchers')
->share('Gitea.Repository.Watchers', [$this,
'getWatchers'], true);
$container->alias(Wiki::class, 'Gitea.Repository.Wiki')
->share('Gitea.Repository.Wiki', [$this,
'getWiki'], true);
}
/**
* Get the Repository class
*
* @param Container $container The DI container.
*
* @return Repo
* @since 3.2.0
*/
public function getRepository(Container $container): Repo
{
return new Repo(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Archive class
*
* @param Container $container The DI container.
*
* @return Archive
* @since 3.2.0
*/
public function getArchive(Container $container): Archive
{
return new Archive(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Assignees class
*
* @param Container $container The DI container.
*
* @return Assignees
* @since 3.2.0
*/
public function getAssignees(Container $container): Assignees
{
return new Assignees(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Attachments class
*
* @param Container $container The DI container.
*
* @return Attachments
* @since 3.2.0
*/
public function getAttachments(Container $container): Attachments
{
return new Attachments(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Branch class
*
* @param Container $container The DI container.
*
* @return Branch
* @since 3.2.0
*/
public function getBranch(Container $container): Branch
{
return new Branch(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Branch Protection class
*
* @param Container $container The DI container.
*
* @return Protection
* @since 3.2.0
*/
public function getProtection(Container $container): Protection
{
return new Protection(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Collaborator class
*
* @param Container $container The DI container.
*
* @return Collaborator
* @since 3.2.0
*/
public function getCollaborator(Container $container): Collaborator
{
return new Collaborator(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Commits class
*
* @param Container $container The DI container.
*
* @return Commits
* @since 3.2.0
*/
public function getCommits(Container $container): Commits
{
return new Commits(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Contents class
*
* @param Container $container The DI container.
*
* @return Contents
* @since 3.2.0
*/
public function getContents(Container $container): Contents
{
return new Contents(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Forks class
*
* @param Container $container The DI container.
*
* @return Forks
* @since 3.2.0
*/
public function getForks(Container $container): Forks
{
return new Forks(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Gpg class
*
* @param Container $container The DI container.
*
* @return Gpg
* @since 3.2.0
*/
public function getGpg(Container $container): Gpg
{
return new Gpg(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Hooks class
*
* @param Container $container The DI container.
*
* @return Hooks
* @since 3.2.0
*/
public function getHooks(Container $container): Hooks
{
return new Hooks(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Hooks Git class
*
* @param Container $container The DI container.
*
* @return Git
* @since 3.2.0
*/
public function getGit(Container $container): Git
{
return new Git(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Keys class
*
* @param Container $container The DI container.
*
* @return Keys
* @since 3.2.0
*/
public function getKeys(Container $container): Keys
{
return new Keys(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Languages class
*
* @param Container $container The DI container.
*
* @return Languages
* @since 3.2.0
*/
public function getLanguages(Container $container): Languages
{
return new Languages(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Media class
*
* @param Container $container The DI container.
*
* @return Media
* @since 3.2.0
*/
public function getMedia(Container $container): Media
{
return new Media(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Merge class
*
* @param Container $container The DI container.
*
* @return Merge
* @since 3.2.0
*/
public function getMerge(Container $container): Merge
{
return new Merge(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Mirror class
*
* @param Container $container The DI container.
*
* @return Mirror
* @since 3.2.0
*/
public function getMirror(Container $container): Mirror
{
return new Mirror(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Mirrors class
*
* @param Container $container The DI container.
*
* @return Mirrors
* @since 3.2.0
*/
public function getMirrors(Container $container): Mirrors
{
return new Mirrors(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Notes class
*
* @param Container $container The DI container.
*
* @return Notes
* @since 3.2.0
*/
public function getNotes(Container $container): Notes
{
return new Notes(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Patch class
*
* @param Container $container The DI container.
*
* @return Patch
* @since 3.2.0
*/
public function getPatch(Container $container): Patch
{
return new Patch(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Pulls class
*
* @param Container $container The DI container.
*
* @return Pulls
* @since 3.2.0
*/
public function getPulls(Container $container): Pulls
{
return new Pulls(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Refs class
*
* @param Container $container The DI container.
*
* @return Refs
* @since 3.2.0
*/
public function getRefs(Container $container): Refs
{
return new Refs(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Releases class
*
* @param Container $container The DI container.
*
* @return Releases
* @since 3.2.0
*/
public function getReleases(Container $container): Releases
{
return new Releases(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Remote class
*
* @param Container $container The DI container.
*
* @return Remote
* @since 3.2.0
*/
public function getRemote(Container $container): Remote
{
return new Remote(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Reviewers class
*
* @param Container $container The DI container.
*
* @return Reviewers
* @since 3.2.0
*/
public function getReviewers(Container $container): Reviewers
{
return new Reviewers(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Reviews class
*
* @param Container $container The DI container.
*
* @return Reviews
* @since 3.2.0
*/
public function getReviews(Container $container): Reviews
{
return new Reviews(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Stargazers class
*
* @param Container $container The DI container.
*
* @return Stargazers
* @since 3.2.0
*/
public function getStargazers(Container $container): Stargazers
{
return new Stargazers(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Statuses class
*
* @param Container $container The DI container.
*
* @return Statuses
* @since 3.2.0
*/
public function getStatuses(Container $container): Statuses
{
return new Statuses(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Tags class
*
* @param Container $container The DI container.
*
* @return Tags
* @since 3.2.0
*/
public function getTags(Container $container): Tags
{
return new Tags(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Teams class
*
* @param Container $container The DI container.
*
* @return Teams
* @since 3.2.0
*/
public function getTeams(Container $container): Teams
{
return new Teams(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Templates class
*
* @param Container $container The DI container.
*
* @return Templates
* @since 3.2.0
*/
public function getTemplates(Container $container): Templates
{
return new Templates(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Times class
*
* @param Container $container The DI container.
*
* @return Times
* @since 3.2.0
*/
public function getTimes(Container $container): Times
{
return new Times(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Topics class
*
* @param Container $container The DI container.
*
* @return Topics
* @since 3.2.0
*/
public function getTopics(Container $container): Topics
{
return new Topics(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Transfer class
*
* @param Container $container The DI container.
*
* @return Transfer
* @since 3.2.0
*/
public function getTransfer(Container $container): Transfer
{
return new Transfer(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Trees class
*
* @param Container $container The DI container.
*
* @return Trees
* @since 3.2.0
*/
public function getTrees(Container $container): Trees
{
return new Trees(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Watchers class
*
* @param Container $container The DI container.
*
* @return Watchers
* @since 3.2.0
*/
public function getWatchers(Container $container): Watchers
{
return new Watchers(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Wiki class
*
* @param Container $container The DI container.
*
* @return Wiki
* @since 3.2.0
*/
public function getWiki(Container $container): Wiki
{
return new Wiki(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
}
PK6g�[j�ei��Service/Settings.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Gitea\Settings\Api;
use VDM\Joomla\Gitea\Settings\Attachment;
use VDM\Joomla\Gitea\Settings\Repository;
use VDM\Joomla\Gitea\Settings\Ui;
/**
* The Gitea Settings Service
*
* @since 3.2.0
*/
class Settings implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 3.2.0
*/
public function register(Container $container)
{
$container->alias(Api::class, 'Gitea.Settings.Api')
->share('Gitea.Settings.Api', [$this, 'getApi'],
true);
$container->alias(Attachment::class,
'Gitea.Settings.Attachment')
->share('Gitea.Settings.Attachment', [$this,
'getAttachment'], true);
$container->alias(Repository::class,
'Gitea.Settings.Repository')
->share('Gitea.Settings.Repository', [$this,
'getRepository'], true);
$container->alias(Ui::class, 'Gitea.Settings.Ui')
->share('Gitea.Settings.Ui', [$this, 'getUi'],
true);
}
/**
* Get the Api class
*
* @param Container $container The DI container.
*
* @return Api
* @since 3.2.0
*/
public function getApi(Container $container): Api
{
return new Api(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Attachment class
*
* @param Container $container The DI container.
*
* @return Attachment
* @since 3.2.0
*/
public function getAttachment(Container $container): Attachment
{
return new Attachment(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Repository class
*
* @param Container $container The DI container.
*
* @return Repository
* @since 3.2.0
*/
public function getRepository(Container $container): Repository
{
return new Repository(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Ui class
*
* @param Container $container The DI container.
*
* @return Ui
* @since 3.2.0
*/
public function getUi(Container $container): Ui
{
return new Ui(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
}
PK6g�[z��� � Service/User.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Gitea\User as Usr;
use VDM\Joomla\Gitea\User\Applications;
use VDM\Joomla\Gitea\User\Emails;
use VDM\Joomla\Gitea\User\Followers;
use VDM\Joomla\Gitea\User\Following;
use VDM\Joomla\Gitea\User\Gpg;
use VDM\Joomla\Gitea\User\Keys;
use VDM\Joomla\Gitea\User\Repos;
use VDM\Joomla\Gitea\User\Settings;
use VDM\Joomla\Gitea\User\Starred;
use VDM\Joomla\Gitea\User\Subscriptions;
use VDM\Joomla\Gitea\User\Teams;
use VDM\Joomla\Gitea\User\Times;
use VDM\Joomla\Gitea\User\Tokens;
/**
* The Gitea User Service
*
* @since 3.2.0
*/
class User implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 3.2.0
*/
public function register(Container $container)
{
$container->alias(Usr::class, 'Gitea.User')
->share('Gitea.User', [$this, 'getUser'], true);
$container->alias(Applications::class,
'Gitea.User.Applications')
->share('Gitea.User.Applications', [$this,
'getApplications'], true);
$container->alias(Emails::class, 'Gitea.User.Emails')
->share('Gitea.User.Emails', [$this,
'getEmails'], true);
$container->alias(Followers::class, 'Gitea.User.Followers')
->share('Gitea.User.Followers', [$this,
'getFollowers'], true);
$container->alias(Following::class, 'Gitea.User.Following')
->share('Gitea.User.Following', [$this,
'getFollowing'], true);
$container->alias(Gpg::class, 'Gitea.User.Gpg')
->share('Gitea.User.Gpg', [$this, 'getGpg'],
true);
$container->alias(Keys::class, 'Gitea.User.Keys')
->share('Gitea.User.Keys', [$this, 'getKeys'],
true);
$container->alias(Repos::class, 'Gitea.User.Repos')
->share('Gitea.User.Repos', [$this, 'getRepos'],
true);
$container->alias(Settings::class, 'Gitea.User.Settings')
->share('Gitea.User.Settings', [$this,
'getSettings'], true);
$container->alias(Starred::class, 'Gitea.User.Starred')
->share('Gitea.User.Starred', [$this,
'getStarred'], true);
$container->alias(Subscriptions::class,
'Gitea.User.Subscriptions')
->share('Gitea.User.Subscriptions', [$this,
'getSubscriptions'], true);
$container->alias(Teams::class, 'Gitea.User.Teams')
->share('Gitea.User.Teams', [$this, 'getTeams'],
true);
$container->alias(Times::class, 'Gitea.User.Times')
->share('Gitea.User.Times', [$this, 'getTimes'],
true);
$container->alias(Tokens::class, 'Gitea.User.Tokens')
->share('Gitea.User.Tokens', [$this,
'getTokens'], true);
}
/**
* Get the User class
*
* @param Container $container The DI container.
*
* @return Usr
* @since 3.2.0
*/
public function getUser(Container $container): Usr
{
return new Usr(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Applications class
*
* @param Container $container The DI container.
*
* @return Applications
* @since 3.2.0
*/
public function getApplications(Container $container): Applications
{
return new Applications(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Emails class
*
* @param Container $container The DI container.
*
* @return Emails
* @since 3.2.0
*/
public function getEmails(Container $container): Emails
{
return new Emails(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Followers class
*
* @param Container $container The DI container.
*
* @return Followers
* @since 3.2.0
*/
public function getFollowers(Container $container): Followers
{
return new Followers(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Following class
*
* @param Container $container The DI container.
*
* @return Following
* @since 3.2.0
*/
public function getFollowing(Container $container): Following
{
return new Following(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Gpg class
*
* @param Container $container The DI container.
*
* @return Gpg
* @since 3.2.0
*/
public function getGpg(Container $container): Gpg
{
return new Gpg(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Keys class
*
* @param Container $container The DI container.
*
* @return Keys
* @since 3.2.0
*/
public function getKeys(Container $container): Keys
{
return new Keys(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Repos class
*
* @param Container $container The DI container.
*
* @return Repos
* @since 3.2.0
*/
public function getRepos(Container $container): Repos
{
return new Repos(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Settings class
*
* @param Container $container The DI container.
*
* @return Settings
* @since 3.2.0
*/
public function getSettings(Container $container): Settings
{
return new Settings(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Starred class
*
* @param Container $container The DI container.
*
* @return Starred
* @since 3.2.0
*/
public function getStarred(Container $container): Starred
{
return new Starred(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Subscriptions class
*
* @param Container $container The DI container.
*
* @return Subscriptions
* @since 3.2.0
*/
public function getSubscriptions(Container $container): Subscriptions
{
return new Subscriptions(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Teams class
*
* @param Container $container The DI container.
*
* @return Teams
* @since 3.2.0
*/
public function getTeams(Container $container): Teams
{
return new Teams(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Times class
*
* @param Container $container The DI container.
*
* @return Times
* @since 3.2.0
*/
public function getTimes(Container $container): Times
{
return new Times(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Tokens class
*
* @param Container $container The DI container.
*
* @return Tokens
* @since 3.2.0
*/
public function getTokens(Container $container): Tokens
{
return new Tokens(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
}
PK6g�[��ގvvService/Utilities.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Gitea\Utilities\Uri;
use VDM\Joomla\Gitea\Utilities\Response;
/**
* The Gitea Utilities Service
*
* @since 3.2.0
*/
class Utilities implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 3.2.0
*/
public function register(Container $container)
{
$container->alias(Uri::class, 'Gitea.Utilities.Uri')
->share('Gitea.Utilities.Uri', [$this, 'getUri'],
true);
$container->alias(Response::class,
'Gitea.Utilities.Response')
->share('Gitea.Utilities.Response', [$this,
'getResponse'], true);
}
/**
* Get the Uri class
*
* @param Container $container The DI container.
*
* @return Uri
* @since 3.2.0
*/
public function getUri(Container $container): Uri
{
return new Uri();
}
/**
* Get the Response class
*
* @param Container $container The DI container.
*
* @return Response
* @since 3.2.0
*/
public function getResponse(Container $container): Response
{
return new Response();
}
}
PK6g�[1g�5��Settings/Api.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Settings;
use VDM\Joomla\Gitea\Abstraction\Api as BaseAPI;
/**
* The Gitea Settings Api
*
* @since 3.2.0
*/
class Api extends BaseAPI
{
/**
* Get instance's global settings for API.
*
* @return object|null
* @since 3.2.0
**/
public function get(): ?object
{
// Build the request path.
$path = "/settings/api";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
}
PK6g�[����Settings/Attachment.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Settings;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Settings Attachment
*
* @since 3.2.0
*/
class Attachment extends Api
{
/**
* Get instance's global settings for Attachment.
*
* @return object|null
* @since 3.2.0
**/
public function get(): ?object
{
// Build the request path.
$path = "/settings/attachment";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
}
PK6g�[�#o,,Settings/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK6g�[ՄW���Settings/Repository.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Settings;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Settings Repository
*
* @since 3.2.0
*/
class Repository extends Api
{
/**
* Get instance's global settings for repositories.
*
* @return object|null
* @since 3.2.0
**/
public function get(): ?object
{
// Build the request path.
$path = "/settings/repository";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
}
PK6g�[]WE��Settings/Ui.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Settings;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Settings Ui
*
* @since 3.2.0
*/
class Ui extends Api
{
/**
* Get instance's global settings for UI.
*
* @return object|null
* @since 3.2.0
**/
public function get(): ?object
{
// Build the request path.
$path = "/settings/ui";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
}
PK6g�[FnFFUser/Applications.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\User;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea User Applications
*
* @since 3.2.0
*/
class Applications extends Api
{
/**
* List the authenticated user's oauth2 applications.
*
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function get(
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = '/user/applications/oauth2';
// Build the URI with query parameters.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Get an OAuth2 application by ID.
*
* @param int $id The OAuth2 application ID.
*
* @return object|null
* @since 3.2.0
**/
public function id(int $id): ?object
{
// Build the request path.
$path = "/user/applications/oauth2/{$id}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Creates a new OAuth2 application.
*
* @param string $appName The application name.
* @param array $redirectUris The application redirect URIs.
* @param bool $confidentialClient The confidentiality of the client
(default: true).
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $appName,
array $redirectUris,
bool $confidentialClient = true
): ?object
{
// Build the request path.
$path = '/user/applications/oauth2';
// Set the application data.
$data = new \stdClass();
$data->name = $appName;
$data->redirect_uris = $redirectUris;
$data->confidential_client = $confidentialClient;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path),
json_encode($data)
), 201
);
}
/**
* Delete an OAuth2 application by ID.
*
* @param int $id The OAuth2 application ID.
*
* @return string
* @since 3.2.0
**/
public function delete(int $id): string
{
// Build the request path.
$path = "/user/applications/oauth2/{$id}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Update an OAuth2 application by ID, this includes regenerating the
client secret.
*
* @param int $appId The OAuth2 application ID.
* @param string $appName The application name.
* @param array $redirectUris The application redirect URIs.
* @param bool $confidentialClient The confidentiality of the client
(default: true).
*
* @return object|null
* @since 3.2.0
**/
public function update(
int $appId,
string $appName,
array $redirectUris,
bool $confidentialClient = true
): ?object
{
// Build the request path.
$path = "/user/applications/oauth2/{$appId}";
// Set the application data.
$data = new \stdClass();
$data->name = $appName;
$data->redirect_uris = $redirectUris;
$data->confidential_client = $confidentialClient;
// Send the patch request.
return $this->response->get(
$this->http->patch(
$this->uri->get($path),
json_encode($data)
)
);
}
}
PK6g�[L�@j��User/Emails.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\User;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea User Emails
*
* @since 3.2.0
*/
class Emails extends Api
{
/**
* List the authenticated user's email addresses.
*
* @return array|null
* @since 3.2.0
**/
public function list(): ?array
{
// Build the request path.
$path = '/user/emails';
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Add email addresses for the authenticated user.
*
* @param array $emails An array of email addresses to add.
*
* @return array|null
* @since 3.2.0
**/
public function add(array $emails): ?array
{
// Build the request path.
$path = '/user/emails';
// Create the request body.
$body = new \stdClass();
$body->emails = $emails;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path),
json_encode($body)
), 201
);
}
/**
* Delete email addresses for the authenticated user.
*
* @param array $$emails An array of email addresses to delete.
*
* @return string
* @since 3.2.0
**/
public function delete(array $emails): string
{
// Build the request path.
$path = '/user/emails';
// Build the URI.
$uri = $this->uri->get($path);
$uri->setVar('emails', json_encode($emails));
// Send the delete request.
return $this->response->get(
$this->http->delete($uri), 204, 'success'
);
}
}
PK6g�[�Q(��User/Followers.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\User;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea User Followers
*
* @since 3.2.0
*/
class Followers extends Api
{
/**
* List the authenticated user's followers.
*
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = '/user/followers';
// Build the URL
$url = $this->uri->get($path);
$url->setVar('page', $page);
$url->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($url)
);
}
}
PK6g�[-���
User/Following.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\User;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea User Following
*
* @since 3.2.0
*/
class Following extends Api
{
/**
* List the users that the authenticated user is following.
*
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = '/user/following';
// Build the URL
$url = $this->uri->get($path);
$url->setVar('page', $page);
$url->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($url)
);
}
/**
* Check whether a user is followed by the authenticated user.
*
* @param string $username The username to check.
*
* @return bool
* @since 3.2.0
**/
public function check(string $username): bool
{
// Build the request path.
$path = "/user/following/{$username}";
// Send the get request.
$response = $this->http->get(
$this->uri->get($path)
);
// Check if the user is followed by the authenticated user.
if ($response->code === 204)
{
return true;
}
return false;
}
/**
* Follow a user.
*
* @param string $username The username to follow.
*
* @return string
* @since 3.2.0
**/
public function follow(string $username): string
{
// Build the request path.
$path = "/user/following/{$username}";
// Send the put request.
return $this->response->get(
$this->http->put(
$this->uri->get($path), ''
), 204, 'success'
);
}
/**
* Unfollow a user.
*
* @param string $username The username to unfollow.
*
* @return string
* @since 3.2.0
**/
public function unfollow(string $username): string
{
// Build the request path.
$path = "/user/following/{$username}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}
PK6g�[����&&User/Gpg.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\User;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea User Gpg
*
* @since 3.2.0
*/
class Gpg extends Api
{
/**
* Create a GPG key for the authenticated user.
*
* @param string $armoredPublicKey The armored public GPG key.
* @param string|null $armoredSignature The armored signature
(optional).
*
* @return object|null
* @since 3.2.0
**/
public function createGPGKey(
string $armoredPublicKey,
?string $armoredSignature = null
): ?object
{
// Build the request path.
$path = '/user/gpg_keys';
// Set the GPG key data.
$data = array_filter([
'armored_public_key' => $armoredPublicKey,
'armored_signature' => $armoredSignature
]);
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path),
json_encode($data)
), 201
);
}
/**
* Get a GPG key for the authenticated user.
*
* @param int $id The GPG key ID.
*
* @return object|null
* @since 3.2.0
**/
public function get(int $id): ?object
{
// Build the request path.
$path = "/user/gpg_keys/{$id}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Get a token to verify.
*
* @return string|null
* @since 3.2.0
**/
public function token(): ?string
{
// Build the request path.
$path = '/user/gpg_key_token';
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Verify a GPG key.
*
* @param string $armoredPublicKey The armored public GPG key.
*
* @return object|null
* @since 3.2.0
**/
public function verify(string $armoredPublicKey): ?object
{
// Build the request path.
$path = '/user/gpg_key_verify';
// Set the GPG key data.
$data = new \stdClass();
$data->armoredPublicKey = $armoredPublicKey;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path),
json_encode($data)
), 201
);
}
/**
* List the authenticated user's GPG keys.
*
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = '/user/gpg_keys';
// Build the URL
$url = $this->uri->get($path);
$url->setVar('page', $page);
$url->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($url)
);
}
/**
* Remove a GPG key for the authenticated user.
*
* @param int $id The GPG key ID.
*
* @return string
* @since 3.2.0
**/
public function remove(int $id): string
{
// Build the request path.
$path = "/user/gpg_keys/{$id}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}
PK6g�[�#o,,User/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK6g�[.�4I��
User/Keys.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\User;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea User Keys
*
* @since 3.2.0
*/
class Keys extends Api
{
/**
* Create a public key for the authenticated user.
*
* @param string $title The title of the public key.
* @param string $key The content of the public key.
* @param bool $readOnly Optional. True if the key has only read
access, false for read/write access.
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $title,
string $key,
bool $readOnly = false
): ?object
{
// Build the request path.
$path = '/user/keys';
// Set the public key data.
$data = new \stdClass();
$data->title = $title;
$data->key = $key;
$data->read_only = $readOnly;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path),
json_encode($data)
), 201
);
}
/**
* List the authenticated user's public keys.
*
* @param string|null $fingerprint Optional. The fingerprint of the
key.
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
?string $fingerprint = null,
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = '/user/keys';
// Build the URI with query parameters.
$uri = $this->uri->get($path);
if ($fingerprint !== null) {
$uri->setVar('fingerprint', $fingerprint);
}
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Get a public key for the authenticated user.
*
* @param int $id The public key ID.
*
* @return object|null
* @since 3.2.0
**/
public function get(int $id): ?object
{
// Build the request path.
$path = "/user/keys/{$id}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Delete a public key for the authenticated user.
*
* @param int $id The public key ID.
*
* @return string
* @since 3.2.0
**/
public function delete(int $id): string
{
// Build the request path.
$path = "/user/keys/{$id}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}
PK6g�[Md��66User/Repos.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\User;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea User Repos
*
* @since 3.2.0
*/
class Repos extends Api
{
/**
* Create a repository for the authenticated user.
*
* @param string $name The name of the repository.
* @param string|null $description Optional. The description of
the repository.
* @param bool $private Optional. Indicates whether
the repository should be private or not.
* @param bool $autoInit Optional. Indicates whether
the repository should be auto-initialized.
* @param string|null $defaultBranch Optional. The default branch
of the repository.
* @param string|null $gitignores Optional. Gitignores to
use.
* @param string|null $issueLabels Optional. Label-Set to use.
* @param string|null $license Optional. License to use.
* @param string|null $readme Optional. Readme of the
repository to create.
* @param bool|null $template Optional. Whether the
repository is a template.
* @param string|null $trustModel Optional. TrustModel of the
repository.
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $name,
?string $description = null,
bool $private = false,
bool $autoInit = false,
?string $defaultBranch = null,
?string $gitignores = null,
?string $issueLabels = null,
?string $license = null,
?string $readme = null,
?bool $template = null,
?string $trustModel = null
): ?object {
// Build the request path.
$path = '/user/repos';
// Set the repository data.
$data = new \stdClass();
$data->name = $name;
if ($description !== null)
{
$data->description = $description;
}
$data->private = $private;
$data->auto_init = $autoInit;
if ($defaultBranch !== null)
{
$data->default_branch = $defaultBranch;
}
if ($gitignores !== null)
{
$data->gitignores = $gitignores;
}
if ($issueLabels !== null)
{
$data->issue_labels = $issueLabels;
}
if ($license !== null)
{
$data->license = $license;
}
if ($readme !== null)
{
$data->readme = $readme;
}
if ($template !== null)
{
$data->template = $template;
}
if ($trustModel !== null)
{
$data->trust_model = $trustModel;
}
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path),
json_encode($data)
), 201
);
}
/**
* List the repos that the authenticated user owns.
*
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = '/user/repos';
// Build the URI with query parameters.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Star the given repo for the authenticated user.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
*
* @return string
* @since 3.2.0
**/
public function star(string $owner, string $repo): string
{
// Build the request path.
$path = "/user/starred/{$owner}/{$repo}";
// Send the put request.
return $this->response->get(
$this->http->put(
$this->uri->get($path), ''
), 204, 'success'
);
}
/**
* Unstar the given repo for the authenticated user.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
*
* @return string
* @since 3.2.0
**/
public function unstar(string $owner, string $repo): string
{
// Build the request path.
$path = "/user/starred/{$owner}/{$repo}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}
PK6g�[���<<User/Settings.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\User;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea User Settings
*
* @since 3.2.0
*/
class Settings extends Api
{
/**
* Get user settings for the authenticated user.
*
* @return object|null
* @since 3.2.0
**/
public function get(): ?object
{
// Build the request path.
$path = '/user/settings';
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Update user settings for the authenticated user.
*
* @param string|null $description Optional. The
description to update.
* @param string|null $diffViewStyle Optional. The diff view
style to update.
* @param string|null $fullName Optional. The full name
to update.
* @param bool|null $hideActivity Optional. Whether to
hide activity or not.
* @param bool|null $hideEmail Optional. Whether to
hide email or not.
* @param string|null $language Optional. The language
to update.
* @param string|null $location Optional. The location
to update.
* @param string|null $theme Optional. The theme to
update.
* @param string|null $website Optional. The website to
update.
*
* @return array|null
* @since 3.2.0
**/
public function update(
?string $description = null,
?string $diffViewStyle = null,
?string $fullName = null,
?bool $hideActivity = null,
?bool $hideEmail = null,
?string $language = null,
?string $location = null,
?string $theme = null,
?string $website = null
): ?array
{
// Prepare settings data
$settings = [];
if ($description !== null)
{
$settings['description'] = $description;
}
if ($diffViewStyle !== null)
{
$settings['diff_view_style'] = $diffViewStyle;
}
if ($fullName !== null)
{
$settings['full_name'] = $fullName;
}
if ($hideActivity !== null)
{
$settings['hide_activity'] = $hideActivity;
}
if ($hideEmail !== null)
{
$settings['hide_email'] = $hideEmail;
}
if ($language !== null)
{
$settings['language'] = $language;
}
if ($location !== null)
{
$settings['location'] = $location;
}
if ($theme !== null)
{
$settings['theme'] = $theme;
}
if ($website !== null)
{
$settings['website'] = $website;
}
// Build the request path.
$path = '/user/settings';
// Send the patch request.
return $this->response->get(
$this->http->patch(
$this->uri->get($path),
json_encode($settings)
)
);
}
}
PK6g�[첽u��User/Starred.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\User;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea User Starred
*
* @since 3.2.0
*/
class Starred extends Api
{
/**
* List the repos that the authenticated user has starred.
*
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = '/user/starred';
// Build the URL
$url = $this->uri->get($path);
$url->setVar('page', $page);
$url->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($url)
);
}
/**
* Check whether the authenticated user is starring the repo.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
*
* @return string
* @since 3.2.0
**/
public function check(string $owner, string $repo): string
{
// Build the request path.
$path = "/user/starred/{$owner}/{$repo}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
), 204, 'success'
);
}
}
PK6g�[R����User/Subscriptions.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\User;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea User Subscriptions
*
* @since 3.2.0
*/
class Subscriptions extends Api
{
/**
* List repositories watched by the authenticated user.
*
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = '/user/subscriptions';
// Build the URL
$url = $this->uri->get($path);
$url->setVar('page', $page);
$url->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($url)
);
}
}
PK6g�[�����User/Teams.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\User;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea User Teams
*
* @since 3.2.0
*/
class Teams extends Api
{
/**
* List all the teams a user belongs to.
*
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = '/user/teams';
// Build the URL
$url = $this->uri->get($path);
$url->setVar('page', $page);
$url->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($url)
);
}
}
PK6g�[�Ŧ�User/Times.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\User;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea User Times
*
* @since 3.2.0
*/
class Times extends Api
{
/**
* List the current user's tracked times.
*
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
* @param string|null $since Optional. Only show times updated after
the given time (RFC 3339 format).
* @param string|null $before Optional. Only show times updated before
the given time (RFC 3339 format).
*
* @return array|null
* @since 3.2.0
**/
public function list(
int $page = 1,
int $limit = 10,
?string $since = null,
?string $before = null
): ?array
{
// Build the request path.
$path = '/user/times';
// Build the URL
$url = $this->uri->get($path);
$url->setVar('page', $page);
$url->setVar('limit', $limit);
if ($since !== null)
{
$url->setVar('since', $since);
}
if ($before !== null)
{
$url->setVar('before', $before);
}
// Send the get request.
return $this->response->get(
$this->http->get($url)
);
}
/**
* Get list of all existing stopwatches for the authenticated user.
*
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function stopwatches(
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = '/user/stopwatches';
// Build the URL
$url = $this->uri->get($path);
$url->setVar('page', $page);
$url->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($url)
);
}
}
PK6g�[�M��/
/
User/Tokens.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\User;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea User Tokens
*
* @since 3.2.0
*/
class Tokens extends Api
{
/**
* List the authenticated user's access tokens.
*
* @param string $username The username of the authenticated user to
retrieve access tokens for.
* @param int|null $page Optional. Page number of results to return
(1-based).
* @param int|null $limit Optional. Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
string $username,
?int $page = null,
?int $limit = null
): ?array
{
// Build the request path.
$path = "/users/{$username}/tokens";
// Build the URL
$url = $this->uri->get($path);
if ($page !== null)
{
$url->setVar('page', $page);
}
if ($limit !== null)
{
$url->setVar('limit', $limit);
}
// Send the get request.
return $this->response->get(
$this->http->get($url)
);
}
/**
* Create an access token for a user.
*
* @param string $username The username of the user to create the
access token for.
* @param string $name The name of the access token.
*
* @return object|null
* @since 3.2.0
**/
public function create(string $username, string $name): ?object
{
// Build the request path.
$path = "/users/{$username}/tokens";
// Set the token data
$data = new \stdClass();
$data->name = $name;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path),
json_encode($data)
), 201
);
}
/**
* Delete an access token for a user.
*
* @param string $username The username of the user to delete the
access token for.
* @param string $token The token to delete.
*
* @return string
* @since 3.2.0
**/
public function delete(string $username, string $token): string
{
// Build the request path.
$path = "/users/{$username}/tokens/{$token}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}
PK6g�[{��<
User.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea User
*
* @since 3.2.0
*/
class User extends Api
{
/**
* Get the authenticated user.
*
* @return object|null
* @since 3.2.0
**/
public function authenticate(): ?object
{
// Build the request path.
$path = '/user';
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Search for users.
*
* @param string $keyword The search keyword.
* @param int|null $uid Optional. ID of the user to search for.
* @param int $page Page number of results to return
(1-based).
* @param int $limit Page size of results.
*
* @return object|null
* @since 3.2.0
**/
public function search(
string $keyword,
?int $uid = null,
int $page = 1,
int $limit = 10
): ?object
{
// Build the request path.
$path = '/users/search';
// Build the URI with query parameters.
$uri = $this->uri->get($path);
$uri->setVar('q', $keyword);
if ($uid !== null)
{
$uri->setVar('uid', $uid);
}
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Get a user by their username.
*
* @param string $username The username of the user to retrieve.
*
* @return object|null
* @since 3.2.0
**/
public function get(string $username): o?bject
{
// Build the request path.
$path = "/users/{$username}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* List the given user's followers.
*
* @param string $userName The username of the user to retrieve
followers for.
* @param int $page Page number of results to return
(1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function followers(
string $userName,
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = "/users/{$userName}/followers";
// Build the URI with query parameters.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* List the users that the given user is following.
*
* @param string $userName The username of the user to retrieve the
following users for.
* @param int $page Page number of results to return
(1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function following(
string $userName,
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = "/users/{$userName}/following";
// Build the URI with query parameters.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Check if one user is following another user.
*
* @param string $username The username of the user to check.
* @param string $target The username of the target user.
*
* @return string
* @since 3.2.0
**/
public function check(string $username, string $target): string
{
// Build the request path.
$path = "/users/{$username}/following/{$target}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* List the given user's GPG keys.
*
* @param string $userName The username of the user to retrieve GPG
keys for.
* @param int $page The page number of results to return
(1-based).
* @param int $limit The page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function gpg(
string $userName,
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = "/users/{$userName}/gpg_keys";
// Build the URI with query parameters.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Get a user's heatmap.
*
* @param string $username The username of the user to retrieve
heatmap for.
*
* @return array|null
* @since 3.2.0
**/
public function heatmap(string $username): ?array
{
// Build the request path.
$path = "/users/{$username}/heatmap";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* List the given user's public keys.
*
* @param string $userName The username of the user to
retrieve public keys for.
* @param string|null $fingerprint Optional. The fingerprint of the
key.
* @param int $page The page number of results to
return (1-based).
* @param int $limit The page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function keys(
string $userName,
?string $fingerprint = null,
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = "/users/{$userName}/keys";
// Build the URI with query parameters.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
if ($fingerprint !== null)
{
$uri->setVar('fingerprint', $fingerprint);
}
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* List the repos that the given user has starred.
*
* @param string $userName The username of the user to retrieve
starred repos for.
* @param int $page The page number of results to return
(1-based).
* @param int $limit The page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function repos(
string $userName,
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = "/users/{$userName}/starred";
// Build the URI with query parameters.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* List the repositories watched by a user.
*
* @param string $userName The username of the user to retrieve
watched repositories for.
* @param int $page The page number of results to return
(1-based).
* @param int $limit The page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function watched(
string $userName,
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = "/users/{$userName}/subscriptions";
// Build the URI with query parameters.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
}
PK6g�[�\ ���Utilities/Http.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Utilities;
use Joomla\CMS\Http\Http as JoomlaHttp;
use Joomla\CMS\Uri\Uri;
use Joomla\Registry\Registry;
/**
* The Gitea Http
*
* @since 3.2.0
*/
final class Http extends JoomlaHttp
{
/**
* The token
*
* @var string
* @since 3.2.0
*/
protected string $_token_; // to avoid collisions (but allow swapping)
/**
* Constructor.
*
* @param string|null $token The Gitea API token.
*
* @since 3.2.0
* @throws \InvalidArgumentException
**/
public function __construct(?string $token)
{
// setup config
$config = [
'userAgent' => 'JoomlaGitea/3.0',
'headers' => [
'Content-Type' => 'application/json'
]
];
// add the token if given
if (is_string($token))
{
$config['headers']['Authorization'] = 'token
' . $token;
$this->_token_ = $token;
}
$options = new Registry($config);
// run parent constructor
parent::__construct($options);
}
/**
* Change the Token.
*
* @param string $token The Gitea API token.
*
* @since 3.2.0
**/
public function setToken(string $token): void
{
// get the current headers
$headers = (array) $this->getOption('headers', [
'Content-Type' => 'application/json'
]
);
// add the token
$headers['Authorization'] = 'token ' . $token;
$this->_token_ = $token;
$this->setOption('headers', $headers);
}
/**
* Get the Token.
*
* @return string|null
* @since 3.2.0
**/
public function getToken(): ?string
{
return $this->_token_ ?? null;
}
}
PK6g�[�#o,,Utilities/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK6g�[:,�
�
Utilities/Response.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Utilities;
use Joomla\CMS\Http\Response as JoomlaResponse;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\StringHelper;
/**
* The Gitea Response
*
* @since 3.2.0
*/
final class Response
{
/**
* Process the response and decode it.
*
* @param JoomlaResponse $response The response.
* @param integer $expectedCode The expected "good"
code.
* @param mixed $default The default if body not have
length
*
* @return mixed
*
* @since 3.2.0
* @throws \DomainException
**/
public function get($response, int $expectedCode = 200, $default = null)
{
// Validate the response code.
if ($response->code != $expectedCode)
{
// Decode the error response and throw an exception.
$message = $this->error($response);
throw new \DomainException("Invalid response received from API.
$message", $response->code);
}
return $this->body($response, $default);
}
/**
* Process the response and decode it. (when we have multiple success
codes)
*
* @param JoomlaResponse $response The response.
* @param array [$expectedCode => $default] The expected
"good" code. and The default if body not have length
*
* @return mixed
*
* @since 3.2.0
* @throws \DomainException
**/
public function get_($response, array $validate = [200 => null])
{
// Validate the response code.
if (!isset($validate[$response->code]))
{
// Decode the error response and throw an exception.
$message = $this->error($response);
throw new \DomainException("Invalid response received from API.
$message", $response->code);
}
return $this->body($response, $validate[$response->code]);
}
/**
* Return the body from the response
*
* @param JoomlaResponse $response The response.
* @param mixed $default The default if body not have
length
*
* @return mixed
* @since 3.2.0
**/
protected function body($response, $default = null)
{
$body = $response->body ?? null;
// check that we have a body
if (StringHelper::check($body))
{
if (JsonHelper::check($body))
{
$body = json_decode((string) $body);
if (isset($body->content_base64))
{
$body->content = base64_decode((string) $body->content_base64);
}
}
return $body;
}
return $default;
}
/**
* Get the error message from the return object
*
* @param JoomlaResponse $response The response.
*
* @return string
* @since 3.2.0
**/
protected function error($response): string
{
// do we have a json string
if (isset($response->body) &&
JsonHelper::check($response->body))
{
$error = json_decode($response->body);
}
else
{
return '';
}
// check
if (isset($error->error))
{
return $error->error;
}
elseif (isset($error->message))
{
return $error->message;
}
return '';
}
}
PK6g�[��6��Utilities/Uri.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Utilities;
use Joomla\Uri\Uri as JoomlaUri;
/**
* The Gitea Uri
*
* @since 3.2.0
*/
final class Uri
{
/**
* The api endpoint
*
* @var string
* @since 3.2.0
*/
private string $endpoint;
/**
* The api version
*
* @var string
* @since 3.2.0
*/
private string $version;
/**
* The api URL
*
* @var string
* @since 3.2.0
*/
private string $url;
/**
* Constructor
*
* @param string $url URL to the gitea system
* example: https://git.vdm.dev
* @param string $endpoint Endpoint to the gitea system
* @param string $version Version to the gitea system
*
* @since 3.2.0
**/
public function __construct(
string $url = 'https://git.vdm.dev',
string $endpoint = 'api',
string $version = 'v1')
{
// set the API details
$this->setUrl($url);
$this->setEndpoint($endpoint);
$this->setVersion($version);
}
/**
* Method to build and return a full request URL for the request. This
method will
* add appropriate pagination details if necessary and also prepend the
API url
* to have a complete URL for the request.
*
* @param string $path URL to inflect
*
* @return JoomlaUri
* @since 3.2.0
**/
public function get(string $path): JoomlaUri
{
// Get a new Uri object focusing the api url and given path.
$uri = new JoomlaUri($this->api() . $path);
return $uri;
}
/**
* Get the full API URL
*
* @return string
* @since 3.2.0
**/
public function api(): string
{
return $this->url . '/' . $this->endpoint . '/'
. $this->version;
}
/**
* Set the URL of the API
*
* @param string $url URL to your gitea system
* example: https://git.vdm.dev
*
* @return void
* @since 3.2.0
**/
public function setUrl(string $url)
{
$this->url = $url;
}
/**
* Get the URL of the API
*
* @return string|null
* @since 3.2.0
**/
public function getUrl(): ?string
{
return $this->url ?? null;
}
/**
* Set the endpoint of the API
*
* @param string $endpoint endpoint to your gitea API
*
* @return void
* @since 3.2.0
**/
private function setEndpoint(string $endpoint)
{
$this->endpoint = $endpoint;
}
/**
* Set the version of the API
*
* @param string $version version to your gitea API
*
* @return void
* @since 3.2.0
**/
private function setVersion($version)
{
$this->version = $version;
}
}
PKk��[�CàZZHelper/VersionHelper.phpnu�[���PKk��[T%�0//�Dispatcher/Dispatcher.phpnu�[���PK��[P���>�>
LdapClient.phpnu�[���PKNc�[q�Z��0IAbstractApplication.phpnu�[���PKNc�[N�K�YY#\AbstractCliApplication.phpnu�[���PKNc�[]t?1a1a�kAbstractDaemonApplication.phpnu�[���PKNc�[R��llD�AbstractWebApplication.phpnu�[���PKOc�[�tt�9Cli/CliInput.phpnu�[���PKOc�[3s�JU<Cli/CliOutput.phpnu�[���PKOc�[~��u �CCli/ColorProcessor.phpnu�[���PKOc�[MS�**FCli/ColorStyle.phpnu�[���PKOc�[h#�ff'pWCli/Output/Processor/ColorProcessor.phpnu�[���PKOc�[?<N}}+-gCli/Output/Processor/ProcessorInterface.phpnu�[���PKOc�[�����jCli/Output/Stdout.phpnu�[���PKOc�[��6�QQ�mCli/Output/Xml.phpnu�[���PKOc�[��u:B:BmqWeb/WebClient.phpnu�[���PK4g�[�r�WW�Abstraction/Api.phpnu�[���PK4g�[�#o,,��Abstraction/index.htmlnu�[���PK4g�[l���Admin/Cron.phpnu�[���PK4g�[�#o,,)�Admin/index.htmlnu�[���PK4g�[�h����Admin/Organizations.phpnu�[���PK4g�[ƨw a�Admin/Unadopted.phpnu�[���PK4g�[�#o,,��Admin/Users/index.htmlnu�[���PK4g�[Cy�UU(�Admin/Users/Keys.phpnu�[���PK4g�[ai�WW��Admin/Users/Organization.phpnu�[���PK4g�[W���
�
d�Admin/Users/Repository.phpnu�[���PK4g�[[N��O�Admin/Users.phpnu�[���PK4g�[����Factory.phpnu�[���PK4g�[�#o,,
`index.htmlnu�[���PK4g�[x��ӹ��Issue/Comments.phpnu�[���PK4g�[�\�kk�%Issue/Deadline.phpnu�[���PK4g�[�#o,,n+Issue/index.htmlnu�[���PK4g�[o
gg�+Issue/Labels.phpnu�[���PK4g�[�����>Issue/Milestones.phpnu�[���PK4g�[j��!�
�
ZUIssue/Reactions/Comment.phpnu�[���PK4g�[�#o,,J`Issue/Reactions/index.htmlnu�[���PK4g�[�4v��`Issue/Reactions.phpnu�[���PK4g�[�l���lIssue/Repository/Comments.phpnu�[���PK4g�[�#o,,�sIssue/Repository/index.htmlnu�[���PK5g�[=�-� ^tIssue/Stopwatch.phpnu�[���PK5g�[{���
�
�}Issue/Subscriptions.phpnu�[���PK5g�[\_��ЋIssue/Timeline.phpnu�[���PK5g�[n&/�YYۓIssue/Times.phpnu�[���PK5g�[]%X�-�- s�Issue.phpnu�[���PK5g�[��c��
S�Labels.phpnu�[���PK5g�[Ճx�Miscellaneous/Activitypub.phpnu�[���PK5g�[��"�����Miscellaneous/Gpg.phpnu�[���PK5g�[�#o,,��Miscellaneous/index.htmlnu�[���PK5g�[� �����Miscellaneous/Markdown.phpnu�[���PK5g�[��(���%�Miscellaneous/NodeInfo.phpnu�[���PK5g�[s$�����Miscellaneous/Version.phpnu�[���PK5g�[�#o,,�Notifications/index.htmlnu�[���PK5g�[q����b�Notifications/Repository.phpnu�[���PK5g�[����> > x
Notifications/Thread.phpnu�[���PK5g�[4{����Notifications.phpnu�[���PK5g�[�G�H]]&Organization/Hooks.phpnu�[���PK5g�[�#o,,�8Organization/index.htmlnu�[���PK5g�[��p�))39Organization/Labels.phpnu�[���PK5g�[��ޭy y �IOrganization/Members.phpnu�[���PK5g�[��G�11dSOrganization/PublicMembers.phpnu�[���PK5g�[Ə����^Organization/Repository.phpnu�[���PK5g�[�#o,,)nOrganization/Teams/index.htmlnu�[���PK5g�[�r�
�
�nOrganization/Teams/Members.phpnu�[���PK5g�[=>��!�yOrganization/Teams/Repository.phpnu�[���PK5g�[�0
^LL$�Organization/Teams.phpnu�[���PK5g�[�d�
��Organization/User.phpnu�[���PK5g�[5�i�<<�Organization.phpnu�[���PK5g�[6b(����Package/Files.phpnu�[���PK5g�[�#o,,��Package/index.htmlnu�[���PK5g�[���{88�Package/Owner.phpnu�[���PK5g�[�h�(ee��Package.phpnu�[���PK5g�[��BB)�Repository/Archive.phpnu�[���PK5g�[��������Repository/Assignees.phpnu�[���PK5g�[����Repository/Attachments.phpnu�[���PK5g�[�#o,,�Repository/Branch/index.htmlnu�[���PK5g�[*��J5J5
��Repository/Branch/Protection.phpnu�[���PK5g�[�¶�..0&Repository/Branch.phpnu�[���PK5g�[|����4Repository/Collaborator.phpnu�[���PK5g�[TC���FRepository/Commits.phpnu�[���PK5g�[�Ywaz6z6E\Repository/Contents.phpnu�[���PK5g�[��v���Repository/Forks.phpnu�[���PK5g�[%�=�77�Repository/Gpg.phpnu�[���PK5g�[2b�<))��Repository/Hooks/Git.phpnu�[���PK5g�[�#o,,�Repository/Hooks/index.htmlnu�[���PK5g�[o4����z�Repository/Hooks.phpnu�[���PK5g�[�#o,,n�Repository/index.htmlnu�[���PK5g�[�I kk�Repository/Keys.phpnu�[���PK5g�[���kk��Repository/Languages.phpnu�[���PK5g�[M�ʹ�@�Repository/Media.phpnu�[���PK5g�[C(y�8�Repository/Merge.phpnu�[���PK5g�[E�[Z�Repository/Mirror.phpnu�[���PK5g�[�f�<<��Repository/Mirrors.phpnu�[���PK5g�[N{���aRepository/Notes.phpnu�[���PK5g�[�=9Έ
�
URepository/Patch.phpnu�[���PK5g�[`����3�3!Repository/Pulls.phpnu�[���PK6g�[9��]xx4ERepository/Refs.phpnu�[���PK6g�[,����KRepository/Releases.phpnu�[���PK6g�[
�[
[
�jRepository/Remote.phpnu�[���PK6g�[���JJVuRepository/Reviewers.phpnu�[���PK6g�[�8����Repository/Reviews.phpnu�[���PK6g�[�}vC]]ǟRepository/Stargazers.phpnu�[���PK6g�[�e�177m�Repository/Statuses.phpnu�[���PK6g�[j�1���Repository/Tags.phpnu�[���PK6g�[j:J����Repository/Teams.phpnu�[���PK6g�[�]77��Repository/Templates.phpnu�[���PK6g�[�gq��H�Repository/Times.phpnu�[���PK6g�[�jtR��2�Repository/Topics.phpnu�[���PK6g�[AV�j j 0�Repository/Transfer.phpnu�[���PK6g�[�X���Repository/Trees.phpnu�[���PK6g�[
�̆K
K
�Repository/Watchers.phpnu�[���PK6g�[�T:ܳ��Repository/Wiki.phpnu�[���PK6g�[�ۚ�K0K0�!Repository.phpnu�[���PK6g�[��k^��,RService/Admin.phpnu�[���PK6g�[�#o,,eService/index.htmlnu�[���PK6g�[�QVII|eService/Issue.phpnu�[���PK6g�[g)Έg g �Service/Jcb.phpnu�[���PK6g�[�>ce��Service/Miscellaneous.phpnu�[���PK6g�[�s��
t�Service/Notifications.phpnu�[���PK6g�[�)b+
ҦService/Organization.phpnu�[���PK6g�['��{ { '�Service/Package.phpnu�[���PK6g�[T�eUeU��Service/Repository.phpnu�[���PK6g�[j�ei���
Service/Settings.phpnu�[���PK6g�[z��� �
�,Service/User.phpnu�[���PK6g�[��ގvv�MService/Utilities.phpnu�[���PK6g�[1g�5��?TSettings/Api.phpnu�[���PK6g�[����XSettings/Attachment.phpnu�[���PK6g�[�#o,,�[Settings/index.htmlnu�[���PK6g�[ՄW���l\Settings/Repository.phpnu�[���PK6g�[]WE��W`Settings/Ui.phpnu�[���PK6g�[FnFFdUser/Applications.phpnu�[���PK6g�[L�@j���sUser/Emails.phpnu�[���PK6g�[�Q(���{User/Followers.phpnu�[���PK6g�[-���
s�User/Following.phpnu�[���PK6g�[����&&ՊUser/Gpg.phpnu�[���PK6g�[�#o,,7�User/index.htmlnu�[���PK6g�[.�4I��
��User/Keys.phpnu�[���PK6g�[Md��66��User/Repos.phpnu�[���PK6g�[���<<�User/Settings.phpnu�[���PK6g�[첽u����User/Starred.phpnu�[���PK6g�[R����r�User/Subscriptions.phpnu�[���PK6g�[�����d�User/Teams.phpnu�[���PK6g�[�Ŧ�'�User/Times.phpnu�[���PK6g�[�M��/
/
�User/Tokens.phpnu�[���PK6g�[{��<
y�User.phpnu�[���PK6g�[�\ ����Utilities/Http.phpnu�[���PK6g�[�#o,,�Utilities/index.htmlnu�[���PK6g�[:,�
�
[Utilities/Response.phpnu�[���PK6g�[��6��-Utilities/Uri.phpnu�[���PK��
1i*