Skip to content

Commit

Permalink
BadgeController extends ContainerAware
Browse files Browse the repository at this point in the history
  • Loading branch information
leopro committed May 29, 2013
1 parent c1a8a21 commit c2bd71e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/PUGX/BadgeBundle/Controller/BadgeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace PUGX\BadgeBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpFoundation\StreamedResponse;
Expand All @@ -20,17 +20,17 @@
use PUGX\BadgeBundle\Service\ImageCreator;
use PUGX\BadgeBundle\Exception\InvalidArgumentException;

class BadgeController extends Controller
class BadgeController extends ContainerAware
{
public function downloadsAction($repository, $type = 'total')
{
$imageCreator = $this->get('image_creator');
$imageCreator = $this->container->get('image_creator');
$outputFilename = sprintf('%s.png', $type);
$httpCode = 500;

// get the statistic from packagist
try {
$downloads = $this->get('badger')->getPackageDownloads($repository, $type);
$downloads = $this->container->get('badger')->getPackageDownloads($repository, $type);
$downloadsText = $imageCreator->transformNumberToReadableFormat($downloads);
$httpCode = 200;
} catch (InvalidArgumentException $e) {
Expand All @@ -45,10 +45,10 @@ public function downloadsAction($repository, $type = 'total')

public function versionAction($repository)
{
$imageCreator = $this->get('image_creator');
$imageCreator = $this->container->get('image_creator');
$outputFilename = sprintf('%s.png', 'version');

$version = $this->get('badger')->getLatestStableVersion($repository);
$version = $this->container->get('badger')->getLatestStableVersion($repository);

if ($version) {
$image = $imageCreator->createStableImage($version);
Expand All @@ -61,7 +61,7 @@ public function versionAction($repository)

protected function streamImage($image, $outputFilename)
{
$imageCreator = $this->get('image_creator');
$imageCreator = $this->container->get('image_creator');

//generating the streamed response
$response = new StreamedResponse(null);
Expand Down

0 comments on commit c2bd71e

Please sign in to comment.