Skip to content

Commit

Permalink
Refactor ValueType to Typ
Browse files Browse the repository at this point in the history
  • Loading branch information
danon committed Nov 24, 2023
1 parent 69b1c46 commit 7198f18
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/Internal/Frame/KeyTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ private function types(DataFrame $frame): array
foreach ($frame->dataset() as $dataRow) {
foreach ($dataRow->keys as $index => $key) {
if ($dataRow->isAssociative($index)) {
$valueType = new ValueType($key);
$types[$valueType->type()] = true;
$types[$this->typeOf($key)] = true;
}
}
}
Expand All @@ -37,4 +36,9 @@ private function arrayKeyTypes(array $types): bool
{
return $types == ['string', 'int'] || $types == ['int', 'string'];
}

private function typeOf($value): string
{
return new Type($value);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace TRegx\PhpUnit\DataProviders\Internal\Frame;

class ValueType
class Type
{
/** @var mixed */
private $value;
Expand All @@ -11,7 +11,7 @@ public function __construct($value)
$this->value = $value;
}

public function type(): string
public function __toString(): string
{
if (\is_string($this->value)) {
return 'string';
Expand Down

0 comments on commit 7198f18

Please sign in to comment.