start on Tune::merge()

This commit is contained in:
2018-05-04 20:30:17 -04:00
parent e8c8709976
commit 655a04a501
2 changed files with 55 additions and 1 deletions

View File

@@ -273,7 +273,22 @@ class Tune implements EntityInterface
*/
protected function set($attribute, $value)
{
call_user_func([$this, 'set'.$attribute], [$value]);
switch ($attribute) {
case 'index':
call_user_func([$this, 'set'.$attribute], $value);
break;
default:
$this->append($attribute, $value);
}
}
protected function append($attribute, array $values)
{
$method = 'add' . substr($attribute, 0, -1);
foreach ($values as $value) {
call_user_func([$this, $method], $value);
}
}
/**
@@ -320,4 +335,11 @@ class Tune implements EntityInterface
return $this;
}
public function merge(Tune $source)
{
//TODO
$this->titles = array_merge($this->getTitles(), $source->getTitles());
return $this;
}
}