Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Adapter/AbstractAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static function factory($type = 'socket', $proxyConfig = null, $customNam
{
$obj = null;
// Ensure the custom namespace ends with a \
$customNamespace = rtrim($customNamespace, '\\') .'\\';
$customNamespace = rtrim($customNamespace ?? '', '\\') .'\\';
if ((strpos($type, '\\') !== false) && class_exists($type)) {
$obj = new $type($proxyConfig);
} elseif ((strlen($customNamespace) > 1) && class_exists($customNamespace . ucfirst($type))) {
Expand Down
2 changes: 1 addition & 1 deletion Adapter/Socket.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ private function connectToProxy(array $proxyConfig, array $config)
*/
private function getProxyList()
{
if (!strlen($this->proxyConfig)) {
if (!strlen($this->proxyConfig ?? '')) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function __construct($specialWhois = array(), $customIni = null)
{
if (empty($this->config)) {
$this->config = parse_ini_file('whois.ini');
if (strlen($customIni)) {
if (strlen($customIni ?? '')) {
$this->customConfig = parse_ini_file($customIni);
}
}
Expand Down
10 changes: 5 additions & 5 deletions Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class Parser
* @var string
* @access protected
*/
protected $dateformat = '%Y-%m-%d %H:%M:%S';
protected $dateformat = 'Y-m-d H:i:s';

/**
* Activate cache
Expand Down Expand Up @@ -272,7 +272,7 @@ private function prepare($query)
if ($this->cachePath !== null) {
$Parser->setCachePath($this->cachePath);
}
$this->Query = $Parser->parse(filter_var($query, FILTER_SANITIZE_STRING));
$this->Query = $Parser->parse(filter_var($query, FILTER_UNSAFE_RAW));
}
}

Expand All @@ -287,7 +287,7 @@ private function prepare($query)
public function call($query = '')
{
if ($query != '') {
$this->Query = filter_var($query, FILTER_SANITIZE_STRING);
$this->Query = filter_var($query, FILTER_UNSAFE_RAW);
}

$Config = $this->Config->getCurrent();
Expand Down Expand Up @@ -471,7 +471,7 @@ public function getQuery()
*/
public function setFormat($format = 'object')
{
$this->format = filter_var($format, FILTER_SANITIZE_STRING);
$this->format = filter_var($format, FILTER_UNSAFE_RAW);
}

/**
Expand All @@ -483,7 +483,7 @@ public function setFormat($format = 'object')
* @param string $dateformat
* @return void
*/
public function setDateFormat($dateformat = '%Y-%m-%d %H:%M:%S')
public function setDateFormat($dateformat = 'Y-m-d H:i:s')
{
$this->dateformat = $dateformat;
}
Expand Down
12 changes: 9 additions & 3 deletions Result/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class Result extends AbstractResult
/**
* Name of the actual template
*
* @var string
* @var string[]
* @access protected
*/
public $template;
Expand Down Expand Up @@ -533,7 +533,7 @@ public function cleanUp($config, $dateformat)
/**
* Format given dates by date format
*
* @param string $dateformat
* @param string $dateformat
* @param string $date
* @return string
*/
Expand All @@ -548,6 +548,12 @@ private function formatDate($dateformat, $date)
$timestamp = strtotime(str_replace('/', '.', $date));
}

return (strlen($timestamp) ? strftime($dateformat, $timestamp) : $date);
if ($timestamp !== false) {
$dt = new \DateTime();
$dt->setTimestamp($timestamp);
return $dt->format($dateformat);
}

return $date;
}
}
2 changes: 1 addition & 1 deletion Templates/Type/AbstractTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public static function factory($template, $customNamespace = null)
$obj = null;

// Ensure the custom namespace ends with a \
$customNamespace = rtrim($customNamespace, '\\') .'\\';
$customNamespace = rtrim($customNamespace ?? '', '\\') .'\\';
if ((strpos($template, '\\') !== false) && class_exists($template, $customNamespace)) {
$class = $template;
$obj = new $class();
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
, "author": "Novutec Inc."
, "license": "Apache-2.0"
, "require": {
"php": ">=7.4.0",
"novutec/domainparser": ">=2.0.3"
}
, "autoload": {
Expand Down