diff --git a/README.md b/README.md index 0743da1..cbce339 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Is an implementation of CasparCG 2.0 AMCP Protocol and OSC Protocol Requirements ----- - - CasparCG v2.0.7 + - CasparCG v2.0.7|v2.3.0 - PHP 7.0 Installation diff --git a/composer.json b/composer.json index 7ad40e7..c9155aa 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "minimum-stability": "dev", "prefer-stable": true, "require": { - "php": "^7.0" + "php": ">=7.0" }, "autoload": { "psr-4": { diff --git a/src/Command/Basic/Builder/AddBuilder.php b/src/Command/Basic/Builder/AddBuilder.php index 4babea3..27d10af 100644 --- a/src/Command/Basic/Builder/AddBuilder.php +++ b/src/Command/Basic/Builder/AddBuilder.php @@ -1,4 +1,5 @@ deckLink) { - return 'DECKLINK ' . $this->deckLink; + return 'DECKLINK '.$this->deckLink; } return ''; @@ -123,7 +124,7 @@ protected function buildDeckLink(): string protected function buildBluefish(): string { if ($this->bluefish) { - return 'BLUEFISH ' . $this->bluefish; + return 'BLUEFISH '.$this->bluefish; } return ''; @@ -150,7 +151,7 @@ public function buildAudio(): string public function buildImage() { if ($this->image) { - return 'IMAGE ' . $this->image; + return 'IMAGE '.$this->image; } return ''; @@ -159,10 +160,10 @@ public function buildImage() public function buildFile(): string { if ($this->file) { - $result = 'FILE ' . $this->file; + $result = 'FILE '.$this->file; if ($this->separateKey) { - $result = $result . ' SEPARATE_KEY'; + $result = $result.' SEPARATE_KEY'; } return $result; @@ -174,10 +175,10 @@ public function buildFile(): string public function buildStream(): string { if ($this->stream) { - $result = 'STREAM ' . $this->stream; + $result = 'STREAM '.$this->stream; if ($this->streamArgs) { - $result = $result . ' ' . $this->streamArgs; + $result .= ' '.$this->streamArgs; } return $result; @@ -189,7 +190,7 @@ public function buildStream(): string /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $commandParts[] = 'ADD'; $commandParts[] = $this->buildChannel(); @@ -202,7 +203,7 @@ public function build(): string $this->buildAudio(), $this->buildImage(), $this->buildFile(), - $this->buildStream() + $this->buildStream(), ]; $consumerCommandPart = null; @@ -210,7 +211,7 @@ public function build(): string foreach ($consumerBuilders as $consumerBuilder) { $consumer = $consumerBuilder; - if (strlen($consumer)) { + if ('' !== $consumer) { $consumerCommandPart = $consumer; } } @@ -222,9 +223,8 @@ public function build(): string $commandParts[] = $consumerCommandPart; $commandParts = array_filter($commandParts); - $command = join(' ', $commandParts); - return $command; + return implode(' ', $commandParts); } #endregion diff --git a/src/Command/Basic/Builder/CallBuilder.php b/src/Command/Basic/Builder/CallBuilder.php index 644e80b..7ca4b4a 100644 --- a/src/Command/Basic/Builder/CallBuilder.php +++ b/src/Command/Basic/Builder/CallBuilder.php @@ -1,8 +1,12 @@ invoke = $command; @@ -40,19 +37,21 @@ public function invoke(string $command): CallBuilder #region builders - protected function buildInvoke(): string + protected function buildInvoke(bool $legacy): string { - return null !== $this->invoke ? sprintf('INVOKE "%s"', addslashes($this->invoke)) : ''; + $invoke = $legacy ? 'INVOKE' : ''; + + return null !== $this->invoke ? sprintf('%s "%s"', $invoke, addslashes($this->invoke)) : ''; } /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $commandParts[] = 'CALL'; $commandParts[] = $this->buildChannel(); - $commandParts[] = $this->buildInvoke(); + $commandParts[] = $this->buildInvoke($legacy); $commandParts[] = $this->buildLoop(); $commandParts[] = $this->buildTransitionGroup(); $commandParts[] = $this->buildSeek(); @@ -61,9 +60,8 @@ public function build(): string $commandParts[] = $this->buildAuto(); $commandParts = array_filter($commandParts); - $command = join(' ', $commandParts); - return $command; + return implode(' ', $commandParts); } #endregion diff --git a/src/Command/Basic/Builder/ClearBuilder.php b/src/Command/Basic/Builder/ClearBuilder.php index af6f5b1..ae8818b 100644 --- a/src/Command/Basic/Builder/ClearBuilder.php +++ b/src/Command/Basic/Builder/ClearBuilder.php @@ -3,6 +3,9 @@ namespace CosmonovaRnD\CasparCG\Command\Basic\Builder; +use function array_filter; +use function implode; + /** * Class ClearBuilder * @@ -17,14 +20,13 @@ class ClearBuilder extends BaseBuilder /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $commandParts[] = 'CLEAR'; $commandParts[] = $this->buildChannel(); $commandParts = array_filter($commandParts); - $command = join(' ', $commandParts); - return $command; + return implode(' ', $commandParts); } } diff --git a/src/Command/Basic/Builder/LoadBgBuilder.php b/src/Command/Basic/Builder/LoadBgBuilder.php index c7e16ad..10f039e 100644 --- a/src/Command/Basic/Builder/LoadBgBuilder.php +++ b/src/Command/Basic/Builder/LoadBgBuilder.php @@ -109,7 +109,7 @@ public function loop($loop = true): ExtendBuilderInterface public function transition(string $transition): ExtendBuilderInterface { if (!in_array(strtoupper($transition), static::transitionTypes())) { - $message = 'Transition must be one of the following values: ' . join(',', static::transitionTypes()); + $message = 'Transition must be one of the following values: ' . implode(',', static::transitionTypes()); throw new ParamException($message); } @@ -138,7 +138,7 @@ public function duration(int $duration): ExtendBuilderInterface public function tween(string $tween): ExtendBuilderInterface { if (!in_array($tween, Tween::animationTypes())) { - $message = 'Tween param must be one of the following values: ' . join(',', Tween::animationTypes()); + $message = 'Tween param must be one of the following values: ' . implode(',', Tween::animationTypes()); throw new ParamException($message); } @@ -155,7 +155,7 @@ public function direction(string $direction): ExtendBuilderInterface $directions = [self::DIRECTION_LEFT, self::DIRECTION_RIGHT]; if (!in_array(strtoupper($direction), $directions)) { - $message = 'Direction must be one of the following values: ' . join(',', $directions); + $message = 'Direction must be one of the following values: ' . implode(',', $directions); throw new ParamException($message); } @@ -261,9 +261,8 @@ protected function buildTransitionGroup(): string $transitionParts[] = $this->direction; $transitionParts = array_filter($transitionParts); - $transition = join(' ', $transitionParts); - return $transition; + return implode(' ', $transitionParts); } return ''; @@ -338,7 +337,7 @@ protected function buildAuto(): string /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $commandParts[] = 'LOADBG'; $commandParts[] = $this->buildChannel(); @@ -353,9 +352,8 @@ public function build(): string $commandParts = array_filter($commandParts); - $command = join(' ', $commandParts); - return $command; + return implode(' ', $commandParts); } #endregion diff --git a/src/Command/Basic/Builder/LoadBuilder.php b/src/Command/Basic/Builder/LoadBuilder.php index 6ad197d..6c950d1 100644 --- a/src/Command/Basic/Builder/LoadBuilder.php +++ b/src/Command/Basic/Builder/LoadBuilder.php @@ -17,7 +17,7 @@ class LoadBuilder extends LoadBgBuilder /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $commandParts[] = 'LOAD'; $commandParts[] = $this->buildChannel(); @@ -31,8 +31,7 @@ public function build(): string $commandParts = array_filter($commandParts); - $command = join(' ', $commandParts); - return $command; + return implode(' ', $commandParts); } } diff --git a/src/Command/Basic/Builder/PauseBuilder.php b/src/Command/Basic/Builder/PauseBuilder.php index b0006da..071ba8f 100644 --- a/src/Command/Basic/Builder/PauseBuilder.php +++ b/src/Command/Basic/Builder/PauseBuilder.php @@ -17,14 +17,13 @@ class PauseBuilder extends BaseBuilder /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $commandParts[] = 'PAUSE'; $commandParts[] = $this->buildChannel(); $commandParts = array_filter($commandParts); - $command = join(' ', $commandParts); - return $command; + return implode(' ', $commandParts); } } diff --git a/src/Command/Basic/Builder/PlayBuilder.php b/src/Command/Basic/Builder/PlayBuilder.php index 10c5b4b..db4b0fc 100644 --- a/src/Command/Basic/Builder/PlayBuilder.php +++ b/src/Command/Basic/Builder/PlayBuilder.php @@ -25,7 +25,7 @@ protected function buildClip(): string /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $commandParts[] = 'PLAY'; $commandParts[] = $this->buildChannel(); @@ -40,9 +40,8 @@ public function build(): string $commandParts = array_filter($commandParts); - $command = join(' ', $commandParts); - return $command; + return implode(' ', $commandParts); } } diff --git a/src/Command/Basic/Builder/RemoveBuilder.php b/src/Command/Basic/Builder/RemoveBuilder.php index d7ef161..e8da2f9 100644 --- a/src/Command/Basic/Builder/RemoveBuilder.php +++ b/src/Command/Basic/Builder/RemoveBuilder.php @@ -148,9 +148,7 @@ public function buildImage() public function buildFile(): string { if ($this->file) { - $result = 'FILE ' . $this->file; - - return $result; + return 'FILE ' . $this->file; } return ''; @@ -159,9 +157,7 @@ public function buildFile(): string public function buildStream(): string { if ($this->stream) { - $result = 'STREAM ' . $this->stream; - - return $result; + return 'STREAM ' . $this->stream; } return ''; @@ -170,7 +166,7 @@ public function buildStream(): string /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $commandParts[] = 'REMOVE'; $commandParts[] = $this->buildChannel(); @@ -191,7 +187,7 @@ public function build(): string foreach ($consumerBuilders as $consumerBuilder) { $consumer = $consumerBuilder; - if (strlen($consumer)) { + if ('' !== $consumer) { $consumerCommandPart = $consumer; } } @@ -203,9 +199,8 @@ public function build(): string $commandParts[] = $consumerCommandPart; $commandParts = array_filter($commandParts); - $command = join(' ', $commandParts); - return $command; + return implode(' ', $commandParts); } #endregion diff --git a/src/Command/Basic/Builder/ResumeBuilder.php b/src/Command/Basic/Builder/ResumeBuilder.php index f2a40c5..fcb501b 100644 --- a/src/Command/Basic/Builder/ResumeBuilder.php +++ b/src/Command/Basic/Builder/ResumeBuilder.php @@ -17,14 +17,13 @@ class ResumeBuilder extends BaseBuilder /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $commandParts[] = 'RESUME'; $commandParts[] = $this->buildChannel(); $commandParts = array_filter($commandParts); - $command = join(' ', $commandParts); - return $command; + return implode(' ', $commandParts); } } diff --git a/src/Command/Basic/Builder/SetBuilder.php b/src/Command/Basic/Builder/SetBuilder.php index 3aaa9d5..e8b79f9 100644 --- a/src/Command/Basic/Builder/SetBuilder.php +++ b/src/Command/Basic/Builder/SetBuilder.php @@ -1,4 +1,5 @@ buildChannel(); $commandParts[] = $this->buildMode(); $commandParts = array_filter($commandParts); - $command = join(' ', $commandParts); - return $command; + return implode(' ', $commandParts); } #endregion diff --git a/src/Command/Basic/Builder/StopBuilder.php b/src/Command/Basic/Builder/StopBuilder.php index f2dc874..c625c55 100644 --- a/src/Command/Basic/Builder/StopBuilder.php +++ b/src/Command/Basic/Builder/StopBuilder.php @@ -17,14 +17,13 @@ class StopBuilder extends BaseBuilder /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $commandParts[] = 'STOP'; $commandParts[] = $this->buildChannel(); $commandParts = array_filter($commandParts); - $command = join(' ', $commandParts); - return $command; + return implode(' ', $commandParts); } } diff --git a/src/Command/Basic/Builder/SwapBuilder.php b/src/Command/Basic/Builder/SwapBuilder.php index 953e45b..3393078 100644 --- a/src/Command/Basic/Builder/SwapBuilder.php +++ b/src/Command/Basic/Builder/SwapBuilder.php @@ -77,22 +77,21 @@ protected function buildSwapChannel(): string $swapChannel = [$this->swapChannel, $this->swapLayer]; $swapChannel = array_filter($swapChannel); - return join('-', $swapChannel); + return implode('-', $swapChannel); } /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $commandParts[] = 'SWAP'; $commandParts[] = $this->buildChannel(); $commandParts[] = $this->buildSwapChannel(); $commandParts = array_filter($commandParts); - $command = join(' ', $commandParts); - return $command; + return implode(' ', $commandParts); } #endregion diff --git a/src/Command/CommandBuilderInterface.php b/src/Command/CommandBuilderInterface.php index 0e102a1..0c24ac7 100644 --- a/src/Command/CommandBuilderInterface.php +++ b/src/Command/CommandBuilderInterface.php @@ -14,7 +14,8 @@ interface CommandBuilderInterface { /** * Build and return command + * @param bool $legacy set 'true' to use v2.0.7 CasparCG version * @return string */ - public function build(): string; + public function build(bool $legacy = false): string; } diff --git a/src/Command/Mixer/Builder/AnchorBuilder.php b/src/Command/Mixer/Builder/AnchorBuilder.php index b58897c..bf17543 100644 --- a/src/Command/Mixer/Builder/AnchorBuilder.php +++ b/src/Command/Mixer/Builder/AnchorBuilder.php @@ -65,13 +65,13 @@ protected function buildCoordinates(): string $parts = [$this->x, $this->y]; array_filter($parts); - return join(' ', $parts); + return implode(' ', $parts); } /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $channelAndLayer = $this->buildChannel(); $coordinates = $this->buildCoordinates(); diff --git a/src/Command/Mixer/Builder/BlendBuilder.php b/src/Command/Mixer/Builder/BlendBuilder.php index dddc87a..08ee7a7 100644 --- a/src/Command/Mixer/Builder/BlendBuilder.php +++ b/src/Command/Mixer/Builder/BlendBuilder.php @@ -74,7 +74,7 @@ public function blendMode(string $mode): BlendBuilder /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $channelAndLayer = $this->buildChannel(); diff --git a/src/Command/Mixer/Builder/BrightnessBuilder.php b/src/Command/Mixer/Builder/BrightnessBuilder.php index fcde8e5..05432f9 100644 --- a/src/Command/Mixer/Builder/BrightnessBuilder.php +++ b/src/Command/Mixer/Builder/BrightnessBuilder.php @@ -85,7 +85,7 @@ public function animation(string $type): BrightnessBuilder /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $channelAndLayer = $this->buildChannel(); diff --git a/src/Command/Mixer/Builder/ChromaBuilder.php b/src/Command/Mixer/Builder/ChromaBuilder.php index 15d58d1..b517d38 100644 --- a/src/Command/Mixer/Builder/ChromaBuilder.php +++ b/src/Command/Mixer/Builder/ChromaBuilder.php @@ -77,7 +77,7 @@ protected function buildTresholds(): string #endregion - public function build(): string + public function build(bool $legacy = false): string { $channelAndLayer = $this->buildChannel(); diff --git a/src/Command/Mixer/Builder/ClearBuilder.php b/src/Command/Mixer/Builder/ClearBuilder.php index f8f3459..21e65aa 100644 --- a/src/Command/Mixer/Builder/ClearBuilder.php +++ b/src/Command/Mixer/Builder/ClearBuilder.php @@ -19,7 +19,7 @@ class ClearBuilder extends BaseBuilder /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $channelAndLayer = $this->buildChannel(); diff --git a/src/Command/Mixer/Builder/ClipBuilder.php b/src/Command/Mixer/Builder/ClipBuilder.php index 2bdd623..05be0fa 100644 --- a/src/Command/Mixer/Builder/ClipBuilder.php +++ b/src/Command/Mixer/Builder/ClipBuilder.php @@ -131,7 +131,7 @@ protected function buildCoordinates(): string $parts = [$this->x, $this->y]; array_filter($parts); - return join(' ', $parts); + return implode(' ', $parts); } /** @@ -142,13 +142,13 @@ protected function buildSize(): string $parts = [$this->width, $this->height]; array_filter($parts); - return join(' ', $parts); + return implode(' ', $parts); } /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $channelAndLayer = $this->buildChannel(); $coordinates = $this->buildCoordinates(); @@ -156,7 +156,7 @@ public function build(): string $tail = ''; - if (strlen($coordinates) && strlen($size)) { + if ('' !== $coordinates && '' !== $size) { $tail = "$coordinates $size {$this->duration} {$this->animation}"; } diff --git a/src/Command/Mixer/Builder/ContrastBuilder.php b/src/Command/Mixer/Builder/ContrastBuilder.php index 90002ec..f3cb931 100644 --- a/src/Command/Mixer/Builder/ContrastBuilder.php +++ b/src/Command/Mixer/Builder/ContrastBuilder.php @@ -85,7 +85,7 @@ public function animation(string $type): ContrastBuilder /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $channelAndLayer = $this->buildChannel(); diff --git a/src/Command/Mixer/Builder/CropBuilder.php b/src/Command/Mixer/Builder/CropBuilder.php index 76a3a16..65fd252 100644 --- a/src/Command/Mixer/Builder/CropBuilder.php +++ b/src/Command/Mixer/Builder/CropBuilder.php @@ -130,7 +130,7 @@ protected function buildLeftTop(): string $parts = [$this->xLeft, $this->yTop]; array_filter($parts); - return join(' ', $parts); + return implode(' ', $parts); } /** @@ -141,13 +141,13 @@ protected function buildRightBottom(): string $parts = [$this->xRight, $this->yBottom]; array_filter($parts); - return join(' ', $parts); + return implode(' ', $parts); } /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $channelAndLayer = $this->buildChannel(); $leftTop = $this->buildLeftTop(); @@ -155,7 +155,7 @@ public function build(): string $tail = ''; - if (strlen($leftTop) && strlen($rightBottom)) { + if ('' !== $leftTop && '' !== $rightBottom) { $tail = "$leftTop $rightBottom {$this->duration} {$this->animation}"; } diff --git a/src/Command/Mixer/Builder/FillBuilder.php b/src/Command/Mixer/Builder/FillBuilder.php index 17414de..7cd5d74 100644 --- a/src/Command/Mixer/Builder/FillBuilder.php +++ b/src/Command/Mixer/Builder/FillBuilder.php @@ -131,7 +131,7 @@ protected function buildCoordinates(): string $parts = [$this->x, $this->y]; array_filter($parts); - return join(' ', $parts); + return implode(' ', $parts); } /** @@ -142,13 +142,13 @@ protected function buildSize(): string $parts = [$this->width, $this->height]; array_filter($parts); - return join(' ', $parts); + return implode(' ', $parts); } /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $channelAndLayer = $this->buildChannel(); $coordinates = $this->buildCoordinates(); @@ -156,7 +156,7 @@ public function build(): string $tail = ''; - if (strlen($coordinates) && strlen($size)) { + if ('' !== $coordinates && '' !== $size) { $tail = "$coordinates $size {$this->duration} {$this->animation}"; } diff --git a/src/Command/Mixer/Builder/GridBuilder.php b/src/Command/Mixer/Builder/GridBuilder.php index 36726f0..ba1b483 100644 --- a/src/Command/Mixer/Builder/GridBuilder.php +++ b/src/Command/Mixer/Builder/GridBuilder.php @@ -111,7 +111,7 @@ protected function buildChannel(): string /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $channel = $this->buildChannel(); diff --git a/src/Command/Mixer/Builder/KeyerBuilder.php b/src/Command/Mixer/Builder/KeyerBuilder.php index 1314097..9602e3e 100644 --- a/src/Command/Mixer/Builder/KeyerBuilder.php +++ b/src/Command/Mixer/Builder/KeyerBuilder.php @@ -42,7 +42,7 @@ public function keyerDisabled(): KeyerBuilder /** * @inheritdoc */ - public function build(): string + public function build(bool $legacy = false): string { $chanelAndLayer = $this->buildChannel(); $keyer = $this->keyer ? 1 : 0; diff --git a/src/Command/Mixer/Builder/LevelsBuilder.php b/src/Command/Mixer/Builder/LevelsBuilder.php index 1b60e63..d45762d 100644 --- a/src/Command/Mixer/Builder/LevelsBuilder.php +++ b/src/Command/Mixer/Builder/LevelsBuilder.php @@ -62,7 +62,7 @@ public function input(float $min, float $max): LevelsBuilder $this->validateValueRange($max); $this->minInput = $min; - $this->minInput = $max; + $this->maxInput = $max; return $this; } @@ -165,7 +165,7 @@ protected function buildLevelParams(): string /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $channelAndLayer = $this->buildChannel(); $levelParamStr = $this->buildLevelParams(); diff --git a/src/Command/Mixer/Builder/MasterVolumeBuilder.php b/src/Command/Mixer/Builder/MasterVolumeBuilder.php index 36792da..85df1a5 100644 --- a/src/Command/Mixer/Builder/MasterVolumeBuilder.php +++ b/src/Command/Mixer/Builder/MasterVolumeBuilder.php @@ -76,7 +76,7 @@ protected function buildChannel(): string /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $channel = $this->buildChannel(); diff --git a/src/Command/Mixer/Builder/OpacityBuilder.php b/src/Command/Mixer/Builder/OpacityBuilder.php index 443350d..a66b8ea 100644 --- a/src/Command/Mixer/Builder/OpacityBuilder.php +++ b/src/Command/Mixer/Builder/OpacityBuilder.php @@ -75,7 +75,7 @@ public function animation(string $type): OpacityBuilder /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $channelAndLayer = $this->buildChannel(); diff --git a/src/Command/Mixer/Builder/PerspectiveBuilder.php b/src/Command/Mixer/Builder/PerspectiveBuilder.php index 16b9d19..7cb12b8 100644 --- a/src/Command/Mixer/Builder/PerspectiveBuilder.php +++ b/src/Command/Mixer/Builder/PerspectiveBuilder.php @@ -134,7 +134,7 @@ protected function toStr($x, $y): string $parts = [$x, $y]; array_filter($parts); - return join(' ', $parts); + return implode(' ', $parts); } /** @@ -172,7 +172,7 @@ protected function buildBottomLeft(): string /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $channelAndLayer = $this->buildChannel(); $topLeft = $this->buildTopLeft(); @@ -182,7 +182,7 @@ public function build(): string $tail = ''; - if (strlen($topLeft) && strlen($topRight) && strlen($bottomRight) && strlen($bottomLeft)) { + if ('' !== $topLeft && '' !== $topRight && '' !== $bottomRight && '' !== $bottomLeft) { $tail = "$topLeft $topRight $bottomRight $bottomLeft"; } diff --git a/src/Command/Mixer/Builder/RotationBuilder.php b/src/Command/Mixer/Builder/RotationBuilder.php index c1264e8..843a2bc 100644 --- a/src/Command/Mixer/Builder/RotationBuilder.php +++ b/src/Command/Mixer/Builder/RotationBuilder.php @@ -36,7 +36,7 @@ public function angle(int $value): RotationBuilder /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $channelAndLayer = $this->buildChannel(); diff --git a/src/Command/Mixer/Builder/SaturationBuilder.php b/src/Command/Mixer/Builder/SaturationBuilder.php index 0342054..e3582c9 100644 --- a/src/Command/Mixer/Builder/SaturationBuilder.php +++ b/src/Command/Mixer/Builder/SaturationBuilder.php @@ -85,7 +85,7 @@ public function animation(string $type): SaturationBuilder /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $channelAndLayer = $this->buildChannel(); diff --git a/src/Command/Mixer/Builder/StraightAlphaOutputBuilder.php b/src/Command/Mixer/Builder/StraightAlphaOutputBuilder.php index c0efdf6..a1ada2a 100644 --- a/src/Command/Mixer/Builder/StraightAlphaOutputBuilder.php +++ b/src/Command/Mixer/Builder/StraightAlphaOutputBuilder.php @@ -85,15 +85,15 @@ protected function buildActiveState(): string { if (null === $this->active) { return ''; - } else { - return $this->active ? '1' : '0'; } + + return $this->active ? '1' : '0'; } /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $channel = $this->buildChannel(); $activeState = $this->buildActiveState(); diff --git a/src/Command/Mixer/Builder/VolumeBuilder.php b/src/Command/Mixer/Builder/VolumeBuilder.php index 60af529..b6ca9f2 100644 --- a/src/Command/Mixer/Builder/VolumeBuilder.php +++ b/src/Command/Mixer/Builder/VolumeBuilder.php @@ -85,7 +85,7 @@ public function animation(string $type): VolumeBuilder /** * @inheritDoc */ - public function build(): string + public function build(bool $legacy = false): string { $channelAndLayer = $this->buildChannel(); diff --git a/src/OSC/Converter.php b/src/OSC/Converter.php index 5ac75fb..812e8f9 100644 --- a/src/OSC/Converter.php +++ b/src/OSC/Converter.php @@ -78,7 +78,7 @@ public static function string(string $bin): string public static function char(string $bin): string { - $res = unpack('cval', substr($bin, 0, 1)); + $res = unpack('cval', $bin[0]); return $res['val']; } diff --git a/src/OSC/Message/Channel.php b/src/OSC/Message/Channel.php index 6b7f713..98b5a4d 100644 --- a/src/OSC/Message/Channel.php +++ b/src/OSC/Message/Channel.php @@ -38,7 +38,7 @@ public static function create(RawMessage $message) /** * @return int|null */ - public function getChannel(): ?int + public function getChannel() { return $this->channel; } diff --git a/src/OSC/Message/Channel/Format.php b/src/OSC/Message/Channel/Format.php index 2cf58a2..e7c354f 100644 --- a/src/OSC/Message/Channel/Format.php +++ b/src/OSC/Message/Channel/Format.php @@ -33,7 +33,7 @@ public function parseArguments(RawMessage $message) /** * @return string|null */ - public function getValue(): ?string + public function getValue() { return $this->value; } diff --git a/src/OSC/Message/Channel/OutputFrameType.php b/src/OSC/Message/Channel/OutputFrameType.php index b2e76f4..9026367 100644 --- a/src/OSC/Message/Channel/OutputFrameType.php +++ b/src/OSC/Message/Channel/OutputFrameType.php @@ -31,7 +31,7 @@ public function parseArguments(RawMessage $message) /** * @return string|null */ - public function getValue(): ?string + public function getValue() { return $this->value; } diff --git a/src/OSC/Message/Channel/OutputPort.php b/src/OSC/Message/Channel/OutputPort.php index c9c406d..542cbe0 100644 --- a/src/OSC/Message/Channel/OutputPort.php +++ b/src/OSC/Message/Channel/OutputPort.php @@ -40,7 +40,7 @@ public static function create(RawMessage $message) /** * @return int|null */ - public function getPort(): ?int + public function getPort() { return $this->port; } diff --git a/src/OSC/Message/Channel/OutputPortFrame.php b/src/OSC/Message/Channel/OutputPortFrame.php index 92fde1d..1658788 100644 --- a/src/OSC/Message/Channel/OutputPortFrame.php +++ b/src/OSC/Message/Channel/OutputPortFrame.php @@ -36,7 +36,7 @@ public function parseArguments(RawMessage $message) * * @return int|null */ - public function getCurrentFrames(): ?int + public function getCurrentFrames() { return $this->currentFrames; } @@ -46,7 +46,7 @@ public function getCurrentFrames(): ?int * * @return int|null */ - public function getMaxFrames(): ?int + public function getMaxFrames() { return $this->maxFrames; } diff --git a/src/OSC/Message/Channel/ProfilerTime.php b/src/OSC/Message/Channel/ProfilerTime.php index d35f5c7..39ffe10 100644 --- a/src/OSC/Message/Channel/ProfilerTime.php +++ b/src/OSC/Message/Channel/ProfilerTime.php @@ -35,7 +35,7 @@ public function parseArguments(RawMessage $message) /** * @return float|null */ - public function getActual(): ?float + public function getActual() { return $this->actual; } @@ -43,7 +43,7 @@ public function getActual(): ?float /** * @return float|null */ - public function getExpected(): ?float + public function getExpected() { return $this->expected; } diff --git a/src/OSC/Message/Mixer/AudioDbFS.php b/src/OSC/Message/Mixer/AudioDbFS.php index f64c7a5..0b99cee 100644 --- a/src/OSC/Message/Mixer/AudioDbFS.php +++ b/src/OSC/Message/Mixer/AudioDbFS.php @@ -63,7 +63,7 @@ public function setNbChannel(int $nbChannel) * * @return int|null */ - public function getNbChannel(): ?int + public function getNbChannel() { return $this->nbChannel; } @@ -73,7 +73,7 @@ public function getNbChannel(): ?int * * @return float|null */ - public function getLevel(): ?float + public function getLevel() { return $this->level; } diff --git a/src/OSC/Message/Mixer/AudioNbChannels.php b/src/OSC/Message/Mixer/AudioNbChannels.php index d5b0970..bcba95b 100644 --- a/src/OSC/Message/Mixer/AudioNbChannels.php +++ b/src/OSC/Message/Mixer/AudioNbChannels.php @@ -34,7 +34,7 @@ public function parseArguments(RawMessage $message) * * @return int|null */ - public function getValue(): ?int + public function getValue() { return $this->value; } diff --git a/src/OSC/Message/Producer/FFmpeg/AudioChannels.php b/src/OSC/Message/Producer/FFmpeg/AudioChannels.php index f4f2927..29facc4 100644 --- a/src/OSC/Message/Producer/FFmpeg/AudioChannels.php +++ b/src/OSC/Message/Producer/FFmpeg/AudioChannels.php @@ -34,7 +34,7 @@ public function parseArguments(RawMessage $message) * * @return int|null */ - public function getValue(): ?int + public function getValue() { return $this->value; } diff --git a/src/OSC/Message/Producer/FFmpeg/AudioCodec.php b/src/OSC/Message/Producer/FFmpeg/AudioCodec.php index 6d3a2cf..a47cf34 100644 --- a/src/OSC/Message/Producer/FFmpeg/AudioCodec.php +++ b/src/OSC/Message/Producer/FFmpeg/AudioCodec.php @@ -34,7 +34,7 @@ public function parseArguments(RawMessage $message) * * @return string|null */ - public function getValue(): ?string + public function getValue() { return $this->value; } diff --git a/src/OSC/Message/Producer/FFmpeg/AudioFormat.php b/src/OSC/Message/Producer/FFmpeg/AudioFormat.php index 7fd6d40..c3a2e83 100644 --- a/src/OSC/Message/Producer/FFmpeg/AudioFormat.php +++ b/src/OSC/Message/Producer/FFmpeg/AudioFormat.php @@ -34,7 +34,7 @@ public function parseArguments(RawMessage $message) * * @return string|null */ - public function getValue(): ?string + public function getValue() { return $this->value; } diff --git a/src/OSC/Message/Producer/FFmpeg/AudioSampleRate.php b/src/OSC/Message/Producer/FFmpeg/AudioSampleRate.php index 56efead..ab8d7dd 100644 --- a/src/OSC/Message/Producer/FFmpeg/AudioSampleRate.php +++ b/src/OSC/Message/Producer/FFmpeg/AudioSampleRate.php @@ -34,7 +34,7 @@ public function parseArguments(RawMessage $message) * * @return int|null */ - public function getValue(): ?int + public function getValue() { return $this->value; } diff --git a/src/OSC/Message/Producer/FFmpeg/Fps.php b/src/OSC/Message/Producer/FFmpeg/Fps.php index d77c2d3..ce84208 100644 --- a/src/OSC/Message/Producer/FFmpeg/Fps.php +++ b/src/OSC/Message/Producer/FFmpeg/Fps.php @@ -34,7 +34,7 @@ public function parseArguments(RawMessage $message) * * @return float|null */ - public function getValue(): ?float + public function getValue() { return $this->value; } diff --git a/src/OSC/Message/Producer/FFmpeg/Frame.php b/src/OSC/Message/Producer/FFmpeg/Frame.php index 38a876c..b635298 100644 --- a/src/OSC/Message/Producer/FFmpeg/Frame.php +++ b/src/OSC/Message/Producer/FFmpeg/Frame.php @@ -37,7 +37,7 @@ public function parseArguments(RawMessage $message) * * @return int|null */ - public function getElapsed(): ?int + public function getElapsed() { return $this->elapsed; } @@ -47,7 +47,7 @@ public function getElapsed(): ?int * * @return int|null */ - public function getTotal(): ?int + public function getTotal() { return $this->total; } diff --git a/src/OSC/Message/Producer/FFmpeg/Loop.php b/src/OSC/Message/Producer/FFmpeg/Loop.php index 5c6b325..b079477 100644 --- a/src/OSC/Message/Producer/FFmpeg/Loop.php +++ b/src/OSC/Message/Producer/FFmpeg/Loop.php @@ -34,7 +34,7 @@ public function parseArguments(RawMessage $message) * * @return bool|null */ - public function getValue(): ?bool + public function getValue() { return $this->value; } diff --git a/src/OSC/Message/Producer/FFmpeg/Path.php b/src/OSC/Message/Producer/FFmpeg/Path.php index 64524e8..ec6e133 100644 --- a/src/OSC/Message/Producer/FFmpeg/Path.php +++ b/src/OSC/Message/Producer/FFmpeg/Path.php @@ -34,7 +34,7 @@ public function parseArguments(RawMessage $message) * * @return string|null */ - public function getValue(): ?string + public function getValue() { return $this->value; } diff --git a/src/OSC/Message/Producer/FFmpeg/Time.php b/src/OSC/Message/Producer/FFmpeg/Time.php index 77d42da..72c7f78 100644 --- a/src/OSC/Message/Producer/FFmpeg/Time.php +++ b/src/OSC/Message/Producer/FFmpeg/Time.php @@ -37,7 +37,7 @@ public function parseArguments(RawMessage $message) * * @return float */ - public function getElapsed(): ?float + public function getElapsed() { return $this->elapsed; } @@ -47,7 +47,7 @@ public function getElapsed(): ?float * * @return float|null */ - public function getTotal(): ?float + public function getTotal() { return $this->total; } diff --git a/src/OSC/Message/Producer/FFmpeg/VideoCodec.php b/src/OSC/Message/Producer/FFmpeg/VideoCodec.php index 640c622..9723a1b 100644 --- a/src/OSC/Message/Producer/FFmpeg/VideoCodec.php +++ b/src/OSC/Message/Producer/FFmpeg/VideoCodec.php @@ -34,7 +34,7 @@ public function parseArguments(RawMessage $message) * * @return string|null */ - public function getValue(): ?string + public function getValue() { return $this->value; } diff --git a/src/OSC/Message/Producer/FFmpeg/VideoField.php b/src/OSC/Message/Producer/FFmpeg/VideoField.php index 6693dc2..07434ba 100644 --- a/src/OSC/Message/Producer/FFmpeg/VideoField.php +++ b/src/OSC/Message/Producer/FFmpeg/VideoField.php @@ -34,7 +34,7 @@ public function parseArguments(RawMessage $message) * * @return string|null */ - public function getValue(): ?string + public function getValue() { return $this->value; } diff --git a/src/OSC/Message/Producer/FFmpeg/VideoHeight.php b/src/OSC/Message/Producer/FFmpeg/VideoHeight.php index 5b30063..ad7fc2d 100644 --- a/src/OSC/Message/Producer/FFmpeg/VideoHeight.php +++ b/src/OSC/Message/Producer/FFmpeg/VideoHeight.php @@ -34,7 +34,7 @@ public function parseArguments(RawMessage $message) * * @return int|null */ - public function getValue(): ?int + public function getValue() { return $this->value; } diff --git a/src/OSC/Message/Producer/FFmpeg/VideoWidth.php b/src/OSC/Message/Producer/FFmpeg/VideoWidth.php index a00ad49..9745ae3 100644 --- a/src/OSC/Message/Producer/FFmpeg/VideoWidth.php +++ b/src/OSC/Message/Producer/FFmpeg/VideoWidth.php @@ -34,7 +34,7 @@ public function parseArguments(RawMessage $message) * * @return int|null */ - public function getValue(): ?int + public function getValue() { return $this->value; } diff --git a/src/OSC/Message/Stage.php b/src/OSC/Message/Stage.php index d26b2ad..05c9c82 100644 --- a/src/OSC/Message/Stage.php +++ b/src/OSC/Message/Stage.php @@ -41,7 +41,7 @@ public static function create(RawMessage $message) * * @return int|null */ - public function getLayer(): ?int + public function getLayer() { return $this->layer; } diff --git a/src/OSC/Message/Stage/BackgroundType.php b/src/OSC/Message/Stage/BackgroundType.php index 6000169..70101b1 100644 --- a/src/OSC/Message/Stage/BackgroundType.php +++ b/src/OSC/Message/Stage/BackgroundType.php @@ -31,7 +31,7 @@ public function parseArguments(RawMessage $message) /** * @return string|null */ - public function getValue(): ?string + public function getValue() { return $this->value; } diff --git a/src/OSC/Message/Stage/Frame.php b/src/OSC/Message/Stage/Frame.php index 28e4d14..7678866 100644 --- a/src/OSC/Message/Stage/Frame.php +++ b/src/OSC/Message/Stage/Frame.php @@ -34,7 +34,7 @@ public function parseArguments(RawMessage $message) * * @return int|null */ - public function getValue(): ?int + public function getValue() { return $this->value; } diff --git a/src/OSC/Message/Stage/Paused.php b/src/OSC/Message/Stage/Paused.php index 602ff63..767f338 100644 --- a/src/OSC/Message/Stage/Paused.php +++ b/src/OSC/Message/Stage/Paused.php @@ -34,7 +34,7 @@ public function parseArguments(RawMessage $message) * * @return bool|null */ - public function isValue(): ?bool + public function isValue() { return $this->value; } diff --git a/src/OSC/Message/Stage/ProfilerTime.php b/src/OSC/Message/Stage/ProfilerTime.php index f7a9b55..4e37c6f 100644 --- a/src/OSC/Message/Stage/ProfilerTime.php +++ b/src/OSC/Message/Stage/ProfilerTime.php @@ -37,7 +37,7 @@ public function parseArguments(RawMessage $message) * * @return float|null */ - public function getActual(): ?float + public function getActual() { return $this->actual; } @@ -47,7 +47,7 @@ public function getActual(): ?float * * @return float|null */ - public function getExpected(): ?float + public function getExpected() { return $this->expected; } diff --git a/src/OSC/Message/Stage/Time.php b/src/OSC/Message/Stage/Time.php index f6bf78e..c4dc149 100644 --- a/src/OSC/Message/Stage/Time.php +++ b/src/OSC/Message/Stage/Time.php @@ -34,7 +34,7 @@ public function parseArguments(RawMessage $message) * * @return float|null */ - public function getValue(): ?float + public function getValue() { return $this->value; } diff --git a/src/OSC/Message/Stage/Type.php b/src/OSC/Message/Stage/Type.php index 436c4b7..a10fe90 100644 --- a/src/OSC/Message/Stage/Type.php +++ b/src/OSC/Message/Stage/Type.php @@ -34,7 +34,7 @@ public function parseArguments(RawMessage $message) * * @return string|null */ - public function getValue(): ?string + public function getValue() { return $this->value; }