@@ -18,7 +18,6 @@ |
||
18 | 18 | use BCRM\BackendBundle\Service\Event\UnregisterCommand; |
19 | 19 | use BCRM\WebBundle\Content\ContentReader; |
20 | 20 | use BCRM\WebBundle\Form\EventRegisterModel; |
21 | -use BCRM\WebBundle\Form\EventRegisterType; |
|
22 | 21 | use BCRM\WebBundle\Form\EventUnregisterType; |
23 | 22 | use Carbon\Carbon; |
24 | 23 | use Dothiv\Bundle\MoneyFormatBundle\Service\MoneyFormatServiceInterface; |
@@ -7,7 +7,6 @@ |
||
7 | 7 | |
8 | 8 | namespace BCRM\WebBundle\Controller; |
9 | 9 | |
10 | -use BCRM\BackendBundle\Entity\Event\Event; |
|
11 | 10 | use BCRM\BackendBundle\Entity\Event\EventRepository; |
12 | 11 | use BCRM\BackendBundle\Entity\Event\Registration; |
13 | 12 | use BCRM\BackendBundle\Entity\Event\Ticket; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | protected function getCheckinsPerDay(array $tickets, $day) |
125 | 125 | { |
126 | - return array_reduce($tickets, function ($count, Ticket $ticket) use ($day) { |
|
126 | + return array_reduce($tickets, function($count, Ticket $ticket) use ($day) { |
|
127 | 127 | return $count + ($ticket->getType() === Registration::TYPE_NORMAL && $ticket->isCheckedIn() && $ticket->getDay() == $day ? 1 : 0); |
128 | 128 | }, 0); |
129 | 129 | } |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | protected function getUniqueDayCheckins(array $tickets, $day, $both = false) |
141 | 141 | { |
142 | 142 | $otherDayCheckins = array_map( |
143 | - function (Ticket $ticket) { |
|
143 | + function(Ticket $ticket) { |
|
144 | 144 | return $ticket->getEmail(); |
145 | 145 | }, |
146 | - array_filter($tickets, function (Ticket $ticket) use ($day) { |
|
146 | + array_filter($tickets, function(Ticket $ticket) use ($day) { |
|
147 | 147 | return |
148 | 148 | $ticket->getType() === Registration::TYPE_NORMAL |
149 | 149 | && $ticket->isCheckedIn() |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | }) |
152 | 152 | ); |
153 | 153 | |
154 | - return array_reduce($tickets, function ($count, Ticket $ticket) use ($otherDayCheckins, $day, $both) { |
|
154 | + return array_reduce($tickets, function($count, Ticket $ticket) use ($otherDayCheckins, $day, $both) { |
|
155 | 155 | return $count + ( |
156 | 156 | $ticket->getType() === Registration::TYPE_NORMAL |
157 | 157 | && $ticket->isCheckedIn() |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | |
164 | 164 | protected function getNoShows(array $tickets, $day) |
165 | 165 | { |
166 | - return array_reduce($tickets, function ($count, Ticket $ticket) use ($day) { |
|
166 | + return array_reduce($tickets, function($count, Ticket $ticket) use ($day) { |
|
167 | 167 | return $count + ( |
168 | 168 | $ticket->getType() === Registration::TYPE_NORMAL |
169 | 169 | && !$ticket->isCheckedIn() |
@@ -105,7 +105,7 @@ |
||
105 | 105 | */ |
106 | 106 | protected function toBatch(ArrayCollection $emails, $deep = true) |
107 | 107 | { |
108 | - return $emails->map(function ($email) use($deep) { |
|
108 | + return $emails->map(function($email) use($deep) { |
|
109 | 109 | return array( |
110 | 110 | 'email' => $deep ? array('email' => $email) : $email, |
111 | 111 | 'email_type' => 'html' |
@@ -61,7 +61,9 @@ |
||
61 | 61 | foreach ($ticketRepo->getTicketsForEvent($eventRepo->getNextEvent()->getOrThrow( |
62 | 62 | new BadMethodCallException('No event.') |
63 | 63 | )) as $ticket) { |
64 | - if ($participants->contains(strtolower($ticket->getEmail()))) continue; |
|
64 | + if ($participants->contains(strtolower($ticket->getEmail()))) { |
|
65 | + continue; |
|
66 | + } |
|
65 | 67 | $participants->add(strtolower($ticket->getEmail())); |
66 | 68 | } |
67 | 69 |
@@ -33,7 +33,9 @@ |
||
33 | 33 | |
34 | 34 | protected function getFile($name) |
35 | 35 | { |
36 | - if (!preg_match('/^bcrm_content:(.+)/', $name, $match)) throw new Twig_Error_Loader(sprintf('Unknown template: %s', $name)); |
|
36 | + if (!preg_match('/^bcrm_content:(.+)/', $name, $match)) { |
|
37 | + throw new Twig_Error_Loader(sprintf('Unknown template: %s', $name)); |
|
38 | + } |
|
37 | 39 | return $match[1]; |
38 | 40 | } |
39 | 41 |
@@ -100,11 +100,11 @@ |
||
100 | 100 | $event->payment = $payment; |
101 | 101 | $payment->setPayload(new ArrayCollection($data)); |
102 | 102 | $this->eventMessageBus->publish($event); |
103 | - Option::fromValue($this->logger)->map(function (LoggerInterface $logger) use ($payment) { |
|
103 | + Option::fromValue($this->logger)->map(function(LoggerInterface $logger) use ($payment) { |
|
104 | 104 | $logger->info(sprintf('Payment "%s" is verified.', $payment->getId()), array($payment)); |
105 | 105 | }); |
106 | 106 | } else { |
107 | - Option::fromValue($this->logger)->map(function (LoggerInterface $logger) use ($payment) { |
|
107 | + Option::fromValue($this->logger)->map(function(LoggerInterface $logger) use ($payment) { |
|
108 | 108 | $logger->alert(sprintf('Payment "%s" could not be verified.', $payment->getId()), array($payment)); |
109 | 109 | }); |
110 | 110 | } |
@@ -84,7 +84,9 @@ |
||
84 | 84 | |
85 | 85 | $data = array(); |
86 | 86 | foreach (explode("\n", $res) as $line) { |
87 | - if (!strpos($line, '=')) continue; |
|
87 | + if (!strpos($line, '=')) { |
|
88 | + continue; |
|
89 | + } |
|
88 | 90 | list($key, $value) = explode('=', $line); |
89 | 91 | $data[$key] = $value; |
90 | 92 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | { |
87 | 87 | $payment = $event->payment; |
88 | 88 | $registration = $event->registration; |
89 | - Option::fromValue($this->logger)->map(function (LoggerInterface $logger) use ($registration, $payment) { |
|
89 | + Option::fromValue($this->logger)->map(function(LoggerInterface $logger) use ($registration, $payment) { |
|
90 | 90 | $logger->alert(sprintf('Registration "%s" has been paid with payment "%s".', $registration->getId(), $payment->getId())); |
91 | 91 | }); |
92 | 92 | foreach ($this->ticketRepo->getTicketsForEmail( |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $updateCommand->id = $ticket->getId(); |
99 | 99 | $updateCommand->data = array('payment' => $payment); |
100 | 100 | $this->commandBus->handle($updateCommand); |
101 | - Option::fromValue($this->logger)->map(function (LoggerInterface $logger) use ($payment, $ticket) { |
|
101 | + Option::fromValue($this->logger)->map(function(LoggerInterface $logger) use ($payment, $ticket) { |
|
102 | 102 | $logger->alert(sprintf('Assigning payment "%s" to ticket "%s"', $payment->getId(), $ticket->getCode())); |
103 | 103 | }); |
104 | 104 | } |
@@ -131,7 +131,9 @@ |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | $p = $this->reader->getPage($path . '.md'); |
134 | - if ($p->isHidden()) throw new NotFoundHttpException(); |
|
134 | + if ($p->isHidden()) { |
|
135 | + throw new NotFoundHttpException(); |
|
136 | + } |
|
135 | 137 | |
136 | 138 | return $this->renderer->renderResponse('BCRMWebBundle:Web:page.html.twig', array( |
137 | 139 | 'page' => $p, |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | public function pageAction(Request $request, $path) |
115 | 115 | { |
116 | 116 | try { |
117 | - $pageInfo = $this->reader->getInfo($path . '.md'); |
|
117 | + $pageInfo = $this->reader->getInfo($path.'.md'); |
|
118 | 118 | } catch (FileNotFoundException $e) { |
119 | 119 | throw new NotFoundHttpException(); |
120 | 120 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $response->setETag($pageInfo->getEtag()); |
123 | 123 | $lastModified = $pageInfo->getLastModified(); |
124 | 124 | if ($this->assetsVersion - $pageInfo->getLastModified()->getTimestamp() > 0) { |
125 | - $lastModified = new \DateTime('@' . $this->assetsVersion); |
|
125 | + $lastModified = new \DateTime('@'.$this->assetsVersion); |
|
126 | 126 | } |
127 | 127 | $response->setLastModified($lastModified); |
128 | 128 | $response->setPublic(); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | return $response; |
131 | 131 | } |
132 | 132 | |
133 | - $p = $this->reader->getPage($path . '.md'); |
|
133 | + $p = $this->reader->getPage($path.'.md'); |
|
134 | 134 | if ($p->isHidden()) throw new NotFoundHttpException(); |
135 | 135 | |
136 | 136 | return $this->renderer->renderResponse('BCRMWebBundle:Web:page.html.twig', array( |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function contentAction(Request $request, $path) |
152 | 152 | { |
153 | - $pageInfo = $this->reader->getInfo($path . '.md'); |
|
153 | + $pageInfo = $this->reader->getInfo($path.'.md'); |
|
154 | 154 | $response = new Response(); |
155 | 155 | $response->setETag($pageInfo->getEtag()); |
156 | 156 | $lastModified = $pageInfo->getLastModified(); |
157 | 157 | if ($this->assetsVersion - $pageInfo->getLastModified()->getTimestamp() > 0) { |
158 | - $lastModified = new \DateTime('@' . $this->assetsVersion); |
|
158 | + $lastModified = new \DateTime('@'.$this->assetsVersion); |
|
159 | 159 | } |
160 | 160 | $response->setLastModified($lastModified); |
161 | 161 | $response->setPublic(); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | return $response; |
164 | 164 | } |
165 | 165 | |
166 | - $p = $this->reader->getPage($path . '.md'); |
|
166 | + $p = $this->reader->getPage($path.'.md'); |
|
167 | 167 | $response->setContent($p->getContent()); |
168 | 168 | return $response; |
169 | 169 | } |
@@ -12,7 +12,6 @@ |
||
12 | 12 | use BCRM\BackendBundle\Exception\FileNotFoundException; |
13 | 13 | use BCRM\WebBundle\Content\ContentReader; |
14 | 14 | use Carbon\Carbon; |
15 | -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; |
|
16 | 15 | use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface; |
17 | 16 | use Symfony\Component\Form\FormFactoryInterface; |
18 | 17 | use Symfony\Component\HttpFoundation\Request; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $ticket = $em->getRepository('BCRMBackendBundle:Event\Ticket')->findOneBy(array('code' => 'WOOT')); |
49 | 49 | $this->assertEquals(false, $ticket->isCheckedIn()); |
50 | 50 | |
51 | - $client = static::createClient(array(), array( |
|
51 | + $client = static::createClient(array(), array( |
|
52 | 52 | 'PHP_AUTH_USER' => 'concierge', |
53 | 53 | 'PHP_AUTH_PW' => 'letmein', |
54 | 54 | )); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public function theTicketSearchApiShouldWork() |
174 | 174 | { |
175 | - $client = static::createClient(array(), array( |
|
175 | + $client = static::createClient(array(), array( |
|
176 | 176 | 'PHP_AUTH_USER' => 'concierge', |
177 | 177 | 'PHP_AUTH_PW' => 'letmein', |
178 | 178 | )); |
@@ -67,8 +67,12 @@ |
||
67 | 67 | |
68 | 68 | protected function createTicket($day, $checkedIn = null, $email = null) |
69 | 69 | { |
70 | - if ($email === null) $email = sprintf('stats.doe.198%[email protected]', $this->ticketCounter); |
|
71 | - if ($checkedIn === null) $checkedIn = true; |
|
70 | + if ($email === null) { |
|
71 | + $email = sprintf('stats.doe.198%[email protected]', $this->ticketCounter); |
|
72 | + } |
|
73 | + if ($checkedIn === null) { |
|
74 | + $checkedIn = true; |
|
75 | + } |
|
72 | 76 | $client = static::createClient(); |
73 | 77 | $container = $client->getContainer(); |
74 | 78 |
@@ -66,6 +66,9 @@ |
||
66 | 66 | |
67 | 67 | protected $ticketCounter = 1; |
68 | 68 | |
69 | + /** |
|
70 | + * @param false $checkedIn |
|
71 | + */ |
|
69 | 72 | protected function createTicket($day, $checkedIn = null, $email = null) |
70 | 73 | { |
71 | 74 | if ($email === null) $email = sprintf('stats.doe.198%[email protected]', $this->ticketCounter); |
@@ -7,11 +7,8 @@ |
||
7 | 7 | |
8 | 8 | namespace BCRM\WebBundle\Tests\Functional; |
9 | 9 | |
10 | -use BCRM\BackendBundle\Entity\Event\Registration; |
|
11 | 10 | use BCRM\BackendBundle\Entity\Event\Ticket; |
12 | 11 | use BCRM\BackendBundle\Entity\Payment; |
13 | -use Symfony\Component\BrowserKit\Cookie; |
|
14 | -use Symfony\Component\DependencyInjection\ContainerInterface; |
|
15 | 12 | |
16 | 13 | class StatsControllerTest extends Base |
17 | 14 | { |
@@ -79,8 +79,8 @@ |
||
79 | 79 | ->getManager(); |
80 | 80 | |
81 | 81 | // Create a payment |
82 | - $txId = sha1('someid' . $email); |
|
83 | - $payment = $em->getRepository('BCRMBackendBundle:Payment')->findOneByTxId($txId); |
|
82 | + $txId = sha1('someid'.$email); |
|
83 | + $payment = $em->getRepository('BCRMBackendBundle:Payment')->findOneByTxId($txId); |
|
84 | 84 | if (!$payment) { |
85 | 85 | $payment = new Payment(); |
86 | 86 | $payment->setTransactionId($txId); |