| @@ -22,7 +22,7 @@ | ||
| 22 | 22 |          if ($item->getUri() === $request->getRequestUri()) { | 
| 23 | 23 | // URL's completely match | 
| 24 | 24 | return true; | 
| 25 | - } elseif ($item->getUri() !== $request->getBaseUrl() . '/' && | |
| 25 | + } elseif ($item->getUri() !== $request->getBaseUrl().'/' && | |
| 26 | 26 | substr($request->getRequestUri(), 0, strlen($item->getUri())) | 
| 27 | 27 |              === $item->getUri()) { | 
| 28 | 28 | // URL isn't just "/" and the first part of the URL match | 
| @@ -30,19 +30,19 @@ discard block | ||
| 30 | 30 | private function getEaster($pYear = null) | 
| 31 | 31 |      { | 
| 32 | 32 |          if (is_null($pYear)) { | 
| 33 | -            $pYear = (int)date('Y'); | |
| 33 | +            $pYear = (int) date('Y'); | |
| 34 | 34 | } | 
| 35 | 35 | $nDate = $pYear - 1900; | 
| 36 | - $pAa = $nDate%19; | |
| 37 | - $pBb = floor(((7*$pAa)+1)/19); | |
| 38 | - $pCc = ((11*$pAa)-$pBb+4)%29; | |
| 39 | - $pDd = floor($nDate/4); | |
| 40 | - $pEe = ($nDate-$pCc+$pDd+31)%7; | |
| 41 | - $pResult = 25-$pCc-$pEe; | |
| 36 | + $pAa = $nDate % 19; | |
| 37 | + $pBb = floor(((7 * $pAa) + 1) / 19); | |
| 38 | + $pCc = ((11 * $pAa) - $pBb + 4) % 29; | |
| 39 | + $pDd = floor($nDate / 4); | |
| 40 | + $pEe = ($nDate - $pCc + $pDd + 31) % 7; | |
| 41 | + $pResult = 25 - $pCc - $pEe; | |
| 42 | 42 |          if ($pResult > 0) { | 
| 43 | 43 | $pEaster = strtotime($pYear.'/04/'.$pResult); | 
| 44 | 44 |          } else { | 
| 45 | - $pEaster = strtotime($pYear.'/03/'.(31+$pResult)); | |
| 45 | + $pEaster = strtotime($pYear.'/03/'.(31 + $pResult)); | |
| 46 | 46 | } | 
| 47 | 47 | return $pEaster; | 
| 48 | 48 | } | 
| @@ -61,20 +61,20 @@ discard block | ||
| 61 | 61 |      { | 
| 62 | 62 | $aBankHolidays = ['1_1', '1_5', '8_5', '14_7', '15_8', '1_11', '11_11', '25_12', ]; | 
| 63 | 63 |          if (function_exists('easter_date')) { | 
| 64 | -            $pEaster = easter_date((int)date('Y', $pDate)); | |
| 64 | +            $pEaster = easter_date((int) date('Y', $pDate)); | |
| 65 | 65 |          } else { | 
| 66 | -            $pEaster = $this->getEaster((int)date('Y', $pDate)); | |
| 66 | +            $pEaster = $this->getEaster((int) date('Y', $pDate)); | |
| 67 | 67 | } | 
| 68 | 68 |          $aBankHolidays[] = date('j_n', $pEaster); | 
| 69 | -        $aBankHolidays[] = date('j_n', $pEaster + (86400*39)); | |
| 70 | -        $aBankHolidays[] = date('j_n', $pEaster + (86400*49)); | |
| 69 | +        $aBankHolidays[] = date('j_n', $pEaster + (86400 * 39)); | |
| 70 | +        $aBankHolidays[] = date('j_n', $pEaster + (86400 * 49)); | |
| 71 | 71 | |
| 72 | -        $pEnd = strtotime('+' . $pDays . ' day', $pDate); | |
| 72 | +        $pEnd = strtotime('+'.$pDays.' day', $pDate); | |
| 73 | 73 | $idn = 0; | 
| 74 | 74 |          while ($idn < $pEnd) { | 
| 75 | 75 |              if (in_array(date('w', $pEnd), array(0, 6)) || in_array(date('j_n', $pEnd), $aBankHolidays)) { | 
| 76 | 76 |                  $pEnd = strtotime('+1 day', $pEnd); | 
| 77 | - $pDays ++; | |
| 77 | + $pDays++; | |
| 78 | 78 | } | 
| 79 | 79 |              $idn = strtotime('+1 day', $idn); | 
| 80 | 80 | } | 
| @@ -114,6 +114,6 @@ | ||
| 114 | 114 |      { | 
| 115 | 115 | $session = new Session(); | 
| 116 | 116 | |
| 117 | -        return $session->has('sort.' . $name) ? $session->get('sort.' . $name) : null; | |
| 117 | +        return $session->has('sort.'.$name) ? $session->get('sort.'.$name) : null; | |
| 118 | 118 | } | 
| 119 | 119 | } | 
| @@ -226,7 +226,7 @@ | ||
| 226 | 226 | * @param \Symfony\Component\HttpFoundation\Request $request Request in progress | 
| 227 | 227 | * @param string $entityName Name of Entity | 
| 228 | 228 | * @param string $prefixRoute Prefix of Route | 
| 229 | - * @return array | |
| 229 | + * @return \Symfony\Component\HttpFoundation\RedirectResponse | |
| 230 | 230 | */ | 
| 231 | 231 | public function abstractDeleteWithArticlesAction($entity, Request $request, $entityName, $prefixRoute) | 
| 232 | 232 |      { | 
| @@ -48,7 +48,7 @@ discard block | ||
| 48 | 48 |              $paginator = $this->get('knp_paginator')->paginate($entities, $request->query->get('page', 1), $item); | 
| 49 | 49 | } | 
| 50 | 50 | |
| 51 | - return ['entities' => $entities, 'ctEntity' => count($entities), 'paginator' => $paginator,]; | |
| 51 | + return ['entities' => $entities, 'ctEntity' => count($entities), 'paginator' => $paginator, ]; | |
| 52 | 52 | } | 
| 53 | 53 | |
| 54 | 54 | /** | 
| @@ -62,7 +62,7 @@ discard block | ||
| 62 | 62 |      { | 
| 63 | 63 | $deleteForm = $this->createDeleteForm($entity->getId(), $prefixRoute.'_delete'); | 
| 64 | 64 | |
| 65 | - return [$prefixRoute => $entity, 'delete_form' => $deleteForm->createView(),]; | |
| 65 | + return [$prefixRoute => $entity, 'delete_form' => $deleteForm->createView(), ]; | |
| 66 | 66 | } | 
| 67 | 67 | |
| 68 | 68 | /** | 
| @@ -85,12 +85,12 @@ discard block | ||
| 85 | 85 |              $this->addFlash('danger', 'gestock.settings.'.$prefixRoute.'.add2'); | 
| 86 | 86 |          } else { | 
| 87 | 87 | $entityNew = $etm->getClassMetadata($entityPath)->newInstance(); | 
| 88 | - $form = $this->createForm($typePath, $entityNew, ['action' => $this->generateUrl($prefixRoute.'_create'),]); | |
| 88 | + $form = $this->createForm($typePath, $entityNew, ['action' => $this->generateUrl($prefixRoute.'_create'), ]); | |
| 89 | 89 | |
| 90 | 90 |              if ($entityName === 'Staff\Group') { | 
| 91 | 91 | $this->addRolesAction($form, $entityNew); | 
| 92 | 92 | } | 
| 93 | - $return = [strtolower($entityName) => $entityNew, 'form' => $form->createView(),]; | |
| 93 | + $return = [strtolower($entityName) => $entityNew, 'form' => $form->createView(), ]; | |
| 94 | 94 | } | 
| 95 | 95 | |
| 96 | 96 | return $return; | 
| @@ -110,12 +110,12 @@ discard block | ||
| 110 | 110 |      { | 
| 111 | 111 | $etm = $this->getDoctrine()->getManager(); | 
| 112 | 112 | $entityNew = $etm->getClassMetadata($entityPath)->newInstance(); | 
| 113 | - $form = $this->createForm($typePath, $entityNew, ['action' => $this->generateUrl($prefixRoute.'_create'),]); | |
| 113 | + $form = $this->createForm($typePath, $entityNew, ['action' => $this->generateUrl($prefixRoute.'_create'), ]); | |
| 114 | 114 |          if ($entityName === 'Staff\Group') { | 
| 115 | 115 | $this->addRolesAction($form, $entityNew); | 
| 116 | 116 | } | 
| 117 | 117 | $form->handleRequest($request); | 
| 118 | - $return = [$entityName => $entityNew, 'form' => $form->createView(),]; | |
| 118 | + $return = [$entityName => $entityNew, 'form' => $form->createView(), ]; | |
| 119 | 119 | |
| 120 | 120 |          if ($form->isValid()) { | 
| 121 | 121 | $etm = $this->getDoctrine()->getManager(); | 
| @@ -155,7 +155,7 @@ discard block | ||
| 155 | 155 | $deleteForm = $this->createDeleteForm($entity->getId(), $prefixRoute.'_delete'); | 
| 156 | 156 | |
| 157 | 157 | return [$prefixRoute => $entity, 'edit_form' => $editForm->createView(), | 
| 158 | - 'delete_form' => $deleteForm->createView(),]; | |
| 158 | + 'delete_form' => $deleteForm->createView(), ]; | |
| 159 | 159 | } | 
| 160 | 160 | |
| 161 | 161 | /** | 
| @@ -181,7 +181,7 @@ discard block | ||
| 181 | 181 | $deleteForm = $this->createDeleteForm($entity->getId(), $prefixRoute.'_delete'); | 
| 182 | 182 | |
| 183 | 183 | $return = [$prefixRoute => $entity, 'edit_form' => $editForm->createView(), | 
| 184 | - 'delete_form' => $deleteForm->createView(),]; | |
| 184 | + 'delete_form' => $deleteForm->createView(), ]; | |
| 185 | 185 | |
| 186 | 186 |          if ($editForm->isValid()) { | 
| 187 | 187 | $this->getDoctrine()->getManager()->flush(); | 
| @@ -223,9 +223,9 @@ discard block | ||
| 223 | 223 | public function abstractDeleteWithArticlesAction($entity, Request $request, $entityName, $prefixRoute) | 
| 224 | 224 |      { | 
| 225 | 225 | $etm = $this->getDoctrine()->getManager(); | 
| 226 | - $form = $this->createDeleteForm($entity->getId(), $prefixRoute . '_delete'); | |
| 226 | + $form = $this->createDeleteForm($entity->getId(), $prefixRoute.'_delete'); | |
| 227 | 227 | $entityArticles = $etm | 
| 228 | -            ->getRepository('AppBundle:' .  $entityName . 'Articles') | |
| 228 | +            ->getRepository('AppBundle:'.$entityName.'Articles') | |
| 229 | 229 | ->findBy([$prefixRoute => $entity->getId()]); | 
| 230 | 230 | |
| 231 | 231 |          if ($form->handleRequest($request)->isValid()) { | 
| @@ -260,7 +260,7 @@ discard block | ||
| 260 | 260 |              } else { | 
| 261 | 261 |                  $alias = current($qbd->getDQLPart('from'))->getAlias(); | 
| 262 | 262 | } | 
| 263 | - $qbd->orderBy($alias . '.' . $order['field'], $order['type']); | |
| 263 | + $qbd->orderBy($alias.'.'.$order['field'], $order['type']); | |
| 264 | 264 | } | 
| 265 | 265 | } | 
| 266 | 266 | |
| @@ -290,7 +290,7 @@ discard block | ||
| 290 | 290 | */ | 
| 291 | 291 | protected function testReturnParam($entity, $prefixRoute) | 
| 292 | 292 |      { | 
| 293 | - $entityArray = ['article', 'supplier', 'familylog', 'zonestorage', 'unit', 'material',]; | |
| 293 | + $entityArray = ['article', 'supplier', 'familylog', 'zonestorage', 'unit', 'material', ]; | |
| 294 | 294 |          if (in_array($prefixRoute, $entityArray, true)) { | 
| 295 | 295 | $param = ['slug' => $entity->getSlug()]; | 
| 296 | 296 |          } else { | 
| @@ -43,8 +43,8 @@ discard block | ||
| 43 | 43 | $form->add( | 
| 44 | 44 | 'save', | 
| 45 | 45 | SubmitType::class, | 
| 46 | - ['attr' => ['class' => 'btn btn-default btn-primary btn-create',], 'label' => 'Create', | |
| 47 | - 'translation_domain' => 'admin',] | |
| 46 | + ['attr' => ['class' => 'btn btn-default btn-primary btn-create', ], 'label' => 'Create', | |
| 47 | + 'translation_domain' => 'admin', ] | |
| 48 | 48 | ) | 
| 49 | 49 | ->add( | 
| 50 | 50 | 'addmore', | 
| @@ -56,8 +56,8 @@ discard block | ||
| 56 | 56 | $form->add( | 
| 57 | 57 | 'save', | 
| 58 | 58 | SubmitType::class, | 
| 59 | - ['attr' => ['class' => 'btn btn-default btn-primary btn-edit',], 'label' => 'Edit', | |
| 60 | - 'translation_domain' => 'admin',] | |
| 59 | + ['attr' => ['class' => 'btn btn-default btn-primary btn-edit', ], 'label' => 'Edit', | |
| 60 | + 'translation_domain' => 'admin', ] | |
| 61 | 61 | ); | 
| 62 | 62 | } | 
| 63 | 63 | } | 
| @@ -47,7 +47,7 @@ discard block | ||
| 47 | 47 | /** | 
| 48 | 48 | * Displays a form to edit an existing item entity. | 
| 49 | 49 | * | 
| 50 | - * @param Object $entity Entity | |
| 50 | + * @param Orders $entity Entity | |
| 51 | 51 | * @param string $prefixRoute Prefix of Route | 
| 52 | 52 | * @param string $typePath Path of FormType | 
| 53 | 53 | * @return array | 
| @@ -69,7 +69,7 @@ discard block | ||
| 69 | 69 | /** | 
| 70 | 70 | * Edits an existing item entity. | 
| 71 | 71 | * | 
| 72 | - * @param Object $entity Entity | |
| 72 | + * @param Orders $entity Entity | |
| 73 | 73 | * @param \Symfony\Component\HttpFoundation\Request $request Request in progress | 
| 74 | 74 | * @param string $prefixRoute Prefix of Route | 
| 75 | 75 | * @param string $typePath Path of FormType | 
| @@ -40,7 +40,7 @@ discard block | ||
| 40 | 40 | return $this->createForm( | 
| 41 | 41 | OrdersType::class, | 
| 42 | 42 | $orders, | 
| 43 | - ['attr' => ['id' => 'create'], 'action' => $this->generateUrl($route), 'method' => 'POST',] | |
| 43 | + ['attr' => ['id' => 'create'], 'action' => $this->generateUrl($route), 'method' => 'POST', ] | |
| 44 | 44 | ); | 
| 45 | 45 | } | 
| 46 | 46 | |
| @@ -63,7 +63,7 @@ discard block | ||
| 63 | 63 | $this->addRolesAction($editForm, $entity); | 
| 64 | 64 | } | 
| 65 | 65 | |
| 66 | - return [$prefixRoute => $entity, 'edit_form' => $editForm->createView(),]; | |
| 66 | + return [$prefixRoute => $entity, 'edit_form' => $editForm->createView(), ]; | |
| 67 | 67 | } | 
| 68 | 68 | |
| 69 | 69 | /** | 
| @@ -117,22 +117,22 @@ discard block | ||
| 117 | 117 | */ | 
| 118 | 118 | protected function abstractPrintAction(Orders $orders, $from) | 
| 119 | 119 |      { | 
| 120 | - $file = $from . '-' . $orders->getId() . '.pdf'; | |
| 120 | + $file = $from.'-'.$orders->getId().'.pdf'; | |
| 121 | 121 |          $company = $this->getDoctrine()->getManager()->getRepository('AppBundle:Settings\Company')->find(1); | 
| 122 | 122 | // Create and save the PDF file to print | 
| 123 | 123 | $html = $this->renderView( | 
| 124 | - 'AppBundle:Orders/' . $from . ':print.pdf.twig', | |
| 124 | + 'AppBundle:Orders/'.$from.':print.pdf.twig', | |
| 125 | 125 | ['articles' => $orders->getArticles(), 'orders' => $orders, 'company' => $company, ] | 
| 126 | 126 | ); | 
| 127 | 127 | return new Response( | 
| 128 | 128 |              $this->get('knp_snappy.pdf')->getOutputFromHtml( | 
| 129 | 129 | $html, | 
| 130 | -                $this->get('app.helper.controller')->getArray((string)date('d/m/y - H:i:s'), '') | |
| 130 | +                $this->get('app.helper.controller')->getArray((string) date('d/m/y - H:i:s'), '') | |
| 131 | 131 | ), | 
| 132 | 132 | 200, | 
| 133 | 133 | array( | 
| 134 | 134 | 'Content-Type' => 'application/pdf', | 
| 135 | - 'Content-Disposition' => 'attachment; filename="' . $file . '"' | |
| 135 | + 'Content-Disposition' => 'attachment; filename="'.$file.'"' | |
| 136 | 136 | ) | 
| 137 | 137 | ); | 
| 138 | 138 | } | 
| @@ -103,7 +103,7 @@ | ||
| 103 | 103 |       * @Method("GET") | 
| 104 | 104 | * @Template() | 
| 105 | 105 | * | 
| 106 | - * @param \AppBundle\Entity\Orders $orders Order item to print | |
| 106 | + * @param Orders $orders Order item to print | |
| 107 | 107 | * @return \Symfony\Component\HttpFoundation\Response | 
| 108 | 108 | */ | 
| 109 | 109 | public function printAction(Orders $orders) | 
| @@ -57,7 +57,7 @@ discard block | ||
| 57 | 57 |       * @Method("GET") | 
| 58 | 58 | * @Template() | 
| 59 | 59 | * | 
| 60 | - * @param \AppBundle\Entity\Article $article Article item to display | |
| 60 | + * @param Article $article Article item to display | |
| 61 | 61 | * @return array | 
| 62 | 62 | */ | 
| 63 | 63 | public function showAction(Article $article) | 
| @@ -118,7 +118,7 @@ discard block | ||
| 118 | 118 |       * @Method("GET") | 
| 119 | 119 | * @Template() | 
| 120 | 120 | * | 
| 121 | - * @param \AppBundle\Entity\Article $article Article item to edit | |
| 121 | + * @param Article $article Article item to edit | |
| 122 | 122 | * @return array | 
| 123 | 123 | */ | 
| 124 | 124 | public function editAction(Article $article) | 
| @@ -135,7 +135,7 @@ discard block | ||
| 135 | 135 |       * @Method("PUT") | 
| 136 | 136 |       * @Template("AppBundle:Article:edit.html.twig") | 
| 137 | 137 | * | 
| 138 | - * @param \AppBundle\Entity\Article $article Article item to update | |
| 138 | + * @param Article $article Article item to update | |
| 139 | 139 | * @param \Symfony\Component\HttpFoundation\Request $request Form request | 
| 140 | 140 | * @return array | 
| 141 | 141 | */ | 
| @@ -190,8 +190,8 @@ discard block | ||
| 190 | 190 |       * @Template("AppBundle:Article:reassign.html.twig") | 
| 191 | 191 | * | 
| 192 | 192 | * @param \Symfony\Component\HttpFoundation\Request $request Form request | 
| 193 | - * @param \AppBundle\Entity\Supplier $supplier Supplier to desactivate | |
| 194 | - * @return array | |
| 193 | + * @param Supplier $supplier Supplier to desactivate | |
| 194 | + * @return \Symfony\Component\HttpFoundation\RedirectResponse | |
| 195 | 195 | */ | 
| 196 | 196 | public function changeAction(Request $request, Supplier $supplier) | 
| 197 | 197 |      { | 
| @@ -245,7 +245,7 @@ discard block | ||
| 245 | 245 |       * @Route("/admin/{id}/delete", name="article_delete", requirements={"id"="\d+"}) | 
| 246 | 246 |       * @Method("DELETE") | 
| 247 | 247 | * | 
| 248 | - * @param \AppBundle\Entity\Article $article Article item to delete | |
| 248 | + * @param Article $article Article item to delete | |
| 249 | 249 | * @param \Symfony\Component\HttpFoundation\Request $request Form request | 
| 250 | 250 | * @return \Symfony\Component\HttpFoundation\RedirectResponse | 
| 251 | 251 | */ | 
| @@ -100,7 +100,7 @@ | ||
| 100 | 100 | $form = $this->createForm(GroupType::class, $group); | 
| 101 | 101 | AbstractController::addRolesAction($form, $group); | 
| 102 | 102 | $form->handleRequest($request); | 
| 103 | - $return = ['group' => $group, 'form' => $form->createView(),]; | |
| 103 | + $return = ['group' => $group, 'form' => $form->createView(), ]; | |
| 104 | 104 | |
| 105 | 105 |          if ($form->isValid()) { | 
| 106 | 106 | $etm = $this->getDoctrine()->getManager(); |