Completed
Push — master ( a7fff6...5ea170 )
by Jeroen
18:57 queued 10s
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 Symfony\Component\Routing\Annotation\Route;
12
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
13
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
14
use Symfony\Component\HttpFoundation\Request;
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("KunstmaanVotingBundle:UpDown:voted.html.twig")
21
     *
22
     * @param \Symfony\Component\HttpFoundation\Request $request
23
     */
24 View Code Duplication
    public function upVoteAction(Request $request)
25
    {
26
        $reference = $request->get('reference');
27
        $value = $request->get('value');
28
        $this->get('event_dispatcher')->dispatch(Events::VOTE_UP, new UpVoteEvent($request, $reference, $value));
29
30
        return;
31
    }
32
33
    /**
34
     * @Route("/voting-downvote", name="voting_downvote")
35
     * @Template("KunstmaanVotingBundle:UpDown:voted.html.twig")
36
     *
37
     * @param \Symfony\Component\HttpFoundation\Request $request
38
     */
39 View Code Duplication
    public function downVoteAction(Request $request)
40
    {
41
        $reference = $request->get('reference');
42
        $value = $request->get('value');
43
        $this->get('event_dispatcher')->dispatch(Events::VOTE_DOWN, new DownVoteEvent($request, $reference, $value));
44
45
        return;
46
    }
47
48
    /**
49
     * @Route("/voting-facebooklike", name="voting_facebooklike")
50
     *
51
     * @param \Symfony\Component\HttpFoundation\Request $request
52
     */
53
    public function facebookLikeAction(Request $request)
54
    {
55
        $response = $request->get('response');
56
        $value = $request->get('value');
57
        $this->get('event_dispatcher')->dispatch(Events::FACEBOOK_LIKE, new FacebookLikeEvent($request, $response, $value));
58
    }
59
60
    /**
61
     * @Route("/voting-facebooksend", name="voting_facebooksend")
62
     *
63
     * @param \Symfony\Component\HttpFoundation\Request $request
64
     */
65
    public function facebookSendAction(Request $request)
66
    {
67
        $response = $request->get('response');
68
        $value = $request->get('value');
69
        $this->get('event_dispatcher')->dispatch(Events::FACEBOOK_SEND, new FacebookSendEvent($request, $response, $value));
70
    }
71
72
    /**
73
     * @Route("/voting-linkedinshare", name="voting_linkedinshare")
74
     *
75
     * @param \Symfony\Component\HttpFoundation\Request $request
76
     */
77
    public function linkedInShareAction(Request $request)
78
    {
79
        $reference = $request->get('reference');
80
        $value = $request->get('value');
81
        $this->get('event_dispatcher')->dispatch(Events::LINKEDIN_SHARE, new LinkedInShareEvent($request, $reference, $value));
82
    }
83
}
84