X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FApiBundle%2FController%2FEntryRestController.php;h=ca460c842462d1e6f3f95bf9e60fbe9c421e2409;hb=f808b01692a835673f328d7221ba8c212caa9b61;hp=9786c4d37ee37a6eecd6387fb2b2b59ae4ad3ba6;hpb=39ffaba3232b6378f47883615c58a9ffba668af3;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index 9786c4d3..ca460c84 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php @@ -6,14 +6,14 @@ use Hateoas\Configuration\Route; use Hateoas\Representation\Factory\PagerfantaFactory; use JMS\Serializer\SerializationContext; use Nelmio\ApiDocBundle\Annotation\ApiDoc; -use Symfony\Component\HttpKernel\Exception\HttpException; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Entity\Tag; -use Wallabag\CoreBundle\Event\EntrySavedEvent; use Wallabag\CoreBundle\Event\EntryDeletedEvent; +use Wallabag\CoreBundle\Event\EntrySavedEvent; class EntryRestController extends WallabagRestController { @@ -38,7 +38,7 @@ class EntryRestController extends WallabagRestController { $this->validateAuthentication(); - $returnId = (null === $request->query->get('return_id')) ? 0 : (bool) $request->query->get('return_id'); + $returnId = (null === $request->query->get('return_id')) ? false : (bool) $request->query->get('return_id'); $urls = $request->query->get('urls', []); // handle multiple urls first @@ -59,7 +59,7 @@ class EntryRestController extends WallabagRestController $url = $request->query->get('url', ''); if (empty($url)) { - throw $this->createAccessDeniedException('URL is empty?, logged user id: '.$this->getUser()->getId()); + throw $this->createAccessDeniedException('URL is empty?, logged user id: ' . $this->getUser()->getId()); } $res = $this->getDoctrine() @@ -239,9 +239,9 @@ class EntryRestController extends WallabagRestController * } * ) * - * @return JsonResponse - * * @throws HttpException When limit is reached + * + * @return JsonResponse */ public function postEntriesListAction(Request $request) { @@ -678,11 +678,11 @@ class EntryRestController extends WallabagRestController ]); } - if (!is_null($isArchived)) { + if (null !== $isArchived) { $entry->setArchived((bool) $isArchived); } - if (!is_null($isStarred)) { + if (null !== $isStarred) { $entry->setStarred((bool) $isStarred); } @@ -690,7 +690,7 @@ class EntryRestController extends WallabagRestController $this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $tags); } - if (!is_null($isPublic)) { + if (null !== $isPublic) { if (true === (bool) $isPublic && null === $entry->getUid()) { $entry->generateUid(); } elseif (false === (bool) $isPublic) { @@ -720,6 +720,6 @@ class EntryRestController extends WallabagRestController return $entry instanceof Entry ? $entry->getId() : null; } - return $entry instanceof Entry ? true : false; + return $entry instanceof Entry; } }