/**
  * Get Transformer
  *
  * @param sting $element_type Element Type
  *
  * @return League\Fractal\TransformerAbstract Transformer
  */
 public function getTransformer(Request $request)
 {
     $transformer = $request->getRoute()->getConfig('transformer', 'rest');
     if (!isset($transformer)) {
         $exception = new HttpMessagesException();
         $exception->setStatus(415)->setMessage(sprintf('A transformer for the `%s` element type is not defined.', $element_type));
         throw $exception;
     }
     return new $transformer();
 }
 /**
  * Get Action
  *
  * @param string  $method       Method
  * @param string  $element_type Element Type
  * @param boolean $element_id   Element Id
  *
  * @return string Action
  */
 private function getAction($method, $element_type, $element_id = null)
 {
     if ($method === 'GET' && !$element_id) {
         return 'actionIndex';
     }
     if ($method === 'GET' && $element_id) {
         return 'actionShow';
     }
     if ($method === 'POST' && !$element_id) {
         return 'actionStore';
     }
     if (in_array($method, ['PUT', 'PATCH']) && $element_id) {
         return 'actionUpdate';
     }
     if ($method === 'DELETE' && $element_id) {
         return 'actionDelete';
     }
     $exception = new HttpMessagesException();
     $exception->setStatus(405)->setMessage(sprintf('`%s` method not allowed for resource `%s`.', $method, $element_type));
     throw $exception;
 }