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 /* * This file is part of PHP-FFmpeg. * * (c) Alchemy <[email protected]> * * Fo..
Decoded Output download
<?php
/*
* This file is part of PHP-FFmpeg.
*
* (c) Alchemy <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace FFMpeg\FFProbe\DataMapping;
use Traversable;
class StreamCollection implements \Countable, \IteratorAggregate
{
private $streams;
public function __construct(array $streams = [])
{
$this->streams = array_values($streams);
}
/**
* Returns the first stream of the collection, null if the collection is
* empty.
*
* @return Stream|null
*/
public function first()
{
$stream = reset($this->streams);
return $stream ?: null;
}
/**
* Adds a stream to the collection.
*
* @return StreamCollection
*/
public function add(Stream $stream)
{
$this->streams[] = $stream;
return $this;
}
/**
* Returns a new StreamCollection with only video streams.
*
* @return StreamCollection
*/
public function videos()
{
return new static(array_filter($this->streams, function (Stream $stream) {
return $stream->isVideo();
}));
}
/**
* Returns a new StreamCollection with only audio streams.
*
* @return StreamCollection
*/
public function audios()
{
return new static(array_filter($this->streams, function (Stream $stream) {
return $stream->isAudio();
}));
}
/**
* {@inheritdoc}
*/
public function count(): int
{
return count($this->streams);
}
/**
* Returns the array of contained streams.
*
* @return array
*/
public function all()
{
return $this->streams;
}
/**
* {@inheritdoc}
*/
public function getIterator(): Traversable
{
return new \ArrayIterator($this->streams);
}
}
?>
Did this file decode correctly?
Original Code
<?php
/*
* This file is part of PHP-FFmpeg.
*
* (c) Alchemy <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace FFMpeg\FFProbe\DataMapping;
use Traversable;
class StreamCollection implements \Countable, \IteratorAggregate
{
private $streams;
public function __construct(array $streams = [])
{
$this->streams = array_values($streams);
}
/**
* Returns the first stream of the collection, null if the collection is
* empty.
*
* @return Stream|null
*/
public function first()
{
$stream = reset($this->streams);
return $stream ?: null;
}
/**
* Adds a stream to the collection.
*
* @return StreamCollection
*/
public function add(Stream $stream)
{
$this->streams[] = $stream;
return $this;
}
/**
* Returns a new StreamCollection with only video streams.
*
* @return StreamCollection
*/
public function videos()
{
return new static(array_filter($this->streams, function (Stream $stream) {
return $stream->isVideo();
}));
}
/**
* Returns a new StreamCollection with only audio streams.
*
* @return StreamCollection
*/
public function audios()
{
return new static(array_filter($this->streams, function (Stream $stream) {
return $stream->isAudio();
}));
}
/**
* {@inheritdoc}
*/
public function count(): int
{
return count($this->streams);
}
/**
* Returns the array of contained streams.
*
* @return array
*/
public function all()
{
return $this->streams;
}
/**
* {@inheritdoc}
*/
public function getIterator(): Traversable
{
return new \ArrayIterator($this->streams);
}
}
Function Calls
None |
Stats
MD5 | 8bf30c3cb1979b79a65585ed528ad0b0 |
Eval Count | 0 |
Decode Time | 106 ms |