You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
1.6 KiB

<?php
namespace Glmdev\Meta\Contracts;
interface MetaContract
{
/**
* Ensure the model recieves valid UUID and meta columns when created.
*
* @param array $args
*
* @return callable
*/
public static function create( array $args = [] );
/**
* Read the serialized value.
*
* @param string|int $key
*
* @return string|int|float|array|bool|null
*/
public function read( $key );
/**
* Adds the key-value pair into the serialized data set.
*
* @param string|int $key
* @param string|int|float|array|bool|null $value
*
* @return void
*/
public function write( $key, $value );
/**
* Get the serialized value of the meta info.
*
* @return string
*/
public function readRaw();
/**
* Set (override) the entire meta with an unmodified string.
*
* @param string $serialized
*
* @return void
*/
public function writeRaw( $serialized );
/**
* Get the universal identifier of the model.
*
* @return \Ramsey\Uuid\Uuid
*/
public function getUuid();
/**
* Set the universal identifier of the model (can only be set once).
*
* @return void
*/
public function setUuid();
/**
* Ask if the model has a universal identifier.
*
* @return bool
*/
public function hasUuid();
/**
* Set the universal identifier via existing UUID.
*
* @param \Ramsey\Uuid\Uuid $uuid
*
* @return void
*/
public function setRawUuid( \Ramsey\Uuid\Uuid $uuid );
}