Skip to content
Browse files

Update: code review for `Strict` compliance.

  • Loading branch information...
1 parent 22d0cef commit 200c0769d3bbedf7fc5eb0867bf6f30b9adb07a8 @quickapps quickapps committed Mar 25, 2012
Showing with 57 additions and 56 deletions.
  1. +1 −1 QuickApps/Controller/Component/HookCollectionComponent.php
  2. +2 −2 QuickApps/Controller/Component/QuickAppsComponent.php
  3. +1 −1 QuickApps/Model/Behavior/HookCollectionBehavior.php
  4. +3 −3 QuickApps/Model/Behavior/SerializedBehavior.php
  5. +2 −2 QuickApps/Model/Behavior/SluggableBehavior.php
  6. +2 −2 QuickApps/Model/Behavior/WhoDidItBehavior.php
  7. +1 −1 QuickApps/Plugin/Block/Model/Block.php
  8. +1 −1 QuickApps/Plugin/Block/Model/BlockRegion.php
  9. +1 −1 QuickApps/Plugin/Comment/Controller/Component/CommentHookComponent.php
  10. +2 −2 QuickApps/Plugin/Comment/Model/Behavior/BBCodeBehavior.php
  11. +3 −3 QuickApps/Plugin/Comment/Model/Comment.php
  12. +1 −1 QuickApps/Plugin/Field/Controller/Component/FieldHookComponent.php
  13. +8 −8 QuickApps/Plugin/Field/Model/Behavior/FieldableBehavior.php
  14. +4 −4 QuickApps/Plugin/Field/Model/Field.php
  15. +3 −3 QuickApps/Plugin/Locale/Model/Language.php
  16. +2 −2 QuickApps/Plugin/Menu/Model/Menu.php
  17. +1 −1 QuickApps/Plugin/Menu/Model/MenuLink.php
  18. +1 −1 QuickApps/Plugin/Node/Controller/Component/NodeHookComponent.php
  19. +4 −4 QuickApps/Plugin/Node/Model/Node.php
  20. +5 −4 QuickApps/Plugin/Node/Model/NodeType.php
  21. +1 −1 QuickApps/Plugin/System/Controller/Component/JqueryUIComponent.php
  22. +1 −1 QuickApps/Plugin/System/View/Helper/SystemHookHelper.php
  23. +1 −1 QuickApps/Plugin/User/Model/Behavior/UserHookBehavior.php
  24. +2 −2 QuickApps/Plugin/User/Model/Role.php
  25. +2 −2 QuickApps/Plugin/User/Model/User.php
  26. +1 −1 QuickApps/View/Helper/HookCollectionHelper.php
  27. +1 −1 QuickApps/View/Helper/HooktagsCollectionHelper.php
