diff --git a/app/AppKernel.php b/app/AppKernel.php index 953614c0f..00206ddf2 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -2,7 +2,6 @@ use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Config\Loader\LoaderInterface; -use Wallabag\ApiBundle\WallabagApiBundle; class AppKernel extends Kernel { diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php index 692a4ae0e..02a6de64c 100644 --- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php @@ -84,12 +84,12 @@ class WallabagRestController extends Controller public function getEntriesAction(Request $request) { $isArchived = $request->query->get('archive'); - $isStarred = $request->query->get('star'); - $sort = $request->query->get('sort', 'created'); - $order = $request->query->get('order', 'desc'); - $page = (int) $request->query->get('page', 1); - $perPage = (int) $request->query->get('perPage', 30); - $tags = $request->query->get('tags', []); + $isStarred = $request->query->get('star'); + $sort = $request->query->get('sort', 'created'); + $order = $request->query->get('order', 'desc'); + $page = (int) $request->query->get('page', 1); + $perPage = (int) $request->query->get('perPage', 30); + $tags = $request->query->get('tags', []); $pager = $this ->getDoctrine() @@ -99,7 +99,7 @@ class WallabagRestController extends Controller $pager->setCurrentPage($page); $pager->setMaxPerPage($perPage); - $pagerfantaFactory = new PagerfantaFactory('page', 'perPage'); + $pagerfantaFactory = new PagerfantaFactory('page', 'perPage'); $paginatedCollection = $pagerfantaFactory->createRepresentation( $pager, new Route('api_get_entries', [], $absolute = true) @@ -188,9 +188,9 @@ class WallabagRestController extends Controller { $this->validateUserAccess($entry->getUser()->getId(), $this->getUser()->getId()); - $title = $request->request->get('title'); + $title = $request->request->get('title'); $isArchived = $request->request->get('is_archived'); - $isStarred = $request->request->get('is_starred'); + $isStarred = $request->request->get('is_starred'); if (!is_null($title)) { $entry->setTitle($title); diff --git a/src/Wallabag/ApiBundle/Security/Authentication/Provider/WsseProvider.php b/src/Wallabag/ApiBundle/Security/Authentication/Provider/WsseProvider.php index db73ae2a4..9bf8b377f 100644 --- a/src/Wallabag/ApiBundle/Security/Authentication/Provider/WsseProvider.php +++ b/src/Wallabag/ApiBundle/Security/Authentication/Provider/WsseProvider.php @@ -17,7 +17,7 @@ class WsseProvider implements AuthenticationProviderInterface public function __construct(UserProviderInterface $userProvider, $cacheDir) { $this->userProvider = $userProvider; - $this->cacheDir = $cacheDir; + $this->cacheDir = $cacheDir; // If cache directory does not exist we create it if (!is_dir($this->cacheDir)) { diff --git a/src/Wallabag/ApiBundle/Security/Firewall/WsseListener.php b/src/Wallabag/ApiBundle/Security/Firewall/WsseListener.php index 505878379..2fcbe014e 100644 --- a/src/Wallabag/ApiBundle/Security/Firewall/WsseListener.php +++ b/src/Wallabag/ApiBundle/Security/Firewall/WsseListener.php @@ -36,9 +36,9 @@ class WsseListener implements ListenerInterface $token = new WsseUserToken(); $token->setUser($matches[1]); - $token->digest = $matches[2]; - $token->nonce = $matches[3]; - $token->created = $matches[4]; + $token->digest = $matches[2]; + $token->nonce = $matches[3]; + $token->created = $matches[4]; try { $authToken = $this->authenticationManager->authenticate($token); diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 93ce650e1..006fa3964 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -136,9 +136,9 @@ class EntryController extends Controller return $this->render( 'WallabagCoreBundle:Entry:entries.html.twig', array( - 'form' => $form->createView(), - 'entries' => $entries, - 'currentPage' => $page + 'form' => $form->createView(), + 'entries' => $entries, + 'currentPage' => $page, ) ); } @@ -178,9 +178,9 @@ class EntryController extends Controller return $this->render( 'WallabagCoreBundle:Entry:entries.html.twig', array( - 'form' => $form->createView(), - 'entries' => $entries, - 'currentPage' => $page + 'form' => $form->createView(), + 'entries' => $entries, + 'currentPage' => $page, ) ); } @@ -220,9 +220,9 @@ class EntryController extends Controller return $this->render( 'WallabagCoreBundle:Entry:entries.html.twig', array( - 'form' => $form->createView(), - 'entries' => $entries, - 'currentPage' => $page + 'form' => $form->createView(), + 'entries' => $entries, + 'currentPage' => $page, ) ); } @@ -265,7 +265,7 @@ class EntryController extends Controller $this->get('session')->getFlashBag()->add( 'notice', - 'Entry ' . ($entry->isArchived() ? 'archived' : 'unarchived') + 'Entry '.($entry->isArchived() ? 'archived' : 'unarchived') ); return $this->redirect($request->headers->get('referer')); @@ -290,7 +290,7 @@ class EntryController extends Controller $this->get('session')->getFlashBag()->add( 'notice', - 'Entry ' . ($entry->isStarred() ? 'starred' : 'unstarred') + 'Entry '.($entry->isStarred() ? 'starred' : 'unstarred') ); return $this->redirect($request->headers->get('referer')); diff --git a/src/Wallabag/CoreBundle/Controller/SecurityController.php b/src/Wallabag/CoreBundle/Controller/SecurityController.php index a61a898bf..f0a7ab6d8 100644 --- a/src/Wallabag/CoreBundle/Controller/SecurityController.php +++ b/src/Wallabag/CoreBundle/Controller/SecurityController.php @@ -25,7 +25,7 @@ class SecurityController extends Controller return $this->render('WallabagCoreBundle:Security:login.html.twig', array( // last username entered by the user 'last_username' => $session->get(SecurityContext::LAST_USERNAME), - 'error' => $error, + 'error' => $error, )); } diff --git a/src/Wallabag/CoreBundle/Controller/StaticController.php b/src/Wallabag/CoreBundle/Controller/StaticController.php index 09be1b74f..3b844b44c 100644 --- a/src/Wallabag/CoreBundle/Controller/StaticController.php +++ b/src/Wallabag/CoreBundle/Controller/StaticController.php @@ -10,13 +10,14 @@ class StaticController extends Controller /** * @Route("/howto", name="howto") */ - public function howtoAction() - { - return $this->render( - 'WallabagCoreBundle:Static:howto.html.twig', - array() - ); - } + public function howtoAction() + { + return $this->render( + 'WallabagCoreBundle:Static:howto.html.twig', + array() + ); + } + /** * @Route("/about", name="about") */ diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index e448cea1e..a342ec0b9 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php @@ -23,9 +23,8 @@ class TagController extends Controller return $this->render( 'WallabagCoreBundle:Tag:tags.html.twig', array( - 'tags' => $tags + 'tags' => $tags, ) ); } - } diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php index 3bb5c5f2a..cb0c52c49 100644 --- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php @@ -10,7 +10,7 @@ use Wallabag\CoreBundle\Entity\Config; class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface { /** - * {@inheritDoc} + * {@inheritdoc} */ public function load(ObjectManager $manager) { @@ -36,7 +36,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface } /** - * {@inheritDoc} + * {@inheritdoc} */ public function getOrder() { diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php index 547d6753e..6cd24d442 100644 --- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php @@ -11,7 +11,7 @@ use Wallabag\CoreBundle\Entity\Tag; class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface { /** - * {@inheritDoc} + * {@inheritdoc} */ public function load(ObjectManager $manager) { @@ -91,7 +91,7 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface } /** - * {@inheritDoc} + * {@inheritdoc} */ public function getOrder() { diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadUserData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadUserData.php index d99412f48..1c7f9dfae 100644 --- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadUserData.php +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadUserData.php @@ -10,7 +10,7 @@ use Wallabag\CoreBundle\Entity\User; class LoadUserData extends AbstractFixture implements OrderedFixtureInterface { /** - * {@inheritDoc} + * {@inheritdoc} */ public function load(ObjectManager $manager) { @@ -38,7 +38,7 @@ class LoadUserData extends AbstractFixture implements OrderedFixtureInterface } /** - * {@inheritDoc} + * {@inheritdoc} */ public function getOrder() { diff --git a/src/Wallabag/CoreBundle/Entity/Tag.php b/src/Wallabag/CoreBundle/Entity/Tag.php index 92442df6d..6f005314f 100644 --- a/src/Wallabag/CoreBundle/Entity/Tag.php +++ b/src/Wallabag/CoreBundle/Entity/Tag.php @@ -48,7 +48,7 @@ class Tag public function __construct(User $user) { - $this->user = $user; + $this->user = $user; $this->entries = new ArrayCollection(); } diff --git a/src/Wallabag/CoreBundle/Entity/User.php b/src/Wallabag/CoreBundle/Entity/User.php index 00eb808a6..510a1594e 100644 --- a/src/Wallabag/CoreBundle/Entity/User.php +++ b/src/Wallabag/CoreBundle/Entity/User.php @@ -123,9 +123,9 @@ class User implements AdvancedUserInterface, \Serializable public function __construct() { $this->isActive = true; - $this->salt = md5(uniqid(null, true)); - $this->entries = new ArrayCollection(); - $this->tags = new ArrayCollection(); + $this->salt = md5(uniqid(null, true)); + $this->entries = new ArrayCollection(); + $this->tags = new ArrayCollection(); } /** @@ -176,7 +176,7 @@ class User implements AdvancedUserInterface, \Serializable } /** - * @inheritDoc + * {@inheritdoc} */ public function getSalt() { @@ -184,7 +184,7 @@ class User implements AdvancedUserInterface, \Serializable } /** - * @inheritDoc + * {@inheritdoc} */ public function getRoles() { @@ -323,7 +323,7 @@ class User implements AdvancedUserInterface, \Serializable return $this->tags; } /** - * @inheritDoc + * {@inheritdoc} */ public function eraseCredentials() { diff --git a/src/Wallabag/CoreBundle/Filter/EntryFilterType.php b/src/Wallabag/CoreBundle/Filter/EntryFilterType.php index d1057fb56..771daef17 100644 --- a/src/Wallabag/CoreBundle/Filter/EntryFilterType.php +++ b/src/Wallabag/CoreBundle/Filter/EntryFilterType.php @@ -5,7 +5,6 @@ namespace Wallabag\CoreBundle\Filter; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Lexik\Bundle\FormFilterBundle\Filter\FilterOperands; use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface; class EntryFilterType extends AbstractType @@ -17,26 +16,29 @@ class EntryFilterType extends AbstractType ->add('createdAt', 'filter_date_range', array( 'left_date_options' => array( 'attr' => array( - 'placeholder' => 'dd/mm/yyyy'), + 'placeholder' => 'dd/mm/yyyy', + ), 'format' => 'dd/MM/yyyy', - 'widget' => 'single_text' + 'widget' => 'single_text', ), 'right_date_options' => array( 'attr' => array( - 'placeholder' => 'dd/mm/yyyy'), + 'placeholder' => 'dd/mm/yyyy', + ), 'format' => 'dd/MM/yyyy', - 'widget' => 'single_text' - ))) + 'widget' => 'single_text', + ), + )) ->add('domainName', 'filter_text', array( - 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) - { + 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { $value = $values['value']; if (strlen($value) <= 3 || empty($value)) { - return null; + return; } $expression = $filterQuery->getExpr()->like($field, $filterQuery->getExpr()->literal('%'.$value.'%')); + return $filterQuery->createCondition($expression); - } + }, )); } @@ -48,8 +50,8 @@ class EntryFilterType extends AbstractType public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( - 'csrf_protection' => false, - 'validation_groups' => array('filtering') + 'csrf_protection' => false, + 'validation_groups' => array('filtering'), )); } } diff --git a/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php b/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php index b4224e3df..82e1954d1 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php @@ -19,7 +19,7 @@ class ChangePasswordType extends AbstractType 'type' => 'password', 'invalid_message' => 'The password fields must match.', 'required' => true, - 'first_options' => array('label' => 'New password'), + 'first_options' => array('label' => 'New password'), 'second_options' => array('label' => 'Repeat new password'), 'constraints' => array( new Constraints\Length(array( diff --git a/src/Wallabag/CoreBundle/Form/Type/ResetPasswordType.php b/src/Wallabag/CoreBundle/Form/Type/ResetPasswordType.php index a5d683c46..38f1a1054 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ResetPasswordType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ResetPasswordType.php @@ -15,7 +15,7 @@ class ResetPasswordType extends AbstractType 'type' => 'password', 'invalid_message' => 'The password fields must match.', 'required' => true, - 'first_options' => array('label' => 'New password'), + 'first_options' => array('label' => 'New password'), 'second_options' => array('label' => 'Repeat new password'), 'constraints' => array( new Constraints\Length(array( diff --git a/src/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverter.php b/src/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverter.php index ea2bda175..2771cf116 100644 --- a/src/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverter.php +++ b/src/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverter.php @@ -67,7 +67,7 @@ class UsernameRssTokenConverter implements ParamConverterInterface public function apply(Request $request, ParamConverter $configuration) { $username = $request->attributes->get('username'); - $rssToken = $request->attributes->get('token'); + $rssToken = $request->attributes->get('token'); // Check, if route attributes exists if (null === $username || null === $rssToken) { diff --git a/src/Wallabag/CoreBundle/Repository/TagRepository.php b/src/Wallabag/CoreBundle/Repository/TagRepository.php index 51f1cd429..9c4096072 100644 --- a/src/Wallabag/CoreBundle/Repository/TagRepository.php +++ b/src/Wallabag/CoreBundle/Repository/TagRepository.php @@ -11,7 +11,7 @@ class TagRepository extends EntityRepository /** * Find Tags. * - * @param int $userId + * @param int $userId * * @return array */ diff --git a/src/Wallabag/CoreBundle/Security/Authentication/Encoder/WallabagPasswordEncoder.php b/src/Wallabag/CoreBundle/Security/Authentication/Encoder/WallabagPasswordEncoder.php index e7c81fc0a..98b4e86b2 100644 --- a/src/Wallabag/CoreBundle/Security/Authentication/Encoder/WallabagPasswordEncoder.php +++ b/src/Wallabag/CoreBundle/Security/Authentication/Encoder/WallabagPasswordEncoder.php @@ -52,7 +52,7 @@ class WallabagPasswordEncoder extends BasePasswordEncoder $digest = hash($this->algorithm, $salted, true); // "stretch" hash - for ($i = 1; $i < $this->iterations; $i++) { + for ($i = 1; $i < $this->iterations; ++$i) { $digest = hash($this->algorithm, $digest.$salted, true); } diff --git a/src/Wallabag/CoreBundle/Service/Extractor.php b/src/Wallabag/CoreBundle/Service/Extractor.php index 961ac20ad..4c067d3af 100644 --- a/src/Wallabag/CoreBundle/Service/Extractor.php +++ b/src/Wallabag/CoreBundle/Service/Extractor.php @@ -33,8 +33,8 @@ final class Extractor $REAL = array(); foreach ($GLOBALS as $key => $value) { if ($key != 'GLOBALS' && $key != '_SESSION' && $key != 'HTTP_SESSION_VARS') { - $GLOBALS[$key] = array(); - $REAL[$key] = $value; + $GLOBALS[$key] = array(); + $REAL[$key] = $value; } } // Saving and clearing session diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php index 8d013ec00..86a19f616 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php @@ -252,7 +252,7 @@ class EntryControllerTest extends WallabagCoreTestCase $data = array( 'entry_filter[readingTime][right_number]' => 11, - 'entry_filter[readingTime][left_number]' => 11 + 'entry_filter[readingTime][left_number]' => 11, ); $crawler = $client->submit($form, $data); @@ -271,7 +271,7 @@ class EntryControllerTest extends WallabagCoreTestCase $data = array( 'entry_filter[createdAt][left_date]' => date('d/m/Y'), - 'entry_filter[createdAt][right_date]' => date('d/m/Y', strtotime("+1 day")) + 'entry_filter[createdAt][right_date]' => date('d/m/Y', strtotime('+1 day')), ); $crawler = $client->submit($form, $data); @@ -280,13 +280,12 @@ class EntryControllerTest extends WallabagCoreTestCase $data = array( 'entry_filter[createdAt][left_date]' => '01/01/1970', - 'entry_filter[createdAt][right_date]' => '01/01/1970' + 'entry_filter[createdAt][right_date]' => '01/01/1970', ); $crawler = $client->submit($form, $data); $this->assertCount(0, $crawler->filter('div[class=entry]')); - } public function testPaginationWithFilter() @@ -318,7 +317,7 @@ class EntryControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/unread/list'); $form = $crawler->filter('button[id=submit-filter]')->form(); $data = array( - 'entry_filter[domainName]' => 'monde' + 'entry_filter[domainName]' => 'monde', ); $crawler = $client->submit($form, $data); @@ -326,7 +325,7 @@ class EntryControllerTest extends WallabagCoreTestCase $form = $crawler->filter('button[id=submit-filter]')->form(); $data = array( - 'entry_filter[domainName]' => 'wallabag' + 'entry_filter[domainName]' => 'wallabag', ); $crawler = $client->submit($form, $data); diff --git a/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php index 34faf7097..4a43e0492 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php @@ -3,7 +3,6 @@ namespace Wallabag\CoreBundle\Tests\Controller; use Wallabag\CoreBundle\Tests\WallabagCoreTestCase; -use Doctrine\ORM\AbstractQuery; class TagControllerTest extends WallabagCoreTestCase {