Skip to content

Commit

Permalink
refactor: No more relative path to composer.json
Browse files Browse the repository at this point in the history
  • Loading branch information
tarlepp committed Aug 6, 2019
1 parent 1ee3793 commit 3e2802e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Controller/DefaultController.php
Expand Up @@ -114,17 +114,19 @@ public function healthzAction(
* ),
* )
*
* @param string $projectDir
*
* @return JsonResponse
*
* @throws Throwable
*/
public function versionAction(): JsonResponse
public function versionAction(string $projectDir): JsonResponse
{
/** @var stdClass $composerData */
$composerData = JSON::decode((string)file_get_contents(__DIR__ . '/../../composer.json'));
$composerData = JSON::decode((string)file_get_contents($projectDir . '/composer.json'));

$data = [
'version' => $composerData->version,
'version' => $composerData->version ?? '0.0.0',
];

return new JsonResponse($data);
Expand Down

0 comments on commit 3e2802e

Please sign in to comment.