<?php

declare(strict_types=1);

/**
 * Copyright (c) 2013-2017 OpenCFP
 *
 * For the full copyright and license information, please view
 * the LICENSE file that was distributed with this source code.
 *
 * @see https://github.com/opencfp/opencfp
 */

namespace OpenCFP\Http\Controller;

use OpenCFP\Domain\Model\Talk;
use Symfony\Component\HttpFoundation\Response;

class PagesController extends BaseController
{
    public function showHomepage(): Response
    {
        return $this->render('home.twig', $this->getContextWithTalksCount());
    }

    public function showSpeakerPackage(): Response
    {
        return $this->render('package.twig', $this->getContextWithTalksCount());
    }

    public function showTalkIdeas(): Response
    {
        return $this->render('ideas.twig', $this->getContextWithTalksCount());
    }

    private function getContextWithTalksCount()
    {
        return ['number_of_talks' => Talk::count()];
    }
}

<?php

declare(strict_types=1);

/**
 * Copyright (c) 2013-2017 OpenCFP
 *
 * For the full copyright and license information, please view
 * the LICENSE file that was distributed with this source code.
 *
 * @see https://github.com/opencfp/opencfp
 */

namespace OpenCFP\Http\Controller;

use OpenCFP\Domain\Model\Talk;
use Symfony\Component\HttpFoundation\Response;

class PagesController extends BaseController
{
    public function showHomepage(): Response
    {
        return $this->render('home.twig', [
            'number_of_talks' => Talk::count(),
        ]);
    }

    public function showSpeakerPackage(): Response
    {
        return $this->render('package.twig');
    }

    public function showTalkIdeas(): Response
    {
        return $this->render('ideas.twig');
    }
}

Remove number of talks variable from pages that dont use it.
Remove number of talks variable from pages that dont use it.

The speaker package and the talk ideas pages didn't use the
number_of_talks variable, so it had no sense to give it to them.
Since it is now only used in one place it makes more sense to inline it
