Skip to content

Instantly share code, notes, and snippets.

@suin
Created February 11, 2012 12:35
Show Gist options
  • Save suin/1799221 to your computer and use it in GitHub Desktop.
Save suin/1799221 to your computer and use it in GitHub Desktop.
モデルのインターフェースを定義してみる。 ref: http://qiita.com/items/2389
<?php
interface ModelInterface
{
/**
* Sets the value of a property.
* @param string $name
* @param mixed $value
* @return void
*/
public function __set($name, $value);
/**
* Gets the value of a property.
* @param string $name
* @return mixed
*/
public function __get($name);
/**
* Determines if a variable is set and is not NULL.
* @param string $name
* @return bool
*/
public function __isset($name);
/**
* Sets the value of a property.
* @param string $name
* @param mixed $value
* @return ModelInterface
*/
public function set($name, $value);
/**
* Gets the value of a property.
* @param string $name
* @return mixed
*/
public function get($name);
/**
* Determines if a variable is set and is not NULL.
* @param string $name
* @return bool
*/
public function defined($name);
/**
* Determines if a variable exists.
* @param string $name
* @return bool
*/
public function exists($name);
/**
* Imports the values of properties.
* @param array $values
* @return ModelInterface
*/
public function import(array $values);
/**
* Exports the values of all properties.
* @return array
*/
public function export();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment