improve #355
Annotations
10 warnings
src/Profiler.php#L62
Escaped Mutant for Mutator "FunctionCallRemoval":
--- Original
+++ New
@@ @@
public function __construct(private LoggerInterface $logger, array $targets = [])
{
$this->setTargets($targets);
- register_shutdown_function([$this, 'flush']);
+
}
/**
* Enable or disable profiler.
|
src/Profiler.php#L72
Escaped Mutant for Mutator "CloneRemoval":
--- Original
+++ New
@@ @@
*/
public function enable(bool $value = true) : self
{
- $new = clone $this;
+ $new = $this;
$new->enabled = $value;
return $new;
}
|
src/Profiler.php#L137
Escaped Mutant for Mutator "UnwrapArrayMerge":
--- Original
+++ New
@@ @@
return;
}
$category = $this->getCategoryFromContext($context);
- $context = array_merge($context, ['token' => $token, 'category' => $category, 'nestedLevel' => $this->nestedLevel, 'time' => microtime(true), 'beginTime' => microtime(true), 'beginMemory' => memory_get_usage()]);
+ $context = ['token' => $token, 'category' => $category, 'nestedLevel' => $this->nestedLevel, 'time' => microtime(true), 'beginTime' => microtime(true), 'beginMemory' => memory_get_usage()];
$message = new Message($category, $token, $context);
$this->pendingMessages[$category][$token][] = $message;
$this->nestedLevel++;
|
src/Profiler.php#L139
Escaped Mutant for Mutator "ArrayItemRemoval":
--- Original
+++ New
@@ @@
return;
}
$category = $this->getCategoryFromContext($context);
- $context = array_merge($context, ['token' => $token, 'category' => $category, 'nestedLevel' => $this->nestedLevel, 'time' => microtime(true), 'beginTime' => microtime(true), 'beginMemory' => memory_get_usage()]);
+ $context = array_merge($context, ['category' => $category, 'nestedLevel' => $this->nestedLevel, 'time' => microtime(true), 'beginTime' => microtime(true), 'beginMemory' => memory_get_usage()]);
$message = new Message($category, $token, $context);
$this->pendingMessages[$category][$token][] = $message;
$this->nestedLevel++;
|
src/Profiler.php#L143
Escaped Mutant for Mutator "ArrayItem":
--- Original
+++ New
@@ @@
return;
}
$category = $this->getCategoryFromContext($context);
- $context = array_merge($context, ['token' => $token, 'category' => $category, 'nestedLevel' => $this->nestedLevel, 'time' => microtime(true), 'beginTime' => microtime(true), 'beginMemory' => memory_get_usage()]);
+ $context = array_merge($context, ['token' => $token, 'category' => $category, 'nestedLevel' => $this->nestedLevel, 'time' > microtime(true), 'beginTime' => microtime(true), 'beginMemory' => memory_get_usage()]);
$message = new Message($category, $token, $context);
$this->pendingMessages[$category][$token][] = $message;
$this->nestedLevel++;
|
src/Profiler.php#L213
Escaped Mutant for Mutator "Minus":
--- Original
+++ New
@@ @@
* endMemory: int,
* } $context
*/
- $context['duration'] = $context['endTime'] - $context['beginTime'];
+ $context['duration'] = $context['endTime'] + $context['beginTime'];
$context['memoryDiff'] = $context['endMemory'] - $context['beginMemory'];
$this->messages[] = new Message($category, $message->token(), $context);
$this->nestedLevel--;
|
src/Profiler.php#L214
Escaped Mutant for Mutator "Minus":
--- Original
+++ New
@@ @@
* } $context
*/
$context['duration'] = $context['endTime'] - $context['beginTime'];
- $context['memoryDiff'] = $context['endMemory'] - $context['beginMemory'];
+ $context['memoryDiff'] = $context['endMemory'] + $context['beginMemory'];
$this->messages[] = new Message($category, $message->token(), $context);
$this->nestedLevel--;
}
|
src/Profiler.php#L229
Escaped Mutant for Mutator "MethodCallRemoval":
--- Original
+++ New
@@ @@
public function flush() : void
{
foreach ($this->pendingMessages as $category => $categoryMessages) {
- $this->logCategoryMessages($category, $categoryMessages);
+
}
$this->pendingMessages = [];
$this->nestedLevel = 0;
|
src/Profiler.php#L233
Escaped Mutant for Mutator "DecrementInteger":
--- Original
+++ New
@@ @@
$this->logCategoryMessages($category, $categoryMessages);
}
$this->pendingMessages = [];
- $this->nestedLevel = 0;
+ $this->nestedLevel = -1;
if (empty($this->messages)) {
return;
}
|
src/Profiler.php#L265
Escaped Mutant for Mutator "LogicalNot":
--- Original
+++ New
@@ @@
private function logCategoryMessages(string $category, array $categoryMessages) : void
{
foreach ($categoryMessages as $token => $messages) {
- if (!empty($messages)) {
+ if (empty($messages)) {
$this->logger->log(LogLevel::WARNING, sprintf('Unclosed profiling entry detected: category "%s" token "%s" %s', $category, $token, __METHOD__));
}
}
|
The logs for this run have expired and are no longer available.
Loading