public function __call($name, $args = []) { $pos1 = strpos($name, 'add'); $pos2 = strrpos($name, 'File'); $pl = strrpos($name, 'Files') === $pos2; if ($pos1 === 0 && $pos2 > 0) { $extension = strtolower(substr($name, 3, $pos2 - 3)); if ($pl) { foreach ($args[0] as $file) { $this->getLinker($extension)->addFile($file); } } else { $this->getLinker($extension)->addFile($args[0]); } return $this; } return parent::__call($name, $args); }