diff --git a/src/MagicObject.php b/src/MagicObject.php index b06617c..6e18908 100644 --- a/src/MagicObject.php +++ b/src/MagicObject.php @@ -156,7 +156,6 @@ class MagicObject extends stdClass // NOSONAR */ private $_persistProp = null; // NOSONAR - /** * Retrieves the list of null properties. * @@ -238,13 +237,16 @@ public function loadData($data) if($data instanceof self) { $values = $data->value(); - foreach ($values as $key => $value) { + foreach ($values as $key => $value) + { $key2 = PicoStringUtil::camelize(str_replace("-", "_", $key)); $this->set($key2, $value, true); } } - else if (is_array($data) || is_object($data)) { - foreach ($data as $key => $value) { + else if (is_array($data) || is_object($data)) + { + foreach ($data as $key => $value) + { $key2 = PicoStringUtil::camelize(str_replace("-", "_", $key)); $this->set($key2, $value, true); } @@ -468,12 +470,14 @@ public function loadJsonFile($path, $systemEnv = false, $asObject = false, $recu $data = json_decode(file_get_contents($path), true); // true to decode as associative array // If data is valid and not empty, process it - if (!empty($data)) { + if (!empty($data)) + { // Replace Pico environment variables in the data $data = PicoEnvironmentVariable::replaceValueAll($data, $data, true); // If systemEnv is true, replace system environment variables - if ($systemEnv) { + if ($systemEnv) + { $data = PicoEnvironmentVariable::replaceSysEnvAll($data, true); } @@ -498,7 +502,8 @@ public function loadJsonFile($path, $systemEnv = false, $asObject = false, $recu */ private function loadJsonData($data, $asObject, $recursive) { - if ($asObject) { + if ($asObject) + { // Convert data to object $data = json_decode(json_encode($data), false); // Convert array to object } @@ -581,13 +586,18 @@ public function currentDatabase($database = null) */ public function databaseEntity($databaseEntity = null) { - if ($databaseEntity !== null) { - if ($databaseEntity instanceof PicoDatabaseEntity) { + if ($databaseEntity !== null) + { + if ($databaseEntity instanceof PicoDatabaseEntity) + { $this->_databaseEntity = $databaseEntity; - } elseif ($databaseEntity instanceof MagicObject) { + } elseif ($databaseEntity instanceof MagicObject) + { $db = $databaseEntity->currentDatabase(); - if (isset($db) && $db->isConnected()) { - if (!isset($this->_databaseEntity)) { + if (isset($db) && $db->isConnected()) + { + if (!isset($this->_databaseEntity)) + { $this->_databaseEntity = new PicoDatabaseEntity(); // Set default database connection $this->_databaseEntity->setDefaultDatabase($this->_database); @@ -1392,7 +1402,8 @@ public function value($snakeCase = false) { $parentProps = $this->propertyList(true, true); $value = new stdClass; - foreach ($this as $key => $val) { + foreach ($this as $key => $val) + { if(!in_array($key, $parentProps)) { $value->{$key} = $val; @@ -1731,7 +1742,6 @@ public function findAll($specification = null, $pageable = null, $sortable = nul $result = $persist->findAll($specification, $pageable, $sortable, $subqueryMap); $stmt = null; } - if($pageable != null && $pageable instanceof PicoPageable) { $match = $this->countData($persist, $specification, $pageable, $sortable, $findOption, $result);