Skip to content

Commit

Permalink
atualizacao
Browse files Browse the repository at this point in the history
  • Loading branch information
brunobmorais committed Feb 19, 2023
1 parent 1869a05 commit 49d1529
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/ModelAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ abstract class ModelAbstract
*/
public function __construct(array $params = null){
if (!empty($params))
$this->modelFromMap($params);
$this->fromMapToModel($params);
}

/**
* @param array $params
* @return void
*/
public function modelFromMap(array $params): void
public function fromMapToModel(array $params): void
{
foreach ($params as $key => $item)
{
Expand All @@ -30,13 +30,10 @@ public function modelFromMap(array $params): void
* @param string $json
* @return void
*/
public function modelFromJson(string $json): void
public function fromJsonToModel(string $json): void
{
$params = json_decode($json, true);
foreach ($params as $key => $item)
{
$this->{$key} = $item;
}
$this->fromMapToModel($params);
}

/**
Expand Down

0 comments on commit 49d1529

Please sign in to comment.