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 | |
trait StaticDefaults{ | |
protected static $_defaults = []; | |
public function __get($key){ | |
if(is_callable($func = self::$_defaults[$key])) return $func(); | |
return $func; | |
} | |
static public function defaults($defaults){ |
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 | |
trait StaticFallback{ | |
public static $_fallback; | |
public function __get($key){return self::$_fallback[$key];} | |
public static function fallback($key, $value){return self::$_fallback[$key] = $value;} | |
} | |
class Model{ | |
use StaticFallback; | |
} |