Skip to content

Commit 25da1ed

Browse files
committed
php8
1 parent d88ab25 commit 25da1ed

File tree

9 files changed

+21
-35
lines changed

9 files changed

+21
-35
lines changed

app/base/abstracts/Controllers/AdminManageModelsPage.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,7 @@ public function getObject(): ?BaseModel
142142
*/
143143
public function getTable(): ?string
144144
{
145-
if (!is_null($this->getTemplate())) {
146-
return $this->getTemplate()->data()['table'] ?? null;
147-
}
148-
149-
return $this->getTemplateData()['table'] ?? null;
145+
return $this->getTemplate()?->data()['table'] ?? ($this->getTemplateData()['table'] ?? null);
150146
}
151147

152148
/**
@@ -156,11 +152,7 @@ public function getTable(): ?string
156152
*/
157153
public function getPaginator(): ?string
158154
{
159-
if (!is_null($this->getTemplate())) {
160-
return $this->getTemplate()->data()['paginator'] ?? null;
161-
}
162-
163-
return $this->getTemplateData()['paginator'] ?? null;
155+
return $this->getTemplate()?->data()['paginator'] ?? ($this->getTemplateData()['paginator'] ?? null);
164156
}
165157

166158
/**

app/base/abstracts/Controllers/FormPage.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ public function __construct(ContainerInterface $container, Request $request, Rou
6464
protected function processFormSubmit() : void
6565
{
6666
$this->getApp()->event('before_form_process', ['form' => $this->getForm()]);
67-
if ($this->getForm() != null) {
68-
$this->getForm()->process();
69-
}
67+
$this->getForm()?->process();
7068
}
7169
}

app/base/abstracts/Controllers/FrontendPage.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ public function getCurrentLocale(): ?string
284284
if ($this->locale == null) {
285285
// try by menu
286286
$rewrite = $this->getRewrite();
287-
if ($rewrite != null && (($menu_obj = $rewrite->menuList()->fetch()) != null)) {
287+
if (($menu_obj = $rewrite?->menuList()->fetch()) != null) {
288288
/** @var Menu $menu_obj */
289289
$menu_obj = $this->getContainer()->make(Menu::class, ['db_row' => $menu_obj]);
290290
$this->locale = $menu_obj->getLocale();
@@ -342,15 +342,12 @@ public function getCurrentWebsite(): ?Website
342342
*/
343343
public function getTranslations(): array
344344
{
345-
if ($this->getRewrite() != null) {
346-
return array_map(
347-
function ($el) {
348-
return $el->url;
349-
},
350-
$this->getRewrite()->getTranslations()
351-
);
352-
}
353-
return [];
345+
return array_map(
346+
function ($el) {
347+
return $el->url;
348+
},
349+
$this->getRewrite()?->getTranslations() ?? []
350+
);
354351
}
355352

356353

app/base/tools/Utils/Globals.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ public function logException(Throwable $e, $prefix = null, Request $request = nu
373373
{
374374
$this->getLog()->error($prefix . ($prefix != null ? ' - ' : '') . $e->getMessage());
375375
$this->getLog()->debug($e->getTraceAsString());
376-
if ($request != null && !empty($request->request->all())) {
376+
if (!empty($request?->request->all())) {
377377
$this->getLog()->debug(serialize($request->request->all()));
378378
}
379379
}

app/base/traits/FormPageTrait.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,7 @@ protected function getFormId(): string
4646
*/
4747
public function getForm(): ?FAPI\Form
4848
{
49-
if (!is_null($this->getTemplate())) {
50-
return $this->getTemplate()->data()['form'] ?? null;
51-
}
52-
53-
return $this->template_data['form'] ?? null;
49+
return $this->getTemplate()?->data()['form'] ?? ($this->template_data['form'] ?? null);
5450
}
5551

5652
/**

app/site/blocks/RewriteMedia.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public function renderHTML(BasePage $current_page = null, $data = []): string
4141
{
4242

4343
$rewrite_id = [];
44-
if ($current_page != null && $current_page->getRewrite() && $current_page->getRewrite()->getId()) {
45-
$rewrite_id[] = $current_page->getRewrite()->getId();
44+
if ($current_page?->getRewrite()?->getId()) {
45+
$rewrite_id[] = $current_page?->getRewrite()?->getId();
4646
$rewrite_id[] = null;
4747
} else {
4848
$rewrite_id = null;

app/site/controllers/Admin/MediaRewrites.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ function ($elem) {
239239
'ID' => $elem->getId(),
240240
'Preview' => $elem->getMediaElement()->getThumb('100x100'),
241241
'Filename - Path' => $elem->getMediaElement()->getFilename(),
242-
'Website' => $elem->getRewriteId() != null ? $elem->getRewrite()->getWebsite()->getDomain() : 'All',
243-
'Rewrite - Url' => $elem->getRewriteId() != null ? $elem->getRewrite()->getUrl() : 'Everywhere',
244-
'Locale' => $elem->getRewriteId() != null ? $elem->getRewrite()->getLocale() : 'Any',
242+
'Website' => $elem->getRewrite()?->getWebsite()?->getDomain() ?? 'All',
243+
'Rewrite - Url' => $elem->getRewrite()?->getUrl() ?? 'Everywhere',
244+
'Locale' => $elem->getRewrite()?->getLocale() ?? 'Any',
245245
'Owner' => $elem->getOwner()->username,
246246
'actions' => implode(
247247
" ",

app/site/migrations/optionals/FakeDataMigration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ private function addMenuItem(string $title, string $menu_name, Rewrite $rewrite,
568568
'title' => $title,
569569
'locale' => $locale,
570570
'rewrite_id' => $rewrite->getId(),
571-
'parent_id' => ($parent != null) ? $parent->getId() : null,
571+
'parent_id' => $parent?->getId() ?? null,
572572
//'breadcrumb' => $menu_item_model->getParentIds(),
573573
]]);
574574
$menu_item_model->persist();

bin/docker

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ case "$1" in
8484
echo "missing container name"
8585
fi
8686
;;
87+
ps)
88+
$docker_compose_bin ps
89+
;;
8790
console)
8891
if [[ $(dockerps php-fpm) = 1 ]]; then
8992
shift

0 commit comments

Comments
 (0)