first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
@@ -0,0 +1,27 @@
<?php
namespace PhpXmlRpc\Traits;
use PhpXmlRpc\Helper\Charset;
trait CharsetEncoderAware
{
protected static $charsetEncoder;
public function getCharsetEncoder()
{
if (self::$charsetEncoder === null) {
self::$charsetEncoder = Charset::instance();
}
return self::$charsetEncoder;
}
/**
* @param $charsetEncoder
* @return void
*/
public static function setCharsetEncoder($charsetEncoder)
{
self::$charsetEncoder = $charsetEncoder;
}
}
@@ -0,0 +1,40 @@
<?php
namespace PhpXmlRpc\Traits;
use PhpXmlRpc\PhpXmlRpc;
trait DeprecationLogger
{
use LoggerAware;
protected function logDeprecation($message)
{
if (PhpXmlRpc::$xmlrpc_silence_deprecations) {
return;
}
$this->getLogger()->warning('XML-RPC Deprecated: ' . $message);
}
/**
* @param string $callee
* @param string $expectedCaller atm only the method name is supported
* @return void
*/
protected function logDeprecationUnlessCalledBy($expectedCaller)
{
if (PhpXmlRpc::$xmlrpc_silence_deprecations) {
return;
}
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3);
/// @todo we should check as well $trace[2]['class'], and make sure that it is a descendent of the class passed in in $expectedCaller
if ($trace[2]['function'] === $expectedCaller) {
return;
}
$this->getLogger()->warning('XML-RPC Deprecated: ' . $trace[1]['class'] . '::' . $trace[1]['function'] .
' is only supposed to be called by ' . $expectedCaller);
}
}
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace PhpXmlRpc\Traits;
use PhpXmlRpc\Helper\Logger;
trait LoggerAware
{
protected static $logger;
public function getLogger()
{
if (self::$logger === null) {
self::$logger = Logger::instance();
}
return self::$logger;
}
/**
* @param $logger
* @return void
*/
public static function setLogger($logger)
{
self::$logger = $logger;
}
}
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace PhpXmlRpc\Traits;
use PhpXmlRpc\Helper\XMLParser;
trait ParserAware
{
protected static $parser;
/// @todo feature-creep: allow passing in $options (but then, how to deal with changing options between invocations?)
public function getParser()
{
if (self::$parser === null) {
self::$parser = new XMLParser();
}
return self::$parser;
}
/**
* @param $parser
* @return void
*/
public static function setParser($parser)
{
self::$parser = $parser;
}
}
+45
View File
@@ -0,0 +1,45 @@
<?php
namespace PhpXmlRpc\Traits;
trait PayloadBearer
{
/** @var string */
protected $payload;
/** @var string */
protected $content_type = 'text/xml';
/**
* @internal
*
* @param string $payload
* @param string $contentType
* @return $this
*/
public function setPayload($payload, $contentType = '')
{
$this->payload = $payload;
if ($contentType != '') {
$this->content_type = $contentType;
}
return $this;
}
/**
* @return string
*/
public function getPayload()
{
return $this->payload;
}
/**
* @return string
*/
public function getContentType()
{
return $this->content_type;
}
}