Revert whole code to legacy

This commit is contained in:
Ghislain Loaec
2018-04-06 10:58:45 +02:00
parent 0ca2fe1fd5
commit 1af0828b15
255 changed files with 6898 additions and 10335 deletions

View File

@ -12,8 +12,6 @@
namespace BeSimple\SoapCommon;
use InvalidArgumentException;
/**
* @author Francis Besset <francis.besset@gmail.com>
*/
@ -27,29 +25,24 @@ class Cache
const TYPE_MEMORY = WSDL_CACHE_MEMORY;
const TYPE_DISK_MEMORY = WSDL_CACHE_BOTH;
static protected $types = [
static protected $types = array(
self::TYPE_NONE,
self::TYPE_DISK,
self::TYPE_MEMORY,
self::TYPE_DISK_MEMORY,
];
);
public static function getTypes()
static public function getTypes()
{
return self::$types;
}
public static function hasType($cacheType)
static public function isEnabled()
{
return in_array($cacheType, self::$types);
return self::iniGet('soap.wsdl_cache_enabled');
}
public static function isEnabled()
{
return self::iniGet('soap.wsdl_cache_enabled') === '1';
}
public static function setEnabled($enabled)
static public function setEnabled($enabled)
{
if (!in_array($enabled, array(self::ENABLED, self::DISABLED), true)) {
throw new \InvalidArgumentException();
@ -58,59 +51,61 @@ class Cache
self::iniSet('soap.wsdl_cache_enabled', $enabled);
}
public static function getType()
static public function getType()
{
return self::iniGet('soap.wsdl_cache');
}
public static function setType($type)
static public function setType($type)
{
if (!in_array($type, self::getTypes(), true)) {
throw new InvalidArgumentException(
'The cache type has to be either Cache::TYPE_NONE, Cache::TYPE_DISK, Cache::TYPE_MEMORY or Cache::TYPE_DISK_MEMORY'
);
throw new \InvalidArgumentException('The cache type has to be either Cache::TYPE_NONE, Cache::TYPE_DISK, Cache::TYPE_MEMORY or Cache::TYPE_DISK_MEMORY');
}
self::iniSet('soap.wsdl_cache', $type);
}
public static function getDirectory()
static public function getDirectory()
{
return self::iniGet('soap.wsdl_cache_dir');
}
public static function setDirectory($directory)
static public function setDirectory($directory)
{
if (!is_dir($directory)) {
mkdir($directory, 0777, true);
}
self::iniSet('soap.wsdl_cache_dir', $directory);
}
public static function getLifetime()
static public function getLifetime()
{
return self::iniGet('soap.wsdl_cache_ttl');
}
public static function setLifetime($lifetime)
static public function setLifetime($lifetime)
{
self::iniSet('soap.wsdl_cache_ttl', $lifetime);
}
public static function getLimit()
static public function getLimit()
{
return self::iniGet('soap.wsdl_cache_limit');
}
public static function setLimit($limit)
static public function setLimit($limit)
{
self::iniSet('soap.wsdl_cache_limit', $limit);
}
protected static function iniGet($key)
static protected function iniGet($key)
{
return ini_get($key);
}
protected static function iniSet($key, $value)
static protected function iniSet($key, $value)
{
ini_set($key, $value);
}
}
}