We shouldn't forget to run `php-cs-fixer` time to time
This commit is contained in:
Jeremy Benoist 2015-08-20 07:53:55 +02:00
parent 34437f408c
commit 8ce32af612
22 changed files with 73 additions and 74 deletions

View file

@ -2,7 +2,6 @@
use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\Config\Loader\LoaderInterface;
use Wallabag\ApiBundle\WallabagApiBundle;
class AppKernel extends Kernel class AppKernel extends Kernel
{ {

View file

@ -84,12 +84,12 @@ class WallabagRestController extends Controller
public function getEntriesAction(Request $request) public function getEntriesAction(Request $request)
{ {
$isArchived = $request->query->get('archive'); $isArchived = $request->query->get('archive');
$isStarred = $request->query->get('star'); $isStarred = $request->query->get('star');
$sort = $request->query->get('sort', 'created'); $sort = $request->query->get('sort', 'created');
$order = $request->query->get('order', 'desc'); $order = $request->query->get('order', 'desc');
$page = (int) $request->query->get('page', 1); $page = (int) $request->query->get('page', 1);
$perPage = (int) $request->query->get('perPage', 30); $perPage = (int) $request->query->get('perPage', 30);
$tags = $request->query->get('tags', []); $tags = $request->query->get('tags', []);
$pager = $this $pager = $this
->getDoctrine() ->getDoctrine()
@ -99,7 +99,7 @@ class WallabagRestController extends Controller
$pager->setCurrentPage($page); $pager->setCurrentPage($page);
$pager->setMaxPerPage($perPage); $pager->setMaxPerPage($perPage);
$pagerfantaFactory = new PagerfantaFactory('page', 'perPage'); $pagerfantaFactory = new PagerfantaFactory('page', 'perPage');
$paginatedCollection = $pagerfantaFactory->createRepresentation( $paginatedCollection = $pagerfantaFactory->createRepresentation(
$pager, $pager,
new Route('api_get_entries', [], $absolute = true) new Route('api_get_entries', [], $absolute = true)
@ -188,9 +188,9 @@ class WallabagRestController extends Controller
{ {
$this->validateUserAccess($entry->getUser()->getId(), $this->getUser()->getId()); $this->validateUserAccess($entry->getUser()->getId(), $this->getUser()->getId());
$title = $request->request->get('title'); $title = $request->request->get('title');
$isArchived = $request->request->get('is_archived'); $isArchived = $request->request->get('is_archived');
$isStarred = $request->request->get('is_starred'); $isStarred = $request->request->get('is_starred');
if (!is_null($title)) { if (!is_null($title)) {
$entry->setTitle($title); $entry->setTitle($title);

View file

@ -17,7 +17,7 @@ class WsseProvider implements AuthenticationProviderInterface
public function __construct(UserProviderInterface $userProvider, $cacheDir) public function __construct(UserProviderInterface $userProvider, $cacheDir)
{ {
$this->userProvider = $userProvider; $this->userProvider = $userProvider;
$this->cacheDir = $cacheDir; $this->cacheDir = $cacheDir;
// If cache directory does not exist we create it // If cache directory does not exist we create it
if (!is_dir($this->cacheDir)) { if (!is_dir($this->cacheDir)) {

View file

@ -36,9 +36,9 @@ class WsseListener implements ListenerInterface
$token = new WsseUserToken(); $token = new WsseUserToken();
$token->setUser($matches[1]); $token->setUser($matches[1]);
$token->digest = $matches[2]; $token->digest = $matches[2];
$token->nonce = $matches[3]; $token->nonce = $matches[3];
$token->created = $matches[4]; $token->created = $matches[4];
try { try {
$authToken = $this->authenticationManager->authenticate($token); $authToken = $this->authenticationManager->authenticate($token);

View file

@ -136,9 +136,9 @@ class EntryController extends Controller
return $this->render( return $this->render(
'WallabagCoreBundle:Entry:entries.html.twig', 'WallabagCoreBundle:Entry:entries.html.twig',
array( array(
'form' => $form->createView(), 'form' => $form->createView(),
'entries' => $entries, 'entries' => $entries,
'currentPage' => $page 'currentPage' => $page,
) )
); );
} }
@ -178,9 +178,9 @@ class EntryController extends Controller
return $this->render( return $this->render(
'WallabagCoreBundle:Entry:entries.html.twig', 'WallabagCoreBundle:Entry:entries.html.twig',
array( array(
'form' => $form->createView(), 'form' => $form->createView(),
'entries' => $entries, 'entries' => $entries,
'currentPage' => $page 'currentPage' => $page,
) )
); );
} }
@ -220,9 +220,9 @@ class EntryController extends Controller
return $this->render( return $this->render(
'WallabagCoreBundle:Entry:entries.html.twig', 'WallabagCoreBundle:Entry:entries.html.twig',
array( array(
'form' => $form->createView(), 'form' => $form->createView(),
'entries' => $entries, 'entries' => $entries,
'currentPage' => $page 'currentPage' => $page,
) )
); );
} }
@ -265,7 +265,7 @@ class EntryController extends Controller
$this->get('session')->getFlashBag()->add( $this->get('session')->getFlashBag()->add(
'notice', 'notice',
'Entry ' . ($entry->isArchived() ? 'archived' : 'unarchived') 'Entry '.($entry->isArchived() ? 'archived' : 'unarchived')
); );
return $this->redirect($request->headers->get('referer')); return $this->redirect($request->headers->get('referer'));
@ -290,7 +290,7 @@ class EntryController extends Controller
$this->get('session')->getFlashBag()->add( $this->get('session')->getFlashBag()->add(
'notice', 'notice',
'Entry ' . ($entry->isStarred() ? 'starred' : 'unstarred') 'Entry '.($entry->isStarred() ? 'starred' : 'unstarred')
); );
return $this->redirect($request->headers->get('referer')); return $this->redirect($request->headers->get('referer'));

View file

@ -25,7 +25,7 @@ class SecurityController extends Controller
return $this->render('WallabagCoreBundle:Security:login.html.twig', array( return $this->render('WallabagCoreBundle:Security:login.html.twig', array(
// last username entered by the user // last username entered by the user
'last_username' => $session->get(SecurityContext::LAST_USERNAME), 'last_username' => $session->get(SecurityContext::LAST_USERNAME),
'error' => $error, 'error' => $error,
)); ));
} }

View file

@ -10,13 +10,14 @@ class StaticController extends Controller
/** /**
* @Route("/howto", name="howto") * @Route("/howto", name="howto")
*/ */
public function howtoAction() public function howtoAction()
{ {
return $this->render( return $this->render(
'WallabagCoreBundle:Static:howto.html.twig', 'WallabagCoreBundle:Static:howto.html.twig',
array() array()
); );
} }
/** /**
* @Route("/about", name="about") * @Route("/about", name="about")
*/ */

View file

@ -23,9 +23,8 @@ class TagController extends Controller
return $this->render( return $this->render(
'WallabagCoreBundle:Tag:tags.html.twig', 'WallabagCoreBundle:Tag:tags.html.twig',
array( array(
'tags' => $tags 'tags' => $tags,
) )
); );
} }
} }

View file

@ -10,7 +10,7 @@ use Wallabag\CoreBundle\Entity\Config;
class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
{ {
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
public function load(ObjectManager $manager) public function load(ObjectManager $manager)
{ {
@ -36,7 +36,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
} }
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
public function getOrder() public function getOrder()
{ {

View file

@ -11,7 +11,7 @@ use Wallabag\CoreBundle\Entity\Tag;
class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface
{ {
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
public function load(ObjectManager $manager) public function load(ObjectManager $manager)
{ {
@ -91,7 +91,7 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface
} }
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
public function getOrder() public function getOrder()
{ {

View file

@ -10,7 +10,7 @@ use Wallabag\CoreBundle\Entity\User;
class LoadUserData extends AbstractFixture implements OrderedFixtureInterface class LoadUserData extends AbstractFixture implements OrderedFixtureInterface
{ {
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
public function load(ObjectManager $manager) public function load(ObjectManager $manager)
{ {
@ -38,7 +38,7 @@ class LoadUserData extends AbstractFixture implements OrderedFixtureInterface
} }
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
public function getOrder() public function getOrder()
{ {

View file

@ -48,7 +48,7 @@ class Tag
public function __construct(User $user) public function __construct(User $user)
{ {
$this->user = $user; $this->user = $user;
$this->entries = new ArrayCollection(); $this->entries = new ArrayCollection();
} }

View file

@ -123,9 +123,9 @@ class User implements AdvancedUserInterface, \Serializable
public function __construct() public function __construct()
{ {
$this->isActive = true; $this->isActive = true;
$this->salt = md5(uniqid(null, true)); $this->salt = md5(uniqid(null, true));
$this->entries = new ArrayCollection(); $this->entries = new ArrayCollection();
$this->tags = new ArrayCollection(); $this->tags = new ArrayCollection();
} }
/** /**
@ -176,7 +176,7 @@ class User implements AdvancedUserInterface, \Serializable
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function getSalt() public function getSalt()
{ {
@ -184,7 +184,7 @@ class User implements AdvancedUserInterface, \Serializable
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function getRoles() public function getRoles()
{ {
@ -323,7 +323,7 @@ class User implements AdvancedUserInterface, \Serializable
return $this->tags; return $this->tags;
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function eraseCredentials() public function eraseCredentials()
{ {

View file

@ -5,7 +5,6 @@ namespace Wallabag\CoreBundle\Filter;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
use Lexik\Bundle\FormFilterBundle\Filter\FilterOperands;
use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface; use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface;
class EntryFilterType extends AbstractType class EntryFilterType extends AbstractType
@ -17,26 +16,29 @@ class EntryFilterType extends AbstractType
->add('createdAt', 'filter_date_range', array( ->add('createdAt', 'filter_date_range', array(
'left_date_options' => array( 'left_date_options' => array(
'attr' => array( 'attr' => array(
'placeholder' => 'dd/mm/yyyy'), 'placeholder' => 'dd/mm/yyyy',
),
'format' => 'dd/MM/yyyy', 'format' => 'dd/MM/yyyy',
'widget' => 'single_text' 'widget' => 'single_text',
), ),
'right_date_options' => array( 'right_date_options' => array(
'attr' => array( 'attr' => array(
'placeholder' => 'dd/mm/yyyy'), 'placeholder' => 'dd/mm/yyyy',
),
'format' => 'dd/MM/yyyy', 'format' => 'dd/MM/yyyy',
'widget' => 'single_text' 'widget' => 'single_text',
))) ),
))
->add('domainName', 'filter_text', array( ->add('domainName', 'filter_text', array(
'apply_filter' => function (QueryInterface $filterQuery, $field, $values) 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) {
{
$value = $values['value']; $value = $values['value'];
if (strlen($value) <= 3 || empty($value)) { if (strlen($value) <= 3 || empty($value)) {
return null; return;
} }
$expression = $filterQuery->getExpr()->like($field, $filterQuery->getExpr()->literal('%'.$value.'%')); $expression = $filterQuery->getExpr()->like($field, $filterQuery->getExpr()->literal('%'.$value.'%'));
return $filterQuery->createCondition($expression); return $filterQuery->createCondition($expression);
} },
)); ));
} }
@ -48,8 +50,8 @@ class EntryFilterType extends AbstractType
public function configureOptions(OptionsResolver $resolver) public function configureOptions(OptionsResolver $resolver)
{ {
$resolver->setDefaults(array( $resolver->setDefaults(array(
'csrf_protection' => false, 'csrf_protection' => false,
'validation_groups' => array('filtering') 'validation_groups' => array('filtering'),
)); ));
} }
} }

View file

@ -19,7 +19,7 @@ class ChangePasswordType extends AbstractType
'type' => 'password', 'type' => 'password',
'invalid_message' => 'The password fields must match.', 'invalid_message' => 'The password fields must match.',
'required' => true, 'required' => true,
'first_options' => array('label' => 'New password'), 'first_options' => array('label' => 'New password'),
'second_options' => array('label' => 'Repeat new password'), 'second_options' => array('label' => 'Repeat new password'),
'constraints' => array( 'constraints' => array(
new Constraints\Length(array( new Constraints\Length(array(

View file

@ -15,7 +15,7 @@ class ResetPasswordType extends AbstractType
'type' => 'password', 'type' => 'password',
'invalid_message' => 'The password fields must match.', 'invalid_message' => 'The password fields must match.',
'required' => true, 'required' => true,
'first_options' => array('label' => 'New password'), 'first_options' => array('label' => 'New password'),
'second_options' => array('label' => 'Repeat new password'), 'second_options' => array('label' => 'Repeat new password'),
'constraints' => array( 'constraints' => array(
new Constraints\Length(array( new Constraints\Length(array(

View file

@ -67,7 +67,7 @@ class UsernameRssTokenConverter implements ParamConverterInterface
public function apply(Request $request, ParamConverter $configuration) public function apply(Request $request, ParamConverter $configuration)
{ {
$username = $request->attributes->get('username'); $username = $request->attributes->get('username');
$rssToken = $request->attributes->get('token'); $rssToken = $request->attributes->get('token');
// Check, if route attributes exists // Check, if route attributes exists
if (null === $username || null === $rssToken) { if (null === $username || null === $rssToken) {

View file

@ -11,7 +11,7 @@ class TagRepository extends EntityRepository
/** /**
* Find Tags. * Find Tags.
* *
* @param int $userId * @param int $userId
* *
* @return array * @return array
*/ */

View file

@ -52,7 +52,7 @@ class WallabagPasswordEncoder extends BasePasswordEncoder
$digest = hash($this->algorithm, $salted, true); $digest = hash($this->algorithm, $salted, true);
// "stretch" hash // "stretch" hash
for ($i = 1; $i < $this->iterations; $i++) { for ($i = 1; $i < $this->iterations; ++$i) {
$digest = hash($this->algorithm, $digest.$salted, true); $digest = hash($this->algorithm, $digest.$salted, true);
} }

View file

@ -33,8 +33,8 @@ final class Extractor
$REAL = array(); $REAL = array();
foreach ($GLOBALS as $key => $value) { foreach ($GLOBALS as $key => $value) {
if ($key != 'GLOBALS' && $key != '_SESSION' && $key != 'HTTP_SESSION_VARS') { if ($key != 'GLOBALS' && $key != '_SESSION' && $key != 'HTTP_SESSION_VARS') {
$GLOBALS[$key] = array(); $GLOBALS[$key] = array();
$REAL[$key] = $value; $REAL[$key] = $value;
} }
} }
// Saving and clearing session // Saving and clearing session

View file

@ -252,7 +252,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$data = array( $data = array(
'entry_filter[readingTime][right_number]' => 11, 'entry_filter[readingTime][right_number]' => 11,
'entry_filter[readingTime][left_number]' => 11 'entry_filter[readingTime][left_number]' => 11,
); );
$crawler = $client->submit($form, $data); $crawler = $client->submit($form, $data);
@ -271,7 +271,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$data = array( $data = array(
'entry_filter[createdAt][left_date]' => date('d/m/Y'), '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); $crawler = $client->submit($form, $data);
@ -280,13 +280,12 @@ class EntryControllerTest extends WallabagCoreTestCase
$data = array( $data = array(
'entry_filter[createdAt][left_date]' => '01/01/1970', '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); $crawler = $client->submit($form, $data);
$this->assertCount(0, $crawler->filter('div[class=entry]')); $this->assertCount(0, $crawler->filter('div[class=entry]'));
} }
public function testPaginationWithFilter() public function testPaginationWithFilter()
@ -318,7 +317,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->request('GET', '/unread/list'); $crawler = $client->request('GET', '/unread/list');
$form = $crawler->filter('button[id=submit-filter]')->form(); $form = $crawler->filter('button[id=submit-filter]')->form();
$data = array( $data = array(
'entry_filter[domainName]' => 'monde' 'entry_filter[domainName]' => 'monde',
); );
$crawler = $client->submit($form, $data); $crawler = $client->submit($form, $data);
@ -326,7 +325,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$form = $crawler->filter('button[id=submit-filter]')->form(); $form = $crawler->filter('button[id=submit-filter]')->form();
$data = array( $data = array(
'entry_filter[domainName]' => 'wallabag' 'entry_filter[domainName]' => 'wallabag',
); );
$crawler = $client->submit($form, $data); $crawler = $client->submit($form, $data);

View file

@ -3,7 +3,6 @@
namespace Wallabag\CoreBundle\Tests\Controller; namespace Wallabag\CoreBundle\Tests\Controller;
use Wallabag\CoreBundle\Tests\WallabagCoreTestCase; use Wallabag\CoreBundle\Tests\WallabagCoreTestCase;
use Doctrine\ORM\AbstractQuery;
class TagControllerTest extends WallabagCoreTestCase class TagControllerTest extends WallabagCoreTestCase
{ {