Commit da16f63e authored by Beatriz Varela's avatar Beatriz Varela Committed by m4olivei
Browse files

Issue #3066644 by anabpv, m4olivei: Fix PHPCS

parent a288a26f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ final class Forwarder extends ControllerBase {
  /**
   * The name of the query string parameter containing the URI.
   *
   * @param string
   * @var string
   */
  private $uriParamName;

@@ -53,7 +53,7 @@ final class Forwarder extends ControllerBase {
   *   The response object.
   */
  public function forward(HttpApiInterface $api_proxy, Request $request): Response {
    // TODO: This belongs to the routing system.
    // @todo This belongs to the routing system.
    $account = $this->currentUser();
    $cache_contexts = [
      'url.query_args:' . $this->uriParamName,
+3 −4
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@

namespace Drupal\api_proxy\EventSubscriber;

use Drupal\api_proxy\Controller\Forwarder;
use Drupal\api_proxy\Plugin\HttpApiPluginBase;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Cache\CacheableResponse;
@@ -36,7 +35,7 @@ class OptionsRequestSubscriber implements EventSubscriberInterface {
  /**
   * The name of the query string parameter containing the URI.
   *
   * @param string
   * @var string
   */
  private $uriParamName;

@@ -45,7 +44,7 @@ class OptionsRequestSubscriber implements EventSubscriberInterface {
   *
   * @param \Symfony\Cmf\Component\Routing\RouteProviderInterface $route_provider
   *   The route provider.
   * @param \Symfony\Component\EventDispatcher\EventSubscriberInterface
   * @param \Symfony\Component\EventDispatcher\EventSubscriberInterface $subject
   *   The decorated service.
   * @param string $uri_param_name
   *   The name of the query string parameter containing the URI.
@@ -117,7 +116,7 @@ class OptionsRequestSubscriber implements EventSubscriberInterface {
   * @return \Drupal\Core\Config\ImmutableConfig
   *   The immutable configuration object.
   *
   * @todo: use dependency injection to pass the configFactory.
   * @todo use dependency injection to pass the configFactory.
   */
  private function config(string $config_id): ImmutableConfig {
    return \Drupal::config($config_id);
+1 −1
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ final class SettingsForm extends ConfigFormBase {
    $message = $this->t('Settings saved for plugin(s): %names', [
      '%names' => implode(', ', array_map(function (HttpApiPluginBase $api_proxy) {
        return $api_proxy->getPluginDefinition()['label'];
      }, $api_proxies))
      }, $api_proxies)),
    ]);
    $this->messenger()->addStatus($message);
  }
+0 −1
Original line number Diff line number Diff line
@@ -3,7 +3,6 @@
namespace Drupal\api_proxy\ParamConverter;

use Drupal\api_proxy\Plugin\HttpApiInterface;
use Drupal\api_proxy\Plugin\HttpApiPluginBase;
use Drupal\api_proxy\Plugin\HttpApiPluginManager;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Http\Exception\CacheableNotFoundHttpException;
+38 −0
Original line number Diff line number Diff line
@@ -10,16 +10,54 @@ use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

/**
 * {@inheritdoc}
 */
interface HttpApiInterface extends PluginInspectionInterface {

  /**
   * {@inheritdoc}
   */
  public function getBaseUrl(): string;

  /**
   * {@inheritdoc}
   */
  public function shouldForwardHeaders(): bool;

  /**
   * {@inheritdoc}
   */
  public function getAdditionalHeaders(): array;

  /**
   * {@inheritdoc}
   */
  public function isCacheForced(): int;

  /**
   * {@inheritdoc}
   */
  public function getForcedCacheTtl(): int;

  /**
   * {@inheritdoc}
   */
  public function preprocessIncoming(string $method, string $uri, HeaderBag $headers, ParameterBag $query): array;

  /**
   * {@inheritdoc}
   */
  public function postprocessOutgoing(Response $response): Response;

  /**
   * {@inheritdoc}
   */
  public function forward(Request $request, string $uri): Response;

  /**
   * {@inheritdoc}
   */
  public function corsResponse(Request $request): CacheableResponse;

  /**
Loading