Skip to content

Commit 6c92d35

Browse files
committed
Undoing some automatic formatting by scrutinizer
1 parent cb2e4a2 commit 6c92d35

12 files changed

+380
-395
lines changed

src/JonnyW/PhantomJs/Client.php

+36-41
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
*/
99
namespace JonnyW\PhantomJs;
1010

11-
use JonnyW\PhantomJs\ClientInterface;
1211
use JonnyW\PhantomJs\Exception\NoPhantomJsException;
1312
use JonnyW\PhantomJs\Exception\CommandFailedException;
1413
use JonnyW\PhantomJs\Exception\NotWriteableException;
@@ -27,14 +26,14 @@ class Client implements ClientInterface
2726
/**
2827
* Client instance
2928
*
30-
* @var JonnyW\PhantomJs\ClientInterface
29+
* @var \JonnyW\PhantomJs\ClientInterface
3130
*/
3231
private static $instance;
3332

3433
/**
3534
* Message factory instance
3635
*
37-
* @var JonnyW\PhantomJs\Message\FactoryInterface
36+
* @var \JonnyW\PhantomJs\Message\FactoryInterface
3837
*/
3938
protected $factory;
4039

@@ -55,7 +54,7 @@ class Client implements ClientInterface
5554
/**
5655
* Internal constructor
5756
*
58-
* @param FactoryInterface $factory
57+
* @param \JonnyW\PhantomJs\Message\FactoryInterface $factory
5958
* @return void
6059
*/
6160
public function __construct(FactoryInterface $factory = null)
@@ -64,16 +63,16 @@ public function __construct(FactoryInterface $factory = null)
6463
$factory = Factory::getInstance();
6564
}
6665

67-
$this->factory = $factory;
68-
$this->phantomJS = 'bin/phantomjs';
66+
$this->factory = $factory;
67+
$this->phantomJS = 'bin/phantomjs';
6968
$this->timeout = 5000;
7069
}
7170

7271
/**
7372
* Get singleton instance
7473
*
75-
* @param FactoryInterface $factory
76-
* @return Client
74+
* @param \JonnyW\PhantomJs\Message\FactoryInterface $factory
75+
* @return \JonnyW\PhantomJs\Client
7776
*/
7877
public static function getInstance(FactoryInterface $factory = null)
7978
{
@@ -87,7 +86,7 @@ public static function getInstance(FactoryInterface $factory = null)
8786
/**
8887
* Get message factory instance
8988
*
90-
* @return JonnyW\PhantomJs\Message\FactoryInterface
89+
* @return \JonnyW\PhantomJs\Message\FactoryInterface
9190
*/
9291
public function getMessageFactory()
9392
{
@@ -97,10 +96,10 @@ public function getMessageFactory()
9796
/**
9897
* Send request
9998
*
100-
* @param RequestInterface $request
101-
* @param ResponseInterface $response
102-
* @param string $file
103-
* @return ResponseInterface
99+
* @param \JonnyW\PhantomJs\Message\RequestInterface $request
100+
* @param \JonnyW\PhantomJs\Message\ResponseInterface $response
101+
* @param string $file
102+
* @return \JonnyW\PhantomJs\Message\ResponseInterface
104103
*/
105104
public function send(RequestInterface $request, ResponseInterface $response, $file = null)
106105
{
@@ -114,14 +113,14 @@ public function send(RequestInterface $request, ResponseInterface $response, $fi
114113
/**
115114
* Open page
116115
*
117-
* @param RequestInterface $request
118-
* @param ResponseInterface $response
119-
* @return ResponseInterface
116+
* @param \JonnyW\PhantomJs\Message\RequestInterface $request
117+
* @param \JonnyW\PhantomJs\Message\ResponseInterface $response
118+
* @return \JonnyW\PhantomJs\Message\ResponseInterface
120119
*/
121120
public function open(RequestInterface $request, ResponseInterface $response, $delay = 0)
122121
{
123122
if ($delay) {
124-
$cmd = sprintf($this->openCmdWithDelay, $delay);
123+
$cmd = sprintf($this->openCmdWithDelay, $delay);
125124
} else {
126125
$cmd = $this->openCmd;
127126
}
@@ -132,10 +131,10 @@ public function open(RequestInterface $request, ResponseInterface $response, $de
132131
/**
133132
* Screen capture
134133
*
135-
* @param RequestInterface $request
136-
* @param ResponseInterface $response
137-
* @param string $file
138-
* @return ResponseInterface
134+
* @param \JonnyW\PhantomJs\Message\RequestInterface $request
135+
* @param \JonnyW\PhantomJs\Message\ResponseInterface $response
136+
* @param string $file
137+
* @return \JonnyW\PhantomJs\Message\ResponseInterface
139138
*/
140139
public function capture(RequestInterface $request, ResponseInterface $response, $file)
141140
{
@@ -151,8 +150,8 @@ public function capture(RequestInterface $request, ResponseInterface $response,
151150
/**
152151
* Set new PhantomJs path
153152
*
154-
* @param string $path
155-
* @return Client
153+
* @param string $path
154+
* @return \JonnyW\PhantomJs\Client
156155
*/
157156
public function setPhantomJs($path)
158157
{
@@ -168,8 +167,8 @@ public function setPhantomJs($path)
168167
/**
169168
* Set timeout period (in milliseconds)
170169
*
171-
* @param int $period
172-
* @return Client
170+
* @param int $period
171+
* @return \JonnyW\PhantomJs\Client
173172
*/
174173
public function setTimeout($period)
175174
{
@@ -181,10 +180,10 @@ public function setTimeout($period)
181180
/**
182181
* Make PhantomJS request
183182
*
184-
* @param RequestInterface $request
185-
* @param ResponseInterface $response
186-
* @param string $cmd
187-
* @return ResponseInterface
183+
* @param \JonnyW\PhantomJs\Message\RequestInterface $request
184+
* @param \JonnyW\PhantomJs\Message\ResponseInterface $response
185+
* @param string $cmd
186+
* @return \JonnyW\PhantomJs\Message\ResponseInterface
188187
*/
189188
protected function request(RequestInterface $request, ResponseInterface $response, $cmd)
190189
{
@@ -207,8 +206,6 @@ protected function request(RequestInterface $request, ResponseInterface $respons
207206
$request->getBody(),
208207
$cmd
209208
);
210-
211-
212209

213210
$script = $this->writeScript($data);
214211
$cmd = escapeshellcmd(sprintf("%s %s", $this->phantomJS, $script));
@@ -261,8 +258,8 @@ protected function writeScript($data)
261258
/**
262259
* Remove temporary script file
263260
*
264-
* @param string|boolean $file
265-
* @return Client
261+
* @param string|boolean $file
262+
* @return \JonnyW\PhantomJs\Client
266263
*/
267264
protected function removeScript($file)
268265
{
@@ -326,7 +323,7 @@ protected function parse($data)
326323
} else {
327324
console.log(JSON.stringify(response, undefined, 4));
328325
phantom.exit();
329-
}
326+
}
330327
});
331328
EOF;
332329

@@ -364,26 +361,24 @@ protected function parse($data)
364361
phantom.exit();
365362
EOF;
366363

367-
/**
364+
/**
368365
* PhantomJs page open
369-
* command template
366+
* command template with
367+
* delay
370368
*
371369
* @var string
372370
*/
373371
protected $openCmdWithDelay = <<<EOF
374372
375-
window.setTimeout(function(){
376-
373+
window.setTimeout(function () {
377374
378375
response.content = page.evaluate(function () {
379376
return document.getElementsByTagName('html')[0].innerHTML
380377
});
381378
382-
383379
console.log(JSON.stringify(response, undefined, 4));
384-
phantom.exit();
380+
phantom.exit();
385381
386382
}, %s);
387-
388383
EOF;
389384
}

src/JonnyW/PhantomJs/ClientInterface.php

+13-13
Original file line numberDiff line numberDiff line change
@@ -21,37 +21,37 @@ interface ClientInterface
2121
/**
2222
* Send request
2323
*
24-
* @param RequestInterface $request
25-
* @param ResponseInterface $response
26-
* @param string $file
27-
* @return ResponseInterface
24+
* @param \JonnyW\PhantomJs\Message\RequestInterface $request
25+
* @param \JonnyW\PhantomJs\Message\ResponseInterface $response
26+
* @param string $file
27+
* @return \JonnyW\PhantomJs\Message\ResponseInterface
2828
*/
2929
public function send(RequestInterface $request, ResponseInterface $response, $file = null);
3030

3131
/**
3232
* Open page
3333
*
34-
* @param RequestInterface $request
35-
* @param ResponseInterface $response
36-
* @return ResponseInterface
34+
* @param \JonnyW\PhantomJs\Message\RequestInterface $request
35+
* @param \JonnyW\PhantomJs\Message\ResponseInterface $response
36+
* @return \JonnyW\PhantomJs\Message\ResponseInterface
3737
*/
3838
public function open(RequestInterface $request, ResponseInterface $response);
3939

4040
/**
4141
* Screen capture
4242
*
43-
* @param RequestInterface $request
44-
* @param ResponseInterface $response
45-
* @param string $file
46-
* @return ResponseInterface
43+
* @param \JonnyW\PhantomJs\Message\RequestInterface $request
44+
* @param \JonnyW\PhantomJs\Message\ResponseInterface $response
45+
* @param string $file
46+
* @return \JonnyW\PhantomJs\Message\ResponseInterface
4747
*/
4848
public function capture(RequestInterface $request, ResponseInterface $response, $file);
4949

5050
/**
5151
* Set new PhantomJs path
5252
*
53-
* @param string $path
54-
* @return Client
53+
* @param string $path
54+
* @return \JonnyW\PhantomJs\Client
5555
*/
5656
public function setPhantomJs($path);
5757
}

src/JonnyW/PhantomJs/Message/Factory.php

+6-11
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88
*/
99
namespace JonnyW\PhantomJs\Message;
1010

11-
use JonnyW\PhantomJs\Message\FactoryInterface;
12-
use JonnyW\PhantomJs\Message\RequestInterface;
13-
use JonnyW\PhantomJs\Message\Request;
14-
use JonnyW\PhantomJs\Message\Response;
15-
1611
/**
1712
* PHP PhantomJs
1813
*
@@ -23,14 +18,14 @@ class Factory implements FactoryInterface
2318
/**
2419
* Client instance
2520
*
26-
* @var JonnyW\PhantomJs\Message\FactoryInterface
21+
* @var \JonnyW\PhantomJs\Message\FactoryInterface
2722
*/
2823
private static $instance;
2924

3025
/**
3126
* Get singleton instance
3227
*
33-
* @return Factory
28+
* @return \JonnyW\PhantomJs\Message\Factory
3429
*/
3530
public static function getInstance()
3631
{
@@ -44,9 +39,9 @@ public static function getInstance()
4439
/**
4540
* Create request instance
4641
*
47-
* @param string $method
48-
* @param string $url
49-
* @return Request
42+
* @param string $method
43+
* @param string $url
44+
* @return \JonnyW\PhantomJs\Message\Request
5045
*/
5146
public function createRequest($method = RequestInterface::METHOD_GET, $url = null)
5247
{
@@ -56,7 +51,7 @@ public function createRequest($method = RequestInterface::METHOD_GET, $url = nul
5651
/**
5752
* Create response instance
5853
*
59-
* @return Response
54+
* @return \JonnyW\PhantomJs\Message\Response
6055
*/
6156
public function createResponse()
6257
{

src/JonnyW/PhantomJs/Message/FactoryInterface.php

+4-6
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
*/
99
namespace JonnyW\PhantomJs\Message;
1010

11-
use JonnyW\PhantomJs\Message\RequestInterface;
12-
1311
/**
1412
* PHP PhantomJs
1513
*
@@ -27,16 +25,16 @@ public static function getInstance();
2725
/**
2826
* Create request instance
2927
*
30-
* @param string $url
31-
* @param string $method
32-
* @return Request
28+
* @param string $url
29+
* @param string $method
30+
* @return \JonnyW\PhantomJs\Message\RequestInterface
3331
*/
3432
public function createRequest($url, $method = RequestInterface::METHOD_GET);
3533

3634
/**
3735
* Create response instance
3836
*
39-
* @return Response
37+
* @return \JonnyW\PhantomJs\Message\ResoibseInterface
4038
*/
4139
public function createResponse();
4240
}

0 commit comments

Comments
 (0)