mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-02 21:19:58 +09:00
Update to laravel 7
This commit is contained in:
@@ -15,9 +15,9 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* MemoryDataCollector.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class MemoryDataCollector extends DataCollector implements LateDataCollectorInterface
|
||||
{
|
||||
@@ -29,7 +29,7 @@ class MemoryDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function collect(Request $request, Response $response, \Exception $exception = null)
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null)
|
||||
{
|
||||
$this->updateMemoryUsage();
|
||||
}
|
||||
@@ -53,29 +53,19 @@ class MemoryDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
$this->updateMemoryUsage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the memory.
|
||||
*
|
||||
* @return int The memory
|
||||
*/
|
||||
public function getMemory()
|
||||
public function getMemory(): int
|
||||
{
|
||||
return $this->data['memory'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the PHP memory limit.
|
||||
*
|
||||
* @return int The memory limit
|
||||
* @return int|float
|
||||
*/
|
||||
public function getMemoryLimit()
|
||||
{
|
||||
return $this->data['memory_limit'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the memory usage data.
|
||||
*/
|
||||
public function updateMemoryUsage()
|
||||
{
|
||||
$this->data['memory'] = memory_get_peak_usage(true);
|
||||
@@ -84,12 +74,15 @@ class MemoryDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return 'memory';
|
||||
}
|
||||
|
||||
private function convertToBytes($memoryLimit)
|
||||
/**
|
||||
* @return int|float
|
||||
*/
|
||||
private function convertToBytes(string $memoryLimit)
|
||||
{
|
||||
if ('-1' === $memoryLimit) {
|
||||
return -1;
|
||||
@@ -97,9 +90,9 @@ class MemoryDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
|
||||
$memoryLimit = strtolower($memoryLimit);
|
||||
$max = strtolower(ltrim($memoryLimit, '+'));
|
||||
if (0 === strpos($max, '0x')) {
|
||||
if (str_starts_with($max, '0x')) {
|
||||
$max = \intval($max, 16);
|
||||
} elseif (0 === strpos($max, '0')) {
|
||||
} elseif (str_starts_with($max, '0')) {
|
||||
$max = \intval($max, 8);
|
||||
} else {
|
||||
$max = (int) $max;
|
||||
|
||||
Reference in New Issue
Block a user