diff options
author | Jérémy Benoist <j0k3r@users.noreply.github.com> | 2017-07-03 13:39:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-03 13:39:54 +0200 |
commit | 71e1cbc8eb5928d393b0772055d6b711e90a09b3 (patch) | |
tree | 71795eadcf13fda9198b8cd9a3da26d51826bbd9 /src/Wallabag/CoreBundle/Twig/WallabagExtension.php | |
parent | 822c877949aff8ae57677671115f8f4fc69588d5 (diff) | |
parent | 38520658addc217f127b0627ea28dcf8d6e6178c (diff) | |
download | wallabag-71e1cbc8eb5928d393b0772055d6b711e90a09b3.tar.gz wallabag-71e1cbc8eb5928d393b0772055d6b711e90a09b3.tar.zst wallabag-71e1cbc8eb5928d393b0772055d6b711e90a09b3.zip |
Merge pull request #3258 from wallabag/cs-fixer
Add a real configuration for CS-Fixer
Diffstat (limited to 'src/Wallabag/CoreBundle/Twig/WallabagExtension.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Twig/WallabagExtension.php | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/Wallabag/CoreBundle/Twig/WallabagExtension.php b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php index a305c53f..351172c4 100644 --- a/src/Wallabag/CoreBundle/Twig/WallabagExtension.php +++ b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php | |||
@@ -3,9 +3,9 @@ | |||
3 | namespace Wallabag\CoreBundle\Twig; | 3 | namespace Wallabag\CoreBundle\Twig; |
4 | 4 | ||
5 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; | 5 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; |
6 | use Symfony\Component\Translation\TranslatorInterface; | ||
6 | use Wallabag\CoreBundle\Repository\EntryRepository; | 7 | use Wallabag\CoreBundle\Repository\EntryRepository; |
7 | use Wallabag\CoreBundle\Repository\TagRepository; | 8 | use Wallabag\CoreBundle\Repository\TagRepository; |
8 | use Symfony\Component\Translation\TranslatorInterface; | ||
9 | 9 | ||
10 | class WallabagExtension extends \Twig_Extension implements \Twig_Extension_GlobalsInterface | 10 | class WallabagExtension extends \Twig_Extension implements \Twig_Extension_GlobalsInterface |
11 | { | 11 | { |
@@ -33,11 +33,11 @@ class WallabagExtension extends \Twig_Extension implements \Twig_Extension_Globa | |||
33 | 33 | ||
34 | public function getFunctions() | 34 | public function getFunctions() |
35 | { | 35 | { |
36 | return array( | 36 | return [ |
37 | new \Twig_SimpleFunction('count_entries', [$this, 'countEntries']), | 37 | new \Twig_SimpleFunction('count_entries', [$this, 'countEntries']), |
38 | new \Twig_SimpleFunction('count_tags', [$this, 'countTags']), | 38 | new \Twig_SimpleFunction('count_tags', [$this, 'countTags']), |
39 | new \Twig_SimpleFunction('display_stats', [$this, 'displayStats']), | 39 | new \Twig_SimpleFunction('display_stats', [$this, 'displayStats']), |
40 | ); | 40 | ]; |
41 | } | 41 | } |
42 | 42 | ||
43 | public function removeWww($url) | 43 | public function removeWww($url) |
@@ -64,19 +64,15 @@ class WallabagExtension extends \Twig_Extension implements \Twig_Extension_Globa | |||
64 | case 'starred': | 64 | case 'starred': |
65 | $qb = $this->entryRepository->getBuilderForStarredByUser($user->getId()); | 65 | $qb = $this->entryRepository->getBuilderForStarredByUser($user->getId()); |
66 | break; | 66 | break; |
67 | |||
68 | case 'archive': | 67 | case 'archive': |
69 | $qb = $this->entryRepository->getBuilderForArchiveByUser($user->getId()); | 68 | $qb = $this->entryRepository->getBuilderForArchiveByUser($user->getId()); |
70 | break; | 69 | break; |
71 | |||
72 | case 'unread': | 70 | case 'unread': |
73 | $qb = $this->entryRepository->getBuilderForUnreadByUser($user->getId()); | 71 | $qb = $this->entryRepository->getBuilderForUnreadByUser($user->getId()); |
74 | break; | 72 | break; |
75 | |||
76 | case 'all': | 73 | case 'all': |
77 | $qb = $this->entryRepository->getBuilderForAllByUser($user->getId()); | 74 | $qb = $this->entryRepository->getBuilderForAllByUser($user->getId()); |
78 | break; | 75 | break; |
79 | |||
80 | default: | 76 | default: |
81 | throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type)); | 77 | throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type)); |
82 | } | 78 | } |
@@ -139,7 +135,7 @@ class WallabagExtension extends \Twig_Extension implements \Twig_Extension_Globa | |||
139 | $nbDays = (int) $interval->format('%a') ?: 1; | 135 | $nbDays = (int) $interval->format('%a') ?: 1; |
140 | 136 | ||
141 | // force setlocale for date translation | 137 | // force setlocale for date translation |
142 | setlocale(LC_TIME, strtolower($user->getConfig()->getLanguage()).'_'.strtoupper(strtolower($user->getConfig()->getLanguage()))); | 138 | setlocale(LC_TIME, strtolower($user->getConfig()->getLanguage()) . '_' . strtoupper(strtolower($user->getConfig()->getLanguage()))); |
143 | 139 | ||
144 | return $this->translator->trans('footer.stats', [ | 140 | return $this->translator->trans('footer.stats', [ |
145 | '%user_creation%' => strftime('%e %B %Y', $user->getCreatedAt()->getTimestamp()), | 141 | '%user_creation%' => strftime('%e %B %Y', $user->getCreatedAt()->getTimestamp()), |