first commit
This commit is contained in:
46
wp-content/plugins/brizy/admin/serializable.php
Normal file
46
wp-content/plugins/brizy/admin/serializable.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
abstract class Brizy_Admin_Serializable implements Serializable, JsonSerializable {
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function serialize() {
|
||||
$get_object_vars = get_object_vars( $this );
|
||||
|
||||
return serialize( $get_object_vars );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $data
|
||||
*/
|
||||
public function unserialize( $data ) {
|
||||
|
||||
$vars = unserialize( $data );
|
||||
|
||||
foreach ( $vars as $prop => $value ) {
|
||||
$this->$prop = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function convertToOptionValue();
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
static public function createFromSerializedData( $data ) {
|
||||
throw new Exception( 'Not implemented' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function jsonSerialize() {
|
||||
return get_object_vars( $this );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user