Completed
Pull Request — 5.6 (#2830)
by Jeroen
14:14
created

VotingBundle/Controller/VotingController.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Kunstmaan\VotingBundle\Controller;
4
5
use Kunstmaan\VotingBundle\Event\Events;
6
use Kunstmaan\VotingBundle\Event\Facebook\FacebookLikeEvent;
7
use Kunstmaan\VotingBundle\Event\Facebook\FacebookSendEvent;
8
use Kunstmaan\VotingBundle\Event\LinkedIn\LinkedInShareEvent;
9
use Kunstmaan\VotingBundle\Event\UpDown\DownVoteEvent;
10
use Kunstmaan\VotingBundle\Event\UpDown\UpVoteEvent;
11
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
12
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
13
use Symfony\Component\HttpFoundation\Request;
14
use Symfony\Component\Routing\Annotation\Route;
15
16
class VotingController extends Controller
0 ignored issues
show
Deprecated Code introduced by
The class Symfony\Bundle\Framework...e\Controller\Controller has been deprecated with message: since Symfony 4.2, use "Symfony\Bundle\FrameworkBundle\Controller\AbstractController" instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
17
{
18
    /**
19
     * @Route("/voting-upvote", name="voting_upvote")
20
     * @Template("@KunstmaanVoting/UpDown/voted.html.twig")
21
     */
22
    public function upVoteAction(Request $request)
23
    {
24
        $reference = $request->get('reference');
25
        $value = $request->get('value');
26
        $this->get('event_dispatcher')->dispatch(Events::VOTE_UP, new UpVoteEvent($request, $reference, $value));
27
    }
28
29
    /**
30
     * @Route("/voting-downvote", name="voting_downvote")
31
     * @Template("@KunstmaanVoting/UpDown/voted.html.twig")
32
     */
33
    public function downVoteAction(Request $request)
34
    {
35
        $reference = $request->get('reference');
36
        $value = $request->get('value');
37
        $this->get('event_dispatcher')->dispatch(Events::VOTE_DOWN, new DownVoteEvent($request, $reference, $value));
38
    }
39
40
    /**
41
     * @Route("/voting-facebooklike", name="voting_facebooklike")
42
     */
43
    public function facebookLikeAction(Request $request)
44
    {
45
        $response = $request->get('response');
46
        $value = $request->get('value');
47
        $this->get('event_dispatcher')->dispatch(Events::FACEBOOK_LIKE, new FacebookLikeEvent($request, $response, $value));
48
    }
49
50
    /**
51
     * @Route("/voting-facebooksend", name="voting_facebooksend")
52
     */
53
    public function facebookSendAction(Request $request)
54
    {
55
        $response = $request->get('response');
56
        $value = $request->get('value');
57
        $this->get('event_dispatcher')->dispatch(Events::FACEBOOK_SEND, new FacebookSendEvent($request, $response, $value));
58
    }
59
60
    /**
61
     * @Route("/voting-linkedinshare", name="voting_linkedinshare")
62
     */
63
    public function linkedInShareAction(Request $request)
64
    {
65
        $reference = $request->get('reference');
66
        $value = $request->get('value');
67
        $this->get('event_dispatcher')->dispatch(Events::LINKEDIN_SHARE, new LinkedInShareEvent($request, $reference, $value));
68
    }
69
}
70