Created
August 7, 2012 07:00
-
-
Save andriasang/3282564 to your computer and use it in GitHub Desktop.
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
class MyClass extends Configurable { | |
protected static $_defaults = array ( | |
"option1" => "blah blah blah", | |
"option2" => 35, | |
"option3" => true | |
); | |
public function __construct($param, $options = null) | |
{ | |
parent::__construct($options); | |
// do whatever else you want to do in the constructor here | |
// | |
} | |
public function test() { | |
print_r ($this->getOptions()); | |
} | |
} | |
class MySubClass extends MyClass { | |
protected static $_defaults = array ( | |
"option2" => 7453, | |
"option4" => "Yes we can!" | |
); | |
} | |
$myClass = new MyClass("I am a param", Array ("option2" => 542)); | |
$mySubClass = new MySubClass("I am a param", Array ("option1" => "la la la la la")); | |
$myClass->test(); | |
// Array ( [option1] => blah blah blah [option2] => 542 [option3] => 1 ) | |
$mySubClass->test(); | |
// Array ( [option1] => la la la la la [option2] => 7453 [option3] => 1 [option4] => Yes we can! ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment