Commit 9c507d5b authored by Stephan Zeidler's avatar Stephan Zeidler
Browse files

Issue #3295808 by szeidler: Fix bugs introduced in coding standard fixes

parent dc9f214e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ services:
  media_fotoweb.client:
    class: Drupal\media_fotoweb\FotowebClient
    factory: Drupal\media_fotoweb\FotowebClientFactory::create
    arguments: ['@config.factory']
    arguments: ['@config.factory', '@media_fotoweb.user_token_persistence', '@media_fotoweb.api_token_persistence', '@state']
  media_fotoweb.rendition_negotiator:
    class: Drupal\media_fotoweb\RenditionNegotiator
    arguments: ['@config.factory']
+3 −17
Original line number Diff line number Diff line
@@ -66,34 +66,20 @@ class FotowebClient {
   *
   * @param array $configuration
   *   The guzzle service configuration.
   * @param Drupal\media_fotoweb\OAuth2\Persistence\UserTokenPersistence $user_token_persistence
   * @param \Drupal\media_fotoweb\OAuth2\Persistence\UserTokenPersistence $user_token_persistence
   *   The user token persistence service.
   * @param Drupal\media_fotoweb\OAuth2\Persistence\ApiTokenPersistence $api_token_persistence
   * @param \Drupal\media_fotoweb\OAuth2\Persistence\ApiTokenPersistence $api_token_persistence
   *   The api token persistence service.
   * @param Drupal\Core\State\State $state
   * @param \Drupal\Core\State\State $state
   *   The state service.
   */
  public function __construct(array $configuration, UserTokenPersistence $user_token_persistence, ApiTokenPersistence $api_token_persistence, State $state) {
    $this->createClientFromConfiguration($configuration);
    $this->configuration = $configuration;
    $this->userTokenPersistence = $user_token_persistence;
    $this->apiTokenPersistence = $api_token_persistence;
    $this->state = $state;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('media_fotoweb.configuration'),
      $container->get('media_fotoweb.user_token_persistence'),
      $container->get('media_fotoweb.state'),
      $container->get('media_fotoweb.api_token_persistence'),
      $container->get('state')
    );
  }

  /**
   * Creates a FotowebClient from configuration.
   *
+11 −2
Original line number Diff line number Diff line
@@ -3,6 +3,9 @@
namespace Drupal\media_fotoweb;

use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\State\State;
use Drupal\media_fotoweb\OAuth2\Persistence\ApiTokenPersistence;
use Drupal\media_fotoweb\OAuth2\Persistence\UserTokenPersistence;

/**
 * Factory that builds the FotowebClient.
@@ -14,11 +17,17 @@ class FotowebClientFactory {
   *
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The config factory.
   * @param \Drupal\media_fotoweb\OAuth2\Persistence\UserTokenPersistence $user_token_persistence
   *   The user token persistence service.
   * @param \Drupal\media_fotoweb\OAuth2\Persistence\ApiTokenPersistence $api_token_persistence
   *   The api token persistence service.
   * @param \Drupal\Core\State\State $state
   *   The state service.
   *
   * @return \Drupal\media_fotoweb\FotowebClient
   *   The Fotoweb Client.
   */
  public static function create(ConfigFactoryInterface $config_factory) {
  public static function create(ConfigFactoryInterface $config_factory, UserTokenPersistence $user_token_persistence, ApiTokenPersistence $api_token_persistence, State $state) {
    $config = $config_factory->get('media_fotoweb.settings');

    $client_configuration = [
@@ -32,7 +41,7 @@ class FotowebClientFactory {
      'client_config' => ['allow_redirects' => FALSE],
    ];

    $client = new FotowebClient($client_configuration);
    $client = new FotowebClient($client_configuration, $user_token_persistence, $api_token_persistence, $state);

    $rendition_service = $config->get('rendition_service');
    if (!empty($rendition_service)) {
+1 −1
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ class Fotoweb extends MediaSourceBase {
      $container->get('plugin.manager.field.field_type'),
      $container->get('config.factory'),
      $container->get('file_system'),
      $container->get('file_repository'),
      $container->get('file.repository'),
      $container->get('token'),
      $container->get('plugin.manager.media_fotoweb.image_fetcher')
    );