Skip to content

Deleted vendor and code refactor #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vendor/
.phpunit.result.cache
.idea/
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@
"license": "proprietary",
"autoload": {
"psr-4": {
"Remotion\\LambdaPhp\\": "src/"
"Remotion\\LambdaPhp\\": "src/",
"Remotion\\LambdaPhp\\Tests\\": "tests/"
}
},
"require": {
"aws/aws-sdk-php": "^3.269"
},
"require-dev": {
"phpunit/phpunit": "^10.1"
},
"scripts": {
"test": "phpunit tests"
}
}
2 changes: 1 addition & 1 deletion src/GetRenderProgressResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class GetRenderProgressResponse
{
public int $chunks;
public ?int $chunks;
public bool $done;
public float $overallProgress;
public string $type;
Expand Down
14 changes: 5 additions & 9 deletions src/PHPClient.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
<?php
namespace Remotion\LambdaPhp;

use Remotion\LambdaPhp\GetRenderProgressResponse;
use Aws\Credentials\CredentialProvider;
use Aws\Lambda\LambdaClient;
use Exception;
use stdClass;

require_once __DIR__ . '/Version.php';

class PHPClient
{
private $client;
private $region;
private $serveUrl;
private $functionName;
protected $client;
protected $region;
protected $serveUrl;
protected $functionName;

public function __construct(string $region, string $serveUrl, string $functionName, ?callable $credential)
{
Expand Down Expand Up @@ -62,7 +58,7 @@ public function makeRenderProgressPayload(string $renderId, string $bucketName,
'renderId' => $renderId,
'bucketName' => $bucketName,
'type' => 'status',
"version" => VERSION,
"version" => Semantic::VERSION,
"s3OutputProvider" => null,
"logLevel" => $logLevel ,
);
Expand Down
10 changes: 10 additions & 0 deletions src/RenderMediaOnLambdaResponse.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Remotion\LambdaPhp;

class RenderMediaOnLambdaResponse
{
public string $type;
public string $bucketName;
public string $renderId;
}
180 changes: 87 additions & 93 deletions src/RenderParams.php
Original file line number Diff line number Diff line change
@@ -1,108 +1,98 @@
<?php

namespace Remotion\LambdaPhp;

require_once __DIR__ . '/Version.php';
use stdClass;
use VERSION;

class RenderMediaOnLambdaResponse
{
public string $type;
public string $bucketName;
public string $renderId;
}


class RenderParams
{

private $data = null;
private $bucketName = null;
private $region = null;
private $outName = null;
private $composition = null;
private $serverUrl = null;
private $framesPerLambda = null;

private $codec = 'h264';
private $version = "";
private $imageFormat = 'jpeg';
private $crf = null;
private $envVariables = [];
private $maxRetries = 1;
private $jpegQuality = 80;
private $privacy = 'private';
private $colorSpace = 'default';
private $logLevel = 'info';
private $frameRange = null;
private $timeoutInMilliseconds = 30000;
private $chromiumOptions = null;
private $scale = 1;
private $everyNthFrame = 1;
private $numberOfGifLoops = 0;
private $concurrencyPerLambda = 1;
private $downloadBehavior = [
protected $data = null;
protected $bucketName = null;
protected $region = null;
protected $outName = null;
protected $composition = null;
protected $serverUrl = null;
protected $framesPerLambda = null;

protected $codec = 'h264';
protected $version = "";
protected $imageFormat = 'jpeg';
protected $crf = null;
protected $envVariables = [];
protected $maxRetries = 1;
protected $jpegQuality = 80;
protected $privacy = 'privacy';
protected $colorSpace = 'default';
protected $logLevel = 'info';
protected $frameRange = null;
protected $timeoutInMilliseconds = 30000;
protected $chromiumOptions = null;
protected $scale = 1;
protected $everyNthFrame = 1;
protected $numberOfGifLoops = 0;
protected $concurrencyPerLambda = 1;
protected $downloadBehavior = [
'type' => 'play-in-browser',
];
private $muted = false;
private $preferLossless = false;
private $overwrite = false;
private $audioBitrate = null;
private $videoBitrate = null;
private $encodingBufferSize = null;
private $maxRate = null;
private $webhook = null;
private $forceHeight = null;
private $forceWidth = null;
private $offthreadVideoCacheSizeInBytes = null;
private $audioCodec = null;
private $rendererFunctionName = null;
private $proResProfile = null;
private $pixelFormat = null;
private $x264Preset = null;
private $deleteAfter = null;
protected $muted = false;
protected $preferLossless = false;
protected $overwrite = false;
protected $audioBitrate = null;
protected $videoBitrate = null;
protected $encodingBufferSize = null;
protected $maxRate = null;
protected $webhook = null;
protected $forceHeight = null;
protected $forceWidth = null;
protected $offthreadVideoCacheSizeInBytes = null;
protected $audioCodec = null;
protected $rendererFunctionName = null;
protected $proResProfile = null;
protected $pixelFormat = null;
protected $x264Preset = null;
protected $deleteAfter = null;

public function __construct(
?array $data = null,
?array $data = null,
?string $composition = 'main',
string $codec = 'h264',
string $codec = 'h264',
?string $version = null,
string $imageFormat = 'jpeg',
?int $crf = null,
?array $envVariables = null,
int $maxRetries = 1,
int $jpegQuality = 80,
string $privacy = 'public',
string $colorSpace = 'default',
string $logLevel = 'info',
string $imageFormat = 'jpeg',
?int $crf = null,
?array $envVariables = null,
int $maxRetries = 1,
int $jpegQuality = 80,
string $privacy = 'public',
string $colorSpace = 'default',
string $logLevel = 'info',
?string $frameRange = null,
?string $outName = null,
?int $timeoutInMilliseconds = 30000,
?object $chromiumOptions = null,
?int $scale = 1,
?int $everyNthFrame = 1,
?int $numberOfGifLoops = 0,
?int $concurrencyPerLambda = 1,
?array $downloadBehavior = null,
?bool $muted = false,
?bool $overwrite = false,
?int $audioBitrate = null,
?int $videoBitrate = null,
?string $webhook = null,
?int $forceHeight = null,
?int $forceWidth = null,
?int $offthreadVideoCacheSizeInBytes = null,
?string $audioCodec = null,
?int $framesPerLambda = null,
?string $rendererFunctionName = null,
?string $proResProfile = null,
?int $timeoutInMilliseconds = 30000,
?object $chromiumOptions = null,
?int $scale = 1,
?int $everyNthFrame = 1,
?int $numberOfGifLoops = 0,
?int $concurrencyPerLambda = 1,
?array $downloadBehavior = null,
?bool $muted = false,
?bool $overwrite = false,
?int $audioBitrate = null,
?int $videoBitrate = null,
?string $webhook = null,
?int $forceHeight = null,
?int $forceWidth = null,
?int $offthreadVideoCacheSizeInBytes = null,
?string $audioCodec = null,
?int $framesPerLambda = null,
?string $rendererFunctionName = null,
?string $proResProfile = null,
?string $pixelFormat = null,
?string $x264Preset = null,
?string $deleteAfter = null,
?string $encodingBufferSize = null,
?string $maxRate = null,
?bool $preferLossless = false
)
?bool $preferLossless = false
)
{
if ($chromiumOptions === null) {
$this->chromiumOptions = new stdClass();
Expand Down Expand Up @@ -150,6 +140,7 @@ public function __construct(
}

private array $inputProps = array();

public function serializeParams()
{
$parameters = [
Expand All @@ -176,7 +167,7 @@ public function serializeParams()
'downloadBehavior' => $this->getDownloadBehavior(),
'muted' => $this->getMuted(),
'preferLossless' => $this->getPreferLossless(),
'version' => VERSION,
'version' => Semantic::VERSION,
'overwrite' => $this->getOverwrite(),
'audioBitrate' => $this->getAudioBitrate(),
'videoBitrate' => $this->getVideoBitrate(),
Expand Down Expand Up @@ -451,7 +442,7 @@ public function setMaxRetries($maxRetries)
return $this;
}

/**
/**
* Get the value of jpegQuality
*/
public function getJpegQuality()
Expand Down Expand Up @@ -491,7 +482,7 @@ public function setPrivacy($privacy)
return $this;
}

/**
/**
* Get the value of colorspace
*/
public function getColorSpace()
Expand Down Expand Up @@ -530,6 +521,7 @@ public function setLogLevel($logLevel)

return $this;
}

// Setter methods
public function setFrameRange($frameRange)
{
Expand Down Expand Up @@ -627,6 +619,7 @@ public function setMuted($muted)
{
$this->muted = $muted;
}

// Setter methods
public function setPreferLossless($preferLossless)
{
Expand Down Expand Up @@ -718,6 +711,7 @@ public function getForceWidth()
{
return $this->forceWidth;
}

public function getOffthreadVideoCacheSizeInBytes()
{
return $this->offthreadVideoCacheSizeInBytes;
Expand Down Expand Up @@ -850,8 +844,8 @@ public function getX264Preset()

public function setX264Preset($x264Preset)
{
$this->x264Preset = $x264Preset;
return $this;
$this->x264Preset = $x264Preset;
return $this;
}

public function getDeleteAfter()
Expand All @@ -861,7 +855,7 @@ public function getDeleteAfter()

public function setDeleteAfter($deleteAfter)
{
$this->$deleteAfter = $deleteAfter;
return $this;
$this->deleteAfter = $deleteAfter;
return $this;
}
}
8 changes: 8 additions & 0 deletions src/Semantic.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace Remotion\LambdaPhp;

class Semantic
{
public const VERSION = "4.0.145";
}
4 changes: 3 additions & 1 deletion src/Exceptions.php → src/ValidationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
use Exception;

class ValidationException extends Exception
{}
{
// Do Nothing
}
4 changes: 0 additions & 4 deletions src/Version.php

This file was deleted.

4 changes: 1 addition & 3 deletions src/PHPClientTest.php → tests/PHPClientTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';
require_once __DIR__ . '/PHPClient.php';
require_once __DIR__ . '/RenderParams.php';
namespace Remotion\LambdaPhp\Tests;

use PHPUnit\Framework\TestCase;
use Remotion\LambdaPhp\PHPClient;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';
require_once __DIR__ . '/PHPClient.php';
require_once __DIR__ . '/RenderParams.php';
namespace Remotion\LambdaPhp\Tests;

use PHPUnit\Framework\TestCase;
use Remotion\LambdaPhp\PHPClient;
use Remotion\LambdaPhp\RenderParams;

class PHPRenderProgressTest extends TestCase
{
Expand Down