Skip to content

Commit 6c7f7db

Browse files
author
abluchet
committed
quick fix pluralize => collection
1 parent 81a279d commit 6c7f7db

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/Operation/DashPathSegmentNameGenerator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Doctrine\Common\Util\Inflector;
1717

1818
/**
19-
* Generate a path name with an underscore separator according to a string and whether it needs pluralization.
19+
* Generate a path name with a dash separator according to a string and whether it's a collection or not.
2020
*
2121
* @author Antoine Bluchet <[email protected]>
2222
*/
@@ -25,11 +25,11 @@ final class DashPathSegmentNameGenerator implements PathSegmentNameGeneratorInte
2525
/**
2626
* {@inheritdoc}
2727
*/
28-
public function getSegmentName(string $name, bool $pluralize = true): string
28+
public function getSegmentName(string $name, bool $collection = true): string
2929
{
3030
$name = $this->dashize($name);
3131

32-
return $pluralize ? Inflector::pluralize($name) : $name;
32+
return $collection ? Inflector::pluralize($name) : $name;
3333
}
3434

3535
private function dashize(string $string): string

src/Operation/PathSegmentNameGeneratorInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace ApiPlatform\Core\Operation;
1515

1616
/**
17-
* Generates a path name according to a string and whether it needs pluralization.
17+
* Generates a path name according to a string and whether it's a collection or not.
1818
*
1919
* @author Antoine Bluchet <[email protected]>
2020
*/
@@ -24,9 +24,9 @@ interface PathSegmentNameGeneratorInterface
2424
* Transforms a given string to a valid path name which can be pluralized (eg. for collections).
2525
*
2626
* @param string $name usually a ResourceMetadata shortname
27-
* @param bool $pluralize
27+
* @param bool $collection
2828
*
2929
* @return string A string that is a part of the route name
3030
*/
31-
public function getSegmentName(string $name, bool $pluralize = true): string;
31+
public function getSegmentName(string $name, bool $collection = true): string;
3232
}

src/Operation/UnderscorePathSegmentNameGenerator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Doctrine\Common\Util\Inflector;
1717

1818
/**
19-
* Generate a path name with an underscore separator according to a string and whether it needs pluralization.
19+
* Generate a path name with an underscore separator according to a string and whether it's a collection or not.
2020
*
2121
* @author Antoine Bluchet <[email protected]>
2222
*/
@@ -25,10 +25,10 @@ final class UnderscorePathSegmentNameGenerator implements PathSegmentNameGenerat
2525
/**
2626
* {@inheritdoc}
2727
*/
28-
public function getSegmentName(string $name, bool $pluralize = true): string
28+
public function getSegmentName(string $name, bool $collection = true): string
2929
{
3030
$name = Inflector::tableize($name);
3131

32-
return $pluralize ? Inflector::pluralize($name) : $name;
32+
return $collection ? Inflector::pluralize($name) : $name;
3333
}
3434
}

0 commit comments

Comments
 (0)