mirror of https://github.com/danoloan10/rss-bridge
[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
|
@ -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…
Reference in New Issue