Skip to content

Commit d8a667d

Browse files
committed
Improve code readability
1 parent 732a9ad commit d8a667d

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

migrations/setup_site_icons.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function configure_site_icons()
5050
$filesystem = $this->get_filesystem();
5151
$root_path = $this->container->getParameter('core.root_path');
5252
$user = $this->container->get('user');
53-
$logger = $this->container->get('log');
53+
$log = $this->container->get('log');
5454

5555
// Prepare paths once
5656
$new_icon_path = $root_path . self::NEW_ICON_DIR;
@@ -86,16 +86,21 @@ public function configure_site_icons()
8686
}
8787

8888
// Set up a log message result
89-
$message = $copied ? 'LOG_WEBPUSH_ICON_COPY_SUCCESS' : 'LOG_WEBPUSH_ICON_DIR_SUCCESS';
90-
$result = [$message => [self::NEW_ICON_DIR]];
89+
$result = [
90+
'lang_key' => $copied ? 'LOG_WEBPUSH_ICON_COPY_SUCCESS' : 'LOG_WEBPUSH_ICON_DIR_SUCCESS',
91+
'params' => [$new_icon_path],
92+
];
9193
}
9294
catch (filesystem_exception $e)
9395
{
94-
$result = ['LOG_WEBPUSH_ICON_DIR_FAIL' => [$e->get_filename(), $e->getMessage()]];
96+
$result = [
97+
'lang_key' => 'LOG_WEBPUSH_ICON_DIR_FAIL',
98+
'params' => [$e->get_filename(), $e->getMessage()]
99+
];
95100
}
96101

97102
// Log result
98-
$logger->add('admin', $user->data['user_id'], $user->ip, key($result), false, current($result));
103+
$log->add('admin', $user->data['user_id'], $user->ip, $result['lang_key'], false, $result['params']);
99104
}
100105

101106
/**

0 commit comments

Comments
 (0)