Refactored the Object class.
This commit is contained in:
parent
8ea0d90952
commit
16cd366b13
1 changed files with 22 additions and 43 deletions
|
@ -3,25 +3,16 @@
|
|||
/**
|
||||
* Object Class File for PICKLES
|
||||
*
|
||||
* PICKLES is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version.
|
||||
* PHP version 5
|
||||
*
|
||||
* PICKLES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* Licensed under the GNU General Public License Version 3
|
||||
* Redistribution of these files must retain the above copyright notice.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with PICKLES. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @author Joshua John Sherman <josh@phpwithpickles.org>
|
||||
* @copyright Copyright 2007, 2008 Joshua John Sherman
|
||||
* @package pickles
|
||||
* @author Josh Sherman <josh@phpwithpickles.org>
|
||||
* @copyright Copyright 2007-2010, Gravity Boulevard, LLC
|
||||
* @license http://www.gnu.org/licenses/gpl.html GPL v3
|
||||
* @link http://phpwithpickles.org
|
||||
* @license http://www.gnu.org/copyleft/lesser.html
|
||||
* @package PICKLES
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -32,39 +23,27 @@
|
|||
* 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.
|
||||
*
|
||||
* @todo Implement a profiler in every object
|
||||
*/
|
||||
class Object {
|
||||
class Object
|
||||
{
|
||||
/**
|
||||
* Instance of the Config object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $config = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct() { }
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
public function __destruct() { }
|
||||
|
||||
/**
|
||||
*
|
||||
* Establishes a Config instance for all children to enjoy
|
||||
*/
|
||||
public function __get($variable) {
|
||||
if (isset($this->$variable)) {
|
||||
return $this->$variable;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a variable
|
||||
*
|
||||
* @param string $variable Name of the variable to be set
|
||||
* @param mixed $value Value to be assigned to the passed variable
|
||||
* @todo Not sure we need this at all, grep to check if it's being used.
|
||||
*/
|
||||
public function set($variable, $value) {
|
||||
$this->$variable = $value;
|
||||
public function __construct()
|
||||
{
|
||||
$this->config = Config::getInstance();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue