Skip to content

Commit af83a0e

Browse files
committed
Improve codebase and remove MapKey from public API
1 parent 6183baf commit af83a0e

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

src/Item.php

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@ public static function fromEncodedByteSequence(Stringable|string $value): self
9797
return self::fromValue(Value::fromEncodedByteSequence($value));
9898
}
9999

100+
/**
101+
* Returns a new bare instance from value.
102+
*/
103+
private static function fromValue(Value $value): self
104+
{
105+
return new self($value, Parameters::create());
106+
}
107+
100108
/**
101109
* Returns a new instance from a decoded byte sequence and an iterable of key-value parameters.
102110
*/
@@ -152,28 +160,36 @@ public static function fromDate(DateTimeInterface $datetime): self
152160
}
153161

154162
/**
155-
* Returns a new bare instance from value.
163+
* Returns a new instance from a float value
164+
*
165+
* @throws SyntaxError if the format is invalid
156166
*/
157-
private static function fromValue(Value $value): self
158-
{
159-
return new self($value, Parameters::create());
160-
}
161-
162167
public static function fromDecimal(int|float $value): self
163168
{
164169
return self::fromValue(Value::fromDecimal($value));
165170
}
166171

172+
/**
173+
* Returns a new instance from an integer value
174+
*
175+
* @throws SyntaxError if the format is invalid
176+
*/
167177
public static function fromInteger(int|float $value): self
168178
{
169179
return self::fromValue(Value::fromInteger($value));
170180
}
171181

182+
/**
183+
* Returns a new instance for the boolean true type
184+
*/
172185
public static function true(): self
173186
{
174187
return self::fromValue(Value::true());
175188
}
176189

190+
/**
191+
* Returns a new instance for the boolean false type
192+
*/
177193
public static function false(): self
178194
{
179195
return self::fromValue(Value::false());

0 commit comments

Comments
 (0)