for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of the InMemoryList package.
*
* (c) Mauro Cassani<https://github.com/mauretto78>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace InMemoryList\Domain\Helper;
class SerializeChecker
{
* @param $data
* @return bool
public static function isSerialized($data)
if (!is_string($data)) {
return false;
}
$data = trim($data);
if ('N;' === $data) {
return true;
if (!preg_match('/^([adObis]):/', $data, $badions)) {
switch ($badions[1]) {
case 'a':
case 'O':
case 's':
if (preg_match("/^{$badions[1]}:[0-9]+:.*[;}]\$/s", $data)) {
break;
case 'b':
case 'i':
case 'd':
if (preg_match("/^{$badions[1]}:[0-9.E-]+;\$/", $data)) {