fix incrementer from post to pre

This commit is contained in:
Dennis Eichhorn 2019-02-11 17:27:04 +01:00
parent 9661171851
commit ebad6f044f
3 changed files with 8 additions and 7 deletions

View File

@ -96,7 +96,7 @@ final class NetPromoterScore
$count = 0; $count = 0;
foreach ($this->scores as $score) { foreach ($this->scores as $score) {
if ($score < 7) { if ($score < 7) {
$count++; ++$count;
} }
} }
@ -117,7 +117,7 @@ final class NetPromoterScore
$count = 0; $count = 0;
foreach ($this->scores as $score) { foreach ($this->scores as $score) {
if ($score > 6 && $score < 9) { if ($score > 6 && $score < 9) {
$count++; ++$count;
} }
} }
@ -138,7 +138,7 @@ final class NetPromoterScore
$count = 0; $count = 0;
foreach ($this->scores as $score) { foreach ($this->scores as $score) {
if ($score > 8) { if ($score > 8) {
$count++; ++$count;
} }
} }

View File

@ -114,7 +114,7 @@ final class Numbers
if ($n & 1 == 1) { if ($n & 1 == 1) {
break; break;
} else { } else {
$count++; ++$count;
$n = $n >> 1; $n = $n >> 1;
} }
} }

View File

@ -130,10 +130,11 @@ final class FileUtils
*/ */
public static function changeFileEncoding(string $file, string $encoding) : void public static function changeFileEncoding(string $file, string $encoding) : void
{ {
$content = \file_get_contents($file); $content = \file_get_contents($file);
$detected = \mb_detect_encoding($content);
if ($content !== false && \preg_match('!!u', $content)) { if ($content !== false) {
\file_put_contents($file, \mb_convert_encoding($content, 'UTF-8', \mb_list_encodings())); \file_put_contents($file, \mb_convert_encoding($content, $encoding, $detected === false ? \mb_list_encodings() : $detected));
} }
} }