Skip to content

Commit

Permalink
Added getOrNull
Browse files Browse the repository at this point in the history
Added get or null for uncertain data, which is pretty common in multiple sheets project
  • Loading branch information
Nika Jorjoliani authored Aug 8, 2019
1 parent b7ed605 commit b36dd7d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,19 @@ public function get($item) {
}
}

/**
* Get value of property or null
* @param $item
* @return Mixed $item
*/
public function getOrNull($item) {
if(!isset($this -> $item)) {
return null;
}else {
return $this -> $item;
}
}

/**
* Stores the $properties given to the instantiated object.
* the $properties may came as an associative array or a stdClass object
Expand Down

0 comments on commit b36dd7d

Please sign in to comment.