Skip to content

Commit 9011f9e

Browse files
authored
Applied fixes from StyleCI (spatie#28)
1 parent f441f7b commit 9011f9e

File tree

2 files changed

+25
-35
lines changed

2 files changed

+25
-35
lines changed

spec/Spatie/Browsershot/BrowsershotSpec.php

+9-19
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,36 @@
33
namespace spec\Spatie\Browsershot;
44

55
use PhpSpec\ObjectBehavior;
6-
use Prophecy\Argument;
7-
8-
96

107
class BrowsershotSpec extends ObjectBehavior
118
{
12-
13-
function it_is_initializable()
9+
public function it_is_initializable()
1410
{
1511
$this->shouldHaveType('Spatie\Browsershot\Browsershot');
1612
}
1713

18-
function it_should_fail_if_target_file_is_not_set()
14+
public function it_should_fail_if_target_file_is_not_set()
1915
{
2016
$this->shouldThrow(new \Exception('targetfile not set'))->during('save', ['']);
2117
}
2218

23-
24-
25-
function it_should_fail_if_invalid_url_is_set()
19+
public function it_should_fail_if_invalid_url_is_set()
2620
{
2721
$this
2822
->setURL('gibberish')
2923
->shouldThrow(new \Exception('url is invalid'))
3024
->during('save', [$this->getTestPath()]);
3125
}
3226

33-
function it_should_fail_if_target_file_not_is_image()
27+
public function it_should_fail_if_target_file_not_is_image()
3428
{
3529
$this
3630
->setURL($this->getTestURL())
3731
->shouldThrow(new \Exception('targetfile extension not valid'))
38-
->during('save', [$this->getTestPath() . 'txt']);
32+
->during('save', [$this->getTestPath().'txt']);
3933
}
4034

41-
function it_should_fail_if_binary_does_not_exist()
35+
public function it_should_fail_if_binary_does_not_exist()
4236
{
4337
$this
4438
->setURL($this->getTestURL())
@@ -60,7 +54,6 @@ function it_should_create_an_image_if_run_succesfully()
6054
}
6155
*/
6256

63-
6457
public function getTestPath()
6558
{
6659
return 'image.png';
@@ -71,15 +64,12 @@ public function getTestURL()
7164
return 'http://google.com';
7265
}
7366

74-
7567
public function getMatchers()
7668
{
7769
return [
78-
'exist' => function($subject, $file) {
79-
return file_exists($file);
80-
},
70+
'exist' => function ($subject, $file) {
71+
return file_exists($file);
72+
},
8173
];
8274
}
83-
84-
8575
}

src/Spatie/Browsershot/Browsershot.php

+16-16
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ public function setBinPath($binPath)
7676
/**
7777
* @param int $width
7878
*
79-
* @return $this
80-
*
8179
* @throws \Exception
80+
*
81+
* @return $this
8282
*/
8383
public function setWidth($width)
8484
{
@@ -94,9 +94,9 @@ public function setWidth($width)
9494
/**
9595
* @param int $height
9696
*
97-
* @return $this
98-
*
9997
* @throws \Exception
98+
*
99+
* @return $this
100100
*/
101101
public function setHeight($height)
102102
{
@@ -114,9 +114,9 @@ public function setHeight($height)
114114
*
115115
* @param $quality
116116
*
117-
* @return $this
118-
*
119117
* @throws \Exception
118+
*
119+
* @return $this
120120
*/
121121
public function setQuality($quality)
122122
{
@@ -134,9 +134,9 @@ public function setQuality($quality)
134134
*
135135
* @param string $backgroundColor
136136
*
137-
* @return $this
138-
*
139137
* @throws \Exception
138+
*
139+
* @return $this
140140
*/
141141
public function setBackgroundColor($backgroundColor)
142142
{
@@ -164,9 +164,9 @@ public function setHeightToRenderWholePage()
164164
/**
165165
* @param string $url
166166
*
167-
* @return $this
168-
*
169167
* @throws \Exception
168+
*
169+
* @return $this
170170
*/
171171
public function setUrl($url)
172172
{
@@ -182,9 +182,9 @@ public function setUrl($url)
182182
/**
183183
* @param int $timeout
184184
*
185-
* @return $this
186-
*
187185
* @throws \Exception
186+
*
187+
* @return $this
188188
*/
189189
public function setTimeout($timeout)
190190
{
@@ -202,9 +202,9 @@ public function setTimeout($timeout)
202202
*
203203
* @param string $targetFile The path of the file where the screenshot should be saved
204204
*
205-
* @return bool
206-
*
207205
* @throws \Exception
206+
*
207+
* @return bool
208208
*/
209209
public function save($targetFile)
210210
{
@@ -275,8 +275,8 @@ protected function getPhantomJsScript($targetFile)
275275
return "
276276
var page = require('webpage').create();
277277
page.settings.javascriptEnabled = true;
278-
page.settings.resourceTimeout = ".$this->timeout.";
279-
page.viewportSize = { width: ".$this->width.($this->height == 0 ? '' : ', height: '.$this->height)." };
278+
page.settings.resourceTimeout = ".$this->timeout.';
279+
page.viewportSize = { width: '.$this->width.($this->height == 0 ? '' : ', height: '.$this->height)." };
280280
page.open('{$this->url}', function() {
281281
if (".($this->backgroundColor ? 'true' : 'false').") {
282282
page.evaluate(function() {

0 commit comments

Comments
 (0)