Permalink
Browse files

Coding Standards. variable names sould be camelBack.

  • Loading branch information...
1 parent 3aa882a commit 814200ecd2b0ccf5b144d015bf0ae6ed8a675637 Yosuke Basuke Suzuki committed Oct 3, 2011
Showing with 12 additions and 12 deletions.
  1. +3 −3 models/entity.php
  2. +9 −9 models/entity_model.php
View
6 models/entity.php
@@ -31,7 +31,7 @@ public function isAllowed($method) {
**************************************/
public $_name_;
- private $model_class;
+ private $modelClass;
/**
* Bind the entity and its source model.
@@ -44,7 +44,7 @@ public function bind(EntityModel $model, $data) {
assert('is_array($data)');
$this->_name_ = $model->alias;
- $this->model_class = $model->name;
+ $this->modelClass = $model->name;
foreach ($data as $modelClass => $values) {
if ($modelClass == $model->alias) {
@@ -64,7 +64,7 @@ public function bind(EntityModel $model, $data) {
public function getModel() {
return ClassRegistry::init(array(
- 'class' => $this->model_class,
+ 'class' => $this->modelClass,
'alias' => $this->_name_,
'type' => 'Model',
));
View
18 models/entity_model.php
@@ -27,13 +27,13 @@ protected function convertToEntity($data) {
return $this->entity($data);
}
- protected function convertToEntities($list_of_data) {
- if ($list_of_data && !Set::numeric(array_keys($list_of_data))) {
- return $this->convertToEntity($list_of_data);
+ protected function convertToEntities($list) {
+ if ($list && !Set::numeric(array_keys($list))) {
+ return $this->convertToEntity($list);
}
$result = array();
- foreach ($list_of_data as $data) {
+ foreach ($list as $data) {
$result[] = $this->convertToEntity($data);
}
return $result;
@@ -104,27 +104,27 @@ public function entities($params = array()) {
}
public function call__($method, $params) {
- list($to_entity, $method) = $this->analyzeMethodName($method);
+ list($entity, $method) = $this->analyzeMethodName($method);
$return = parent::call__($method, $params);
- if ($to_entity && !is_null($return)) {
+ if ($entity && !is_null($return)) {
$return = $this->convertToEntities($return);
}
return $return;
}
protected function analyzeMethodName($method) {
- $to_entity = false;
+ $entity = false;
if (preg_match('/^(entity|(?:all)?entities)by(.+)$/i', $method, $matches)) {
- $to_entity = true;
+ $entity = true;
$all = (strtolower($matches[1]) != 'entity');
$method = ($all ? 'findAllBy' : 'findBy'). $matches[2];
}
- return array($to_entity, $method);
+ return array($entity, $method);
}
/**

0 comments on commit 814200e

Please sign in to comment.