From 61da19a3d7dea70aa779219dd9dbeaabcbf46677 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sun, 28 Apr 2024 15:28:46 -0400 Subject: [PATCH] refactor: Code cleanup --- src/services/ServicesTrait.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/services/ServicesTrait.php b/src/services/ServicesTrait.php index ad3b9dd..a26c914 100755 --- a/src/services/ServicesTrait.php +++ b/src/services/ServicesTrait.php @@ -11,7 +11,6 @@ namespace nystudio107\twigprofiler\services; -use craft\helpers\ArrayHelper; use nystudio107\twigprofiler\services\Profile as ProfileService; use yii\base\InvalidConfigException; @@ -20,33 +19,32 @@ * @package Twig Profiler * @since 4.0.1 * - * @property ProfileService $pofile + * @property ProfileService $profile */ trait ServicesTrait { - // Public Methods + // Public Static Methods // ========================================================================= /** * @inheritdoc */ - public function __construct($id, $parent = null, array $config = []) + public static function config(): array { - // Merge in the passed config, so it our config can be overridden by Plugins::pluginConfigs['vite'] - // ref: https://github.com/craftcms/cms/issues/1989 - $config = ArrayHelper::merge([ + return [ 'components' => [ 'profile' => ProfileService::class, ], - ], $config); - - parent::__construct($id, $parent, $config); + ]; } + // Public Methods + // ========================================================================= + /** - * Returns the helper service + * Returns the profile service * - * @return ProfileService The minify service + * @return ProfileService The profile service * @throws InvalidConfigException */ public function getProfile(): ProfileService