From 67319e047b2a7a9fd4527586683d53cd3999fec4 Mon Sep 17 00:00:00 2001 From: sizuhiko Date: Sat, 7 Mar 2015 17:45:07 +0900 Subject: [PATCH] fix psr-2 --- src/Adaptor/CakeFabricateAdaptor.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Adaptor/CakeFabricateAdaptor.php b/src/Adaptor/CakeFabricateAdaptor.php index 172ee0a..51d8a93 100644 --- a/src/Adaptor/CakeFabricateAdaptor.php +++ b/src/Adaptor/CakeFabricateAdaptor.php @@ -32,7 +32,7 @@ class CakeFabricateAdaptor extends AbstractFabricateAdaptor const OPTION_VALIDATE = "validate"; /** option values */ - private $_options; + private $options; /** * Constructor @@ -44,7 +44,7 @@ public function __construct($options = []) self::OPTION_FILTER_KEY => false, self::OPTION_VALIDATE => false, ]; - $this->_options = array_merge($defaults, $options); + $this->options = array_merge($defaults, $options); } /** @@ -95,11 +95,11 @@ public function getModel($modelName) public function create($modelName, $attributes, $recordCount) { $table = TableRegistry::get($modelName); - $entities = $table->newEntities($attributes, ['validate' => $this->_options[self::OPTION_VALIDATE]]); + $entities = $table->newEntities($attributes, ['validate' => $this->options[self::OPTION_VALIDATE]]); $table->connection()->transactional(function () use ($table, $entities) { foreach ($entities as $entity) { $ret = $table->save($entity); - if(!$ret) { + if (!$ret) { return false; } } @@ -114,8 +114,8 @@ public function create($modelName, $attributes, $recordCount) public function build($modelName, $data) { $table = TableRegistry::get($modelName); - var_dump($this->_options); - $entity = $table->newEntity($data, ['validate' => $this->_options[self::OPTION_VALIDATE]]); + var_dump($this->options); + $entity = $table->newEntity($data, ['validate' => $this->options[self::OPTION_VALIDATE]]); return $entity; } @@ -125,8 +125,9 @@ public function build($modelName, $data) * @param string $name field name * @return true if $name is primary key, otherwise false */ - protected function filterKey($table, $name) { - if (!$this->_options[self::OPTION_FILTER_KEY]) { + protected function filterKey($table, $name) + { + if (!$this->options[self::OPTION_FILTER_KEY]) { return false; } $primaryKey = $table->primaryKey();