Skip to content

Commit 195bf7d

Browse files
author
Julien Neuhart
committed
updating for Gotenberg 6.0.0
1 parent 6776748 commit 195bf7d

24 files changed

+173
-218
lines changed

.github/CONTRIBUTING.md

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ find below useful information about how to contribute to the Gotenberg PHP clien
99

1010
1. Fork this repository
1111
2. Install Docker and Docker Compose.
12-
3. Install the latest [Orbit](https://github.com/gulien/orbit) release
1312

1413
### Working with git
1514

.github/PULL_REQUEST_TEMPLATE.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ Fixes #
3737
**Checklist**
3838

3939
- [ ] Have you followed the guidelines in our [CONTRIBUTING](CONTRIBUTING.md) guide?
40-
- [ ] Have you lint your code locally prior to submission (`orbit run lint`)?
40+
- [ ] Have you lint your code locally prior to submission (`make lint`)?
4141
- [ ] Have you written new tests for your core changes, as applicable?
42-
- [ ] Have you successfully ran tests with your changes locally (`orbit run up ci`)?
42+
- [ ] Have you successfully ran tests with your changes locally (`make tests`)?
4343
- [ ] I have squashed any insignificant commits
4444
- [ ] This change has comments for package types, values, functions, and non-obvious lines of code

.travis.yml

+2-8
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ language: generic
55
services:
66
- docker
77

8-
before_install:
9-
- wget -qO- https://github.com/gulien/orbit/releases/download/v3.0.1/orbit_Linux_x86_64.tar.gz | tar xvz -C .
10-
- sudo mv ./orbit /usr/local/bin && chmod +x /usr/local/bin/orbit
11-
12-
before_script:
13-
- orbit run up
14-
158
script:
16-
- orbit run lint tests
9+
- make lint
10+
- make tests

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018 TheCodingMachine
3+
Copyright (c) 2019 TheCodingMachine
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Makefile

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# start workspace.
2+
workspace:
3+
docker-compose run --rm php bash
4+
5+
# run all linters.
6+
lint:
7+
docker-compose run --rm -T php composer install
8+
docker-compose run --rm -T php composer run csfix
9+
docker-compose run --rm -T php composer run cscheck
10+
docker-compose run --rm -T php composer run phpstan
11+
12+
# run all tests.
13+
test:
14+
docker-compose up -d gotenberg
15+
docker-compose run --rm -T php composer run phpunit
16+
docker-compose down

composer.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"thecodingmachine/phpstan-safe-rule": "^0.1.0",
3939
"thecodingmachine/phpstan-strict-rules": "^0.10.7",
4040
"php-http/mock-client": "^1.0",
41-
"php-http/guzzle6-adapter": "^1.1"
41+
"php-http/guzzle6-adapter": "^1.1",
42+
"doctrine/coding-standard": "^6.0"
4243
},
4344
"autoload" : {
4445
"psr-4" : {
@@ -51,14 +52,14 @@
5152
}
5253
},
5354
"scripts": {
54-
"cs-fix": "phpcbf",
55-
"cs-check": "phpcs",
55+
"csfix": "phpcbf",
56+
"cscheck": "phpcs",
5657
"phpstan": "phpstan analyse src -c phpstan.neon --level=7 --no-progress -vvv",
5758
"phpunit": "phpunit --configuration phpunit.xml.dist"
5859
},
5960
"extra": {
6061
"branch-alias": {
61-
"dev-master": "3.0.x-dev"
62+
"dev-master": "6.0.x-dev"
6263
}
6364
}
6465
}

docker-compose.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: '3'
33
services:
44

55
php:
6-
image: thecodingmachine/php:7.2-v2-cli
6+
image: thecodingmachine/php:7.3-v2-cli
77
container_name: php
88
environment:
99
- PHP_EXTENSION_XDEBUG=1
@@ -12,6 +12,6 @@ services:
1212
- ./:/usr/src/app:rw
1313

1414
gotenberg:
15-
image: thecodingmachine/gotenberg:5.0.0
15+
image: thecodingmachine/gotenberg:6.0.0
1616
container_name: gotenberg
1717
restart: 'no'

orbit.yml

-24
This file was deleted.

phpcs.xml.dist

+36-12
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,45 @@
11
<?xml version="1.0"?>
2-
<ruleset name="Expressive Skeleton coding standard">
3-
<description>Expressive Skeleton coding standard</description>
4-
5-
<!-- display progress -->
6-
<arg value="p"/>
2+
<ruleset>
3+
<arg name="basepath" value="."/>
4+
<arg name="extensions" value="php"/>
5+
<arg name="parallel" value="16"/>
76
<arg name="colors"/>
87

9-
<!-- inherit rules from: -->
10-
<rule ref="PSR2"/>
8+
<!-- Ignore warnings, show progress of the run and show sniff names -->
9+
<arg value="nps"/>
1110

