// Fill in any public properties that were passed in
// but only ones that are in the $pulibcProperties array.
$instance =
$instance->
fill($publicParams);
// If there are any protected/private properties, we need to
// send them to the mount() method.
if (method_exists($instance, 'mount'
)) { // if any $params have keys that match the name of an argument in the
// mount method, pass those variables to the method.
$mountParams =
$this->
getMethodParams($instance, 'mount',
$params);
$instance->
mount(...
$mountParams);
} return $instance->
{$method}();
} /**
* Returns the values from $params that match the parameters
* for a method, in the order they are defined. This allows
* them to be passed directly into the method.
*/
private function getMethodParams(BaseCell
$instance, string
$method, array
$params): array
{