Skip to content

Commit 321e868

Browse files
committed
Missed this example
1 parent 466b5dc commit 321e868

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

examples/ffmpeg.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
use Amp\Pipeline\Pipeline;
44
use Amp\Process\Process;
55
use function Amp\ByteStream\getStdout;
66

77
require dirname(__DIR__) . "/vendor/autoload.php";
88

9+
/** @psalm-suppress RiskyTruthyFalsyComparison */
910
$ffmpeg = getenv('FFMPEG_BIN') ?: 'ffmpeg';
10-
$concurrency = $argv[1] ?? 3;
11+
$concurrency = (int) ($argv[1] ?? 3);
1112
$start = microtime(true);
1213

1314
Pipeline::fromIterable(new DirectoryIterator('.'))
@@ -35,9 +36,9 @@ function createVideoClip(string $ffmpeg, string $source, string $destination): a
3536

3637
$success = Process::start($cmd)->join() === 0;
3738

38-
if ($success) {
39-
return [$source, $destination];
40-
} else {
39+
if (!$success) {
4140
throw new \RuntimeException('Unable to perform conversion');
4241
}
43-
}
42+
43+
return [$source, $destination];
44+
}

0 commit comments

Comments
 (0)