-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Markdown screenshot URL + Add headers to client call + Some renaming + Add metadata to files + Units in paper size #41
Conversation
$splitAndParseStringWithUnit = static function (mixed $raw, callable $callback): void { | ||
[$value, $unit] = sscanf((string) $raw, '%d%s') ?? throw new \InvalidArgumentException(sprintf('Unexpected value "%s", expected format is "%%d%%s"', $raw)); | ||
|
||
$callback((float) $value, Unit::tryFrom((string) $unit) ?? Unit::Inches); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could emit a log if the unit is invalid ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Will do in another PR where I will add several logs like this one.
@@ -377,7 +380,7 @@ private function addConfiguration(string $configurationName, mixed $value): void | |||
'width' => $this->width($value), | |||
'height' => $this->height($value), | |||
'clip' => $this->clip($value), | |||
'format' => $this->format($value), | |||
'format' => $this->format(ScreenshotFormat::from($value)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the error handled if the format is not valid ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope it simply fails (in this case it will fail on clear-cache)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Maybe we should throw a InvalidBuilderConfiguration
exception instead to make debug easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed. The Configuration class already handles this. I do not see a proper usecase for this exception at the moment.
self::assertSame(['marginTop' => '1in'], $multipartFormData[3]); | ||
self::assertSame(['marginBottom' => '1in'], $multipartFormData[4]); | ||
self::assertSame(['marginLeft' => '1in'], $multipartFormData[5]); | ||
self::assertSame(['marginRight' => '1in'], $multipartFormData[6]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since, in
is the default one, we should add a test with an other one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree. Several tests needs to be written actually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will create a dedicated PR after #40 is merged to rework some of the tests to better reflect all usecases.
Resolves #38
Resolves #45