getUser($request); ['class' => $class] = self::getAvatarClass($range_id, $range_type, $user); $resource = $class::getAvatar($range_id); if (!$resource) { throw new RecordNotFoundException(); } if (!Authority::canShowAvatarOfRange($this->getUser($request), $resource)) { throw new AuthorizationFailedException(); } return $this->getContentResponse($resource); } }