Completed
Push — master ( 770316...74fc07 )
by Jeroen
09:08 queued 02:44
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
    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
31
    /**
32
     * @Route("/voting-downvote", name="voting_downvote")
33
     * @Template("KunstmaanVotingBundle:UpDown:voted.html.twig")
34
     *
35
     * @param \Symfony\Component\HttpFoundation\Request $request
36
     */
37
    public function downVoteAction(Request $request)
38
    {
39
        $reference = $request->get('reference');
40
        $value = $request->get('value');
41
        $this->get('event_dispatcher')->dispatch(Events::VOTE_DOWN, new DownVoteEvent($request, $reference, $value));
42
    }
43
44
    /**
45
     * @Route("/voting-facebooklike", name="voting_facebooklike")
46
     *
47
     * @param \Symfony\Component\HttpFoundation\Request $request
48
     */
49
    public function facebookLikeAction(Request $request)
50
    {
51
        $response = $request->get('response');
52
        $value = $request->get('value');
53
        $this->get('event_dispatcher')->dispatch(Events::FACEBOOK_LIKE, new FacebookLikeEvent($request, $response, $value));
54
    }
55
56
    /**
57
     * @Route("/voting-facebooksend", name="voting_facebooksend")
58
     *
59
     * @param \Symfony\Component\HttpFoundation\Request $request
60
     */
61
    public function facebookSendAction(Request $request)
62
    {
63
        $response = $request->get('response');
64
        $value = $request->get('value');
65
        $this->get('event_dispatcher')->dispatch(Events::FACEBOOK_SEND, new FacebookSendEvent($request, $response, $value));
66
    }
67
68
    /**
69
     * @Route("/voting-linkedinshare", name="voting_linkedinshare")
70
     *
71
     * @param \Symfony\Component\HttpFoundation\Request $request
72
     */
73
    public function linkedInShareAction(Request $request)
74
    {
75
        $reference = $request->get('reference');
76
        $value = $request->get('value');
77
        $this->get('event_dispatcher')->dispatch(Events::LINKEDIN_SHARE, new LinkedInShareEvent($request, $reference, $value));
78
    }
79
}
80