GetDKAN/dkan

View on GitHub
modules/harvest/src/Storage/IdGenerator.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%
<?php

namespace Drupal\harvest\Storage;

use Contracts\IdGeneratorInterface;

/**
 * Extracts identifiers from metastore data objects.
 *
 * @codeCoverageIgnore
 *
 * @deprecated Is this dead code?
 */
class IdGenerator implements IdGeneratorInterface {

  /**
   * Data.
   *
   * @var mixed
   */
  protected $data;

  /**
   * Public.
   */
  public function __construct($json) {
    $this->data = json_decode($json);
  }

  /**
   * Public.
   */
  public function generate() {
    return $this->data->identifier ?? NULL;
  }

}