Skip to content

Commit

Permalink
fix: unnecessary exception throw
Browse files Browse the repository at this point in the history
  • Loading branch information
yajra committed Nov 15, 2023
1 parent 979ac47 commit 9ce95f4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
2 changes: 0 additions & 2 deletions src/Contracts/DataTableHtmlBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ interface DataTableHtmlBuilder
* Handle building of dataTables html.
*
* @return \Yajra\DataTables\Html\Builder
*
* @throws \Exception
*/
public function handle();
}
22 changes: 5 additions & 17 deletions src/Html/DataTableHtml.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,24 @@
*/
abstract class DataTableHtml implements DataTableHtmlBuilder
{
/**
* @var \Yajra\DataTables\Html\Builder|null
*/
protected ?Builder $htmlBuilder = null;

/**
* @return \Yajra\DataTables\Html\Builder
*
* @throws \Exception
*/
public static function make(): Builder
{
if (func_get_args()) {
return (new static(...func_get_args()))->handle();
}

return app(static::class)->handle();
/** @var static $html */
$html = app(static::class);

return $html->handle();
}

/**
* @param string $method
* @param mixed $parameters
* @return mixed
* @return \Yajra\DataTables\Html\Builder
*
* @throws \Exception
*/
Expand All @@ -45,9 +40,6 @@ public function __call(string $method, $parameters)
throw new BadMethodCallException("Method {$method} does not exists");
}

/**
* @return \Yajra\DataTables\Html\Builder
*/
protected function getHtmlBuilder(): Builder
{
if ($this->htmlBuilder) {
Expand All @@ -57,10 +49,6 @@ protected function getHtmlBuilder(): Builder
return $this->htmlBuilder = app(Builder::class);
}

/**
* @param \Yajra\DataTables\Html\Builder $builder
* @return static
*/
public function setHtmlBuilder(Builder $builder): static
{
$this->htmlBuilder = $builder;
Expand Down

0 comments on commit 9ce95f4

Please sign in to comment.