@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * Get this page's database ID. |
| 62 | - * @return int |
|
| 62 | + * @return \string|null |
|
| 63 | 63 | */ |
| 64 | 64 | public function getId() |
| 65 | 65 | { |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * Get this page's length in bytes. |
| 72 | - * @return int |
|
| 72 | + * @return \string|null |
|
| 73 | 73 | */ |
| 74 | 74 | public function getLength() |
| 75 | 75 | { |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | /** |
| 95 | 95 | * Get the full URL of this page. |
| 96 | - * @return string |
|
| 96 | + * @return \string|null |
|
| 97 | 97 | */ |
| 98 | 98 | public function getUrl() |
| 99 | 99 | { |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | 105 | * Get the numerical ID of the namespace of this page. |
| 106 | - * @return int |
|
| 106 | + * @return \string|null |
|
| 107 | 107 | */ |
| 108 | 108 | public function getNamespace() |
| 109 | 109 | { |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | 115 | * Get the number of page watchers. |
| 116 | - * @return int |
|
| 116 | + * @return \string|null |
|
| 117 | 117 | */ |
| 118 | 118 | public function getWatchers() |
| 119 | 119 | { |
@@ -420,8 +420,8 @@ discard block |
||
| 420 | 420 | |
| 421 | 421 | /** |
| 422 | 422 | * Get the sum of pageviews for the given page and timeframe. |
| 423 | - * @param string|DateTime $start In the format YYYYMMDD |
|
| 424 | - * @param string|DateTime $end In the format YYYYMMDD |
|
| 423 | + * @param string $start In the format YYYYMMDD |
|
| 424 | + * @param string $end In the format YYYYMMDD |
|
| 425 | 425 | * @return string[] |
| 426 | 426 | */ |
| 427 | 427 | public function getPageviews($start, $end) |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $info = $this->getPageInfo(); |
| 82 | 82 | $title = isset($info['title']) ? $info['title'] : $this->unnormalizedPageName; |
| 83 | 83 | $nsName = $this->getNamespaceName(); |
| 84 | - return str_replace($nsName . ':', '', $title); |
|
| 84 | + return str_replace($nsName.':', '', $title); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | { |
| 218 | 218 | // If a user is given, we will not cache the result via instance variable. |
| 219 | 219 | if ($user !== null) { |
| 220 | - return (int) $this->getRepository()->getNumRevisions($this, $user); |
|
| 220 | + return (int)$this->getRepository()->getNumRevisions($this, $user); |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | // Return cached value, if present. |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | $this->numRevisions = count($this->revisions); |
| 231 | 231 | } else { |
| 232 | 232 | // Otherwise do a COUNT in the event fetching all revisions is not desired. |
| 233 | - $this->numRevisions = (int) $this->getRepository()->getNumRevisions($this); |
|
| 233 | + $this->numRevisions = (int)$this->getRepository()->getNumRevisions($this); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | return $this->numRevisions; |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | { |
| 261 | 261 | $content = $this->getRepository()->getPagesWikitext( |
| 262 | 262 | $this->getProject(), |
| 263 | - [ $this->getTitle() ] |
|
| 263 | + [$this->getTitle()] |
|
| 264 | 264 | ); |
| 265 | 265 | |
| 266 | 266 | return isset($content[$this->getTitle()]) |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | |
| 418 | 418 | $wikidataInfo = $this->getRepository()->getWikidataInfo($this); |
| 419 | 419 | |
| 420 | - $terms = array_map(function ($entry) { |
|
| 420 | + $terms = array_map(function($entry) { |
|
| 421 | 421 | return $entry['term']; |
| 422 | 422 | }, $wikidataInfo); |
| 423 | 423 | |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | 'prio' => 2, |
| 429 | 429 | 'name' => 'Wikidata', |
| 430 | 430 | 'notice' => "Label for language <em>$lang</em> is missing", // FIXME: i18n |
| 431 | - 'explanation' => "See: <a target='_blank' " . |
|
| 431 | + 'explanation' => "See: <a target='_blank' ". |
|
| 432 | 432 | "href='//www.wikidata.org/wiki/Help:Label'>Help:Label</a>", |
| 433 | 433 | ]; |
| 434 | 434 | } |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | 'prio' => 3, |
| 439 | 439 | 'name' => 'Wikidata', |
| 440 | 440 | 'notice' => "Description for language <em>$lang</em> is missing", // FIXME: i18n |
| 441 | - 'explanation' => "See: <a target='_blank' " . |
|
| 441 | + 'explanation' => "See: <a target='_blank' ". |
|
| 442 | 442 | "href='//www.wikidata.org/wiki/Help:Description'>Help:Description</a>", |
| 443 | 443 | ]; |
| 444 | 444 | } |
@@ -517,8 +517,8 @@ discard block |
||
| 517 | 517 | return 0; |
| 518 | 518 | } |
| 519 | 519 | |
| 520 | - return array_sum(array_map(function ($item) { |
|
| 521 | - return (int) $item['views']; |
|
| 520 | + return array_sum(array_map(function($item) { |
|
| 521 | + return (int)$item['views']; |
|
| 522 | 522 | }, $pageviews['items'])); |
| 523 | 523 | } |
| 524 | 524 | |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public function onKernelController(FilterControllerEvent $event) |
| 58 | 58 | { |
| 59 | - $this->rateLimit = (int) $this->container->getParameter('app.rate_limit_count'); |
|
| 60 | - $this->rateDuration = (int) $this->container->getParameter('app.rate_limit_time'); |
|
| 59 | + $this->rateLimit = (int)$this->container->getParameter('app.rate_limit_count'); |
|
| 60 | + $this->rateDuration = (int)$this->container->getParameter('app.rate_limit_time'); |
|
| 61 | 61 | |
| 62 | 62 | // Zero values indicate the rate limiting feature should be disabled. |
| 63 | 63 | if ($this->rateLimit === 0 || $this->rateDuration === 0) { |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | $controller = $event->getController(); |
| 68 | - $loggedIn = (bool) $this->container->get('session')->get('logged_in_user'); |
|
| 68 | + $loggedIn = (bool)$this->container->get('session')->get('logged_in_user'); |
|
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * Rate limiting will not apply to these actions |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $cacheItem = $cache->getItem($cacheKey); |
| 92 | 92 | |
| 93 | 93 | // If increment value already in cache, or start with 1. |
| 94 | - $count = $cacheItem->isHit() ? (int) $cacheItem->get() + 1 : 1; |
|
| 94 | + $count = $cacheItem->isHit() ? (int)$cacheItem->get()+1 : 1; |
|
| 95 | 95 | |
| 96 | 96 | // Check if limit has been exceeded, and if so, throw an error. |
| 97 | 97 | if ($count > $this->rateLimit) { |
@@ -143,14 +143,14 @@ discard block |
||
| 143 | 143 | // Log the denied request |
| 144 | 144 | $logger = $this->container->get('monolog.logger.rate_limit'); |
| 145 | 145 | $logger->info( |
| 146 | - "<URI>: " . $request->getRequestUri() . |
|
| 147 | - ($logComment != '' ? "\t<Reason>: $logComment" : '') . |
|
| 148 | - "\t<User agent>: " . $request->headers->get('User-Agent') |
|
| 146 | + "<URI>: ".$request->getRequestUri(). |
|
| 147 | + ($logComment != '' ? "\t<Reason>: $logComment" : ''). |
|
| 148 | + "\t<User agent>: ".$request->headers->get('User-Agent') |
|
| 149 | 149 | ); |
| 150 | 150 | |
| 151 | - throw new AccessDeniedHttpException("Possible spider crawl detected. " . |
|
| 152 | - 'If you are human, you are making too many requests during a short period of time. ' . |
|
| 153 | - "Please wait $this->rateDuration minutes before reloading this tool. You can then " . |
|
| 151 | + throw new AccessDeniedHttpException("Possible spider crawl detected. ". |
|
| 152 | + 'If you are human, you are making too many requests during a short period of time. '. |
|
| 153 | + "Please wait $this->rateDuration minutes before reloading this tool. You can then ". |
|
| 154 | 154 | 'login to prevent this from happening again.'); |
| 155 | 155 | } |
| 156 | 156 | } |
@@ -8,7 +8,6 @@ |
||
| 8 | 8 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
| 9 | 9 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
| 10 | 10 | use Symfony\Component\HttpFoundation\Request; |
| 11 | -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
|
| 12 | 11 | use Xtools\ProjectRepository; |
| 13 | 12 | use Xtools\Page; |
| 14 | 13 | use Xtools\PagesRepository; |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @Route("/rfx/{project}", name="rfxAnalysisProject") |
| 45 | 45 | * @Route("/rfx/{project}/{type}", name="rfxAnalysisProjectType") |
| 46 | 46 | * |
| 47 | - * @return Response|RedirectResponse |
|
| 47 | + * @return \Symfony\Component\HttpFoundation\Response |
|
| 48 | 48 | */ |
| 49 | 49 | public function indexAction(Request $request, $project = null, $type = null) |
| 50 | 50 | { |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * |
| 111 | 111 | * @Route("/rfx/{project}/{type}/{username}", name="rfxAnalysisResult") |
| 112 | 112 | * |
| 113 | - * @return Response|RedirectResponse |
|
| 113 | + * @return \Symfony\Component\HttpFoundation\Response |
|
| 114 | 114 | */ |
| 115 | 115 | public function resultAction($project, $type, $username) |
| 116 | 116 | { |
@@ -166,7 +166,7 @@ |
||
| 166 | 166 | $neutral = $rfx->getSection('neutral'); |
| 167 | 167 | $dup = $rfx->getDuplicates(); |
| 168 | 168 | |
| 169 | - $total = count($support) + count($oppose) + count($neutral); |
|
| 169 | + $total = count($support)+count($oppose)+count($neutral); |
|
| 170 | 170 | |
| 171 | 171 | if ($total === 0) { |
| 172 | 172 | $this->addFlash('notice', ['no-result', $pagename]); |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | * Returns matches. |
| 36 | 36 | * |
| 37 | 37 | * @param string $input The line we're looking for |
| 38 | - * @param array $matches Pointer to an array where we stash results |
|
| 38 | + * @param string[] $matches Pointer to an array where we stash results |
|
| 39 | 39 | * |
| 40 | 40 | * @TODO: Make this cleaner |
| 41 | 41 | * |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - $final = []; // initialize the final array |
|
| 122 | + $final = []; // initialize the final array |
|
| 123 | 123 | $finalRaw = []; // Initialize the raw data array |
| 124 | 124 | |
| 125 | 125 | foreach ($this->data as $key => $value) { |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | $final = array_count_values($final); // find repetition and its count |
| 134 | 134 | |
| 135 | - $final = array_diff($final, [1]); // remove single occurrences |
|
| 135 | + $final = array_diff($final, [1]); // remove single occurrences |
|
| 136 | 136 | |
| 137 | 137 | $this->duplicates = array_keys($final); |
| 138 | 138 | } |
@@ -13,7 +13,6 @@ |
||
| 13 | 13 | use Symfony\Component\HttpFoundation\JsonResponse; |
| 14 | 14 | use Xtools\EditCounter; |
| 15 | 15 | use Xtools\EditCounterRepository; |
| 16 | -use Xtools\Page; |
|
| 17 | 16 | use Xtools\Project; |
| 18 | 17 | use Xtools\ProjectRepository; |
| 19 | 18 | use Xtools\User; |
@@ -136,7 +136,7 @@ |
||
| 136 | 136 | $isSubRequest = $this->container->get('request_stack')->getParentRequest() !== null; |
| 137 | 137 | |
| 138 | 138 | return $this->render('editCounter/result.html.twig', [ |
| 139 | - 'xtTitle' => $this->user->getUsername() . ' - ' . $this->project->getTitle(), |
|
| 139 | + 'xtTitle' => $this->user->getUsername().' - '.$this->project->getTitle(), |
|
| 140 | 140 | 'xtPage' => 'ec', |
| 141 | 141 | 'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..'), |
| 142 | 142 | 'is_sub_request' => $isSubRequest, |
@@ -505,7 +505,7 @@ |
||
| 505 | 505 | /** |
| 506 | 506 | * Get a list of (semi-)automated tools that were used to edit the page, including |
| 507 | 507 | * the number of times they were used, and a link to the tool's homepage. |
| 508 | - * @return mixed[] |
|
| 508 | + * @return string[] |
|
| 509 | 509 | */ |
| 510 | 510 | public function getTools() |
| 511 | 511 | { |
@@ -389,7 +389,7 @@ |
||
| 389 | 389 | * The edit previously deemed as having the maximum amount of content added. |
| 390 | 390 | * This is used to discount content that was reverted. |
| 391 | 391 | * @var Edit|null |
| 392 | - */ |
|
| 392 | + */ |
|
| 393 | 393 | $prevMaxAddEdit = null; |
| 394 | 394 | |
| 395 | 395 | /** |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | public function getMaxRevisions() |
| 160 | 160 | { |
| 161 | 161 | if (!isset($this->maxRevisions)) { |
| 162 | - $this->maxRevisions = (int) $this->container->getParameter('app.max_page_revisions'); |
|
| 162 | + $this->maxRevisions = (int)$this->container->getParameter('app.max_page_revisions'); |
|
| 163 | 163 | } |
| 164 | 164 | return $this->maxRevisions; |
| 165 | 165 | } |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | |
| 639 | 639 | if ($revCount === 0) { |
| 640 | 640 | $this->firstEdit = $edit; |
| 641 | - $firstEditMonth = mktime(0, 0, 0, (int) $this->firstEdit->getMonth(), 1, $this->firstEdit->getYear()); |
|
| 641 | + $firstEditMonth = mktime(0, 0, 0, (int)$this->firstEdit->getMonth(), 1, $this->firstEdit->getYear()); |
|
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | $username = $edit->getUser()->getUsername(); |
@@ -824,7 +824,7 @@ discard block |
||
| 824 | 824 | $userGroupsTable = $this->getProject()->getTableName('user_groups'); |
| 825 | 825 | $userFromerGroupsTable = $this->getProject()->getTableName('user_former_groups'); |
| 826 | 826 | $sql = "SELECT COUNT(rev_user_text) AS count, rev_user_text AS username, ug_group AS current |
| 827 | - FROM " . $this->getProject()->getTableName('revision') . " |
|
| 827 | + FROM " . $this->getProject()->getTableName('revision')." |
|
| 828 | 828 | LEFT JOIN $userGroupsTable ON rev_user = ug_user |
| 829 | 829 | LEFT JOIN $userFromerGroupsTable ON rev_user = ufg_user |
| 830 | 830 | WHERE rev_page = :pageId AND (ug_group = 'bot' OR ufg_group = 'bot') |
@@ -839,14 +839,14 @@ discard block |
||
| 839 | 839 | $sum = 0; |
| 840 | 840 | while ($bot = $resultQuery->fetch()) { |
| 841 | 841 | $bots[$bot['username']] = [ |
| 842 | - 'count' => (int) $bot['count'], |
|
| 842 | + 'count' => (int)$bot['count'], |
|
| 843 | 843 | 'current' => $bot['current'] === 'bot' |
| 844 | 844 | ]; |
| 845 | 845 | $sum += $bot['count']; |
| 846 | 846 | } |
| 847 | 847 | |
| 848 | - uasort($bots, function ($a, $b) { |
|
| 849 | - return $b['count'] - $a['count']; |
|
| 848 | + uasort($bots, function($a, $b) { |
|
| 849 | + return $b['count']-$a['count']; |
|
| 850 | 850 | }); |
| 851 | 851 | |
| 852 | 852 | $this->botRevisionCount = $sum; |
@@ -869,7 +869,7 @@ discard block |
||
| 869 | 869 | $title = str_replace(' ', '_', $this->page->getTitle()); |
| 870 | 870 | $sql = "SELECT log_action, log_type, log_timestamp AS timestamp |
| 871 | 871 | FROM $loggingTable |
| 872 | - WHERE log_namespace = '" . $this->page->getNamespace() . "' |
|
| 872 | + WHERE log_namespace = '".$this->page->getNamespace()."' |
|
| 873 | 873 | AND log_title = :title AND log_timestamp > 1 |
| 874 | 874 | AND log_type IN ('delete', 'move', 'protect', 'stable')"; |
| 875 | 875 | $resultQuery = $this->conn->prepare($sql); |
@@ -944,7 +944,7 @@ discard block |
||
| 944 | 944 | |
| 945 | 945 | if ($info['all'] > 1) { |
| 946 | 946 | // Number of seconds/days between first and last edit |
| 947 | - $secs = $info['last']->getTimestamp() - $info['first']->getTimestamp(); |
|
| 947 | + $secs = $info['last']->getTimestamp()-$info['first']->getTimestamp(); |
|
| 948 | 948 | $days = $secs / (60 * 60 * 24); |
| 949 | 949 | |
| 950 | 950 | // Average time between edits (in days) |
@@ -963,7 +963,7 @@ discard block |
||
| 963 | 963 | |
| 964 | 964 | // First sort editors array by the amount of text they added |
| 965 | 965 | $topTenEditorsByAdded = $this->editors; |
| 966 | - uasort($topTenEditorsByAdded, function ($a, $b) { |
|
| 966 | + uasort($topTenEditorsByAdded, function($a, $b) { |
|
| 967 | 967 | if ($a['added'] === $b['added']) { |
| 968 | 968 | return 0; |
| 969 | 969 | } |
@@ -972,7 +972,7 @@ discard block |
||
| 972 | 972 | |
| 973 | 973 | // Then build a new array of top 10 editors by added text, |
| 974 | 974 | // in the data structure needed for the chart |
| 975 | - $this->topTenEditorsByAdded = array_map(function ($editor) { |
|
| 975 | + $this->topTenEditorsByAdded = array_map(function($editor) { |
|
| 976 | 976 | $added = $this->editors[$editor]['added']; |
| 977 | 977 | return [ |
| 978 | 978 | 'label' => $editor, |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | * Get metadata about a single page from the API. |
| 20 | 20 | * @param Project $project The project to which the page belongs. |
| 21 | 21 | * @param string $pageTitle Page title. |
| 22 | - * @return string[] Array with some of the following keys: pageid, title, missing, displaytitle, |
|
| 22 | + * @return string|null Array with some of the following keys: pageid, title, missing, displaytitle, |
|
| 23 | 23 | * url. |
| 24 | 24 | */ |
| 25 | 25 | public function getPageInfo(Project $project, $pageTitle) |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | * @param int $numRevisions Number of revisions, if known. This is used solely to determine the |
| 136 | 136 | * OFFSET if we are given a $limit (see below). If $limit is set and $numRevisions is not set, |
| 137 | 137 | * a separate query is ran to get the nuber of revisions. |
| 138 | - * @return Doctrine\DBAL\Driver\PDOStatement |
|
| 138 | + * @return \Doctrine\DBAL\Driver\Statement |
|
| 139 | 139 | */ |
| 140 | 140 | public function getRevisionsStmt(Page $page, User $user = null, $limit = null, $numRevisions = null) |
| 141 | 141 | { |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | // supply as the OFFSET. |
| 149 | 149 | $limitClause = ''; |
| 150 | 150 | if (intval($limit) > 0 && isset($numRevisions)) { |
| 151 | - $offset = $numRevisions - $limit; |
|
| 151 | + $offset = $numRevisions-$limit; |
|
| 152 | 152 | $limitClause = "LIMIT $offset, $limit"; |
| 153 | 153 | } |
| 154 | 154 | |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | |
| 379 | 379 | $wikidataId = ltrim($page->getWikidataId(), 'Q'); |
| 380 | 380 | |
| 381 | - $sql = "SELECT " . ($count ? 'COUNT(*) AS count' : '*') . " |
|
| 381 | + $sql = "SELECT ".($count ? 'COUNT(*) AS count' : '*')." |
|
| 382 | 382 | FROM wikidatawiki_p.wb_items_per_site |
| 383 | 383 | WHERE ips_item_id = :wikidataId"; |
| 384 | 384 | |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | |
| 389 | 389 | $result = $resultQuery->fetchAll(); |
| 390 | 390 | |
| 391 | - return $count ? (int) $result[0]['count'] : $result; |
|
| 391 | + return $count ? (int)$result[0]['count'] : $result; |
|
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | /** |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | |
| 429 | 429 | // Transform to associative array by 'type' |
| 430 | 430 | foreach ($res as $row) { |
| 431 | - $data[$row['type'] . '_count'] = $row['value']; |
|
| 431 | + $data[$row['type'].'_count'] = $row['value']; |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | return $data; |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | |
| 467 | 467 | $project = $page->getProject()->getDomain(); |
| 468 | 468 | |
| 469 | - $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/' . |
|
| 469 | + $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/'. |
|
| 470 | 470 | "$project/all-access/user/$title/daily/$start/$end"; |
| 471 | 471 | |
| 472 | 472 | $res = $client->request('GET', $url); |
@@ -81,9 +81,9 @@ discard block |
||
| 81 | 81 | $article = $request->query->get('article'); |
| 82 | 82 | |
| 83 | 83 | if ($projectQuery != '' && $article != '') { |
| 84 | - return $this->redirectToRoute('ArticleInfoResult', [ 'project'=>$projectQuery, 'article' => $article ]); |
|
| 84 | + return $this->redirectToRoute('ArticleInfoResult', ['project'=>$projectQuery, 'article' => $article]); |
|
| 85 | 85 | } elseif ($article != '') { |
| 86 | - return $this->redirectToRoute('ArticleInfoProject', [ 'project'=>$projectQuery ]); |
|
| 86 | + return $this->redirectToRoute('ArticleInfoProject', ['project'=>$projectQuery]); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | if ($projectQuery == '') { |
@@ -121,10 +121,10 @@ discard block |
||
| 121 | 121 | $rendered = str_replace('"', '\"', trim($rendered)); |
| 122 | 122 | |
| 123 | 123 | // Uglify temporary file. |
| 124 | - $tmpFile = sys_get_temp_dir() . '/xtools_articleinfo_gadget.js'; |
|
| 124 | + $tmpFile = sys_get_temp_dir().'/xtools_articleinfo_gadget.js'; |
|
| 125 | 125 | $script = "echo \"$rendered\" | tee $tmpFile >/dev/null && "; |
| 126 | - $script .= $this->get('kernel')->getRootDir() . |
|
| 127 | - "/Resources/node_modules/uglify-es/bin/uglifyjs $tmpFile --mangle " . |
|
| 126 | + $script .= $this->get('kernel')->getRootDir(). |
|
| 127 | + "/Resources/node_modules/uglify-es/bin/uglifyjs $tmpFile --mangle ". |
|
| 128 | 128 | "&& rm $tmpFile >/dev/null"; |
| 129 | 129 | $process = new Process($script); |
| 130 | 130 | $process->run(); |
@@ -143,10 +143,10 @@ discard block |
||
| 143 | 143 | $rendered = str_replace('\"', '"', trim($rendered)); |
| 144 | 144 | |
| 145 | 145 | // Add comment after uglifying since it removes comments. |
| 146 | - $rendered = "/**\n * This code was automatically generated and should not " . |
|
| 147 | - "be manually edited.\n * For updates, please copy and paste from " . |
|
| 148 | - $this->generateUrl('ArticleInfoGadget', ['uglify' => 1], UrlGeneratorInterface::ABSOLUTE_URL) . |
|
| 149 | - "\n * Released under GPL v3 license.\n */\n" . $rendered; |
|
| 146 | + $rendered = "/**\n * This code was automatically generated and should not ". |
|
| 147 | + "be manually edited.\n * For updates, please copy and paste from ". |
|
| 148 | + $this->generateUrl('ArticleInfoGadget', ['uglify' => 1], UrlGeneratorInterface::ABSOLUTE_URL). |
|
| 149 | + "\n * Released under GPL v3 license.\n */\n".$rendered; |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | $response = new \Symfony\Component\HttpFoundation\Response($rendered); |
@@ -8,7 +8,6 @@ |
||
| 8 | 8 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
| 9 | 9 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
| 10 | 10 | use Symfony\Component\HttpFoundation\Request; |
| 11 | -use Symfony\Component\DependencyInjection\ContainerInterface; |
|
| 12 | 11 | use Symfony\Component\HttpFoundation\Response; |
| 13 | 12 | use Symfony\Component\Process\Process; |
| 14 | 13 | use Symfony\Component\Routing\Generator\UrlGeneratorInterface; |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // Find the path, and complain if English doesn't exist. |
| 60 | - $path = $this->container->getParameter('kernel.root_dir') . '/../i18n'; |
|
| 60 | + $path = $this->container->getParameter('kernel.root_dir').'/../i18n'; |
|
| 61 | 61 | if (!file_exists("$path/en.json")) { |
| 62 | 62 | throw new Exception("Language directory doesn't exist: $path"); |
| 63 | 63 | } |