php class View private store public function set key value if is_array

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
<?php
class View {
private $store = [];
public function set($key, $value = 0) {
if (is_array($key) {
foreach ($key as $key1 => $value1) {
$this->store[$key1] = $value;
}
} else {
$this->store[$key] = $value;
}
}
}