Created
November 16, 2010 02:04
-
-
Save hiromitz/701310 to your computer and use it in GitHub Desktop.
Abstract Model class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Abstract Model class | |
*/ | |
abstract class Abstract | |
{ | |
/** | |
* stored values | |
* @var mixed | |
*/ | |
protected $_value; | |
public function __set(string $key, $value) | |
{ | |
$this->_value[$key] = $value; | |
} | |
public function __get($key) | |
{ | |
return $this->_value[$key]; | |
} | |
/** | |
* Store Value | |
* return class object for key chain | |
* | |
* @param string $key | |
* @param mixed $value | |
*/ | |
public function setValue(string $key, $value) | |
{ | |
$this->_value[$key] = $value; | |
return $this; | |
} | |
/** | |
* Store values | |
* @param array $array | |
*/ | |
public function setValues(array $array) | |
{ | |
foreach($array as $key => $value) { | |
$this->_value[$key] = $value; | |
} | |
return $this; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment