@@ -45,6 +45,9 @@ discard block |
||
45 | 45 | $this->properties = $properties; |
46 | 46 | } |
47 | 47 | |
48 | + /** |
|
49 | + * @param string $name |
|
50 | + */ |
|
48 | 51 | public function setDirect($name, $value) { |
49 | 52 | parent::__set($name, $value); |
50 | 53 | } |
@@ -65,6 +68,10 @@ discard block |
||
65 | 68 | } |
66 | 69 | } |
67 | 70 | |
71 | + /** |
|
72 | + * @param string $processor |
|
73 | + * @param string $name |
|
74 | + */ |
|
68 | 75 | protected function performMagic($processor, $name, $value = null) { |
69 | 76 | if ( |
70 | 77 | !empty($this->accessors[$name][$processor]) |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | if (is_callable($callable)) { |
62 | 62 | $this->accessors[$varName][$type] = $callable; |
63 | 63 | } else { |
64 | - throw new Exception('Error assigning callable in ' . get_called_class() . '! Callable typed [' . $type . '] is not a callable or not accessible in the scope'); |
|
64 | + throw new Exception('Error assigning callable in '.get_called_class().'! Callable typed ['.$type.'] is not a callable or not accessible in the scope'); |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | } |
79 | 79 | |
80 | 80 | public function __set($name, $value) { |
81 | - if(is_callable($value)) { |
|
81 | + if (is_callable($value)) { |
|
82 | 82 | $this->accessors[$name][P_CONTAINER_GET] = $value; |
83 | - } else{ |
|
83 | + } else { |
|
84 | 84 | $this->performMagic(P_CONTAINER_SET, $name, $value); |
85 | 85 | } |
86 | 86 | } |
@@ -101,7 +101,7 @@ |
||
101 | 101 | parent::__construct($gc); |
102 | 102 | |
103 | 103 | $this->assignAccessor('type', P_CONTAINER_SET, |
104 | - function (V2UnitContainer $that, $value) { |
|
104 | + function(V2UnitContainer $that, $value) { |
|
105 | 105 | $that->setDirect('type', $value); |
106 | 106 | $array = get_unit_param($value); |
107 | 107 | $that->unitInfo = $array; |
@@ -124,7 +124,7 @@ |
||
124 | 124 | ) { |
125 | 125 | call_user_func_array($this->accessors[$propertyName][$processor], array($this, &$row, $propertyName, $fieldName)); |
126 | 126 | } elseif ($fieldName) { |
127 | - if($processor == P_CONTAINER_IMPORT) { |
|
127 | + if ($processor == P_CONTAINER_IMPORT) { |
|
128 | 128 | $this->$propertyName = $row[$fieldName]; |
129 | 129 | } else { |
130 | 130 | $row[$fieldName] = $this->$propertyName; |
@@ -35,60 +35,60 @@ |
||
35 | 35 | $gc = $this; |
36 | 36 | |
37 | 37 | // Default db |
38 | - $gc->db = function ($c) { |
|
38 | + $gc->db = function($c) { |
|
39 | 39 | classSupernova::$db = $db = new \db_mysql($c); |
40 | 40 | $db->sn_db_connect(); |
41 | 41 | |
42 | 42 | return $db; |
43 | 43 | }; |
44 | 44 | |
45 | - $gc->debug = function ($c) { |
|
45 | + $gc->debug = function($c) { |
|
46 | 46 | return new \debug(); |
47 | 47 | }; |
48 | 48 | |
49 | - $gc->types = function ($c) { |
|
49 | + $gc->types = function($c) { |
|
50 | 50 | return new \Common\Types(); |
51 | 51 | }; |
52 | 52 | |
53 | - $gc->cache = function ($c) { |
|
53 | + $gc->cache = function($c) { |
|
54 | 54 | return new \classCache(classSupernova::$cache_prefix); |
55 | 55 | }; |
56 | 56 | |
57 | - $gc->config = function ($c) { |
|
57 | + $gc->config = function($c) { |
|
58 | 58 | return new \classConfig(classSupernova::$cache_prefix); |
59 | 59 | }; |
60 | 60 | |
61 | - $gc->localePlayer = function (GlobalContainer $c) { |
|
61 | + $gc->localePlayer = function(GlobalContainer $c) { |
|
62 | 62 | return new \classLocale($c->config->server_locale_log_usage); |
63 | 63 | }; |
64 | 64 | |
65 | - $gc->dbRowOperator = function ($c) { |
|
65 | + $gc->dbRowOperator = function($c) { |
|
66 | 66 | return new \DbRowDirectOperator($c); |
67 | 67 | }; |
68 | 68 | |
69 | - $gc->query = $gc->factory(function (GlobalContainer $c) { |
|
69 | + $gc->query = $gc->factory(function(GlobalContainer $c) { |
|
70 | 70 | return new \DbQueryConstructor($c->db); |
71 | 71 | }); |
72 | 72 | |
73 | - $gc->cacheOperator = function (GlobalContainer $gc) { |
|
73 | + $gc->cacheOperator = function(GlobalContainer $gc) { |
|
74 | 74 | return new \SnDbCachedOperator($gc); |
75 | 75 | }; |
76 | 76 | |
77 | 77 | $gc->snCacheClass = 'SnCache'; |
78 | - $gc->snCache = function (GlobalContainer $gc) { |
|
78 | + $gc->snCache = function(GlobalContainer $gc) { |
|
79 | 79 | return $gc->db->snCache; |
80 | 80 | }; |
81 | 81 | |
82 | 82 | |
83 | 83 | $gc->buddyClass = 'Buddy\BuddyModel'; |
84 | - $gc->buddyModel = function (GlobalContainer $c) { |
|
84 | + $gc->buddyModel = function(GlobalContainer $c) { |
|
85 | 85 | return new $c->buddyClass($c); |
86 | 86 | }; |
87 | 87 | |
88 | - $gc->unitModel = function (GlobalContainer $c) { |
|
88 | + $gc->unitModel = function(GlobalContainer $c) { |
|
89 | 89 | return new \V2Unit\V2UnitModel($c); |
90 | 90 | }; |
91 | - $gc->unitContainer = $gc->factory(function (GlobalContainer $c) { |
|
91 | + $gc->unitContainer = $gc->factory(function(GlobalContainer $c) { |
|
92 | 92 | return new \V2Unit\V2UnitContainer($c); |
93 | 93 | }); |
94 | 94 |