-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
decoupled implementation by introducing BaseNameHelper
- Loading branch information
konradoboza
committed
Mar 28, 2022
1 parent
bdcbcd4
commit b377ddf
Showing
5 changed files
with
53 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
namespace Ibexa\GraphQL\Schema\Domain; | ||
|
||
use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter; | ||
|
||
abstract class BaseNameHelper | ||
{ | ||
private CamelCaseToSnakeCaseNameConverter $caseConverter; | ||
|
||
private Pluralizer $pluralizer; | ||
|
||
public function __construct(Pluralizer $pluralizer) | ||
{ | ||
$this->caseConverter = new CamelCaseToSnakeCaseNameConverter(null, false); | ||
$this->pluralizer = $pluralizer; | ||
} | ||
|
||
public function toCamelCase(string $string): string | ||
{ | ||
return $this->caseConverter->denormalize($string); | ||
} | ||
|
||
public function pluralize(string $name): string | ||
{ | ||
return $this->pluralizer->pluralize($name); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters