Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 09c092e

Browse files
Code formatting.
1 parent 2c32b8b commit 09c092e

File tree

1 file changed

+54
-54
lines changed

1 file changed

+54
-54
lines changed

‎src/MailtrapWait.php‎

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -8,63 +8,63 @@
88
*/
99
class MailtrapWait
1010
{
11-
/**
12-
* @var Mailtrap
13-
*/
14-
protected $mailtrap;
15-
/**
16-
* @var int
17-
*/
18-
protected $timeout;
19-
/**
20-
* @var int
21-
*/
22-
protected $interval;
11+
/**
12+
* @var Mailtrap
13+
*/
14+
protected $mailtrap;
15+
/**
16+
* @var int
17+
*/
18+
protected $timeout;
19+
/**
20+
* @var int
21+
*/
22+
protected $interval;
2323

24-
/**
25-
* MailtrapWait constructor.
26-
*
27-
* @param Mailtrap $mailtrap
28-
* @param null|int $timeout_in_second
29-
* @param null|int $interval_in_millisecond
30-
*/
31-
public function __construct(Mailtrap $mailtrap, $timeout_in_second = null, $interval_in_millisecond = null)
32-
{
33-
$this->mailtrap = $mailtrap;
34-
$this->timeout = isset($timeout_in_second) ? $timeout_in_second : 30;
35-
$this->interval = $interval_in_millisecond ?: 250;
36-
}
24+
/**
25+
* MailtrapWait constructor.
26+
*
27+
* @param Mailtrap $mailtrap
28+
* @param null|int $timeout_in_second
29+
* @param null|int $interval_in_millisecond
30+
*/
31+
public function __construct(Mailtrap $mailtrap, $timeout_in_second = null, $interval_in_millisecond = null)
32+
{
33+
$this->mailtrap = $mailtrap;
34+
$this->timeout = isset($timeout_in_second) ? $timeout_in_second : 30;
35+
$this->interval = $interval_in_millisecond ?: 250;
36+
}
3737

38-
/**
39-
* Calls the function provided with the driver as an argument until the return value is not falsey.
40-
*
41-
* @param callable $function
42-
* @param string $message
43-
*
44-
* @throws \Exception
45-
* @return mixed The return value of $function
46-
*/
47-
public function until($function, $message = '')
48-
{
49-
$end = microtime(true) + $this->timeout;
50-
$last_exception = null;
38+
/**
39+
* Calls the function provided with the driver as an argument until the return value is not falsey.
40+
*
41+
* @param callable $function
42+
* @param string $message
43+
*
44+
* @throws \Exception
45+
* @return mixed The return value of $function
46+
*/
47+
public function until($function, $message = '')
48+
{
49+
$end = microtime(true) + $this->timeout;
50+
$last_exception = null;
5151

52-
while ($end > microtime(true ) ) {
53-
try {
54-
$ret_val = call_user_func($function, $this->mailtrap);
55-
if ($ret_val) {
56-
return $ret_val;
57-
}
58-
} catch (\Exception $e) {
59-
$last_exception = $e;
60-
}
61-
usleep($this->interval * 1000);
62-
}
52+
while ($end > microtime(true)) {
53+
try {
54+
$ret_val = call_user_func($function, $this->mailtrap);
55+
if ($ret_val) {
56+
return $ret_val;
57+
}
58+
} catch (\Exception $e) {
59+
$last_exception = $e;
60+
}
61+
usleep($this->interval * 1000);
62+
}
6363

64-
if ($last_exception) {
65-
throw $last_exception;
66-
}
64+
if ($last_exception) {
65+
throw $last_exception;
66+
}
6767

68-
throw new \Exception($message);
69-
}
68+
throw new \Exception($message);
69+
}
7070
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /