mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-07-11 14:34:39 +02:00
[ActionFactory] Allow camel-case action names (#3044)
Dash symbol is used to convert dash-seperated string to camel-cased string
This commit is contained in:
parent
2db523a37a
commit
3d9fead463
1 changed files with 2 additions and 1 deletions
|
@ -26,7 +26,8 @@ class ActionFactory
|
||||||
*/
|
*/
|
||||||
public function create(string $name): ActionInterface
|
public function create(string $name): ActionInterface
|
||||||
{
|
{
|
||||||
$name = ucfirst(strtolower($name)) . 'Action';
|
$name = strtolower($name) . 'Action';
|
||||||
|
$name = implode(array_map('ucfirst', explode('-', $name)));
|
||||||
$filePath = $this->folder . $name . '.php';
|
$filePath = $this->folder . $name . '.php';
|
||||||
if (!file_exists($filePath)) {
|
if (!file_exists($filePath)) {
|
||||||
throw new \Exception('Invalid action');
|
throw new \Exception('Invalid action');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue