Skip to content

Commit

Permalink
No gemini (#45)
Browse files Browse the repository at this point in the history
* Update IslandoraServiceProvider.php

* Just using EntityMapper instead of Gemini

* Updates from testing

* Coding standards and tests
  • Loading branch information
dannylamb authored and whikloj committed Oct 29, 2021
1 parent 9e0ec7f commit 628e0d6
Show file tree
Hide file tree
Showing 6 changed files with 1,815 additions and 1,053 deletions.
232 changes: 0 additions & 232 deletions Client/GeminiClient.php

This file was deleted.

37 changes: 37 additions & 0 deletions EntityMapper/EntityMapper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace Islandora\Crayfish\Commons\EntityMapper;

class EntityMapper implements EntityMapperInterface
{
/**
* {@inheritdoc}
*/
public function getFedoraPath($uuid)
{
if (strlen($uuid) < 8) {
throw new \InvalidArgumentException(
"Provided UUID must be at least of length 8 to account for pair-trees",
400
);
}

$segments = str_split(substr($uuid, 0, 8), 2);
return implode("/", $segments) . "/$uuid";
}

/**
* {@inheritdoc}
*/
public function getDrupalUuid($fedora_path)
{
if (empty($fedora_path)) {
throw new \InvalidArgumentException(
"Empty string provided fedora path",
400
);
}
$segments = explode("/", $fedora_path);
return end($segments);
}
}
22 changes: 22 additions & 0 deletions EntityMapper/EntityMapperInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Islandora\Crayfish\Commons\EntityMapper;

interface EntityMapperInterface
{
/**
* Gets a fedora path given a uuid.
*
* @param string $uuid
* @return string
*/
public function getFedoraPath($uuid);

/**
* Gets a drupal uuid from a fedora path.
*
* @param string $fedora_path
* @return string
*/
public function getDrupalUuid($fedora_path);
}
Loading

0 comments on commit 628e0d6

Please sign in to comment.