@@ -102,8 +102,8 @@ |
||
| 102 | 102 | */ |
| 103 | 103 | public function tokenAction(Request $request) |
| 104 | 104 | { |
| 105 | - if ( ! $request->request->get('grant_type')){ |
|
| 106 | - $request->request->set('grant_type','client_credentials'); |
|
| 105 | + if (!$request->request->get('grant_type')) { |
|
| 106 | + $request->request->set('grant_type', 'client_credentials'); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | return parent::tokenAction($request); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | private $clientManager; |
| 18 | 18 | |
| 19 | - protected function configure () |
|
| 19 | + protected function configure() |
|
| 20 | 20 | { |
| 21 | 21 | |
| 22 | 22 | $this |
@@ -26,10 +26,10 @@ discard block |
||
| 26 | 26 | ->addOption('grant-type', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_OPTIONAL, 'Set allowed grant type. Use multiple times to set multiple grant types', 'client_credentials') |
| 27 | 27 | ; |
| 28 | 28 | } |
| 29 | - protected function execute (InputInterface $input, OutputInterface $output) |
|
| 29 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
| 30 | 30 | { |
| 31 | 31 | |
| 32 | - $this->clientManager = $this->getContainer()->get('fos_oauth_server.client_manager.default');; |
|
| 32 | + $this->clientManager = $this->getContainer()->get('fos_oauth_server.client_manager.default'); ; |
|
| 33 | 33 | $client = $this->clientManager->createClient(); |
| 34 | 34 | $client->setRedirectUris($input->getOption('redirect-uri')); |
| 35 | 35 | $client->setAllowedGrantTypes([$input->getOption('grant-type')]); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | return $router->generate($route, $newParams, 0); |
| 69 | 69 | }); |
| 70 | 70 | |
| 71 | - $resource = new Collection($filteredResults,$this->userTransformer, 'user'); |
|
| 71 | + $resource = new Collection($filteredResults, $this->userTransformer, 'user'); |
|
| 72 | 72 | $resource->setPaginator($paginatorAdapter); |
| 73 | 73 | return $resource; |
| 74 | 74 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | if (!$user) |
| 81 | 81 | throw new EntityNotFoundException('user not found'); |
| 82 | 82 | |
| 83 | - return new Item($user,$this->userTransformer,'user'); |
|
| 83 | + return new Item($user, $this->userTransformer, 'user'); |
|
| 84 | 84 | |
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | \ No newline at end of file |
@@ -122,7 +122,7 @@ |
||
| 122 | 122 | */ |
| 123 | 123 | public function addTag(Tag $tag) |
| 124 | 124 | { |
| 125 | - if (!$this->tags->contains($tag)){ |
|
| 125 | + if (!$this->tags->contains($tag)) { |
|
| 126 | 126 | $this->tags->add($tag); |
| 127 | 127 | } |
| 128 | 128 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | return $router->generate($route, $newParams, 0); |
| 77 | 77 | }); |
| 78 | 78 | |
| 79 | - $resource = new Collection($filteredResults,$this->articleTransformer, 'article'); |
|
| 79 | + $resource = new Collection($filteredResults, $this->articleTransformer, 'article'); |
|
| 80 | 80 | $resource->setPaginator($paginatorAdapter); |
| 81 | 81 | return $resource; |
| 82 | 82 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | var_dump($request); |
| 105 | 105 | |
| 106 | 106 | /** @var User $user */ |
| 107 | - $user = $this->entityManager->getReference(User::class,$request->request->get('user')); |
|
| 107 | + $user = $this->entityManager->getReference(User::class, $request->request->get('user')); |
|
| 108 | 108 | |
| 109 | 109 | $article = new Article(); |
| 110 | 110 | $article->setTitle($request->request->get('title')); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $article->setContributors(new ArrayCollection([$user])); |
| 114 | 114 | |
| 115 | 115 | //set tags |
| 116 | - if(is_array($request->request->get('tags'))){ |
|
| 116 | + if (is_array($request->request->get('tags'))) { |
|
| 117 | 117 | foreach ($request->request->get('tags') as $tag) { |
| 118 | 118 | $article->addTagFromName($tag); |
| 119 | 119 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | { |
| 129 | 129 | $resource = $this->entityManager->getRepository(Article::class)->searchArticle($request); |
| 130 | 130 | |
| 131 | - $collection = new Collection($resource,$this->articleTransformer,'article'); |
|
| 131 | + $collection = new Collection($resource, $this->articleTransformer, 'article'); |
|
| 132 | 132 | |
| 133 | 133 | return $this->fractalService->transform($collection); |
| 134 | 134 | } |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | try { |
| 90 | 90 | $article = $this->articleService->getArticleById($id); |
| 91 | 91 | return new JsonResponse($this->fractalService->transform($article)); |
| 92 | - }catch (\Exception $e){ |
|
| 93 | - return new JsonResponse($this->fractalService->transform($e->getMessage(),false), Response::HTTP_INTERNAL_SERVER_ERROR); |
|
| 92 | + }catch (\Exception $e) { |
|
| 93 | + return new JsonResponse($this->fractalService->transform($e->getMessage(), false), Response::HTTP_INTERNAL_SERVER_ERROR); |
|
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | |
@@ -143,9 +143,9 @@ discard block |
||
| 143 | 143 | { |
| 144 | 144 | try { |
| 145 | 145 | $this->articleService->addArticle($request); |
| 146 | - return new JsonResponse($this->fractalService->transform('Article has been added'),Response::HTTP_OK); |
|
| 146 | + return new JsonResponse($this->fractalService->transform('Article has been added'), Response::HTTP_OK); |
|
| 147 | 147 | }catch (\Exception $exception) { |
| 148 | - return new JsonResponse($this->fractalService->transform($exception->getMessage(), false),Response::HTTP_INTERNAL_SERVER_ERROR); |
|
| 148 | + return new JsonResponse($this->fractalService->transform($exception->getMessage(), false), Response::HTTP_INTERNAL_SERVER_ERROR); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | } |
@@ -96,7 +96,7 @@ |
||
| 96 | 96 | return new JsonResponse($this->fractalService->transform($user)); |
| 97 | 97 | |
| 98 | 98 | }catch (EntityNotFoundException $exception) { |
| 99 | - return new JsonResponse($this->fractalService->transform($exception->getMessage(),false),Response::HTTP_NO_CONTENT); |
|
| 99 | + return new JsonResponse($this->fractalService->transform($exception->getMessage(), false), Response::HTTP_NO_CONTENT); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | \ No newline at end of file |
@@ -28,19 +28,19 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | public function transform($resource, $success = true) |
| 30 | 30 | { |
| 31 | - if ($resource instanceof ResourceInterface){ |
|
| 31 | + if ($resource instanceof ResourceInterface) { |
|
| 32 | 32 | |
| 33 | 33 | $this->setSerializer(new JsonApiSerializer($this->baseUrl)); |
| 34 | 34 | |
| 35 | 35 | //if there is an include, set transformer include |
| 36 | - if ( isset($_GET['include']) && !empty($_GET['include'])) { |
|
| 36 | + if (isset($_GET['include']) && !empty($_GET['include'])) { |
|
| 37 | 37 | $this->parseIncludes($_GET['include']); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | $resource = $this->createData($resource); |
| 41 | 41 | |
| 42 | 42 | $response = array_merge(['success' => $success], $resource->toArray()); |
| 43 | - }else{ |
|
| 43 | + }else { |
|
| 44 | 44 | $response = [ |
| 45 | 45 | 'success' => $success, |
| 46 | 46 | 'message' => $resource |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | public function load(ObjectManager $manager) |
| 14 | 14 | { |
| 15 | 15 | $faker = \Faker\Factory::create(); |
| 16 | - for ($i=0; $i <= 50; $i++){ |
|
| 16 | + for ($i = 0; $i <= 50; $i++) { |
|
| 17 | 17 | $article = new Article(); |
| 18 | 18 | |
| 19 | 19 | $article->setContributors( |