@@ -105,7 +105,7 @@ |
||
105 | 105 | * @return boolean success of write. |
106 | 106 | */ |
107 | 107 | public function write($type, $message) { |
108 | - if (!$this->_open) { |
|
108 | + if ( ! $this->_open) { |
|
109 | 109 | $config = $this->_config; |
110 | 110 | $this->_open($config['prefix'], $config['flag'], $config['facility']); |
111 | 111 | $this->_open = true; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | unset($options['engine']); |
40 | 40 | $className = $this->_getLogger($loggerName); |
41 | 41 | $logger = new $className($options); |
42 | - if (!$logger instanceof CakeLogInterface) { |
|
42 | + if ( ! $logger instanceof CakeLogInterface) { |
|
43 | 43 | throw new CakeLogException( |
44 | 44 | __d('cake_dev', 'logger class %s does not implement a %s method.', $loggerName, 'write()') |
45 | 45 | ); |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | if (substr($loggerName, -3) !== 'Log') { |
65 | 65 | $loggerName .= 'Log'; |
66 | 66 | } |
67 | - App::uses($loggerName, $plugin . 'Log/Engine'); |
|
68 | - if (!class_exists($loggerName)) { |
|
67 | + App::uses($loggerName, $plugin.'Log/Engine'); |
|
68 | + if ( ! class_exists($loggerName)) { |
|
69 | 69 | throw new CakeLogException(__d('cake_dev', 'Could not load class %s', $loggerName)); |
70 | 70 | } |
71 | 71 | return $loggerName; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $type = $this->alias; |
64 | 64 | $result = null; |
65 | 65 | |
66 | - if (!empty($this->useTable)) { |
|
66 | + if ( ! empty($this->useTable)) { |
|
67 | 67 | $table = $this->useTable; |
68 | 68 | } else { |
69 | 69 | $table = Inflector::pluralize(Inflector::underscore($type)); |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | |
79 | 79 | $queryData = array( |
80 | 80 | 'conditions' => array( |
81 | - $db->name("{$type}.lft") . ' <= ' . $db->name("{$type}0.lft"), |
|
82 | - $db->name("{$type}.rght") . ' >= ' . $db->name("{$type}0.rght")), |
|
81 | + $db->name("{$type}.lft").' <= '.$db->name("{$type}0.lft"), |
|
82 | + $db->name("{$type}.rght").' >= '.$db->name("{$type}0.rght")), |
|
83 | 83 | 'fields' => array('id', 'parent_id', 'model', 'foreign_key', 'alias'), |
84 | 84 | 'joins' => array(array( |
85 | 85 | 'table' => $table, |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | 'type' => 'INNER', |
88 | 88 | 'conditions' => array("{$type}0.alias" => $start) |
89 | 89 | )), |
90 | - 'order' => $db->name("{$type}.lft") . ' DESC' |
|
90 | + 'order' => $db->name("{$type}.lft").' DESC' |
|
91 | 91 | ); |
92 | 92 | |
93 | 93 | foreach ($path as $i => $alias) { |
@@ -98,31 +98,31 @@ discard block |
||
98 | 98 | 'alias' => "{$type}{$i}", |
99 | 99 | 'type' => 'INNER', |
100 | 100 | 'conditions' => array( |
101 | - $db->name("{$type}{$i}.lft") . ' > ' . $db->name("{$type}{$j}.lft"), |
|
102 | - $db->name("{$type}{$i}.rght") . ' < ' . $db->name("{$type}{$j}.rght"), |
|
103 | - $db->name("{$type}{$i}.alias") . ' = ' . $db->value($alias, 'string'), |
|
104 | - $db->name("{$type}{$j}.id") . ' = ' . $db->name("{$type}{$i}.parent_id") |
|
101 | + $db->name("{$type}{$i}.lft").' > '.$db->name("{$type}{$j}.lft"), |
|
102 | + $db->name("{$type}{$i}.rght").' < '.$db->name("{$type}{$j}.rght"), |
|
103 | + $db->name("{$type}{$i}.alias").' = '.$db->value($alias, 'string'), |
|
104 | + $db->name("{$type}{$j}.id").' = '.$db->name("{$type}{$i}.parent_id") |
|
105 | 105 | ) |
106 | 106 | ); |
107 | 107 | |
108 | 108 | $queryData['conditions'] = array('or' => array( |
109 | - $db->name("{$type}.lft") . ' <= ' . $db->name("{$type}0.lft") . ' AND ' . $db->name("{$type}.rght") . ' >= ' . $db->name("{$type}0.rght"), |
|
110 | - $db->name("{$type}.lft") . ' <= ' . $db->name("{$type}{$i}.lft") . ' AND ' . $db->name("{$type}.rght") . ' >= ' . $db->name("{$type}{$i}.rght")) |
|
109 | + $db->name("{$type}.lft").' <= '.$db->name("{$type}0.lft").' AND '.$db->name("{$type}.rght").' >= '.$db->name("{$type}0.rght"), |
|
110 | + $db->name("{$type}.lft").' <= '.$db->name("{$type}{$i}.lft").' AND '.$db->name("{$type}.rght").' >= '.$db->name("{$type}{$i}.rght")) |
|
111 | 111 | ); |
112 | 112 | } |
113 | 113 | $result = $db->read($this, $queryData, -1); |
114 | 114 | $path = array_values($path); |
115 | 115 | |
116 | 116 | if ( |
117 | - !isset($result[0][$type]) || |
|
118 | - (!empty($path) && $result[0][$type]['alias'] != $path[count($path) - 1]) || |
|
117 | + ! isset($result[0][$type]) || |
|
118 | + ( ! empty($path) && $result[0][$type]['alias'] != $path[count($path) - 1]) || |
|
119 | 119 | (empty($path) && $result[0][$type]['alias'] != $start) |
120 | 120 | ) { |
121 | 121 | return false; |
122 | 122 | } |
123 | 123 | } elseif (is_object($ref) && $ref instanceof Model) { |
124 | 124 | $ref = array('model' => $ref->name, 'foreign_key' => $ref->id); |
125 | - } elseif (is_array($ref) && !(isset($ref['model']) && isset($ref['foreign_key']))) { |
|
125 | + } elseif (is_array($ref) && ! (isset($ref['model']) && isset($ref['foreign_key']))) { |
|
126 | 126 | $name = key($ref); |
127 | 127 | list(, $alias) = pluginSplit($name); |
128 | 128 | |
@@ -164,15 +164,15 @@ discard block |
||
164 | 164 | 'alias' => "{$type}0", |
165 | 165 | 'type' => 'INNER', |
166 | 166 | 'conditions' => array( |
167 | - $db->name("{$type}.lft") . ' <= ' . $db->name("{$type}0.lft"), |
|
168 | - $db->name("{$type}.rght") . ' >= ' . $db->name("{$type}0.rght") |
|
167 | + $db->name("{$type}.lft").' <= '.$db->name("{$type}0.lft"), |
|
168 | + $db->name("{$type}.rght").' >= '.$db->name("{$type}0.rght") |
|
169 | 169 | ) |
170 | 170 | )), |
171 | - 'order' => $db->name("{$type}.lft") . ' DESC' |
|
171 | + 'order' => $db->name("{$type}.lft").' DESC' |
|
172 | 172 | ); |
173 | 173 | $result = $db->read($this, $queryData, -1); |
174 | 174 | |
175 | - if (!$result) { |
|
175 | + if ( ! $result) { |
|
176 | 176 | throw new CakeException(__d('cake_dev', "AclNode::node() - Couldn't find %s node identified by \"%s\"", $type, print_r($ref, true))); |
177 | 177 | } |
178 | 178 | } |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | |
57 | 57 | $types = $this->_typeMaps[$this->settings[$model->name]['type']]; |
58 | 58 | |
59 | - if (!is_array($types)) { |
|
59 | + if ( ! is_array($types)) { |
|
60 | 60 | $types = array($types); |
61 | 61 | } |
62 | 62 | foreach ($types as $type) { |
63 | 63 | $model->{$type} = ClassRegistry::init($type); |
64 | 64 | } |
65 | - if (!method_exists($model, 'parentNode')) { |
|
65 | + if ( ! method_exists($model, 'parentNode')) { |
|
66 | 66 | trigger_error(__d('cake_dev', 'Callback %s not defined in %s', 'parentNode()', $model->alias), E_USER_WARNING); |
67 | 67 | } |
68 | 68 | } |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function afterSave(Model $model, $created, $options = array()) { |
102 | 102 | $types = $this->_typeMaps[$this->settings[$model->name]['type']]; |
103 | - if (!is_array($types)) { |
|
103 | + if ( ! is_array($types)) { |
|
104 | 104 | $types = array($types); |
105 | 105 | } |
106 | 106 | foreach ($types as $type) { |
107 | 107 | $parent = $model->parentNode(); |
108 | - if (!empty($parent)) { |
|
108 | + if ( ! empty($parent)) { |
|
109 | 109 | $parent = $this->node($model, $parent, $type); |
110 | 110 | } |
111 | 111 | $data = array( |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | 'model' => $model->name, |
114 | 114 | 'foreign_key' => $model->id |
115 | 115 | ); |
116 | - if (!$created) { |
|
116 | + if ( ! $created) { |
|
117 | 117 | $node = $this->node($model, null, $type); |
118 | 118 | $data['id'] = isset($node[0][$type]['id']) ? $node[0][$type]['id'] : null; |
119 | 119 | } |
@@ -130,12 +130,12 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function afterDelete(Model $model) { |
132 | 132 | $types = $this->_typeMaps[$this->settings[$model->name]['type']]; |
133 | - if (!is_array($types)) { |
|
133 | + if ( ! is_array($types)) { |
|
134 | 134 | $types = array($types); |
135 | 135 | } |
136 | 136 | foreach ($types as $type) { |
137 | 137 | $node = Hash::extract($this->node($model, null, $type), "0.{$type}.id"); |
138 | - if (!empty($node)) { |
|
138 | + if ( ! empty($node)) { |
|
139 | 139 | $model->{$type}->delete($node); |
140 | 140 | } |
141 | 141 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @return void |
64 | 64 | */ |
65 | 65 | public function setup(Model $Model, $settings = array()) { |
66 | - if (!isset($this->settings[$Model->alias])) { |
|
66 | + if ( ! isset($this->settings[$Model->alias])) { |
|
67 | 67 | $this->settings[$Model->alias] = array('recursive' => true, 'notices' => true, 'autoFields' => true); |
68 | 68 | } |
69 | 69 | $this->settings[$Model->alias] = array_merge($this->settings[$Model->alias], $settings); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | if (isset($query['contain'])) { |
105 | 105 | $noContain = $noContain || empty($query['contain']); |
106 | 106 | if ($query['contain'] !== false) { |
107 | - $contain = array_merge($contain, (array)$query['contain']); |
|
107 | + $contain = array_merge($contain, (array) $query['contain']); |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | $noContain = $noContain && empty($contain); |
@@ -127,13 +127,13 @@ discard block |
||
127 | 127 | foreach ($containments['models'] as $model) { |
128 | 128 | $instance = $model['instance']; |
129 | 129 | $needed = $this->fieldDependencies($instance, $map, false); |
130 | - if (!empty($needed)) { |
|
130 | + if ( ! empty($needed)) { |
|
131 | 131 | $mandatory = array_merge($mandatory, $needed); |
132 | 132 | } |
133 | 133 | if ($contain) { |
134 | 134 | $backupBindings = array(); |
135 | 135 | foreach ($this->types as $relation) { |
136 | - if (!empty($instance->__backAssociation[$relation])) { |
|
136 | + if ( ! empty($instance->__backAssociation[$relation])) { |
|
137 | 137 | $backupBindings[$relation] = $instance->__backAssociation[$relation]; |
138 | 138 | } else { |
139 | 139 | $backupBindings[$relation] = $instance->{$relation}; |
@@ -142,29 +142,29 @@ discard block |
||
142 | 142 | foreach ($this->types as $type) { |
143 | 143 | $unbind = array(); |
144 | 144 | foreach ($instance->{$type} as $assoc => $options) { |
145 | - if (!isset($model['keep'][$assoc])) { |
|
145 | + if ( ! isset($model['keep'][$assoc])) { |
|
146 | 146 | $unbind[] = $assoc; |
147 | 147 | } |
148 | 148 | } |
149 | - if (!empty($unbind)) { |
|
150 | - if (!$reset && empty($instance->__backOriginalAssociation)) { |
|
149 | + if ( ! empty($unbind)) { |
|
150 | + if ( ! $reset && empty($instance->__backOriginalAssociation)) { |
|
151 | 151 | $instance->__backOriginalAssociation = $backupBindings; |
152 | 152 | } |
153 | 153 | $instance->unbindModel(array($type => $unbind), $reset); |
154 | 154 | } |
155 | 155 | foreach ($instance->{$type} as $assoc => $options) { |
156 | - if (isset($model['keep'][$assoc]) && !empty($model['keep'][$assoc])) { |
|
156 | + if (isset($model['keep'][$assoc]) && ! empty($model['keep'][$assoc])) { |
|
157 | 157 | if (isset($model['keep'][$assoc]['fields'])) { |
158 | 158 | $model['keep'][$assoc]['fields'] = $this->fieldDependencies($containments['models'][$assoc]['instance'], $map, $model['keep'][$assoc]['fields']); |
159 | 159 | } |
160 | - if (!$reset && empty($instance->__backOriginalAssociation)) { |
|
160 | + if ( ! $reset && empty($instance->__backOriginalAssociation)) { |
|
161 | 161 | $instance->__backOriginalAssociation = $backupBindings; |
162 | 162 | } elseif ($reset) { |
163 | 163 | $instance->__backAssociation[$type] = $backupBindings[$type]; |
164 | 164 | } |
165 | 165 | $instance->{$type}[$assoc] = array_merge($instance->{$type}[$assoc], $model['keep'][$assoc]); |
166 | 166 | } |
167 | - if (!$reset) { |
|
167 | + if ( ! $reset) { |
|
168 | 168 | $instance->__backInnerAssociation[] = $assoc; |
169 | 169 | } |
170 | 170 | } |
@@ -177,34 +177,34 @@ discard block |
||
177 | 177 | } |
178 | 178 | |
179 | 179 | $autoFields = ($this->settings[$Model->alias]['autoFields'] |
180 | - && !in_array($Model->findQueryType, array('list', 'count')) |
|
181 | - && !empty($query['fields'])); |
|
180 | + && ! in_array($Model->findQueryType, array('list', 'count')) |
|
181 | + && ! empty($query['fields'])); |
|
182 | 182 | |
183 | - if (!$autoFields) { |
|
183 | + if ( ! $autoFields) { |
|
184 | 184 | return $query; |
185 | 185 | } |
186 | 186 | |
187 | - $query['fields'] = (array)$query['fields']; |
|
187 | + $query['fields'] = (array) $query['fields']; |
|
188 | 188 | foreach (array('hasOne', 'belongsTo') as $type) { |
189 | - if (!empty($Model->{$type})) { |
|
189 | + if ( ! empty($Model->{$type})) { |
|
190 | 190 | foreach ($Model->{$type} as $assoc => $data) { |
191 | - if ($Model->useDbConfig === $Model->{$assoc}->useDbConfig && !empty($data['fields'])) { |
|
192 | - foreach ((array)$data['fields'] as $field) { |
|
193 | - $query['fields'][] = (strpos($field, '.') === false ? $assoc . '.' : '') . $field; |
|
191 | + if ($Model->useDbConfig === $Model->{$assoc}->useDbConfig && ! empty($data['fields'])) { |
|
192 | + foreach ((array) $data['fields'] as $field) { |
|
193 | + $query['fields'][] = (strpos($field, '.') === false ? $assoc.'.' : '').$field; |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 | } |
197 | 197 | } |
198 | 198 | } |
199 | 199 | |
200 | - if (!empty($mandatory[$Model->alias])) { |
|
200 | + if ( ! empty($mandatory[$Model->alias])) { |
|
201 | 201 | foreach ($mandatory[$Model->alias] as $field) { |
202 | 202 | if ($field === '--primaryKey--') { |
203 | 203 | $field = $Model->primaryKey; |
204 | 204 | } elseif (preg_match('/^.+\.\-\-[^-]+\-\-$/', $field)) { |
205 | 205 | list($modelName, $field) = explode('.', $field); |
206 | 206 | if ($Model->useDbConfig === $Model->{$modelName}->useDbConfig) { |
207 | - $field = $modelName . '.' . ( |
|
207 | + $field = $modelName.'.'.( |
|
208 | 208 | ($field === '--primaryKey--') ? $Model->$modelName->primaryKey : $field |
209 | 209 | ); |
210 | 210 | } else { |
@@ -243,12 +243,12 @@ discard block |
||
243 | 243 | * @return void |
244 | 244 | */ |
245 | 245 | public function resetBindings(Model $Model) { |
246 | - if (!empty($Model->__backOriginalAssociation)) { |
|
246 | + if ( ! empty($Model->__backOriginalAssociation)) { |
|
247 | 247 | $Model->__backAssociation = $Model->__backOriginalAssociation; |
248 | 248 | unset($Model->__backOriginalAssociation); |
249 | 249 | } |
250 | 250 | $Model->resetAssociations(); |
251 | - if (!empty($Model->__backInnerAssociation)) { |
|
251 | + if ( ! empty($Model->__backInnerAssociation)) { |
|
252 | 252 | $assocs = $Model->__backInnerAssociation; |
253 | 253 | $Model->__backInnerAssociation = array(); |
254 | 254 | foreach ($assocs as $currentModel) { |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | if ($throwErrors === null) { |
273 | 273 | $throwErrors = (empty($this->settings[$Model->alias]) ? true : $this->settings[$Model->alias]['notices']); |
274 | 274 | } |
275 | - foreach ((array)$contain as $name => $children) { |
|
275 | + foreach ((array) $contain as $name => $children) { |
|
276 | 276 | if (is_numeric($name)) { |
277 | 277 | $name = $children; |
278 | 278 | $children = array(); |
@@ -286,10 +286,10 @@ discard block |
||
286 | 286 | $children = array(implode('.', $chain) => $children); |
287 | 287 | } |
288 | 288 | |
289 | - $children = (array)$children; |
|
289 | + $children = (array) $children; |
|
290 | 290 | foreach ($children as $key => $val) { |
291 | - if (is_string($key) && is_string($val) && !in_array($key, $options, true)) { |
|
292 | - $children[$key] = (array)$val; |
|
291 | + if (is_string($key) && is_string($val) && ! in_array($key, $options, true)) { |
|
292 | + $children[$key] = (array) $val; |
|
293 | 293 | } |
294 | 294 | } |
295 | 295 | |
@@ -303,33 +303,33 @@ discard block |
||
303 | 303 | continue; |
304 | 304 | } |
305 | 305 | $optionKey = in_array($key, $options, true); |
306 | - if (!$optionKey && is_string($key) && preg_match('/^[a-z(]/', $key) && (!isset($Model->{$key}) || !is_object($Model->{$key}))) { |
|
306 | + if ( ! $optionKey && is_string($key) && preg_match('/^[a-z(]/', $key) && ( ! isset($Model->{$key}) || ! is_object($Model->{$key}))) { |
|
307 | 307 | $option = 'fields'; |
308 | 308 | $val = array($key); |
309 | 309 | if ($key{0} === '(') { |
310 | 310 | $val = preg_split('/\s*,\s*/', substr($key, 1, -1)); |
311 | 311 | } elseif (preg_match('/ASC|DESC$/', $key)) { |
312 | 312 | $option = 'order'; |
313 | - $val = $Model->{$name}->alias . '.' . $key; |
|
313 | + $val = $Model->{$name}->alias.'.'.$key; |
|
314 | 314 | } elseif (preg_match('/[ =!]/', $key)) { |
315 | 315 | $option = 'conditions'; |
316 | - $val = $Model->{$name}->alias . '.' . $key; |
|
316 | + $val = $Model->{$name}->alias.'.'.$key; |
|
317 | 317 | } |
318 | 318 | $children[$option] = is_array($val) ? $val : array($val); |
319 | 319 | $newChildren = null; |
320 | - if (!empty($name) && !empty($children[$key])) { |
|
320 | + if ( ! empty($name) && ! empty($children[$key])) { |
|
321 | 321 | $newChildren = $children[$key]; |
322 | 322 | } |
323 | 323 | unset($children[$key], $children[$i]); |
324 | 324 | $key = $option; |
325 | 325 | $optionKey = true; |
326 | - if (!empty($newChildren)) { |
|
326 | + if ( ! empty($newChildren)) { |
|
327 | 327 | $children = Hash::merge($children, $newChildren); |
328 | 328 | } |
329 | 329 | } |
330 | 330 | if ($optionKey && isset($children[$key])) { |
331 | - if (!empty($keep[$name][$key]) && is_array($keep[$name][$key])) { |
|
332 | - $keep[$name][$key] = array_merge((isset($keep[$name][$key]) ? $keep[$name][$key] : array()), (array)$children[$key]); |
|
331 | + if ( ! empty($keep[$name][$key]) && is_array($keep[$name][$key])) { |
|
332 | + $keep[$name][$key] = array_merge((isset($keep[$name][$key]) ? $keep[$name][$key] : array()), (array) $children[$key]); |
|
333 | 333 | } else { |
334 | 334 | $keep[$name][$key] = $children[$key]; |
335 | 335 | } |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | } |
338 | 338 | } |
339 | 339 | |
340 | - if (!isset($Model->{$name}) || !is_object($Model->{$name})) { |
|
340 | + if ( ! isset($Model->{$name}) || ! is_object($Model->{$name})) { |
|
341 | 341 | if ($throwErrors) { |
342 | 342 | trigger_error(__d('cake_dev', 'Model "%s" is not associated with model "%s"', $Model->alias, $name), E_USER_WARNING); |
343 | 343 | } |
@@ -346,12 +346,12 @@ discard block |
||
346 | 346 | |
347 | 347 | $containments = $this->containments($Model->{$name}, $children, $containments); |
348 | 348 | $depths[] = $containments['depth'] + 1; |
349 | - if (!isset($keep[$name])) { |
|
349 | + if ( ! isset($keep[$name])) { |
|
350 | 350 | $keep[$name] = array(); |
351 | 351 | } |
352 | 352 | } |
353 | 353 | |
354 | - if (!isset($containments['models'][$Model->alias])) { |
|
354 | + if ( ! isset($containments['models'][$Model->alias])) { |
|
355 | 355 | $containments['models'][$Model->alias] = array('keep' => array(), 'instance' => &$Model); |
356 | 356 | } |
357 | 357 | |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | if ($type === 'hasAndBelongsToMany') { |
377 | 377 | $fields[$parent][] = '--primaryKey--'; |
378 | 378 | } elseif ($type === 'belongsTo') { |
379 | - $fields[$parent][] = $dependency . '.--primaryKey--'; |
|
379 | + $fields[$parent][] = $dependency.'.--primaryKey--'; |
|
380 | 380 | } |
381 | 381 | } |
382 | 382 | } |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | $fields[] = $Model->primaryKey; |
400 | 400 | break; |
401 | 401 | } |
402 | - if (!empty($innerFields) && !empty($Model->{$type}[$dependency]['fields'])) { |
|
402 | + if ( ! empty($innerFields) && ! empty($Model->{$type}[$dependency]['fields'])) { |
|
403 | 403 | $Model->{$type}[$dependency]['fields'] = array_unique(array_merge($Model->{$type}[$dependency]['fields'], $innerFields)); |
404 | 404 | } |
405 | 405 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | foreach ($this->types as $type) { |
421 | 421 | foreach ($instance->{$type} as $assoc => $options) { |
422 | 422 | if (isset($model['keep'][$assoc])) { |
423 | - $map[$name][$type] = isset($map[$name][$type]) ? array_merge($map[$name][$type], (array)$assoc) : (array)$assoc; |
|
423 | + $map[$name][$type] = isset($map[$name][$type]) ? array_merge($map[$name][$type], (array) $assoc) : (array) $assoc; |
|
424 | 424 | } |
425 | 425 | } |
426 | 426 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | if (empty($options['name'])) { |
82 | 82 | $this->name = preg_replace('/schema$/i', '', get_class($this)); |
83 | 83 | } |
84 | - if (!empty($options['plugin'])) { |
|
84 | + if ( ! empty($options['plugin'])) { |
|
85 | 85 | $this->plugin = $options['plugin']; |
86 | 86 | } |
87 | 87 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | } |
91 | 91 | |
92 | 92 | if (empty($options['path'])) { |
93 | - $this->path = APP . 'Config' . DS . 'Schema'; |
|
93 | + $this->path = APP.'Config'.DS.'Schema'; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | $options = array_merge(get_object_vars($this), $options); |
@@ -106,25 +106,25 @@ discard block |
||
106 | 106 | public function build($data) { |
107 | 107 | $file = null; |
108 | 108 | foreach ($data as $key => $val) { |
109 | - if (!empty($val)) { |
|
110 | - if (!in_array($key, array('plugin', 'name', 'path', 'file', 'connection', 'tables', '_log'))) { |
|
109 | + if ( ! empty($val)) { |
|
110 | + if ( ! in_array($key, array('plugin', 'name', 'path', 'file', 'connection', 'tables', '_log'))) { |
|
111 | 111 | if ($key[0] === '_') { |
112 | 112 | continue; |
113 | 113 | } |
114 | 114 | $this->tables[$key] = $val; |
115 | 115 | unset($this->{$key}); |
116 | 116 | } elseif ($key !== 'tables') { |
117 | - if ($key === 'name' && $val !== $this->name && !isset($data['file'])) { |
|
118 | - $file = Inflector::underscore($val) . '.php'; |
|
117 | + if ($key === 'name' && $val !== $this->name && ! isset($data['file'])) { |
|
118 | + $file = Inflector::underscore($val).'.php'; |
|
119 | 119 | } |
120 | 120 | $this->{$key} = $val; |
121 | 121 | } |
122 | 122 | } |
123 | 123 | } |
124 | - if (file_exists($this->path . DS . $file) && is_file($this->path . DS . $file)) { |
|
124 | + if (file_exists($this->path.DS.$file) && is_file($this->path.DS.$file)) { |
|
125 | 125 | $this->file = $file; |
126 | - } elseif (!empty($this->plugin)) { |
|
127 | - $this->path = CakePlugin::path($this->plugin) . 'Config' . DS . 'Schema'; |
|
126 | + } elseif ( ! empty($this->plugin)) { |
|
127 | + $this->path = CakePlugin::path($this->plugin).'Config'.DS.'Schema'; |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
@@ -161,13 +161,13 @@ discard block |
||
161 | 161 | $this->build($options); |
162 | 162 | extract(get_object_vars($this)); |
163 | 163 | |
164 | - $class = $name . 'Schema'; |
|
164 | + $class = $name.'Schema'; |
|
165 | 165 | |
166 | - if (!class_exists($class)) { |
|
167 | - if (file_exists($path . DS . $file) && is_file($path . DS . $file)) { |
|
168 | - require_once $path . DS . $file; |
|
169 | - } elseif (file_exists($path . DS . 'schema.php') && is_file($path . DS . 'schema.php')) { |
|
170 | - require_once $path . DS . 'schema.php'; |
|
166 | + if ( ! class_exists($class)) { |
|
167 | + if (file_exists($path.DS.$file) && is_file($path.DS.$file)) { |
|
168 | + require_once $path.DS.$file; |
|
169 | + } elseif (file_exists($path.DS.'schema.php') && is_file($path.DS.'schema.php')) { |
|
170 | + require_once $path.DS.'schema.php'; |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | |
@@ -202,20 +202,20 @@ discard block |
||
202 | 202 | $db = ConnectionManager::getDataSource($connection); |
203 | 203 | |
204 | 204 | if (isset($this->plugin)) { |
205 | - App::uses($this->plugin . 'AppModel', $this->plugin . '.Model'); |
|
205 | + App::uses($this->plugin.'AppModel', $this->plugin.'.Model'); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | $tables = array(); |
209 | - $currentTables = (array)$db->listSources(); |
|
209 | + $currentTables = (array) $db->listSources(); |
|
210 | 210 | |
211 | 211 | $prefix = null; |
212 | 212 | if (isset($db->config['prefix'])) { |
213 | 213 | $prefix = $db->config['prefix']; |
214 | 214 | } |
215 | 215 | |
216 | - if (!is_array($models) && $models !== false) { |
|
216 | + if ( ! is_array($models) && $models !== false) { |
|
217 | 217 | if (isset($this->plugin)) { |
218 | - $models = App::objects($this->plugin . '.Model', null, false); |
|
218 | + $models = App::objects($this->plugin.'.Model', null, false); |
|
219 | 219 | } else { |
220 | 220 | $models = App::objects('Model'); |
221 | 221 | } |
@@ -230,15 +230,15 @@ discard block |
||
230 | 230 | } |
231 | 231 | |
232 | 232 | if (isset($this->plugin)) { |
233 | - if ($model === $this->plugin . 'AppModel') { |
|
233 | + if ($model === $this->plugin.'AppModel') { |
|
234 | 234 | continue; |
235 | 235 | } |
236 | 236 | $importModel = $model; |
237 | - $plugin = $this->plugin . '.'; |
|
237 | + $plugin = $this->plugin.'.'; |
|
238 | 238 | } |
239 | 239 | |
240 | - App::uses($importModel, $plugin . 'Model'); |
|
241 | - if (!class_exists($importModel)) { |
|
240 | + App::uses($importModel, $plugin.'Model'); |
|
241 | + if ( ! class_exists($importModel)) { |
|
242 | 242 | continue; |
243 | 243 | } |
244 | 244 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | continue; |
254 | 254 | } |
255 | 255 | |
256 | - if (!is_object($Object) || $Object->useTable === false) { |
|
256 | + if ( ! is_object($Object) || $Object->useTable === false) { |
|
257 | 257 | continue; |
258 | 258 | } |
259 | 259 | $db = $Object->getDataSource(); |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | if ($prefix && strpos($table, $prefix) !== 0) { |
263 | 263 | continue; |
264 | 264 | } |
265 | - if (!in_array($fulltable, $currentTables)) { |
|
265 | + if ( ! in_array($fulltable, $currentTables)) { |
|
266 | 266 | continue; |
267 | 267 | } |
268 | 268 | |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | if (isset($assocData['with'])) { |
283 | 283 | $class = $assocData['with']; |
284 | 284 | } |
285 | - if (!is_object($Object->$class)) { |
|
285 | + if ( ! is_object($Object->$class)) { |
|
286 | 286 | continue; |
287 | 287 | } |
288 | 288 | $withTable = $db->fullTableName($Object->$class, false, false); |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | } |
303 | 303 | } |
304 | 304 | |
305 | - if (!empty($currentTables)) { |
|
305 | + if ( ! empty($currentTables)) { |
|
306 | 306 | foreach ($currentTables as $table) { |
307 | 307 | if ($prefix) { |
308 | 308 | if (strpos($table, $prefix) !== 0) { |
@@ -383,13 +383,13 @@ discard block |
||
383 | 383 | } |
384 | 384 | |
385 | 385 | foreach ($tables as $table => $fields) { |
386 | - if (!is_numeric($table) && $table !== 'missing') { |
|
386 | + if ( ! is_numeric($table) && $table !== 'missing') { |
|
387 | 387 | $out .= $this->generateTable($table, $fields); |
388 | 388 | } |
389 | 389 | } |
390 | 390 | $out .= "}\n"; |
391 | 391 | |
392 | - $file = new File($path . DS . $file, true); |
|
392 | + $file = new File($path.DS.$file, true); |
|
393 | 393 | $content = "<?php \n{$out}"; |
394 | 394 | if ($file->write($content)) { |
395 | 395 | return $content; |
@@ -415,20 +415,20 @@ discard block |
||
415 | 415 | $type = $value; |
416 | 416 | $value = array('type' => $type); |
417 | 417 | } |
418 | - $col = "\t\t'{$field}' => array('type' => '" . $value['type'] . "', "; |
|
418 | + $col = "\t\t'{$field}' => array('type' => '".$value['type']."', "; |
|
419 | 419 | unset($value['type']); |
420 | 420 | $col .= implode(', ', $this->_values($value)); |
421 | 421 | } elseif ($field === 'indexes') { |
422 | 422 | $col = "\t\t'indexes' => array(\n\t\t\t"; |
423 | 423 | $props = array(); |
424 | - foreach ((array)$value as $key => $index) { |
|
425 | - $props[] = "'{$key}' => array(" . implode(', ', $this->_values($index)) . ")"; |
|
424 | + foreach ((array) $value as $key => $index) { |
|
425 | + $props[] = "'{$key}' => array(".implode(', ', $this->_values($index)).")"; |
|
426 | 426 | } |
427 | - $col .= implode(",\n\t\t\t", $props) . "\n\t\t"; |
|
427 | + $col .= implode(",\n\t\t\t", $props)."\n\t\t"; |
|
428 | 428 | } elseif ($field === 'tableParameters') { |
429 | 429 | $col = "\t\t'tableParameters' => array("; |
430 | 430 | $props = array(); |
431 | - foreach ((array)$value as $key => $param) { |
|
431 | + foreach ((array) $value as $key => $param) { |
|
432 | 432 | $props[] = "'{$key}' => '$param'"; |
433 | 433 | } |
434 | 434 | $col .= implode(', ', $props); |
@@ -473,23 +473,23 @@ discard block |
||
473 | 473 | if ($table === 'missing') { |
474 | 474 | continue; |
475 | 475 | } |
476 | - if (!array_key_exists($table, $old)) { |
|
476 | + if ( ! array_key_exists($table, $old)) { |
|
477 | 477 | $tables[$table]['create'] = $fields; |
478 | 478 | } else { |
479 | 479 | $diff = $this->_arrayDiffAssoc($fields, $old[$table]); |
480 | - if (!empty($diff)) { |
|
480 | + if ( ! empty($diff)) { |
|
481 | 481 | $tables[$table]['add'] = $diff; |
482 | 482 | } |
483 | 483 | $diff = $this->_arrayDiffAssoc($old[$table], $fields); |
484 | - if (!empty($diff)) { |
|
484 | + if ( ! empty($diff)) { |
|
485 | 485 | $tables[$table]['drop'] = $diff; |
486 | 486 | } |
487 | 487 | } |
488 | 488 | |
489 | 489 | foreach ($fields as $field => $value) { |
490 | - if (!empty($old[$table][$field])) { |
|
490 | + if ( ! empty($old[$table][$field])) { |
|
491 | 491 | $diff = $this->_arrayDiffAssoc($value, $old[$table][$field]); |
492 | - if (!empty($diff) && $field !== 'indexes' && $field !== 'tableParameters') { |
|
492 | + if ( ! empty($diff) && $field !== 'indexes' && $field !== 'tableParameters') { |
|
493 | 493 | $tables[$table]['change'][$field] = $value; |
494 | 494 | } |
495 | 495 | } |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | if (isset($old[$table]['indexes']) && isset($new[$table]['indexes'])) { |
508 | 508 | $diff = $this->_compareIndexes($new[$table]['indexes'], $old[$table]['indexes']); |
509 | 509 | if ($diff) { |
510 | - if (!isset($tables[$table])) { |
|
510 | + if ( ! isset($tables[$table])) { |
|
511 | 511 | $tables[$table] = array(); |
512 | 512 | } |
513 | 513 | if (isset($diff['drop'])) { |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | protected function _arrayDiffAssoc($array1, $array2) { |
545 | 545 | $difference = array(); |
546 | 546 | foreach ($array1 as $key => $value) { |
547 | - if (!array_key_exists($key, $array2)) { |
|
547 | + if ( ! array_key_exists($key, $array2)) { |
|
548 | 548 | $difference[$key] = $value; |
549 | 549 | continue; |
550 | 550 | } |
@@ -579,13 +579,13 @@ discard block |
||
579 | 579 | if (is_array($values)) { |
580 | 580 | foreach ($values as $key => $val) { |
581 | 581 | if (is_array($val)) { |
582 | - $vals[] = "'{$key}' => array(" . implode(", ", $this->_values($val)) . ")"; |
|
582 | + $vals[] = "'{$key}' => array(".implode(", ", $this->_values($val)).")"; |
|
583 | 583 | } else { |
584 | 584 | $val = var_export($val, true); |
585 | 585 | if ($val === 'NULL') { |
586 | 586 | $val = 'null'; |
587 | 587 | } |
588 | - if (!is_numeric($key)) { |
|
588 | + if ( ! is_numeric($key)) { |
|
589 | 589 | $vals[] = "'{$key}' => {$val}"; |
590 | 590 | } else { |
591 | 591 | $vals[] = "{$val}"; |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | if ($Obj->primaryKey === $name) { |
612 | 612 | $value['key'] = 'primary'; |
613 | 613 | } |
614 | - if (!isset($db->columns[$value['type']])) { |
|
614 | + if ( ! isset($db->columns[$value['type']])) { |
|
615 | 615 | trigger_error(__d('cake_dev', 'Schema generation error: invalid column type %s for %s.%s does not exist in DBO', $value['type'], $Obj->name, $name), E_USER_NOTICE); |
616 | 616 | continue; |
617 | 617 | } else { |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | * @return mixed False on failure, or an array of parameters to add & drop. |
648 | 648 | */ |
649 | 649 | protected function _compareTableParameters($new, $old) { |
650 | - if (!is_array($new) || !is_array($old)) { |
|
650 | + if ( ! is_array($new) || ! is_array($old)) { |
|
651 | 651 | return false; |
652 | 652 | } |
653 | 653 | $change = $this->_arrayDiffAssoc($new, $old); |
@@ -662,19 +662,19 @@ discard block |
||
662 | 662 | * @return mixed false on failure or array of indexes to add and drop |
663 | 663 | */ |
664 | 664 | protected function _compareIndexes($new, $old) { |
665 | - if (!is_array($new) || !is_array($old)) { |
|
665 | + if ( ! is_array($new) || ! is_array($old)) { |
|
666 | 666 | return false; |
667 | 667 | } |
668 | 668 | |
669 | 669 | $add = $drop = array(); |
670 | 670 | |
671 | 671 | $diff = $this->_arrayDiffAssoc($new, $old); |
672 | - if (!empty($diff)) { |
|
672 | + if ( ! empty($diff)) { |
|
673 | 673 | $add = $diff; |
674 | 674 | } |
675 | 675 | |
676 | 676 | $diff = $this->_arrayDiffAssoc($old, $new); |
677 | - if (!empty($diff)) { |
|
677 | + if ( ! empty($diff)) { |
|
678 | 678 | $drop = $diff; |
679 | 679 | } |
680 | 680 | |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | * @return string Prefix-less table name |
714 | 714 | */ |
715 | 715 | protected function _noPrefixTable($prefix, $table) { |
716 | - return preg_replace('/^' . preg_quote($prefix) . '/', '', $table); |
|
716 | + return preg_replace('/^'.preg_quote($prefix).'/', '', $table); |
|
717 | 717 | } |
718 | 718 | |
719 | 719 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @return void |
65 | 65 | */ |
66 | 66 | protected static function _init() { |
67 | - include_once APP . 'Config' . DS . 'database.php'; |
|
67 | + include_once APP.'Config'.DS.'database.php'; |
|
68 | 68 | if (class_exists('DATABASE_CONFIG')) { |
69 | 69 | self::$config = new DATABASE_CONFIG(); |
70 | 70 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | self::_init(); |
84 | 84 | } |
85 | 85 | |
86 | - if (!empty(self::$_dataSources[$name])) { |
|
86 | + if ( ! empty(self::$_dataSources[$name])) { |
|
87 | 87 | return self::$_dataSources[$name]; |
88 | 88 | } |
89 | 89 | |
@@ -166,15 +166,15 @@ discard block |
||
166 | 166 | } |
167 | 167 | |
168 | 168 | $plugin = $package = null; |
169 | - if (!empty($conn['plugin'])) { |
|
170 | - $plugin = $conn['plugin'] . '.'; |
|
169 | + if ( ! empty($conn['plugin'])) { |
|
170 | + $plugin = $conn['plugin'].'.'; |
|
171 | 171 | } |
172 | - if (!empty($conn['package'])) { |
|
173 | - $package = '/' . $conn['package']; |
|
172 | + if ( ! empty($conn['package'])) { |
|
173 | + $package = '/'.$conn['package']; |
|
174 | 174 | } |
175 | 175 | |
176 | - App::uses($conn['classname'], $plugin . 'Model/Datasource' . $package); |
|
177 | - if (!class_exists($conn['classname'])) { |
|
176 | + App::uses($conn['classname'], $plugin.'Model/Datasource'.$package); |
|
177 | + if ( ! class_exists($conn['classname'])) { |
|
178 | 178 | throw new MissingDatasourceException(array( |
179 | 179 | 'class' => $conn['classname'], |
180 | 180 | 'plugin' => substr($plugin, 0, -1) |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | if (empty(self::$_init)) { |
194 | 194 | self::_init(); |
195 | 195 | } |
196 | - return (array)self::$config; |
|
196 | + return (array) self::$config; |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | /** |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | self::_init(); |
229 | 229 | } |
230 | 230 | |
231 | - if (!isset(self::$config->{$name})) { |
|
231 | + if ( ! isset(self::$config->{$name})) { |
|
232 | 232 | return false; |
233 | 233 | } |
234 | 234 | unset(self::$_connectionsEnum[$name], self::$_dataSources[$name], self::$config->{$name}); |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * @throws MissingDatasourceConfigException |
244 | 244 | */ |
245 | 245 | protected static function _getConnectionObject($name) { |
246 | - if (!empty(self::$config->{$name})) { |
|
246 | + if ( ! empty(self::$config->{$name})) { |
|
247 | 247 | self::$_connectionsEnum[$name] = self::_connectionData(self::$config->{$name}); |
248 | 248 | } else { |
249 | 249 | throw new MissingDatasourceConfigException(array('config' => $name)); |
@@ -232,7 +232,7 @@ |
||
232 | 232 | } |
233 | 233 | return; |
234 | 234 | } |
235 | - if (!empty($model->whitelist) && !in_array($field, $model->whitelist)) { |
|
235 | + if ( ! empty($model->whitelist) && ! in_array($field, $model->whitelist)) { |
|
236 | 236 | $model->whitelist[] = $field; |
237 | 237 | } |
238 | 238 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function __construct() { |
61 | 61 | $config = Configure::read('Acl.database'); |
62 | - if (!empty($config)) { |
|
62 | + if ( ! empty($config)) { |
|
63 | 63 | $this->useDbConfig = $config; |
64 | 64 | } |
65 | 65 | parent::__construct(); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @return boolean Success (true if ARO has access to action in ACO, false otherwise) |
75 | 75 | */ |
76 | 76 | public function check($aro, $aco, $action = '*') { |
77 | - if (!$aro || !$aco) { |
|
77 | + if ( ! $aro || ! $aco) { |
|
78 | 78 | return false; |
79 | 79 | } |
80 | 80 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $aroPath = $this->Aro->node($aro); |
83 | 83 | $acoPath = $this->Aco->node($aco); |
84 | 84 | |
85 | - if (!$aroPath) { |
|
85 | + if ( ! $aroPath) { |
|
86 | 86 | trigger_error(__d('cake_dev', |
87 | 87 | "%s - Failed ARO node lookup in permissions check. Node references:\nAro: %s\nAco: %s", |
88 | 88 | 'DbAcl::check()', |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | return false; |
94 | 94 | } |
95 | 95 | |
96 | - if (!$acoPath) { |
|
96 | + if ( ! $acoPath) { |
|
97 | 97 | trigger_error(__d('cake_dev', |
98 | 98 | "%s - Failed ACO node lookup in permissions check. Node references:\nAro: %s\nAco: %s", |
99 | 99 | 'DbAcl::check()', |
@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | return false; |
105 | 105 | } |
106 | 106 | |
107 | - if ($action !== '*' && !in_array('_' . $action, $permKeys)) { |
|
107 | + if ($action !== '*' && ! in_array('_'.$action, $permKeys)) { |
|
108 | 108 | trigger_error(__d('cake_dev', "ACO permissions key %s does not exist in %s", $action, 'DbAcl::check()'), E_USER_NOTICE); |
109 | 109 | return false; |
110 | 110 | } |
111 | 111 | |
112 | 112 | $inherited = array(); |
113 | - $acoIDs = Hash::extract($acoPath, '{n}.' . $this->Aco->alias . '.id'); |
|
113 | + $acoIDs = Hash::extract($acoPath, '{n}.'.$this->Aco->alias.'.id'); |
|
114 | 114 | |
115 | 115 | $count = count($aroPath); |
116 | 116 | for ($i = 0; $i < $count; $i++) { |
@@ -121,19 +121,19 @@ discard block |
||
121 | 121 | "{$permAlias}.aro_id" => $aroPath[$i][$this->Aro->alias]['id'], |
122 | 122 | "{$permAlias}.aco_id" => $acoIDs |
123 | 123 | ), |
124 | - 'order' => array($this->Aco->alias . '.lft' => 'desc'), |
|
124 | + 'order' => array($this->Aco->alias.'.lft' => 'desc'), |
|
125 | 125 | 'recursive' => 0 |
126 | 126 | )); |
127 | 127 | |
128 | 128 | if (empty($perms)) { |
129 | 129 | continue; |
130 | 130 | } |
131 | - $perms = Hash::extract($perms, '{n}.' . $this->alias); |
|
131 | + $perms = Hash::extract($perms, '{n}.'.$this->alias); |
|
132 | 132 | foreach ($perms as $perm) { |
133 | 133 | if ($action === '*') { |
134 | 134 | |
135 | 135 | foreach ($permKeys as $key) { |
136 | - if (!empty($perm)) { |
|
136 | + if ( ! empty($perm)) { |
|
137 | 137 | if ($perm[$key] == -1) { |
138 | 138 | return false; |
139 | 139 | } elseif ($perm[$key] == 1) { |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | return true; |
147 | 147 | } |
148 | 148 | } else { |
149 | - switch ($perm['_' . $action]) { |
|
149 | + switch ($perm['_'.$action]) { |
|
150 | 150 | case -1: |
151 | 151 | return false; |
152 | 152 | case 0: |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | $permKeys = $this->getAcoKeys($this->schema()); |
176 | 176 | $save = array(); |
177 | 177 | |
178 | - if (!$perms) { |
|
178 | + if ( ! $perms) { |
|
179 | 179 | trigger_error(__d('cake_dev', '%s - Invalid node', 'DbAcl::allow()'), E_USER_WARNING); |
180 | 180 | return false; |
181 | 181 | } |
@@ -186,14 +186,14 @@ discard block |
||
186 | 186 | if ($actions === '*') { |
187 | 187 | $save = array_combine($permKeys, array_pad(array(), count($permKeys), $value)); |
188 | 188 | } else { |
189 | - if (!is_array($actions)) { |
|
190 | - $actions = array('_' . $actions); |
|
189 | + if ( ! is_array($actions)) { |
|
190 | + $actions = array('_'.$actions); |
|
191 | 191 | } |
192 | 192 | foreach ($actions as $action) { |
193 | 193 | if ($action{0} !== '_') { |
194 | - $action = '_' . $action; |
|
194 | + $action = '_'.$action; |
|
195 | 195 | } |
196 | - if (!in_array($action, $permKeys, true)) { |
|
196 | + if ( ! in_array($action, $permKeys, true)) { |
|
197 | 197 | throw new AclException(__d('cake_dev', 'Invalid permission key "%s"', $action)); |
198 | 198 | } |
199 | 199 | $save[$action] = $value; |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | } |
202 | 202 | list($save['aro_id'], $save['aco_id']) = array($perms['aro'], $perms['aco']); |
203 | 203 | |
204 | - if ($perms['link'] && !empty($perms['link'])) { |
|
204 | + if ($perms['link'] && ! empty($perms['link'])) { |
|
205 | 205 | $save['id'] = $perms['link'][0][$this->alias]['id']; |
206 | 206 | } else { |
207 | 207 | unset($save['id']); |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | if (empty($obj['Aro']) || empty($obj['Aco'])) { |
226 | 226 | return false; |
227 | 227 | } |
228 | - $aro = Hash::extract($obj, 'Aro.0.' . $this->Aro->alias . '.id'); |
|
229 | - $aco = Hash::extract($obj, 'Aco.0.' . $this->Aco->alias . '.id'); |
|
228 | + $aro = Hash::extract($obj, 'Aro.0.'.$this->Aro->alias.'.id'); |
|
229 | + $aco = Hash::extract($obj, 'Aco.0.'.$this->Aco->alias.'.id'); |
|
230 | 230 | $aro = current($aro); |
231 | 231 | $aco = current($aco); |
232 | 232 | |
@@ -234,8 +234,8 @@ discard block |
||
234 | 234 | 'aro' => $aro, |
235 | 235 | 'aco' => $aco, |
236 | 236 | 'link' => $this->find('all', array('conditions' => array( |
237 | - $this->alias . '.aro_id' => $aro, |
|
238 | - $this->alias . '.aco_id' => $aco |
|
237 | + $this->alias.'.aro_id' => $aro, |
|
238 | + $this->alias.'.aco_id' => $aco |
|
239 | 239 | ))) |
240 | 240 | ); |
241 | 241 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $newKeys = array(); |
251 | 251 | $keys = array_keys($keys); |
252 | 252 | foreach ($keys as $key) { |
253 | - if (!in_array($key, array('id', 'aro_id', 'aco_id'))) { |
|
253 | + if ( ! in_array($key, array('id', 'aro_id', 'aco_id'))) { |
|
254 | 254 | $newKeys[] = $key; |
255 | 255 | } |
256 | 256 | } |