Initial unit tests, code cleanup
This commit is contained in:
@ -7,6 +7,10 @@ use NoccyLabs\Dataset\Readers\JsonReader;
|
||||
|
||||
class Dataset
|
||||
{
|
||||
protected string $packageName;
|
||||
|
||||
protected string $datasetName;
|
||||
|
||||
protected string $identifier;
|
||||
|
||||
protected array $options;
|
||||
@ -18,6 +22,8 @@ class Dataset
|
||||
$this->identifier = $identifier;
|
||||
$this->options = $options;
|
||||
$this->version = $version;
|
||||
|
||||
[$this->packageName, $this->datasetName] = explode("#", $identifier, 2);
|
||||
}
|
||||
|
||||
public function getIdentifier(): string
|
||||
@ -25,11 +31,31 @@ class Dataset
|
||||
return $this->identifier;
|
||||
}
|
||||
|
||||
public function getPackageName(): string
|
||||
{
|
||||
return $this->packageName;
|
||||
}
|
||||
|
||||
public function getDatasetName(): string
|
||||
{
|
||||
return $this->datasetName;
|
||||
}
|
||||
|
||||
public function getVersion(): ?string
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
public function getComment(): ?string
|
||||
{
|
||||
return array_key_exists('comment', $this->options) ? $this->options['comment'] : null;
|
||||
}
|
||||
|
||||
public function getLicense(): ?string
|
||||
{
|
||||
return array_key_exists('license', $this->options) ? $this->options['license'] : null;
|
||||
}
|
||||
|
||||
public function open(): ReaderInterface
|
||||
{
|
||||
$filename = $this->options['filename'];
|
||||
|
Reference in New Issue
Block a user