fix phpcs

This commit is contained in:
Frédéric FRANCE 2020-10-27 21:28:26 +01:00
parent f7c90d7e90
commit 7a7a6f8018
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
4 changed files with 14 additions and 22 deletions

View File

@ -17,6 +17,7 @@
<exclude-pattern type="relative">*/nltechno*</exclude-pattern>
<exclude-pattern type="relative">*/htdocs/includes</exclude-pattern>
<exclude-pattern type="relative">*/htdocs/includes</exclude-pattern>
<exclude-pattern type="relative">.git</exclude-pattern>
<!-- List of all tests -->

View File

@ -29,7 +29,7 @@
* \brief List of bank transactions
*/
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
require '../../main.inc.php';
@ -125,8 +125,7 @@ elseif ($syear && $smonth && $sday) $sql .= " AND datef BETWEEN '".$db->idate(
else dol_print_error('', 'Year not defined');
$resql = $db->query($sql);
if ($resql)
{
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
@ -166,12 +165,10 @@ if ($resql)
$totalarray = array();
$cachebankaccount = array();
$amountpertype = array();
while ($i < $num)
{
while ($i < $num) {
$objp = $db->fetch_object($resql);
if (empty($cachebankaccount[$objp->bankid]))
{
if (empty($cachebankaccount[$objp->bankid])) {
$bankaccounttmp = new Account($db);
$bankaccounttmp->fetch($objp->bankid);
$cachebankaccount[$objp->bankid] = $bankaccounttmp;
@ -235,8 +232,7 @@ if ($resql)
// Debit
print '<td class="right">';
if ($objp->amount < 0)
{
if ($objp->amount < 0) {
print price($objp->amount * -1);
$totalarray['val']['totaldebfield'] += $objp->amount;
$amountpertype[$objp->code] += $objp->amount;
@ -247,8 +243,7 @@ if ($resql)
// Credit
print '<td class="right">';
if ($objp->amount > 0)
{
if ($objp->amount > 0) {
print price($objp->amount);
$totalarray['val']['totalcredfield'] += $objp->amount;
$amountpertype[$objp->code] -= $objp->amount;

View File

@ -76,7 +76,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
// Restrict use to some protocols only
$protocols = 0;
if (is_array($allowedschemes)) {
foreach($allowedschemes as $allowedscheme) {
foreach ($allowedschemes as $allowedscheme) {
if ($allowedscheme == 'http') $protocols |= CURLPROTO_HTTP;
if ($allowedscheme == 'https') $protocols |= CURLPROTO_HTTPS;
}
@ -129,8 +129,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
$info = array();
$response = '';
do
{
do {
if ($maxRedirection < 1) break;
curl_setopt($ch, CURLOPT_URL, $newUrl);
@ -187,7 +186,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
$http_code = 0;
}
}
while($http_code);
while ($http_code);
$request = curl_getinfo($ch, CURLINFO_HEADER_OUT); // Reading of request must be done after sending request
@ -196,8 +195,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
dol_syslog("getURLContent response size=".strlen($response)); // This may contains binary data, so we dont output it
$rep = array();
if (curl_errno($ch))
{
if (curl_errno($ch)) {
// Ad keys to $rep
$rep['content'] = $response;
@ -240,14 +238,12 @@ function getDomainFromURL($url, $mode = 0)
{
$tmpdomain = preg_replace('/^https?:\/\//i', '', $url); // Remove http(s)://
$tmpdomain = preg_replace('/\/.*$/i', '', $tmpdomain); // Remove part after domain
if ($mode == 2)
{
if ($mode == 2) {
$tmpdomain = preg_replace('/^.*\.([^\.]+)\.([^\.]+)\.([^\.]+)$/', '\1.\2.\3', $tmpdomain); // Remove part 'www.' before 'abc.mydomain.com'
} else {
$tmpdomain = preg_replace('/^.*\.([^\.]+)\.([^\.]+)$/', '\1.\2', $tmpdomain); // Remove part 'www.abc.' before 'mydomain.com'
}
if (empty($mode))
{
if (empty($mode)) {
$tmpdomain = preg_replace('/\.[^\.]+$/', '', $tmpdomain); // Remove first level domain (.com, .net, ...)
}

View File

@ -171,7 +171,7 @@ class RestAPIDocumentTest extends PHPUnit\Framework\TestCase
'fileencoding'=>""
);
$result = getURLContent($url, 'POST', $data, 1,array(), array('http', 'https'), 2);
$result = getURLContent($url, 'POST', $data, 1, array(), array('http', 'https'), 2);
echo __METHOD__.' Result for sending document: '.var_export($result, true)."\n";
echo __METHOD__.' curl_error_no: '.$result['curl_error_no']."\n";
$object = json_decode($result['content'], true);