Add a readable module name
This commit is contained in:
parent
20a6a011d9
commit
28696ce13f
4 changed files with 49 additions and 16 deletions
17
src/Service/ModuleNameConverter.php
Normal file
17
src/Service/ModuleNameConverter.php
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Opdavies\DrupalModuleGenerator\Service;
|
||||
|
||||
class ModuleNameConverter
|
||||
{
|
||||
public function __invoke(string $moduleName)
|
||||
{
|
||||
$parts = explode('_', $moduleName);
|
||||
|
||||
$parts = array_map(function ($part) {
|
||||
return ucfirst($part);
|
||||
}, $parts);
|
||||
|
||||
return implode(' ', $parts);
|
||||
}
|
||||
}
|
||||
Reference in a new issue