Skip to content

Commit

Permalink
coder_fixes (#797)
Browse files Browse the repository at this point in the history
Co-authored-by: ajstanley <alanjarlathstanle@gmail.com>
  • Loading branch information
ajstanley and ajstanley authored Sep 22, 2020
1 parent ad05b37 commit a3d7a55
Show file tree
Hide file tree
Showing 18 changed files with 276 additions and 160 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use GuzzleHttp\Exception\ClientException;

/**
* Class IslandoraIIIFConfigForm.
* Form to configure IslandoraIIIF.
*/
class IslandoraIIIFConfigForm extends ConfigFormBase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Drupal\Core\File\FileSystem;

/**
* Class MediaSourceController.
* Controller for Media Source.
*/
class MediaSourceController extends ControllerBase {

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/IslandoraCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function optionsetRollbackUser($options = ['userid' => self::REQ]) {
* @hook validate migrate:import
*/
public function validateUserImport(CommandData $commandData) {
$this->validateUser($commandData);;
$this->validateUser($commandData);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/MediaSourceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
use Symfony\Component\HttpKernel\Exception\HttpException;

/**
* Class MediaSourceController.
* Controller for MediaSource.
*
* @package Drupal\islandora\Controller
*/
Expand Down
2 changes: 1 addition & 1 deletion src/EventSubscriber/JwtEventSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

/**
* Class JwtEventSubscriber.
* Subscribes to Jwt Events.
*
* @package Drupal\islandora\EventSubscriber
*/
Expand Down
2 changes: 1 addition & 1 deletion src/EventSubscriber/LinkHeaderSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use Symfony\Component\HttpKernel\KernelEvents;

/**
* Class LinkHeaderSubscriber.
* Abstract class to subscribe to LinkHeader Event.
*
* @package Drupal\islandora\EventSubscriber
*/
Expand Down
2 changes: 1 addition & 1 deletion src/EventSubscriber/MediaLinkHeaderSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;

/**
* Class MediaLinkHeaderSubscriber.
* Subscribes to MediaLinkHeader Event.
*
* @package Drupal\islandora\EventSubscriber
*/
Expand Down
2 changes: 1 addition & 1 deletion src/EventSubscriber/NodeLinkHeaderSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

/**
* Class NodeLinkHeaderSubscriber.
* Subcribes to NodeLinkHeader.
*
* @package Drupal\islandora\EventSubscriber
*/
Expand Down
3 changes: 1 addition & 2 deletions src/Flysystem/Adapter/FedoraAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use GuzzleHttp\Psr7\Response;
use GuzzleHttp\Psr7\StreamWrapper;
use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface;
use DateTime;

/**
* Fedora adapter for Flysystem.
Expand Down Expand Up @@ -255,7 +254,7 @@ public function write($path, $contents, Config $config) {
];
if ($this->has($path)) {
$fedora_url = $path;
$date = new DateTime();
$date = new \DateTime();
$timestamp = $date->format("D, d M Y H:i:s O");
// Create version in Fedora.
try {
Expand Down
26 changes: 18 additions & 8 deletions src/IslandoraUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use Drupal\context\ContextManager;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityFieldManagerInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\Query\QueryException;
use Drupal\Core\Entity\Query\QueryFactory;
Expand All @@ -15,9 +15,9 @@
use Drupal\Core\Url;
use Drupal\file\FileInterface;
use Drupal\flysystem\FlysystemFactory;
use Drupal\islandora\ContextProvider\NodeContextProvider;
use Drupal\islandora\ContextProvider\MediaContextProvider;
use Drupal\islandora\ContextProvider\FileContextProvider;
use Drupal\islandora\ContextProvider\MediaContextProvider;
use Drupal\islandora\ContextProvider\NodeContextProvider;
use Drupal\islandora\ContextProvider\TermContextProvider;
use Drupal\media\MediaInterface;
use Drupal\node\NodeInterface;
Expand All @@ -29,7 +29,9 @@
class IslandoraUtils {

const EXTERNAL_URI_FIELD = 'field_external_uri';

const MEDIA_OF_FIELD = 'field_media_of';

const MEDIA_USAGE_FIELD = 'field_media_use';

/**
Expand Down Expand Up @@ -151,10 +153,13 @@ public function getParentNode(MediaInterface $media) {
* Calling getStorage() throws if the storage handler couldn't be loaded.
*/
public function getMedia(NodeInterface $node) {
if (!$this->entityTypeManager->getStorage('field_storage_config')->load('media.' . self::MEDIA_OF_FIELD)) {
if (!$this->entityTypeManager->getStorage('field_storage_config')
->load('media.' . self::MEDIA_OF_FIELD)) {
return [];
}
$mids = $this->entityQuery->get('media')->condition(self::MEDIA_OF_FIELD, $node->id())->execute();
$mids = $this->entityQuery->get('media')
->condition(self::MEDIA_OF_FIELD, $node->id())
->execute();
if (empty($mids)) {
return [];
}
Expand Down Expand Up @@ -217,7 +222,8 @@ function ($field) {
$query->condition($condition, $fid);
}

return $this->entityTypeManager->getStorage('media')->loadMultiple($query->execute());
return $this->entityTypeManager->getStorage('media')
->loadMultiple($query->execute());
}

/**
Expand Down Expand Up @@ -261,7 +267,8 @@ public function getTermForUri($uri) {
return NULL;
}

return $this->entityTypeManager->getStorage('taxonomy_term')->load(reset($results));
return $this->entityTypeManager->getStorage('taxonomy_term')
->load(reset($results));
}

/**
Expand Down Expand Up @@ -587,7 +594,10 @@ public function getEntityUrl(EntityInterface $entity) {
*/
public function getDownloadUrl(FileInterface $file) {
$undefined = $this->languageManager->getLanguage('und');
return $file->url('canonical', ['absolute' => TRUE, 'language' => $undefined]);
return $file->url('canonical', [
'absolute' => TRUE,
'language' => $undefined,
]);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/Condition/EntityBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
'#default_value' => $this->configuration['bundles'],
];

return parent::buildConfigurationForm($form, $form_state);;
return parent::buildConfigurationForm($form, $form_state);
}

/**
Expand Down
Loading

0 comments on commit a3d7a55

Please sign in to comment.