added docblocks, contract, and service provider
This commit is contained in:
80
src/Contracts/MetaContract.php
Normal file
80
src/Contracts/MetaContract.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?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 );
|
||||
}
|
||||
Reference in New Issue
Block a user