Add a readable module name

This commit is contained in:
Oliver Davies 2020-02-09 19:16:57 +00:00
parent 20a6a011d9
commit 28696ce13f
4 changed files with 49 additions and 16 deletions

View 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);
}
}