for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Soluble\MediaTools\Preset\WebM;
use Soluble\MediaTools\Preset\PresetInterface;
use Soluble\MediaTools\Video\VideoAnalyzerInterface;
use Soluble\MediaTools\Video\VideoConverterInterface;
use Soluble\MediaTools\Video\VideoConvertParams;
use Soluble\MediaTools\Video\VideoInfoReaderInterface;
class GoogleVod2019Preset implements PresetInterface
{
/** @var VideoInfoReaderInterface */
private $reader;
/** @var VideoConverterInterface */
private $converter;
/** @var VideoAnalyzerInterface */
private $analyzer;
public function __construct(VideoInfoReaderInterface $reader, VideoConverterInterface $converter, VideoAnalyzerInterface $analyzer)
$this->converter = $converter;
$this->reader = $reader;
$this->analyzer = $analyzer;
}
public function getName(): string
return __CLASS__;
public function convert(string $file, ?int $width = null, ?int $height = null): void
$info = $this->reader->getInfo($file);
$vStream = $info->getVideoStreams()->getFirst();
$aStream = $info->getAudioStreams()->getFirst();
$aStream
$width = $width ?? $vStream->getWidth();
$height = $height ?? $vStream->getHeight();
$params = $this->getParams($width, $height);
$params
public function getParams(int $width, int $height): VideoConvertParams
$width
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function getParams(/** @scrutinizer ignore-unused */ int $width, int $height): VideoConvertParams
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
$height
public function getParams(int $width, /** @scrutinizer ignore-unused */ int $height): VideoConvertParams
$params = (new VideoConvertParams())
->withVideoCodec('vp9');
return $params;