Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace App\Factories; use App\Models\Song; use App\Services\Streamers\DirectStr..
Decoded Output download
<?php
namespace App\Factories;
use App\Models\Song;
use App\Services\Streamers\DirectStreamerInterface;
use App\Services\Streamers\ObjectStorageStreamerInterface;
use App\Services\Streamers\StreamerInterface;
use App\Services\Streamers\TranscodingStreamerInterface;
use App\Services\TranscodingService;
class StreamerFactory
{
public function __construct(
private DirectStreamerInterface $directStreamer,
private TranscodingStreamerInterface $transcodingStreamer,
private ObjectStorageStreamerInterface $objectStorageStreamer,
private TranscodingService $transcodingService
) {
}
public function createStreamer(
Song $song,
?bool $transcode = null,
?int $bitRate = null,
float $startTime = 0.0
): StreamerInterface {
if ($song->s3_params) {
$this->objectStorageStreamer->setSong($song);
return $this->objectStorageStreamer;
}
if ($transcode === null && $this->transcodingService->songShouldBeTranscoded($song)) {
$transcode = true;
}
if ($transcode) {
$this->transcodingStreamer->setSong($song);
$this->transcodingStreamer->setBitRate($bitRate ?: config('koel.streaming.bitrate'));
$this->transcodingStreamer->setStartTime($startTime);
return $this->transcodingStreamer;
}
$this->directStreamer->setSong($song);
return $this->directStreamer;
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace App\Factories;
use App\Models\Song;
use App\Services\Streamers\DirectStreamerInterface;
use App\Services\Streamers\ObjectStorageStreamerInterface;
use App\Services\Streamers\StreamerInterface;
use App\Services\Streamers\TranscodingStreamerInterface;
use App\Services\TranscodingService;
class StreamerFactory
{
public function __construct(
private DirectStreamerInterface $directStreamer,
private TranscodingStreamerInterface $transcodingStreamer,
private ObjectStorageStreamerInterface $objectStorageStreamer,
private TranscodingService $transcodingService
) {
}
public function createStreamer(
Song $song,
?bool $transcode = null,
?int $bitRate = null,
float $startTime = 0.0
): StreamerInterface {
if ($song->s3_params) {
$this->objectStorageStreamer->setSong($song);
return $this->objectStorageStreamer;
}
if ($transcode === null && $this->transcodingService->songShouldBeTranscoded($song)) {
$transcode = true;
}
if ($transcode) {
$this->transcodingStreamer->setSong($song);
$this->transcodingStreamer->setBitRate($bitRate ?: config('koel.streaming.bitrate'));
$this->transcodingStreamer->setStartTime($startTime);
return $this->transcodingStreamer;
}
$this->directStreamer->setSong($song);
return $this->directStreamer;
}
}
Function Calls
| None |
Stats
| MD5 | 2581cc51ae1f487b5168a832d996b2a2 |
| Eval Count | 0 |
| Decode Time | 108 ms |