Skip to content

Commit

Permalink
Injecting interfaces instead of actual classes (#750)
Browse files Browse the repository at this point in the history
  • Loading branch information
dannylamb authored Jan 29, 2020
1 parent a0c0b06 commit 0d9019b
Show file tree
Hide file tree
Showing 17 changed files with 83 additions and 83 deletions.
6 changes: 3 additions & 3 deletions src/ContextReaction/DisplayAlterReaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Drupal\islandora\ContextReaction;

use Drupal\Core\Entity\EntityTypeManager;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\context\ContextReactionPluginBase;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
Expand All @@ -18,14 +18,14 @@ abstract class DisplayAlterReaction extends ContextReactionPluginBase implements
/**
* View mode storage.
*
* @var \Drupal\Core\Entity\EntityTypeManager
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;

/**
* {@inheritdoc}
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManager $entity_type_manager) {
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->entityTypeManager = $entity_type_manager;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Controller/ManageMembersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Render\RendererInterface;
use Drupal\Core\Entity\Controller\EntityController;
use Drupal\Core\Entity\EntityFieldManager;
use Drupal\Core\Entity\EntityFieldManagerInterface;
use Drupal\Core\Link;
use Drupal\node\NodeInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
Expand All @@ -25,7 +25,7 @@ class ManageMembersController extends EntityController {
/**
* The entity field manager.
*
* @var \Drupal\Core\Entity\EntityFieldManager
* @var \Drupal\Core\Entity\EntityFieldManagerInterface
*/
protected $entityFieldManger;

Expand All @@ -41,14 +41,14 @@ class ManageMembersController extends EntityController {
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Drupal\Core\Entity\EntityFieldManager $entity_field_manager
* @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager
* The entity field manager.
* @param \Drupal\Core\Render\RendererInterface $renderer
* The renderer.
*/
public function __construct(
EntityTypeManagerInterface $entity_type_manager,
EntityFieldManager $entity_field_manager,
EntityFieldManagerInterface $entity_field_manager,
RendererInterface $renderer
) {
$this->entityTypeManager = $entity_type_manager;
Expand Down
8 changes: 4 additions & 4 deletions src/EventGenerator/EmitEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Action\ConfigurableActionBase;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeManager;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Session\AccountInterface;
Expand All @@ -30,7 +30,7 @@ abstract class EmitEvent extends ConfigurableActionBase implements ContainerFact
/**
* Entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManager
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;

Expand Down Expand Up @@ -66,7 +66,7 @@ abstract class EmitEvent extends ConfigurableActionBase implements ContainerFact
* The plugin implementation definition.
* @param \Drupal\Core\Session\AccountInterface $account
* Current user.
* @param \Drupal\Core\Entity\EntityTypeManager $entity_type_manager
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* Entity type manager.
* @param \Drupal\islandora\EventGenerator\EventGeneratorInterface $event_generator
* EventGenerator service to serialize AS2 events.
Expand All @@ -80,7 +80,7 @@ public function __construct(
$plugin_id,
$plugin_definition,
AccountInterface $account,
EntityTypeManager $entity_type_manager,
EntityTypeManagerInterface $entity_type_manager,
EventGeneratorInterface $event_generator,
StatefulStomp $stomp,
JwtAuth $auth
Expand Down
16 changes: 8 additions & 8 deletions src/EventSubscriber/LinkHeaderSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace Drupal\islandora\EventSubscriber;

use Drupal\Core\Access\AccessManagerInterface;
use Drupal\Core\Entity\EntityFieldManager;
use Drupal\Core\Entity\EntityFieldManagerInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeManager;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\islandora\IslandoraUtils;
Expand All @@ -25,14 +25,14 @@ abstract class LinkHeaderSubscriber implements EventSubscriberInterface {
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManager
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;

/**
* The entity field manager.
*
* @var \Drupal\Core\Entity\EntityFieldManager
* @var \Drupal\Core\Entity\EntityFieldManagerInterface
*/
protected $entityFieldManager;

Expand Down Expand Up @@ -74,9 +74,9 @@ abstract class LinkHeaderSubscriber implements EventSubscriberInterface {
/**
* Constructor.
*
* @param \Drupal\Core\Entity\EntityTypeManager $entity_type_manager
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Drupal\Core\Entity\EntityFieldManager $entity_field_manager
* @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager
* The entity field manager.
* @param \Drupal\Core\Access\AccessManagerInterface $access_manager
* The access manager.
Expand All @@ -90,8 +90,8 @@ abstract class LinkHeaderSubscriber implements EventSubscriberInterface {
* Islandora utils.
*/
public function __construct(
EntityTypeManager $entity_type_manager,
EntityFieldManager $entity_field_manager,
EntityTypeManagerInterface $entity_type_manager,
EntityFieldManagerInterface $entity_field_manager,
AccessManagerInterface $access_manager,
AccountInterface $account,
RouteMatchInterface $route_match,
Expand Down
8 changes: 4 additions & 4 deletions src/Form/IslandoraSettingsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Drupal\islandora\Form;

use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\EntityTypeBundleInfo;
use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Site\Settings;
Expand All @@ -30,7 +30,7 @@ class IslandoraSettingsForm extends ConfigFormBase {
/**
* To list the available bundle types.
*
* @var \Drupal\Core\Entity\EntityTypeBundleInfo
* @var \Drupal\Core\Entity\EntityTypeBundleInfoInterface
*/
private $entityTypeBundleInfo;

Expand All @@ -39,10 +39,10 @@ class IslandoraSettingsForm extends ConfigFormBase {
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The factory for configuration objects.
* @param \Drupal\Core\Entity\EntityTypeBundleInfo $entity_type_bundle_info
* @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info
* The EntityTypeBundleInfo service.
*/
public function __construct(ConfigFactoryInterface $config_factory, EntityTypeBundleInfo $entity_type_bundle_info) {
public function __construct(ConfigFactoryInterface $config_factory, EntityTypeBundleInfoInterface $entity_type_bundle_info) {
$this->setConfigFactory($config_factory);
$this->entityTypeBundleInfo = $entity_type_bundle_info;
}
Expand Down
16 changes: 8 additions & 8 deletions src/IslandoraUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use Drupal\context\ContextManager;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityFieldManager;
use Drupal\Core\Entity\EntityTypeManager;
use Drupal\Core\Entity\EntityFieldManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\Query\QueryException;
use Drupal\Core\Entity\Query\QueryFactory;
use Drupal\Core\Entity\Query\QueryInterface;
Expand Down Expand Up @@ -35,14 +35,14 @@ class IslandoraUtils {
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManager
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;

/**
* The entity field manager.
*
* @var \Drupal\Core\Entity\EntityFieldManager
* @var \Drupal\Core\Entity\EntityFieldManagerInterface
*/
protected $entityFieldManager;

Expand Down Expand Up @@ -77,9 +77,9 @@ class IslandoraUtils {
/**
* Constructor.
*
* @param \Drupal\Core\Entity\EntityTypeManager $entity_type_manager
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Drupal\Core\Entity\EntityFieldManager $entity_field_manager
* @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager
* The entity field manager.
* @param \Drupal\Core\Entity\Query\QueryFactory $entity_query
* Entity query.
Expand All @@ -91,8 +91,8 @@ class IslandoraUtils {
* Language manager.
*/
public function __construct(
EntityTypeManager $entity_type_manager,
EntityFieldManager $entity_field_manager,
EntityTypeManagerInterface $entity_type_manager,
EntityFieldManagerInterface $entity_field_manager,
QueryFactory $entity_query,
ContextManager $context_manager,
FlysystemFactory $flysystem_factory,
Expand Down
16 changes: 8 additions & 8 deletions src/MediaSource/MediaSourceService.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Drupal\islandora\MediaSource;

use Drupal\Core\Entity\EntityTypeManager;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\Query\QueryFactory;
use Drupal\Core\File\FileSystem;
use Drupal\Core\File\FileSystemInterface;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\file\FileInterface;
Expand All @@ -25,7 +25,7 @@ class MediaSourceService {
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManager
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;

Expand Down Expand Up @@ -53,7 +53,7 @@ class MediaSourceService {
/**
* File system service.
*
* @var \Drupal\Core\File\FileSystem
* @var \Drupal\Core\File\FileSystemInterface
*/
protected $fileSystem;

Expand All @@ -67,25 +67,25 @@ class MediaSourceService {
/**
* Constructor.
*
* @param \Drupal\Core\Entity\EntityTypeManager $entity_type_manager
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Drupal\Core\Session\AccountInterface $account
* The current user.
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* Language manager.
* @param \Drupal\Core\Entity\Query\QueryFactory $entity_query
* Entity query.
* @param \Drupal\Core\File\FileSystem $file_system
* @param \Drupal\Core\File\FileSystemInterface $file_system
* File system service.
* @param \Drupal\islandora\IslandoraUtils $islandora_utils
* Utility service.
*/
public function __construct(
EntityTypeManager $entity_type_manager,
EntityTypeManagerInterface $entity_type_manager,
AccountInterface $account,
LanguageManagerInterface $language_manager,
QueryFactory $entity_query,
FileSystem $file_system,
FileSystemInterface $file_system,
IslandoraUtils $islandora_utils
) {
$this->entityTypeManager = $entity_type_manager;
Expand Down
14 changes: 7 additions & 7 deletions src/Plugin/Action/AbstractGenerateDerivative.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Drupal\islandora\Plugin\Action;

use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeManager;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Url;
Expand All @@ -12,7 +12,7 @@
use Drupal\islandora\EventGenerator\EventGeneratorInterface;
use Drupal\islandora\MediaSource\MediaSourceService;
use Drupal\jwt\Authentication\Provider\JwtAuth;
use Drupal\token\Token;
use Drupal\token\TokenInterface;
use Stomp\StatefulStomp;
use Symfony\Component\DependencyInjection\ContainerInterface;

Expand All @@ -38,7 +38,7 @@ class AbstractGenerateDerivative extends EmitEvent {
/**
* Token replacement service.
*
* @var \Drupal\token\Token
* @var \Drupal\token\TokenInterface
*/
protected $token;

Expand All @@ -53,7 +53,7 @@ class AbstractGenerateDerivative extends EmitEvent {
* The plugin implementation definition.
* @param \Drupal\Core\Session\AccountInterface $account
* Current user.
* @param \Drupal\Core\Entity\EntityTypeManager $entity_type_manager
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* Entity type manager.
* @param \Drupal\islandora\EventGenerator\EventGeneratorInterface $event_generator
* EventGenerator service to serialize AS2 events.
Expand All @@ -65,21 +65,21 @@ class AbstractGenerateDerivative extends EmitEvent {
* Islandora utility functions.
* @param \Drupal\islandora\MediaSource\MediaSourceService $media_source
* Media source service.
* @param \Drupal\token\Token $token
* @param \Drupal\token\TokenInterface $token
* Token service.
*/
public function __construct(
array $configuration,
$plugin_id,
$plugin_definition,
AccountInterface $account,
EntityTypeManager $entity_type_manager,
EntityTypeManagerInterface $entity_type_manager,
EventGeneratorInterface $event_generator,
StatefulStomp $stomp,
JwtAuth $auth,
IslandoraUtils $utils,
MediaSourceService $media_source,
Token $token
TokenInterface $token
) {
parent::__construct(
$configuration,
Expand Down
Loading

0 comments on commit 0d9019b

Please sign in to comment.