From c4ae1f54def657466decd922fe1628b8de87f462 Mon Sep 17 00:00:00 2001 From: Adam Engebretson Date: Tue, 1 Dec 2015 00:44:13 -0600 Subject: [PATCH] Tidying Signed-off-by: Adam Engebretson --- src/HtmlBuilder.php | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/HtmlBuilder.php b/src/HtmlBuilder.php index fbf7df3..cd7f994 100755 --- a/src/HtmlBuilder.php +++ b/src/HtmlBuilder.php @@ -516,23 +516,36 @@ class HtmlBuilder /** * Render a custom component. * - * @param $name - * @param array $arguments - * @return string + * @param $name + * @param array $arguments + * @return \Illuminate\Contracts\View\View */ protected function renderComponent($name, array $arguments) { $component = static::$components[$name]; + $data = $this->getComponentData($component['signature'], $arguments); - return $this->view->make($component['view'], array_combine($component['signature'], $arguments))->render(); + return $this->view->make($component['view'], $data); + } + + /** + * Prepare the component data. + * + * @param array $signature + * @param array $arguments + * @return array + */ + protected function getComponentData(array $signature, array $arguments) + { + return array_combine($signature, $arguments); } /** * Dynamically handle calls to the class. * - * @param $method - * @param $parameters - * @return mixed|string + * @param string $method + * @param array $parameters + * @return \Illuminate\Contracts\View\View|mixed * * @throws \BadMethodCallException */