12-
<!-- Paths to check -->
11+
<!-- Directories to be checked -->
1312
<file>src</file>
13+
<file>tests</file>
14+
15+
<exclude-pattern>tests/dependencies/*</exclude-pattern>
16+
17+
<!-- Include full Doctrine Coding Standard -->
18+
<rule ref="Doctrine">
19+
<exclude name="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming.SuperfluousSuffix"/>
20+
<exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming.SuperfluousSuffix"/>
21+
<exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming.SuperfluousPrefix"/>
22+
<exclude name="Squiz.Commenting.FunctionComment.InvalidNoReturn" />
23+
<exclude name="Generic.Formatting.MultipleStatementAlignment" />
24+
</rule>
25+
26+
<!-- Do not align assignments -->
27+
<rule ref="Generic.Formatting.MultipleStatementAlignment">
28+
<severity>0</severity>
29+
</rule>
30+
31+
<!-- Do not align comments -->
32+
<rule ref="Squiz.Commenting.FunctionComment.SpacingAfterParamName">
33+
<severity>0</severity>
34+
</rule>
35+
<rule ref="Squiz.Commenting.FunctionComment.SpacingAfterParamType">
36+
<severity>0</severity>
37+
</rule>
1438

15-
<rule ref="Generic.Files.LineLength">
39+
<!-- Require no space before colon in return types -->
40+
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing">
1641
<properties>
17-
<property name="lineLimit" value="300"/>
18-
<property name="absoluteLineLimit" value="500"/>
42+
<property name="spacesCountBeforeColon" value="0"/>
1943
</properties>
2044
</rule>
21-
</ruleset>
45+
</ruleset>

src/ChromeRequest.php

+17-39
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace TheCodingMachine\Gotenberg;
46

7+
use function count;
8+
59
abstract class ChromeRequest extends Request implements GotenbergRequestInterface
610
{
711
private const WAIT_DELAY = 'waitDelay';
@@ -49,28 +53,29 @@ abstract class ChromeRequest extends Request implements GotenbergRequestInterfac
4953
public function getFormValues(): array
5054
{
5155
$values = parent::getFormValues();
52-
if (!is_null($this->waitDelay)) {
56+
if ($this->waitDelay !== null) {
5357
$values[self::WAIT_DELAY] = $this->waitDelay;
5458
}
55-
if (!is_null($this->paperWidth)) {
59+
if ($this->paperWidth !== null) {
5660
$values[self::PAPER_WIDTH] = $this->paperWidth;
5761
}
58-
if (!is_null($this->paperHeight)) {
62+
if ($this->paperHeight !== null) {
5963
$values[self::PAPER_HEIGHT] = $this->paperHeight;
6064
}
61-
if (!is_null($this->marginTop)) {
65+
if ($this->marginTop !== null) {
6266
$values[self::MARGIN_TOP] = $this->marginTop;
6367
}
64-
if (!is_null($this->marginBottom)) {
68+
if ($this->marginBottom !== null) {
6569
$values[self::MARGIN_BOTTOM] = $this->marginBottom;
6670
}
67-
if (!is_null($this->marginLeft)) {
71+
if ($this->marginLeft !== null) {
6872
$values[self::MARGIN_LEFT] = $this->marginLeft;
6973
}
70-
if (!is_null($this->marginRight)) {
74+
if ($this->marginRight !== null) {
7175
$values[self::MARGIN_RIGHT] = $this->marginRight;
7276
}
7377
$values[self::LANDSCAPE] = $this->landscape;
78+
7479
return $values;
7580
}
7681

@@ -80,25 +85,24 @@ public function getFormValues(): array
8085
public function getFormFiles(): array
8186
{
8287
$files = [];
83-
if (!empty($this->header)) {
88+
if (! empty($this->header)) {
8489
$files['header.html'] = $this->header;
8590
}
86-
if (!empty($this->footer)) {
91+
if (! empty($this->footer)) {
8792
$files['footer.html'] = $this->footer;
8893
}
94+
8995
return $files;
9096
}
9197

92-
/**
93-
* @param float|null $waitDelay
94-
*/
9598
public function setWaitDelay(?float $waitDelay): void
9699
{
97100
$this->waitDelay = $waitDelay;
98101
}
99102

100103
/**
101104
* @param float[] $paperSize
105+
*
102106
* @throws RequestException
103107
*/
104108
public function setPaperSize(array $paperSize): void
@@ -112,6 +116,7 @@ public function setPaperSize(array $paperSize): void
112116

113117
/**
114118
* @param float[] $margins
119+
*
115120
* @throws RequestException
116121
*/
117122
public function setMargins(array $margins): void
@@ -125,73 +130,46 @@ public function setMargins(array $margins): void
125130
$this->marginRight = $margins[3];
126131
}
127132

128-
/**
129-
* @param Document|null $header
130-
*/
131133
public function setHeader(?Document $header): void
132134
{
133135
$this->header = $header;
134136
}
135137

136-
/**
137-
* @param Document|null $footer
138-
*/
139138
public function setFooter(?Document $footer): void
140139
{
141140
$this->footer = $footer;
142141
}
143142

144-
/**
145-
* @param float|null $paperWidth
146-
*/
147143
public function setPaperWidth(?float $paperWidth): void
148144
{
149145
$this->paperWidth = $paperWidth;
150146
}
151147

152-
/**
153-
* @param float|null $paperHeight
154-
*/
155148
public function setPaperHeight(?float $paperHeight): void
156149
{
157150
$this->paperHeight = $paperHeight;
158151
}
159152

160-
/**
161-
* @param float|null $marginTop
162-
*/
163153
public function setMarginTop(?float $marginTop): void
164154
{
165155
$this->marginTop = $marginTop;
166156
}
167157

168-
/**
169-
* @param float|null $marginBottom
170-
*/
171158
public function setMarginBottom(?float $marginBottom): void
172159
{
173160
$this->marginBottom = $marginBottom;
174161
}
175162

176-
/**
177-
* @param float|null $marginLeft
178-
*/
179163
public function setMarginLeft(?float $marginLeft): void
180164
{
181165
$this->marginLeft = $marginLeft;
182166
}
183167

184-
/**
185-
* @param float|null $marginRight
186-
*/
187168
public function setMarginRight(?float $marginRight): void
188169
{
189170
$this->marginRight = $marginRight;
190171
}
191172

192-
/**
193-
* @param bool $landscape
194-
*/
195173
public function setLandscape(bool $landscape): void
196174
{
197175
$this->landscape = $landscape;

0 commit comments

Comments
 (0)