@@ -67,7 +67,9 @@ |
||
| 67 | 67 | |
| 68 | 68 | protected function logVerbose($msg) |
| 69 | 69 | { |
| 70 | - if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERBOSE) return; |
|
| 70 | + if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERBOSE) { |
|
| 71 | + return; |
|
| 72 | + } |
|
| 71 | 73 | $this->output->writeln($msg); |
| 72 | 74 | } |
| 73 | 75 | } |
@@ -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 | |
@@ -52,7 +52,9 @@ discard block |
||
| 52 | 52 | { |
| 53 | 53 | $contentdir = $this->contentDir->getPathname() . DIRECTORY_SEPARATOR; |
| 54 | 54 | $file = $contentdir . $path; |
| 55 | - if (!is_file($file)) throw new FileNotFoundException($path); |
|
| 55 | + if (!is_file($file)) { |
|
| 56 | + throw new FileNotFoundException($path); |
|
| 57 | + } |
|
| 56 | 58 | return new \SplFileInfo($file); |
| 57 | 59 | } |
| 58 | 60 | |
@@ -74,7 +76,9 @@ discard block |
||
| 74 | 76 | protected function readProperties($markdown) |
| 75 | 77 | { |
| 76 | 78 | $properties = array(); |
| 77 | - if (!preg_match_all(static::PROPERTIES_MATCH, $markdown, $matches, PREG_SET_ORDER)) return $properties; |
|
| 79 | + if (!preg_match_all(static::PROPERTIES_MATCH, $markdown, $matches, PREG_SET_ORDER)) { |
|
| 80 | + return $properties; |
|
| 81 | + } |
|
| 78 | 82 | foreach ($matches as $match) { |
| 79 | 83 | $properties[$match[1]] = $match[2]; |
| 80 | 84 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | { |
| 39 | 39 | $file = $this->getFilePath($path); |
| 40 | 40 | $info = new Info(); |
| 41 | - $info->setLastModified(new \DateTime('@' . filemtime($file))); |
|
| 41 | + $info->setLastModified(new \DateTime('@'.filemtime($file))); |
|
| 42 | 42 | $info->setEtag(md5_file($file)); |
| 43 | 43 | return $info; |
| 44 | 44 | } |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | protected function getFilePath($path) |
| 52 | 52 | { |
| 53 | - $contentdir = $this->contentDir->getPathname() . DIRECTORY_SEPARATOR; |
|
| 54 | - $file = $contentdir . $path; |
|
| 53 | + $contentdir = $this->contentDir->getPathname().DIRECTORY_SEPARATOR; |
|
| 54 | + $file = $contentdir.$path; |
|
| 55 | 55 | if (!is_file($file)) throw new FileNotFoundException($path); |
| 56 | 56 | return new \SplFileInfo($file); |
| 57 | 57 | } |
@@ -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 | } |
@@ -48,7 +48,9 @@ discard block |
||
| 48 | 48 | $subNav = array(); |
| 49 | 49 | foreach ($this->getSubnav($this->getFilePath($path)) as $subPage) { |
| 50 | 50 | $s = $this->buildPage($subPage, false); |
| 51 | - if ($s->isHidden()) continue; |
|
| 51 | + if ($s->isHidden()) { |
|
| 52 | + continue; |
|
| 53 | + } |
|
| 52 | 54 | $n = new Nav(); |
| 53 | 55 | $n->setTitle($s->getProperties()->get('title')); |
| 54 | 56 | $n->setPath(str_replace('.md', '', $subPage)); |
@@ -81,7 +83,9 @@ discard block |
||
| 81 | 83 | |
| 82 | 84 | protected function fixLinks($html, $page) |
| 83 | 85 | { |
| 84 | - if (!preg_match_all('/src="([^"]+)"/', $html, $matches, PREG_SET_ORDER)) return $html; |
|
| 86 | + if (!preg_match_all('/src="([^"]+)"/', $html, $matches, PREG_SET_ORDER)) { |
|
| 87 | + return $html; |
|
| 88 | + } |
|
| 85 | 89 | $path = $this->contentPath . '/' . dirname($page) . '/'; |
| 86 | 90 | foreach ($matches as $match) { |
| 87 | 91 | $srcpath = $this->normalizePath($path . $match[1]); |
@@ -100,9 +104,14 @@ discard block |
||
| 100 | 104 | { |
| 101 | 105 | $out = array(); |
| 102 | 106 | foreach (explode('/', $path) as $i => $fold) { |
| 103 | - if ($fold == '' || $fold == '.') continue; |
|
| 104 | - if ($fold == '..' && $i > 0 && end($out) != '..') array_pop($out); |
|
| 105 | - else $out[] = $fold; |
|
| 107 | + if ($fold == '' || $fold == '.') { |
|
| 108 | + continue; |
|
| 109 | + } |
|
| 110 | + if ($fold == '..' && $i > 0 && end($out) != '..') { |
|
| 111 | + array_pop($out); |
|
| 112 | + } else { |
|
| 113 | + $out[] = $fold; |
|
| 114 | + } |
|
| 106 | 115 | } |
| 107 | 116 | return ($path{0} == '/' ? '/' : '') . join('/', $out); |
| 108 | 117 | } |
@@ -82,9 +82,9 @@ discard block |
||
| 82 | 82 | protected function fixLinks($html, $page) |
| 83 | 83 | { |
| 84 | 84 | if (!preg_match_all('/src="([^"]+)"/', $html, $matches, PREG_SET_ORDER)) return $html; |
| 85 | - $path = $this->contentPath . '/' . dirname($page) . '/'; |
|
| 85 | + $path = $this->contentPath.'/'.dirname($page).'/'; |
|
| 86 | 86 | foreach ($matches as $match) { |
| 87 | - $srcpath = $this->normalizePath($path . $match[1]); |
|
| 87 | + $srcpath = $this->normalizePath($path.$match[1]); |
|
| 88 | 88 | $html = str_replace($match[1], $srcpath, $html); |
| 89 | 89 | } |
| 90 | 90 | return $html; |
@@ -104,16 +104,16 @@ discard block |
||
| 104 | 104 | if ($fold == '..' && $i > 0 && end($out) != '..') array_pop($out); |
| 105 | 105 | else $out[] = $fold; |
| 106 | 106 | } |
| 107 | - return ($path{0} == '/' ? '/' : '') . join('/', $out); |
|
| 107 | + return ($path{0} == '/' ? '/' : '').join('/', $out); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | protected function getSubnav(\SplFileInfo $file) |
| 111 | 111 | { |
| 112 | - $dir = dirname($file->getPathname()) . DIRECTORY_SEPARATOR; |
|
| 113 | - $contentdir = $this->contentDir->getPathname() . DIRECTORY_SEPARATOR; |
|
| 114 | - return array_map(function ($entry) use ($contentdir) { |
|
| 112 | + $dir = dirname($file->getPathname()).DIRECTORY_SEPARATOR; |
|
| 113 | + $contentdir = $this->contentDir->getPathname().DIRECTORY_SEPARATOR; |
|
| 114 | + return array_map(function($entry) use ($contentdir) { |
|
| 115 | 115 | $entry = str_replace($contentdir, '', $entry); |
| 116 | 116 | return $entry; |
| 117 | - }, glob($dir . '*.md')); |
|
| 117 | + }, glob($dir.'*.md')); |
|
| 118 | 118 | } |
| 119 | 119 | } |
@@ -168,7 +168,7 @@ |
||
| 168 | 168 | $end->setTime(23, 59, 59); |
| 169 | 169 | $day = $now->between($start, $end) ? Ticket::DAY_SATURDAY : Ticket::DAY_SUNDAY; |
| 170 | 170 | |
| 171 | - $tickets = array_map(function (Ticket $ticket) { |
|
| 171 | + $tickets = array_map(function(Ticket $ticket) { |
|
| 172 | 172 | return array( |
| 173 | 173 | 'code' => $ticket->getCode(), |
| 174 | 174 | 'email' => $ticket->getEmail(), |
@@ -112,7 +112,9 @@ |
||
| 112 | 112 | Ticket::DAY_SATURDAY => $formData->getSaturday(), |
| 113 | 113 | Ticket::DAY_SUNDAY => $formData->getSunday(), |
| 114 | 114 | ) as $day => $want) { |
| 115 | - if (!$want) continue; |
|
| 115 | + if (!$want) { |
|
| 116 | + continue; |
|
| 117 | + } |
|
| 116 | 118 | $ticketCommand = new CreateTicketCommand(); |
| 117 | 119 | $ticketCommand->day = $day; |
| 118 | 120 | $ticketCommand->event = $event; |
@@ -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() |