Compare commits
No commits in common. "eff0b8676220bf4dc95cc44e18310cc65958629b" and "d48f24ed989ed98ec79f358169843bb0c183e211" have entirely different histories.
eff0b86762
...
d48f24ed98
@ -25,15 +25,9 @@ class Neuron {
|
|||||||
/**
|
/**
|
||||||
* __construct
|
* __construct
|
||||||
*
|
*
|
||||||
* @param array $data
|
* @param object|array $data
|
||||||
*/
|
*/
|
||||||
public function __construct(...$data) {
|
public function __construct(array|object $data = []) {
|
||||||
if (count($data) === 1 &&
|
|
||||||
isset($data[0]) &&
|
|
||||||
(is_array($data[0]) ||
|
|
||||||
is_object($data[0])))
|
|
||||||
$data = $data[0];
|
|
||||||
|
|
||||||
foreach($data as $key => $value)
|
foreach($data as $key => $value)
|
||||||
$this->{$key} = $value;
|
$this->{$key} = $value;
|
||||||
}
|
}
|
||||||
@ -44,8 +38,9 @@ class Neuron {
|
|||||||
* @param string $index
|
* @param string $index
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function __get(string $index) : mixed {
|
public function __get(string $index) {
|
||||||
return null;
|
return (isset($this->{$index}) &&
|
||||||
|
$this->{$index} != '') ? $this->{$index} : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user