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:
@@ -16,9 +16,12 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
|
||||
use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface;
|
||||
use Symfony\Component\Translation\DataCollectorTranslator;
|
||||
use Symfony\Component\VarDumper\Cloner\Data;
|
||||
|
||||
/**
|
||||
* @author Abdellatif Ait boudad <a.aitboudad@gmail.com>
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class TranslationDataCollector extends DataCollector implements LateDataCollectorInterface
|
||||
{
|
||||
@@ -45,7 +48,7 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function collect(Request $request, Response $response, \Exception $exception = null)
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null)
|
||||
{
|
||||
$this->data['locale'] = $this->translator->getLocale();
|
||||
$this->data['fallback_locales'] = $this->translator->getFallbackLocales();
|
||||
@@ -60,35 +63,26 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @return array|Data
|
||||
*/
|
||||
public function getMessages()
|
||||
{
|
||||
return isset($this->data['messages']) ? $this->data['messages'] : [];
|
||||
return $this->data['messages'] ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getCountMissings()
|
||||
public function getCountMissings(): int
|
||||
{
|
||||
return isset($this->data[DataCollectorTranslator::MESSAGE_MISSING]) ? $this->data[DataCollectorTranslator::MESSAGE_MISSING] : 0;
|
||||
return $this->data[DataCollectorTranslator::MESSAGE_MISSING] ?? 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getCountFallbacks()
|
||||
public function getCountFallbacks(): int
|
||||
{
|
||||
return isset($this->data[DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK]) ? $this->data[DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK] : 0;
|
||||
return $this->data[DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK] ?? 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getCountDefines()
|
||||
public function getCountDefines(): int
|
||||
{
|
||||
return isset($this->data[DataCollectorTranslator::MESSAGE_DEFINED]) ? $this->data[DataCollectorTranslator::MESSAGE_DEFINED] : 0;
|
||||
return $this->data[DataCollectorTranslator::MESSAGE_DEFINED] ?? 0;
|
||||
}
|
||||
|
||||
public function getLocale()
|
||||
@@ -97,7 +91,7 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal since Symfony 4.2
|
||||
* @internal
|
||||
*/
|
||||
public function getFallbackLocales()
|
||||
{
|
||||
@@ -107,12 +101,12 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return 'translation';
|
||||
}
|
||||
|
||||
private function sanitizeCollectedMessages($messages)
|
||||
private function sanitizeCollectedMessages(array $messages)
|
||||
{
|
||||
$result = [];
|
||||
foreach ($messages as $key => $message) {
|
||||
@@ -137,7 +131,7 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function computeCount($messages)
|
||||
private function computeCount(array $messages)
|
||||
{
|
||||
$count = [
|
||||
DataCollectorTranslator::MESSAGE_DEFINED => 0,
|
||||
@@ -152,7 +146,7 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto
|
||||
return $count;
|
||||
}
|
||||
|
||||
private function sanitizeString($string, $length = 80)
|
||||
private function sanitizeString(string $string, int $length = 80)
|
||||
{
|
||||
$string = trim(preg_replace('/\s+/', ' ', $string));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user