Massive amounts of documentation has been added.
git-svn-id: http://svn.cleancode.org/svn/pickles@55 4d10bc64-7434-11dc-a737-d2d0f8310089
This commit is contained in:
parent
cbcfc9cc4f
commit
1784514696
20 changed files with 941 additions and 59 deletions
|
@ -1,16 +1,39 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Object class
|
||||
*
|
||||
* Every non-Singleton-based class needs to extend this class. Any models will
|
||||
* extend the Model class which entends the Object class already. This class
|
||||
* handles getting an instance of the Config object so that it's available. Also
|
||||
* provides a getter and setter for variables.
|
||||
*
|
||||
* @package PICKLES
|
||||
* @author Joshua Sherman <josh@phpwithpickles.org>
|
||||
* @copyright 2007-2008 Joshua Sherman
|
||||
*/
|
||||
class Object {
|
||||
|
||||
/**
|
||||
* Protected instance of the Config class
|
||||
*
|
||||
* @todo Perhaps this should be private?
|
||||
*/
|
||||
protected $config = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* Handles getting an instance of the Config class.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->config = Config::getInstance();
|
||||
}
|
||||
|
||||
public function __destruct() {
|
||||
|
||||
}
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
public function __destruct() { }
|
||||
|
||||
/*
|
||||
// @todo maybe later
|
||||
|
@ -23,6 +46,14 @@ class Object {
|
|||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets a variable
|
||||
*
|
||||
* @return Returns either the variable value or false if no variable.
|
||||
* @todo Returning false could be misleading, especially if you're
|
||||
* expecting a boolean value to begin with. Perhaps an error should
|
||||
* be thrown?
|
||||
*/
|
||||
public function get($variable, $array_element = null) {
|
||||
if (isset($this->$variable)) {
|
||||
if (isset($array_element)) {
|
||||
|
@ -40,10 +71,15 @@ class Object {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a variable
|
||||
*
|
||||
* @param string $variable Name of the variable to be set
|
||||
* @param mixed $value Value to be assigned to the passed variable
|
||||
*/
|
||||
public function set($variable, $value) {
|
||||
$this->$variable = $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue