-
-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #124 from agiuliano/master
Abstract routes for future formats
- Loading branch information
Showing
11 changed files
with
167 additions
and
212 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 |
---|---|---|
|
@@ -29,6 +29,7 @@ | |
* @author Giulio De Donato <[email protected]> | ||
* @author Leonardo Proietti <[email protected]> | ||
* @author Simone Fumagalli <[email protected]> | ||
* @author Andrea Giuliano <[email protected]> | ||
*/ | ||
class BadgeController extends Controller | ||
{ | ||
|
@@ -64,15 +65,15 @@ public function searchPackagistAction(Request $request) | |
* @param string $repository repository | ||
* @param string $type badge type | ||
* | ||
* @Route("/{repository}/downloads.svg", | ||
* @Route("/{repository}/downloads", | ||
* name = "pugx_badge_download", | ||
* defaults = {"type" = "total"}, | ||
* requirements = { | ||
* "repository" = "[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+?" | ||
* } | ||
* ) | ||
* @Route("/{repository}/d/{type}.svg", | ||
* @Route("/{repository}/d/{type}", | ||
* name = "pugx_badge_download_type", | ||
* defaults = {"type" = "total"}, | ||
* requirements = { | ||
* "type" = "total|daily|monthly", | ||
* "repository" = "[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+?" | ||
|
@@ -83,7 +84,7 @@ public function searchPackagistAction(Request $request) | |
* | ||
* @return StreamedResponse | ||
*/ | ||
public function downloadsAction($repository, $type = 'total') | ||
public function downloadsAction($repository, $type) | ||
{ | ||
$imageCreator = $this->getImageCreator(); | ||
$status = 500; | ||
|
@@ -125,15 +126,15 @@ public function downloadsAction($repository, $type = 'total') | |
* @param string $repository repository | ||
* @param string $latest latest | ||
* | ||
* @Route("/{repository}/version.svg", | ||
* @Route("/{repository}/version", | ||
* name="pugx_badge_version", | ||
* defaults = {"latest" = "stable"}, | ||
* requirements={"repository" = "[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+?"} | ||
* ) | ||
* @Route("/{repository}/v/{latest}.svg", | ||
* @Route("/{repository}/v/{latest}", | ||
* name = "pugx_badge_version_latest", | ||
* defaults = {"latest" = "stable"}, | ||
* requirements = { | ||
* "type" = "stable|unstable", | ||
* "latest" = "stable|unstable", | ||
* "repository" = "[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+?" | ||
* } | ||
* ) | ||
|
@@ -142,7 +143,7 @@ public function downloadsAction($repository, $type = 'total') | |
* | ||
* @return StreamedResponse | ||
*/ | ||
public function versionAction($repository, $latest = 'stable') | ||
public function versionAction($repository, $latest) | ||
{ | ||
$image = null; | ||
$error = self::ERROR_TEXT_GENERIC; | ||
|
@@ -182,7 +183,7 @@ public function versionAction($repository, $latest = 'stable') | |
* | ||
* @param string $repository repository | ||
* | ||
* @Route("/{repository}/license.svg", | ||
* @Route("/{repository}/license", | ||
* name="pugx_badge_license", | ||
* requirements={"repository" = "[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+?"} | ||
* ) | ||
|
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
src/PUGX/BadgeBundle/Resources/config/routing/routing_aliases.yml
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,45 @@ | ||
download_svg_alias: | ||
path: /{repository}/downloads.svg | ||
defaults: | ||
_controller: PUGXBadgeBundle:Badge:downloads | ||
type: "total" | ||
requirements: | ||
repository: "[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+?" | ||
methods: [GET] | ||
|
||
download_type_svg_alias: | ||
path: /{repository}/d/{type}.svg | ||
defaults: | ||
_controller: PUGXBadgeBundle:Badge:downloads | ||
type: "total" | ||
requirements: | ||
repository: "[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+?" | ||
type: "total|daily|monthly" | ||
methods: [GET] | ||
|
||
badge_version_svg_alias: | ||
path: /{repository}/version.svg | ||
defaults: | ||
_controller: PUGXBadgeBundle:Badge:version | ||
latest: "stable" | ||
requirements: | ||
repository: "[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+?" | ||
methods: [GET] | ||
|
||
version_latest_svg_alias: | ||
path: /{repository}/v/{latest}.svg | ||
defaults: | ||
_controller: PUGXBadgeBundle:Badge:version | ||
latest: "stable" | ||
requirements: | ||
repository: "[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+?" | ||
latest: "stable|unstable" | ||
methods: [GET] | ||
|
||
badge_license_svg_alias: | ||
path: /{repository}/license.svg | ||
defaults: | ||
_controller: PUGXBadgeBundle:Badge:license | ||
requirements: | ||
repository: "[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+?" | ||
methods: [GET] |
53 changes: 53 additions & 0 deletions
53
src/PUGX/BadgeBundle/Resources/config/routing/routing_redirects.yml
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,53 @@ | ||
download_png_redirect: | ||
path: /{repository}/downloads.png | ||
defaults: | ||
_controller: FrameworkBundle:Redirect:redirect | ||
route: pugx_badge_download | ||
permanent: true | ||
requirements: | ||
repository: "[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+?" | ||
methods: [GET] | ||
|
||
download_type_png_redirect: | ||
path: /{repository}/d/{type}.png | ||
defaults: | ||
_controller: FrameworkBundle:Redirect:redirect | ||
route: pugx_badge_download_type | ||
permanent: true | ||
type: "total" | ||
requirements: | ||
repository: "[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+?" | ||
type: "total|daily|monthly" | ||
methods: [GET] | ||
|
||
badge_version_png_redirect: | ||
path: /{repository}/version.png | ||
defaults: | ||
_controller: FrameworkBundle:Redirect:redirect | ||
route: pugx_badge_version | ||
permanent: true | ||
requirements: | ||
repository: "[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+?" | ||
methods: [GET] | ||
|
||
version_latest_png_redirect: | ||
path: /{repository}/v/{latest}.png | ||
defaults: | ||
_controller: FrameworkBundle:Redirect:redirect | ||
route: pugx_badge_version_latest | ||
permanent: true | ||
latest: "stable" | ||
requirements: | ||
repository: "[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+?" | ||
type: "stable|unstable" | ||
methods: [GET] | ||
|
||
badge_license_png_redirect: | ||
path: /{repository}/license.png | ||
defaults: | ||
_controller: FrameworkBundle:Redirect:redirect | ||
route: pugx_badge_license | ||
permanent: true | ||
requirements: | ||
repository: "[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+?" | ||
methods: [GET] |
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
Oops, something went wrong.