Compare commits

..

No commits in common. "eff0b8676220bf4dc95cc44e18310cc65958629b" and "d48f24ed989ed98ec79f358169843bb0c183e211" have entirely different histories.

View File

@ -25,15 +25,9 @@ class Neuron {
/**
* __construct
*
* @param array $data
* @param object|array $data
*/
public function __construct(...$data) {
if (count($data) === 1 &&
isset($data[0]) &&
(is_array($data[0]) ||
is_object($data[0])))
$data = $data[0];
public function __construct(array|object $data = []) {
foreach($data as $key => $value)
$this->{$key} = $value;
}
@ -44,8 +38,9 @@ class Neuron {
* @param string $index
* @return mixed
*/
public function __get(string $index) : mixed {
return null;
public function __get(string $index) {
return (isset($this->{$index}) &&
$this->{$index} != '') ? $this->{$index} : null;
}
}