PHP Class JBZoo\Utils\Ser

Afficher le fichier Open project: jbzoo/utils Class Usage Examples

Méthodes publiques

Méthode Description
fix ( string $brokenSerializedData ) : string Unserializes partially-corrupted arrays that occur sometimes. Addresses specifically the unserialize(): Error at offset xxx of yyy bytes error.
is ( mixed $data ) : boolean Check value to find if it was serialized.
maybe ( mixed $data ) : mixed Serialize data, if needed.
maybeUn ( string $data ) : mixed Unserialize value only if it is serialized.

Méthodes protégées

Méthode Description
_checkBasic ( string $data, integer $length ) : boolean Check some basic requirements of all serialized strings

Method Details

_checkBasic() protected static méthode

Check some basic requirements of all serialized strings
protected static _checkBasic ( string $data, integer $length ) : boolean
$data string
$length integer
Résultat boolean

fix() public static méthode

NOTE: This error can *frequently* occur with mismatched character sets and higher-than-ASCII characters. Contributed by Theodore R. Smith of PHP Experts, Inc.
public static fix ( string $brokenSerializedData ) : string
$brokenSerializedData string
Résultat string

is() public static méthode

If $data is not an string, then returned value will always be false. Serialized data is always a string.
public static is ( mixed $data ) : boolean
$data mixed Value to check to see if was serialized
Résultat boolean

maybe() public static méthode

Serialize data, if needed.
public static maybe ( mixed $data ) : mixed
$data mixed Data that might need to be serialized
Résultat mixed

maybeUn() public static méthode

Unserialize value only if it is serialized.
public static maybeUn ( string $data ) : mixed
$data string A variable that may or may not be serialized
Résultat mixed