/**
  * Retrieves a filtered tip of the day history list. Filters by the currently logged in user by default
  *
  * @param Request $request
  *
  * @return array|\Dunglas\ApiBundle\Model\PaginatorInterface|\Traversable
  *
  * @throws RuntimeException
  */
 public function __invoke(Request $request)
 {
     list($resourceType) = $this->extractAttributes($request);
     $collection = $this->dataProvider->getCollection($resourceType);
     $user = $this->userService->getUser();
     $resultCollection = array();
     foreach ($collection as $item) {
         /**
          * @var $item TipOfTheDayHistory
          */
         if ($item->getUser() == $user) {
             $resultCollection[] = $item;
         }
     }
     return $resultCollection;
 }
 /**
  * {@inheritdoc}
  */
 protected function renderOne(array $data)
 {
     $path = $data['methodePath'];
     $markdown = sprintf("### `%s` %s ###\n", $data['method'], $data['uri']);
     if (isset($data['deprecated']) && false !== $data['deprecated']) {
         $markdown .= "### This method is deprecated ###";
         $markdown .= "\n\n";
     }
     if (isset($data['description'])) {
         $markdown .= sprintf("\n_%s_", $data['description']);
     }
     $markdown .= "\n\n";
     if (isset($data['documentation']) && !empty($data['documentation'])) {
         if (isset($data['description']) && 0 === strcmp($data['description'], $data['documentation'])) {
             $markdown .= $data['documentation'];
             $markdown .= "\n\n";
         }
     }
     if (isset($data['requirements']) && !empty($data['requirements']) && !$this->fs->exists($path . '/requirements.html')) {
         $dataFilters = $this->engine->render('ElibertyApiBundle:nelmio:requirements.html.twig', ['data' => $data]);
         $this->fs->dumpFile($path . '/requirements.html', $dataFilters);
     }
     if (isset($data['filters']) && !$this->fs->exists($path . '/filters.html')) {
         $dataFilters = $this->engine->render('ElibertyApiBundle:nelmio:filters.html.twig', ['data' => $data]);
         $this->fs->dumpFile($path . '/filters.html', $dataFilters);
     }
     if (isset($data['parameters']) && !$this->fs->exists($path . '/parameters.html')) {
         $dataFilters = $this->engine->render('ElibertyApiBundle:nelmio:parameters.html.twig', ['data' => $data]);
         $this->fs->dumpFile($path . '/parameters.html', $dataFilters);
     }
     if (isset($data['statusCodes']) && !$this->fs->exists($path . '/statusCodes.html')) {
         $dataFilters = $this->engine->render('ElibertyApiBundle:nelmio:statusCodes.html.twig', ['data' => $data]);
         $this->fs->dumpFile($path . '/statusCodes.html', $dataFilters);
     }
     if (isset($data['response'])) {
         if (!$this->fs->exists($path . '/responses.html')) {
             $dataFilters = $this->engine->render('ElibertyApiBundle:nelmio:responses.html.twig', ['data' => $data, 'enums' => $this->enums, 'entityName' => strtolower($this->apiResource->getShortName())]);
             $this->fs->dumpFile($path . '/responses.html', $dataFilters);
         }
         $dataToSerialize = $this->dataProvider->getCollection($this->apiResource, new Request());
         if (!isset($data['tags']['collection']) && $dataToSerialize instanceof Paginator) {
             $dataToSerialize = $dataToSerialize->getIterator()->current();
         }
         if (!$this->fs->exists($path . '/json/responses.json')) {
             try {
                 if (isset($data['tags']['embed']) && in_array(strtolower($this->apiResource->getShortName()), ['option', 'orderitem'])) {
                     $this->setEmbed($data, $dataToSerialize);
                 }
                 $dataJson = $this->normalizer->normalize($dataToSerialize, 'json-ld', $this->apiResource->getNormalizationContext(), false);
                 $this->fs->dumpFile($path . '/json/responses.json', json_encode($dataJson, JSON_PRETTY_PRINT));
             } catch (\Exception $ex) {
                 return $markdown;
             }
         }
     }
     return $markdown;
 }
 /**
  * Retrieves a collection of resources.
  *
  * @param Request $request
  *
  * @return array|\Dunglas\ApiBundle\Model\PaginatorInterface|\Traversable
  *
  * @throws RuntimeException
  */
 public function __invoke(Request $request)
 {
     list($resourceType) = $this->extractAttributes($request);
     return $this->dataProvider->getCollection($resourceType);
 }