View
2 QuickApps/Controller/Component/HookCollectionComponent.php
@@ -24,7 +24,7 @@ class HookCollectionComponent extends Component {
* @param object $controller Controller with components to initialize
* @return void
*/
- public function initialize(&$Controller) {
+ public function initialize(Controller $Controller) {
$this->HookCollection = new HookCollection($Controller, 'Component');
}
View
4 QuickApps/Controller/Component/QuickAppsComponent.php
@@ -23,7 +23,7 @@ class QuickAppsComponent extends Component {
* @param object $controller Controller with components to initialize
* @return void
*/
- public function initialize($Controller) {
+ public function initialize(Controller $Controller) {
$this->Controller = $Controller;
$this->loadVariables();
@@ -45,7 +45,7 @@ public function initialize($Controller) {
* @param Controller $controller Controller with components to beforeRender
* @return void
*/
- public function beforeRender($controller) {
+ public function beforeRender(Controller $Controller) {
if ($this->Controller->request->is('ajax')) {
$this->Controller->layout = 'ajax';
} elseif ($this->is('view.node')) {
View
2 QuickApps/Model/Behavior/HookCollectionBehavior.php
@@ -18,7 +18,7 @@ class HookCollectionBehavior extends ModelBehavior {
*/
public $HookCollection;
- public function setup(&$Model, $settings = array()) {
+ public function setup(Model $Model, $settings = array()) {
if (!Configure::read('__HookCollectionBehavior')) {
$this->HookCollection = new HookCollection($Model, 'Behavior');
View
6 QuickApps/Model/Behavior/SerializedBehavior.php
@@ -26,15 +26,15 @@ class SerializedBehavior extends ModelBehavior {
* @return void
* @access public
*/
- public function setup($Model, $config = array()) {
+ public function setup(Model $Model, $config = array()) {
if (is_string($config)) {
$config = array($config);
}
$this->fields = array_merge($this->fields, $config);
}
- public function afterFind(&$Model, $results, $primary) {
+ public function afterFind(Model $Model, $results, $primary) {
$_results = $results;
if (isset($_results[0][$Model->alias])) {
@@ -62,7 +62,7 @@ public function afterFind(&$Model, $results, $primary) {
return $_results;
}
- public function beforeSave($Model) {
+ public function beforeSave(Model $Model) {
if (isset($Model->data[$Model->alias][0])) {
foreach ($Model->data[$Model->alias] as &$record) {
foreach ($record as $field => &$data) {
View
4 QuickApps/Model/Behavior/SluggableBehavior.php
@@ -50,7 +50,7 @@ class SluggableBehavior extends ModelBehavior
* @param array $settings Settings to override for model.
* @access public
*/
- function setup(&$Model, $settings = array())
+ function setup(Model $Model, $settings = array())
{
$default = array('label' => array('title'), 'slug' => 'slug', 'separator' => '-', 'length' => 200, 'overwrite' => true, 'translation' => null);
@@ -69,7 +69,7 @@ function setup(&$Model, $settings = array())
* @return boolean true if save should proceed, false otherwise
* @access public
*/
- function beforeSave(&$Model)
+ function beforeSave(Model $Model)
{
$return = parent::beforeSave($Model);
View
4 QuickApps/Model/Behavior/WhoDidItBehavior.php
@@ -39,7 +39,7 @@ class WhoDidItBehavior extends ModelBehavior {
* @return void
* @access public
*/
- function setup(&$model, $config = array()) {
+ function setup(Model $model, $config = array()) {
//assigne default settings
$this->settings[$model->alias] = $this->_defaults;
@@ -80,7 +80,7 @@ function setup(&$model, $config = array()) {
* @return boolean True if the operation should continue, false if it should abort
* @access public
*/
- function beforeSave(&$model) {
+ function beforeSave(Model $model) {
if ($this->settings[$model->alias]['has_created_by'] || $this->settings[$model->alias]['has_modified_by']) {
$AuthSession = $this->settings[$model->alias]['auth_session'];
View
2 QuickApps/Plugin/Block/Model/Block.php
@@ -49,7 +49,7 @@ class Block extends BlockAppModel {
)
);
- public function beforeSave() {
+ public function beforeSave($options = array()) {
// get new delta
if (!isset($this->data['Block']['id'])) {
// new record
View
2 QuickApps/Plugin/Block/Model/BlockRegion.php
@@ -15,7 +15,7 @@ class BlockRegion extends BlockAppModel {
public $order = array('BlockRegion.ordering' => 'ASC');
public $primaryKey = 'id';
- public function beforeSave() {
+ public function beforeSave($options = array()) {
if (!isset($this->data['BlockRegion']['id'])) {
$r = $this->data['BlockRegion']['region'];
$t = $this->data['BlockRegion']['theme'];
View
2 QuickApps/Plugin/Comment/Controller/Component/CommentHookComponent.php
@@ -18,7 +18,7 @@ class CommentHookComponent extends Component {
* @param object $controller Controller with components to initialize
* @return void
*/
- public function initialize($Controller) {
+ public function initialize(Controller $Controller) {
$this->Controller = $Controller;
$data = $this->Controller->data;
View
4 QuickApps/Plugin/Comment/Model/Behavior/BBCodeBehavior.php
@@ -20,7 +20,7 @@ class BBCodeBehavior extends ModelBehavior {
* @return void
* @access public
*/
- public function setup($Model, $config = array()) {
+ public function setup(Model $Model, $config = array()) {
$smileyURL = QuickApps::strip_language_prefix(Router::url('/', true)) . 'comment/img/smileys';
$__settings = array(
@@ -38,7 +38,7 @@ public function setup($Model, $config = array()) {
$this->settings[$Model->alias]['fields'] = array_unique($this->settings[$Model->alias]['fields']);
}
- public function afterFind(&$Model, $results, $primary) {
+ public function afterFind(Model $Model, $results, $primary) {
$_results = $results;
if (isset($_results[0][$Model->alias])) {
foreach ($_results as $rkey => &$record) {
View
6 QuickApps/Plugin/Comment/Model/Comment.php
@@ -63,7 +63,7 @@ class Comment extends CommentAppModel {
)
);
- public function beforeValidate() {
+ public function beforeValidate($options = array()) {
if (!isset($this->data['Comment']['node_id'])) {
return false;
}
@@ -150,7 +150,7 @@ public function beforeValidate() {
return !in_array(false, (array)$r, true);
}
- public function beforeSave() {
+ public function beforeSave($options = array()) {
if (isset($this->data['Comment']['node_id'])) {
Cache::delete("node_{$this->__tmp['nodeData']['Node']['slug']}");
}
@@ -200,7 +200,7 @@ public function beforeSave() {
return !in_array(false, (array)$r, true);
}
- public function afterSave() {
+ public function afterSave($created) {
if (isset($this->__tmp['deleteSpam'])) {
$this->delete($this->id);
}
View
2 QuickApps/Plugin/Field/Controller/Component/FieldHookComponent.php
@@ -12,7 +12,7 @@
class FieldHookComponent extends Component {
public $Controller = null;
- public function initialize(&$Controller) {
+ public function initialize(Controller $Controller) {
$this->Controller = $Controller;
}
View
16 QuickApps/Plugin/Field/Model/Behavior/FieldableBehavior.php
@@ -156,7 +156,7 @@ class FieldableBehavior extends ModelBehavior {
* @param array $settings array of configuration settings
* @return void
*/
- public function setup(&$Model, $settings = array()) {
+ public function setup(Model $Model, $settings = array()) {
// keep a setings array for each model
$this->__settings[$Model->alias] = array();
$this->__settings[$Model->alias] = Set::merge($this->__settings[$Model->alias], $settings);
@@ -172,7 +172,7 @@ public function setup(&$Model, $settings = array()) {
* @param object $Model instance of model
* @return boolean true
*/
- public function beforeFind(&$Model, $query) {
+ public function beforeFind(Model $Model, $query) {
if ((isset($Model->fieldsNoFetch) && $Model->fieldsNoFetch) ||
(isset($query['recursive']) && $query['recursive'] <= 0)
) {
@@ -216,7 +216,7 @@ public function beforeFind(&$Model, $query) {
* @param boolean $primary Whether Model is being queried directly (vs. being queried as an association)
* @return mixed An array value will replace the value of $results - any other value will be ignored
*/
- public function afterFind(&$Model, $results, $primary) {
+ public function afterFind(Model $Model, $results, $primary) {
if (empty($results) ||
!$primary ||
(isset($Model->fieldsNoFetch) && $Model->fieldsNoFetch)
@@ -280,7 +280,7 @@ public function afterFind(&$Model, $results, $primary) {
* @param object $Model instance of model
* @return boolean FALSE if any of the fields has returned FALSE. TRUE otherwise
*/
- public function beforeSave(&$Model) {
+ public function beforeSave(Model $Model) {
$r = array();
if (isset($Model->data['FieldData'])) {
@@ -310,7 +310,7 @@ public function beforeSave(&$Model) {
* @see $this::beforeSave()
* @return void
*/
- public function afterSave(&$Model, $created) {
+ public function afterSave(Model $Model, $created) {
if (!empty($this->__tmp['fieldData'])) {
foreach ($this->__tmp['fieldData'] as $field_module => $fields) {
foreach ($fields as $field_id => $info) {
@@ -333,7 +333,7 @@ public function afterSave(&$Model, $created) {
* @param object $Model instance of model
* @return boolean False if any of the fields has returned false. True otherwise.
*/
- public function beforeDelete(&$Model) {
+ public function beforeDelete(Model $Model, $cascade = true) {
return $this->__beforeAfterDelete($Model, 'before');
}
@@ -343,7 +343,7 @@ public function beforeDelete(&$Model) {
* @param object $Model instance of model
* @return boolean False if any of the fields has returned false. True otherwise.
*/
- public function afterDelete(&$Model) {
+ public function afterDelete(Model $Model) {
return $this->__beforeAfterDelete($Model, 'after');
}
@@ -359,7 +359,7 @@ public function afterDelete(&$Model) {
* @param object $Model instance of model
* @return boolean True if all the fields are valid, false otherwise
*/
- public function beforeValidate(&$Model) {
+ public function beforeValidate(Model $Model) {
if (!isset($Model->data['FieldData'])) {
return true;
}
View
8 QuickApps/Plugin/Field/Model/Field.php
@@ -23,7 +23,7 @@ class Field extends FieldAppModel {
'field_module' => array('required' => true, 'allowEmpty' => false, 'rule' => 'notEmpty', 'message' => 'Select a field type.')
);
- public function beforeValidate() {
+ public function beforeValidate($options = array()) {
// merge settings (array treatment): formatter form post
if (isset($this->data['Field']['id']) && isset($this->data['Field']['settings'])) {
$this->validate = false;
@@ -58,7 +58,7 @@ public function beforeValidate() {
return true;
}
- public function beforeSave() {
+ public function beforeSave($options = array()) {
if (isset($this->data['Field']['field_module'])) {
if (isset($this->data['Field']['name'])) {
$this->data['Field']['name'] = 'field_' . str_replace('field_', '', $this->data['Field']['name']);
@@ -90,13 +90,13 @@ public function beforeSave() {
return true;
}
- public function afterSave() {
+ public function afterSave($created) {
$field = $this->read();
$this->hook("{$field['Field']['field_module']}_after_save_instance", $this);
}
- public function beforeDelete() {
+ public function beforeDelete($cascade = true) {
$this->data = $this->read(); // tmp holder (before/afterDelete)
$before = $this->hook("{$this->field['Field']['field_module']}_before_delete_instance", $this, array('collectReturn' => false));
View
6 QuickApps/Plugin/Locale/Model/Language.php
@@ -24,7 +24,7 @@ class Language extends LocaleAppModel {
'direction' => array('required' => true, 'allowEmpty' => false, 'rule' => '/^(ltr|rtl)$/s', 'message' => 'Invalid language direction.')
);
- public function beforeValidate() {
+ public function beforeValidate($options = array()) {
if (!isset($this->data['Language']['id']) && !isset($this->data['Language']['addCustom'])) {
// new language => determinate name&native
if (isset($this->data['Language']['code'])) {
@@ -48,7 +48,7 @@ public function beforeValidate() {
return true;
}
- public function beforeSave() {
+ public function beforeSave($options = array()) {
if (isset($this->data['Language']['custom_icon']) && trim($this->data['Language']['custom_icon']) !== '') {
$this->data['Language']['icon'] = $this->data['Language']['custom_icon'];
}
@@ -67,7 +67,7 @@ public function beforeSave() {
return true;
}
- public function beforeDelete() {
+ public function beforeDelete($cascade = true) {
if (in_array($this->id, array(1, $this->__languageIdByCode(Configure::read('Variable.default_language'))))) {
return false;
}
View
4 QuickApps/Plugin/Menu/Model/Menu.php
@@ -36,7 +36,7 @@ class Menu extends MenuAppModel {
)
);
- public function beforeDelete($cascade) {
+ public function beforeDelete($cascade = true) {
// delete block
$this->Block->deleteAll(
array(
@@ -64,7 +64,7 @@ public function beforeDelete($cascade) {
return true;
}
- public function beforeSave() {
+ public function beforeSave($options = array()) {
if (!isset($this->data['Menu']['id'])) {
/* menu slug */
$id = Inflector::slug($this->data['Menu']['title'], '-');
View
2 QuickApps/Plugin/Menu/Model/MenuLink.php
@@ -24,7 +24,7 @@ class MenuLink extends MenuAppModel {
'router_path' => array('required' => true, 'allowEmpty' => false, 'rule' => 'validatePath', 'message' => 'Invalid link path.')
);
- public function beforeSave() {
+ public function beforeSave($options = array()) {
if (isset($this->data['MenuLink']['router_path']) && $this->data['MenuLink']['router_path'] !== '/') {
// fix: paths must never end with '/'
$this->data['MenuLink']['router_path'] = preg_replace('/\/{2,}/', '', "{$this->data['MenuLink']['router_path']}//");
View
2 QuickApps/Plugin/Node/Controller/Component/NodeHookComponent.php
@@ -12,7 +12,7 @@
class NodeHookComponent extends Component {
public $Controller = null;
- public function initialize(&$Controller) {
+ public function initialize(Controller $Controller) {
$this->Controller = $Controller;
}
View
8 QuickApps/Plugin/Node/Model/Node.php
@@ -42,7 +42,7 @@ class Node extends NodeAppModel {
)
);
- public function afterFind($results, $primary) {
+ public function afterFind($results, $primary = false) {
if (empty($results) || !$primary) {
return $results;
}
@@ -58,7 +58,7 @@ public function afterFind($results, $primary) {
return $results;
}
- public function beforeValidate() {
+ public function beforeValidate($options = array()) {
if (!isset($this->data['Node']['regenerate_slug']) || !$this->data['Node']['regenerate_slug']) {
$this->Behaviors->detach('Sluggable');
$this->Behaviors->attach('Sluggable', array('overwrite' => false));
@@ -74,7 +74,7 @@ public function beforeValidate() {
return ($r !== false);
}
- public function beforeSave($options) {
+ public function beforeSave($options = array()) {
$roles = implode("|", Set::extract('/Role/Role', $this->data));
$this->data['Node']['roles_cache'] = !empty($roles) ? "|" . $roles . "|" : '';
@@ -258,7 +258,7 @@ public function afterSave($created) {
}
}
- public function beforeDelete($cascade) {
+ public function beforeDelete($cascade = true) {
// bind comments and delete them
$this->bindComments();
View
9 QuickApps/Plugin/Node/Model/NodeType.php
@@ -20,12 +20,13 @@ class NodeType extends NodeAppModel {
'title_label' => array('required' => true, 'allowEmpty' => false, 'rule' => 'notEmpty', 'message' => 'Title field label can not be empty.')
);
- public function beforeDelete() {
+ public function beforeDelete($cascade = true) {
$this->tmpId = $this->id;
+
return true;
}
- public function beforeValidate() {
+ public function beforeValidate($options = array()) {
if (isset($this->data['NodeType']['id']) &&
isset($this->data['NodeType']['new_id']) &&
$this->data['NodeType']['id'] != $this->data['NodeType']['new_id']
@@ -43,15 +44,15 @@ public function beforeValidate() {
return true;
}
- public function beforeSave() {
+ public function beforeSave($options = array()) {
if (isset($this->data['NodeType']['base'])) {
$this->data['NodeType']['base'] = Inflector::underscore($this->data['NodeType']['base']);
}
return true;
}
- public function afterSave() {
+ public function afterSave($created) {
if (isset($this->__tmp['old_id'])) {
// update ID
$this->updateAll(
View
2 QuickApps/Plugin/System/Controller/Component/JqueryUIComponent.php
@@ -20,7 +20,7 @@ class JqueryUIComponent extends Component {
* @param object $controller Controller with components to initialize
* @return void
*/
- public function initialize($Controller) {
+ public function initialize(Controller $Controller) {
$this->Controller = $Controller;
$this->Controller->helpers[] = 'System.JqueryUI';
}
View
2 QuickApps/Plugin/System/View/Helper/SystemHookHelper.php
@@ -15,7 +15,7 @@ class SystemHookHelper extends AppHelper {
*
* @return void
*/
- public function beforeLayout() {
+ public function beforeLayout($layoutFile) {
if ($this->is('view.admin') &&
isset($this->request->params['plugin']) &&
$this->request->params['plugin'] == 'system' &&
View
2 QuickApps/Plugin/User/Model/Behavior/UserHookBehavior.php
@@ -19,7 +19,7 @@ class UserHookBehavior extends ModelBehavior {
* @return array Modified query array
* @see QuickAppsComponent::loadVariables()
*/
- public function beforeFind($Model, $query) {
+ public function beforeFind(Model $Model, $query) {
if ($Model->name == 'Variable' && empty($query['conditions'])) {
$query['conditions'] = Set::merge($query['conditions'],
array(
View
4 QuickApps/Plugin/User/Model/Role.php
@@ -20,7 +20,7 @@ class Role extends UserAppModel {
)
);
- public function beforeDelete() {
+ public function beforeDelete($cascade = true) {
$Aro = ClassRegistry::init('Aro');
$Permission = ClassRegistry::init('Permission');
@@ -29,7 +29,7 @@ public function beforeDelete() {
return $Aro->deleteAll(array('model' => 'User.Role', 'foreign_key' => $this->id));
}
- public function afterSave() {
+ public function afterSave($created) {
$Aro = ClassRegistry::init('Aro');
$data = array(
'model' => 'User.Role',
View
4 QuickApps/Plugin/User/Model/User.php
@@ -70,7 +70,7 @@ class User extends UserAppModel {
)
);
- public function beforeValidate() {
+ public function beforeValidate($options = array()) {
if (isset($this->data['User']['id'])) {
$this->validate['password']['allowEmpty'] = true;
}
@@ -82,7 +82,7 @@ public function beforeValidate() {
return true;
}
- public function beforeSave() {
+ public function beforeSave($options = array()) {
App::uses('Security', 'Utility');
App::uses('String', 'Utility');
View
2 QuickApps/View/Helper/HookCollectionHelper.php
@@ -18,7 +18,7 @@ class HookCollectionHelper extends AppHelper {
*/
public $HookCollection;
- public function beforeRender() {
+ public function beforeRender($viewFile) {
$this->HookCollection = new HookCollection($this->_View, 'Helper');
return true;
View
2 QuickApps/View/Helper/HooktagsCollectionHelper.php
@@ -46,7 +46,7 @@ class HooktagsCollectionHelper extends AppHelper {
*/
protected $_hookObjects = array();
- public function beforeRender() {
+ public function beforeRender($viewFile) {
$this->__view = $this->_View;
$this->__loadHooktags();

0 comments on commit 200c076

Please sign in to comment.
Something went wrong with that request. Please try again.