@@ -65,6 +65,9 @@ |
||
| 65 | 65 | $commandBus->handle($command); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | + /** |
|
| 69 | + * @param string $msg |
|
| 70 | + */ |
|
| 68 | 71 | protected function logVerbose($msg) |
| 69 | 72 | { |
| 70 | 73 | if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERBOSE) return; |
@@ -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 | } |
@@ -10,7 +10,6 @@ |
||
| 10 | 10 | use BCRM\BackendBundle\Entity\Event\Event; |
| 11 | 11 | use BCRM\BackendBundle\Exception\CommandException; |
| 12 | 12 | use BCRM\BackendBundle\Service\Event\SendTicketMailCommand; |
| 13 | -use Doctrine\Common\Util\Debug; |
|
| 14 | 13 | use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; |
| 15 | 14 | use Symfony\Component\Console\Input\InputInterface; |
| 16 | 15 | use Symfony\Component\Console\Output\OutputInterface; |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | - * @param $path |
|
| 47 | + * @param string $path |
|
| 48 | 48 | * |
| 49 | 49 | * @return \SplFileInfo |
| 50 | 50 | */ |
@@ -71,6 +71,9 @@ discard block |
||
| 71 | 71 | return $c; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | + /** |
|
| 75 | + * @param string $markdown |
|
| 76 | + */ |
|
| 74 | 77 | protected function readProperties($markdown) |
| 75 | 78 | { |
| 76 | 79 | $properties = array(); |
@@ -81,6 +84,11 @@ discard block |
||
| 81 | 84 | return $properties; |
| 82 | 85 | } |
| 83 | 86 | |
| 87 | + /** |
|
| 88 | + * @param string $markdown |
|
| 89 | + * |
|
| 90 | + * @return string |
|
| 91 | + */ |
|
| 84 | 92 | protected function removeProperties($markdown) |
| 85 | 93 | { |
| 86 | 94 | return preg_replace(static::PROPERTIES_MATCH, '', $markdown); |
@@ -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 | } |
@@ -251,7 +251,7 @@ |
||
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | /** |
| 254 | - * @return \DateTime|null |
|
| 254 | + * @return boolean |
|
| 255 | 255 | */ |
| 256 | 256 | public function getCheckinTime() |
| 257 | 257 | { |
@@ -158,7 +158,7 @@ |
||
| 158 | 158 | } else { |
| 159 | 159 | $days[] = 'SU'; |
| 160 | 160 | } |
| 161 | - $str .= ' (' . join('+', $days) . ')'; |
|
| 161 | + $str .= ' ('.join('+', $days).')'; |
|
| 162 | 162 | return $str; |
| 163 | 163 | } |
| 164 | 164 | |
@@ -34,7 +34,6 @@ |
||
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * @param CommandBus $commandBus |
| 37 | - * @param RouterInterface $router |
|
| 38 | 37 | * @param PaymentRepository $paymentRepo |
| 39 | 38 | * @param RegistrationRepository $registrationRepo |
| 40 | 39 | */ |
@@ -12,7 +12,6 @@ |
||
| 12 | 12 | use BCRM\BackendBundle\Service\Concierge\PayRegistrationConciergeCommand; |
| 13 | 13 | use BCRM\BackendBundle\Entity\PaymentRepository; |
| 14 | 14 | use BCRM\BackendBundle\Entity\Event\RegistrationRepository; |
| 15 | -use Endroid\QrCode\QrCode; |
|
| 16 | 15 | use LiteCQRS\Bus\CommandBus; |
| 17 | 16 | use LiteCQRS\Bus\EventMessageBus; |
| 18 | 17 | use LiteCQRS\Plugin\CRUD\Model\Commands\UpdateResourceCommand; |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use BCRM\BackendBundle\Service\Mail\SendTemplateMailCommand; |
| 6 | 6 | use BCRM\BackendBundle\Content\ContentReader; |
| 7 | 7 | use Symfony\Bridge\Twig\TwigEngine; |
| 8 | -use Symfony\Component\Templating\TemplateReference; |
|
| 9 | 8 | |
| 10 | 9 | class Mail |
| 11 | 10 | { |
@@ -51,11 +51,11 @@ discard block |
||
| 51 | 51 | { |
| 52 | 52 | $message = \Swift_Message::newInstance(); |
| 53 | 53 | $ext = $command->format === 'text/html' ? 'html' : 'txt'; |
| 54 | - $tplIdentifier = 'Email/' . $command->template . '.' . $ext; |
|
| 54 | + $tplIdentifier = 'Email/'.$command->template.'.'.$ext; |
|
| 55 | 55 | $template = $this->cr->getContent($tplIdentifier); |
| 56 | 56 | $templateData = $command->templateData; |
| 57 | 57 | if ($command->image !== null) { |
| 58 | - $templateData['image'] = $message->embed(\Swift_Image::fromPath($command->image));; |
|
| 58 | + $templateData['image'] = $message->embed(\Swift_Image::fromPath($command->image)); ; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | // Subject |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $subject = $env->render($subject, $templateData); |
| 65 | 65 | |
| 66 | 66 | // Body |
| 67 | - $body = $this->templating->render('bcrm_content:' . $tplIdentifier, $templateData); |
|
| 67 | + $body = $this->templating->render('bcrm_content:'.$tplIdentifier, $templateData); |
|
| 68 | 68 | $message->setCharset('UTF-8'); |
| 69 | 69 | $message->setFrom($this->mailFromEmail, $this->mailFromName) |
| 70 | 70 | ->setSubject($subject) |
@@ -7,13 +7,8 @@ |
||
| 7 | 7 | |
| 8 | 8 | namespace BCRM\PrintBundle\Command; |
| 9 | 9 | |
| 10 | -use BCRM\BackendBundle\Entity\Event\Event; |
|
| 11 | -use BCRM\BackendBundle\Entity\Event\Registration; |
|
| 12 | 10 | use BCRM\BackendBundle\Entity\Event\Ticket; |
| 13 | -use BCRM\BackendBundle\Exception\CommandException; |
|
| 14 | -use BCRM\BackendBundle\Service\Event\CreateTicketCommand; |
|
| 15 | 11 | use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; |
| 16 | -use Symfony\Component\Console\Input\InputArgument; |
|
| 17 | 12 | use Symfony\Component\Console\Input\InputInterface; |
| 18 | 13 | use Symfony\Component\Console\Input\InputOption; |
| 19 | 14 | use Symfony\Component\Console\Output\OutputInterface; |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | $data->lastname = isset($nameParts[1]) ? $nameParts[1] : null; |
| 65 | 65 | $data->day = $ticket->day == Ticket::DAY_SATURDAY ? 'Sa' : 'So'; |
| 66 | 66 | $badge = $env->render($template, (array)$data); |
| 67 | - $badgeFileName = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $ticket->code; |
|
| 68 | - $badgeSVG = $badgeFileName . '.svg'; |
|
| 69 | - $badgePDF = $badgeFileName . '.pdf'; |
|
| 67 | + $badgeFileName = sys_get_temp_dir().DIRECTORY_SEPARATOR.$ticket->code; |
|
| 68 | + $badgeSVG = $badgeFileName.'.svg'; |
|
| 69 | + $badgePDF = $badgeFileName.'.pdf'; |
|
| 70 | 70 | file_put_contents($badgeSVG, $badge); |
| 71 | 71 | exec( |
| 72 | 72 | sprintf( |
@@ -75,11 +75,11 @@ discard block |
||
| 75 | 75 | escapeshellarg($badgeSVG) |
| 76 | 76 | ) |
| 77 | 77 | ); |
| 78 | - $printFile = rtrim($input->getOption('output'), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $ticket->code . '.pdf'; |
|
| 78 | + $printFile = rtrim($input->getOption('output'), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$ticket->code.'.pdf'; |
|
| 79 | 79 | if (is_file($printFile)) { |
| 80 | 80 | $counter = 1; |
| 81 | 81 | do { |
| 82 | - $printFile = preg_replace('/(\.[0-9]+)*\.pdf$/', '.' . ($counter++) . '.pdf', $printFile); |
|
| 82 | + $printFile = preg_replace('/(\.[0-9]+)*\.pdf$/', '.'.($counter++).'.pdf', $printFile); |
|
| 83 | 83 | } while (is_file($printFile)); |
| 84 | 84 | } |
| 85 | 85 | copy($badgePDF, $printFile); |
@@ -79,6 +79,12 @@ discard block |
||
| 79 | 79 | return $page; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | + /** |
|
| 83 | + * @param string $html |
|
| 84 | + * @param string $page |
|
| 85 | + * |
|
| 86 | + * @return string |
|
| 87 | + */ |
|
| 82 | 88 | protected function fixLinks($html, $page) |
| 83 | 89 | { |
| 84 | 90 | if (!preg_match_all('/src="([^"]+)"/', $html, $matches, PREG_SET_ORDER)) return $html; |
@@ -91,7 +97,7 @@ discard block |
||
| 91 | 97 | } |
| 92 | 98 | |
| 93 | 99 | /** |
| 94 | - * @param $path |
|
| 100 | + * @param string $path |
|
| 95 | 101 | * |
| 96 | 102 | * @return string |
| 97 | 103 | * @see http://www.php.net/manual/en/function.realpath.php#81935 |
@@ -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 | } |
@@ -13,7 +13,6 @@ discard block |
||
| 13 | 13 | use BCRM\BackendBundle\Entity\Event\Ticket; |
| 14 | 14 | use BCRM\BackendBundle\Entity\Event\TicketRepository; |
| 15 | 15 | use BCRM\BackendBundle\Service\Concierge\CheckinCommand; |
| 16 | -use BCRM\WebBundle\Content\ContentReader; |
|
| 17 | 16 | use BCRM\WebBundle\Exception\AccesDeniedHttpException; |
| 18 | 17 | use BCRM\WebBundle\Exception\BadRequestException; |
| 19 | 18 | use Carbon\Carbon; |
@@ -21,10 +20,7 @@ discard block |
||
| 21 | 20 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; |
| 22 | 21 | use Symfony\Component\HttpFoundation\RedirectResponse; |
| 23 | 22 | use Symfony\Component\HttpFoundation\Request; |
| 24 | -use Symfony\Component\HttpFoundation\Response; |
|
| 25 | 23 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
| 26 | -use Symfony\Component\Routing\RouterInterface; |
|
| 27 | -use Symfony\Component\Validator\Constraints\DateTime; |
|
| 28 | 24 | |
| 29 | 25 | /** |
| 30 | 26 | * Manages event checkins. |