Skip to content

Commit 161eb66

Browse files
committed
Improving wording and coding style
1 parent d3cfe52 commit 161eb66

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

src/Utils/DefaultNamingStrategy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ private function getSchema(): Schema
327327
return $this->schema;
328328
}
329329

330-
public function getAutopivotEntityNameFrom(ForeignKeyConstraint $constraint, bool $useAlternativeName): string
330+
public function getAutoPivotEntityName(ForeignKeyConstraint $constraint, bool $useAlternativeName): string
331331
{
332332
return $this->getForeignKeyUpperCamelCaseName($constraint, $useAlternativeName);
333333
}

src/Utils/NamingStrategyInterface.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,12 @@ public function getJsonProperty(AbstractBeanPropertyDescriptor $property): strin
9393
*/
9494
public function getFindByIndexMethodName(Index $index, array $elements): string;
9595

96-
public function getAutopivotEntityNameFrom(ForeignKeyConstraint $constraint, bool $useAlternativeName): string;
96+
/**
97+
* Returns the prefix used when naming auto-pivot getters/setters.
98+
*
99+
* @param ForeignKeyConstraint $constraint
100+
* @param bool $useAlternativeName
101+
* @return string
102+
*/
103+
public function getAutoPivotEntityName(ForeignKeyConstraint $constraint, bool $useAlternativeName): string;
97104
}

src/Utils/PivotTableMethodsDescriptor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function getBeanClassName(): string
115115
private function getPluralName() : string
116116
{
117117
if ($this->isAutoPivot()) {
118-
$name = Inflector::pluralize($this->namingStrategy->getAutopivotEntityNameFrom($this->remoteFk, false));
118+
$name = Inflector::pluralize($this->namingStrategy->getAutoPivotEntityName($this->remoteFk, false));
119119
if ($this->useAlternateName) {
120120
$name .= 'By_'.$this->pivotTable->getName();
121121
}
@@ -135,11 +135,11 @@ private function getPluralName() : string
135135
private function getSingularName() : string
136136
{
137137
if ($this->isAutoPivot()) {
138-
$name = $this->namingStrategy->getAutopivotEntityNameFrom($this->remoteFk, false);
138+
$name = $this->namingStrategy->getAutoPivotEntityName($this->remoteFk, false);
139139
if ($this->useAlternateName) {
140140
$name .= 'By_'.$this->pivotTable->getName();
141141
}
142-
} else if (!$this->useAlternateName) {
142+
} elseif (!$this->useAlternateName) {
143143
$name = TDBMDaoGenerator::toSingular($this->remoteFk->getForeignTableName());
144144
} else {
145145
$name = TDBMDaoGenerator::toSingular($this->remoteFk->getForeignTableName()).'By_'.$this->pivotTable->getName();

tests/AbstractTDBMObjectTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
class AbstractTDBMObjectTest extends TestCase
88
{
9-
109
public function testGetManyToManyRelationshipDescriptor()
1110
{
1211
$object = new TDBMObject();

tests/TDBMObjectTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
class TDBMObjectTest extends TestCase
88
{
9-
109
public function testJsonSerialize()
1110
{
1211
$object = new TDBMObject();

0 commit comments

Comments
 (0)