Skip to content

Commit

Permalink
Made the user agent parsing class configurable.
Browse files Browse the repository at this point in the history
  • Loading branch information
ash-jc-allen committed Apr 25, 2024
1 parent 45a05cd commit ab74ad0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 12 additions & 0 deletions config/short-url.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,16 @@
|
*/
'validate_config' => false,

/*
|--------------------------------------------------------------------------
| User Agent Parser
|--------------------------------------------------------------------------
|
| Define the class that should be used to handle the parsing of the user
| agent string. This class must implement the following interface:
| AshAllenDesign\ShortURL\Interfaces\UserAgentDriver.
|
*/
'user_agent_driver' => \AshAllenDesign\ShortURL\Classes\UserAgent\ParserPhpDriver::class,
];
4 changes: 1 addition & 3 deletions src/Providers/ShortURLProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ public function boot(): void
(new Validation())->validateConfig();
}

// TODO Rename the interface.
// TODO Make the driver configurable.
$this->app->bind(UserAgentDriver::class, ParserPhpDriver::class);
$this->app->bind(UserAgentDriver::class, config('short-url.user_agent_driver'));
}
}

0 comments on commit ab74ad0

Please sign in to comment.