Skip to content
Merged
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
34 changes: 16 additions & 18 deletions src/AnimatedGif.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*
* Code fragments used from: GIFEncoder Version 2.0 by László Zsidi
*/
class AnimatedGif implements \Serializable
class AnimatedGif
{

/**
Expand Down Expand Up @@ -278,32 +278,30 @@ public function getAnimation()
/**
* String representation of an AnimatedGif.
*
* @return string The string representation of the object or null.
* @return array The string representation of the object or null.
*/
public function serialize()
public function __serialize()
{
return serialize(
[
$this->outFilePath,
$this->width,
$this->height,
$this->frameRate,
$this->loopCount,
$this->gifData,
$this->frames,
$this->counter,
]
);
return [
$this->outFilePath,
$this->width,
$this->height,
$this->frameRate,
$this->loopCount,
$this->gifData,
$this->frames,
$this->counter,
];
}

/**
* Constructs the AnimatedGif.
*
* @param string $serialized The string representation of the object.
* @param array $serialized The string representation of the object.
*
* @return void
*/
public function unserialize($serialized)
public function __unserialize($serialized)
{
list(
$this->outFilePath,
Expand All @@ -314,6 +312,6 @@ public function unserialize($serialized)
$this->gifData,
$this->frames,
$this->counter
) = unserialize($serialized);
) = $serialized;
}
}
16 changes: 7 additions & 9 deletions src/Frame.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* Represents one frame from the movie.
*/
class Frame implements \Serializable
class Frame
{

protected static $EX_CODE_NO_VALID_RESOURCE = 334563;
Expand Down Expand Up @@ -198,34 +198,32 @@ public function getHeight()
/**
* Return string representation of a Frame.
*
* @return string The string representation of the object or null.
* @return array The string representation of the object or null.
*/
public function serialize()
public function __serialize()
{
$data = [
return [
$this->gdImageData,
$this->pts,
$this->width,
$this->height,
];

return serialize($data);
}

/**
* Constructs the Frame from serialized data.
*
* @param string $serialized The string representation of Frame instance.
* @param array $serialized The string representation of Frame instance.
*
* @return void
*/
public function unserialize($serialized)
public function __unserialize($serialized)
{
list(
$this->gdImageData,
$this->pts,
$this->width,
$this->height
) = unserialize($serialized);
) = $serialized;
}
}
30 changes: 13 additions & 17 deletions src/Movie.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/**
* Represents a movie file.
*/
class Movie implements \Serializable
class Movie
{

protected static $REGEX_DURATION = '/Duration: (\d{2}):(\d{2}):(\d{2})(\.(\d+))?/';
Expand Down Expand Up @@ -883,38 +883,34 @@ public function __clone()
/**
* String representation of a Movie.
*
* @return string Rhe string representation of the object or null.
* @return array Rhe string representation of the object or null.
*/
public function serialize()
public function __serialize()
{
$data = serialize(
[
$this->ffmpegBinary,
$this->movieFile,
$this->output,
$this->frameNumber,
$this->provider,
]
);

return $data;
return [
$this->ffmpegBinary,
$this->movieFile,
$this->output,
$this->frameNumber,
$this->provider,
];
}

/**
* Constructs the Movie from serialized data.
*
* @param string $serialized The string representation of Movie instance.
* @param array $serialized The string representation of Movie instance.
*
* @return void
*/
public function unserialize($serialized)
public function __unserialize($serialized)
{
list(
$this->ffmpegBinary,
$this->movieFile,
$this->output,
$this->frameNumber,
$this->provider
) = unserialize($serialized);
) = $serialized;
}
}
26 changes: 13 additions & 13 deletions src/OutputProviders/AbstractProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,33 @@
/**
* AbstractProvider parent of all output providers.
*/
abstract class AbstractProvider implements OutputProvider, \Serializable
abstract class AbstractProvider implements OutputProvider
{

protected static $EX_CODE_FILE_NOT_FOUND = 334561;
protected static $persistentBuffer = array();

/**
* Binary that returns info about movie file
*
* @var string
*/
protected $binary;

/**
* Movie File path
*
* @var string
*/
protected $movieFile;

/**
* Persistent functionality on/off
*
* @var boolean
*/
protected $persistent;

/**
* Base constructor for every provider
*
Expand All @@ -42,7 +42,7 @@ public function __construct($binary, $persistent)
$this->binary = $binary;
$this->persistent = $persistent;
}

/**
* Setting movie file path
*
Expand All @@ -52,22 +52,22 @@ public function setMovieFile($movieFile)
{
$this->movieFile = $movieFile;
}
public function serialize()

public function __serialize()
{
return serialize(array(
return [
$this->binary,
$this->movieFile,
$this->persistent
));
];
}
public function unserialize($serialized)

public function __unserialize($serialized)
{
list(
$this->binary,
$this->movieFile,
$this->persistent
) = unserialize($serialized);
) = $serialized;
}
}