Skip to content

Commit

Permalink
scrutinizer fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefanius67 committed Aug 3, 2021
1 parent 08c7230 commit c10409f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion SKien/XLogger/FileLogger.php
Expand Up @@ -128,7 +128,9 @@ protected function openLogfile() : void
{
if ($this->logfile === false) {
$strFullPath = $this->getFullpath();
switch (strtolower(pathinfo($strFullPath, PATHINFO_EXTENSION))) {
// scrutinizer didn't realize, that pathinfo returns allways string, if $options set!
$strExt = strtolower(/** @scrutinizer ignore-type */ pathinfo($strFullPath, PATHINFO_EXTENSION));
switch ($strExt) {
case 'csv':
case 'txt':
$this->strSep = ";";
Expand Down
7 changes: 4 additions & 3 deletions SKien/XLogger/XLogger.php
Expand Up @@ -121,8 +121,9 @@ public function setFullpath(string $strFullpath) : void
$this->closeLogfile();
if (strlen($strFullpath) > 0) {
$strFullpath = $this->replacePathPlaceholder($strFullpath);
$this->strPath = pathinfo($strFullpath, PATHINFO_DIRNAME);
$this->strFilename = pathinfo($strFullpath, PATHINFO_BASENAME);
// scrutinizer didn't realize, that pathinfo returns allways string, if $options set!
$this->strPath = /** @scrutinizer ignore-type */ pathinfo($strFullpath, PATHINFO_DIRNAME);
$this->strFilename = /** @scrutinizer ignore-type */ pathinfo($strFullpath, PATHINFO_BASENAME);
}
}

Expand Down Expand Up @@ -275,7 +276,7 @@ protected function replacePathPlaceholder(string $strPath) : string
$strPath = str_replace('{year}', date('Y'), $strPath);
$strPath = str_replace('{week}', date('Y_W'), $strPath);

$strUser = preg_replace("/[^A-Za-z0-9_-]/",'', $this->strUser);
$strUser = preg_replace("/[^A-Za-z0-9_-]/", '', $this->strUser);
$strPath = str_replace('{name}', $strUser, $strPath);

return $strPath;
Expand Down

0 comments on commit c10409f

Please sign in to comment.