Initial unit tests, code cleanup

This commit is contained in:
2022-10-31 00:42:29 +01:00
parent abde48640f
commit d0956f851c
13 changed files with 180 additions and 24 deletions

View File

@ -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'];