22
33namespace Yajra \DataTables \Html ;
44
5- use Collective \Html \HtmlBuilder ;
6- use Illuminate \Contracts \Config \Repository ;
7- use Illuminate \Contracts \View \Factory ;
85use Illuminate \Support \Arr ;
6+ use Illuminate \Support \Str ;
7+ use Collective \Html \HtmlBuilder ;
98use Illuminate \Support \Collection ;
109use Illuminate \Support \HtmlString ;
11- use Illuminate \Support \ Str ;
10+ use Illuminate \Contracts \ View \ Factory ;
1211use Illuminate \Support \Traits \Macroable ;
12+ use Illuminate \Contracts \Config \Repository ;
1313
1414class Builder
1515{
@@ -86,10 +86,10 @@ class Builder
8686 */
8787public function __construct (Repository $ config ,Factory $ view ,HtmlBuilder $ html )
8888 {
89- $ this ->config =$ config ;
90- $ this ->view =$ view ;
91- $ this ->html =$ html ;
92- $ this ->collection =new Collection ;
89+ $ this ->config =$ config ;
90+ $ this ->view =$ view ;
91+ $ this ->html =$ html ;
92+ $ this ->collection =new Collection ;
9393$ this ->tableAttributes =$ this ->config ->get ('datatables-html.table ' , []);
9494 }
9595
@@ -157,7 +157,7 @@ public function parameterize($attributes = [])
157157$ values = [];
158158$ replacements = [];
159159foreach ($ parametersas $ key => &$ value ) {
160- if (!is_array ($ value )) {
160+ if (!is_array ($ value )) {
161161if (strpos ($ value ,'$. ' ) ===0 ) {
162162// Store function string.
163163$ values [] =$ value ;
@@ -169,8 +169,8 @@ public function parameterize($attributes = [])
169169 }
170170 }
171171
172- list ($ ajaxDataFunction ,$ parameters ) =$ this ->encodeAjaxDataFunction ($ parameters );
173- list ($ columnFunctions ,$ parameters ) =$ this ->encodeColumnFunctions ($ parameters );
172+ list ($ ajaxDataFunction ,$ parameters ) =$ this ->encodeAjaxDataFunction ($ parameters );
173+ list ($ columnFunctions ,$ parameters ) =$ this ->encodeColumnFunctions ($ parameters );
174174list ($ callbackFunctions ,$ parameters ) =$ this ->encodeCallbackFunctions ($ parameters );
175175
176176$ json =json_encode ($ parameters );
@@ -247,7 +247,7 @@ public function setTableId($id)
247247 */
248248public function getTableAttribute ($ attribute )
249249 {
250- if (!array_key_exists ($ attribute ,$ this ->tableAttributes )) {
250+ if (!array_key_exists ($ attribute ,$ this ->tableAttributes )) {
251251throw new \Exception ("Table attribute ' {$ attribute }' does not exist. " );
252252 }
253253
@@ -262,11 +262,11 @@ public function getTableAttribute($attribute)
262262 */
263263public function addTableClass ($ class )
264264 {
265- $ class =is_array ($ class ) ?implode (' ' ,$ class ) :$ class ;
265+ $ class =is_array ($ class ) ?implode (' ' ,$ class ) :$ class ;
266266$ currentClass = Arr::get (array_change_key_case ($ this ->tableAttributes ),'class ' );
267267
268268$ classes =preg_split ('#\s+# ' ,$ currentClass .' ' .$ class ,null ,PREG_SPLIT_NO_EMPTY );
269- $ class =implode (' ' ,array_unique ($ classes ));
269+ $ class =implode (' ' ,array_unique ($ classes ));
270270
271271return $ this ->setTableAttribute ('class ' ,$ class );
272272 }
@@ -279,7 +279,7 @@ public function addTableClass($class)
279279 */
280280public function removeTableClass ($ class )
281281 {
282- $ class =is_array ($ class ) ?implode (' ' ,$ class ) :$ class ;
282+ $ class =is_array ($ class ) ?implode (' ' ,$ class ) :$ class ;
283283$ currentClass = Arr::get (array_change_key_case ($ this ->tableAttributes ),'class ' );
284284
285285$ classes =array_diff (
@@ -305,7 +305,7 @@ public function addColumn(array $attributes)
305305 }
306306
307307/**
308- * Add a Column object at the beginning of collection
308+ * Add a Column object at the beginning of collection.
309309 *
310310 * @param \Yajra\DataTables\Html\Column $column
311311 * @return $this
@@ -354,7 +354,7 @@ public function columns(array $columns)
354354$ this ->collection =new Collection ;
355355
356356foreach ($ columnsas $ key =>$ value ) {
357- if (!is_a ($ value , Column::class)) {
357+ if (!is_a ($ value , Column::class)) {
358358if (is_array ($ value )) {
359359$ attributes =array_merge (['name ' =>$ key ,'data ' =>$ key ],$ this ->setTitle ($ key ,$ value ));
360360 }else {
@@ -383,7 +383,7 @@ public function columns(array $columns)
383383 */
384384public function setTitle ($ title ,array $ attributes )
385385 {
386- if (!isset ($ attributes ['title ' ])) {
386+ if (!isset ($ attributes ['title ' ])) {
387387$ attributes ['title ' ] =$ this ->getQualifiedTitle ($ title );
388388 }
389389
@@ -477,7 +477,7 @@ public function addIndex(array $attributes = [])
477477 }
478478
479479/**
480- * Setup ajax parameter for datatables pipeline plugin
480+ * Setup ajax parameter for datatables pipeline plugin.
481481 *
482482 * @param string $url
483483 * @param string $pages
@@ -491,7 +491,7 @@ public function pipeline($url, $pages)
491491 }
492492
493493/**
494- * Setup ajax parameter
494+ * Setup ajax parameter.
495495 *
496496 * @param string|array $attributes
497497 * @return $this
@@ -521,7 +521,7 @@ public function table(array $attributes = [], $drawFooter = false, $drawSearch =
521521$ tableHtml ='<table ' .$ htmlAttr .'> ' ;
522522$ searchHtml =$ drawSearch ?'<tr class="search-filter"> ' .implode ('' ,
523523$ this ->compileTableSearchHeaders ()) .'</tr> ' :'' ;
524- $ tableHtml .='<thead><tr> ' .implode ('' ,$ th ) .'</tr> ' .$ searchHtml .'</thead> ' ;
524+ $ tableHtml .='<thead><tr> ' .implode ('' ,$ th ) .'</tr> ' .$ searchHtml .'</thead> ' ;
525525if ($ drawFooter ) {
526526$ tf =$ this ->compileTableFooter ();
527527$ tableHtml .='<tfoot><tr> ' .implode ('' ,$ tf ) .'</tr></tfoot> ' ;
@@ -601,16 +601,16 @@ public function minifiedAjax($url = '', $script = null, $data = [])
601601$ this ->ajax ['url ' ] =$ url ;
602602$ this ->ajax ['type ' ] ='GET ' ;
603603if (isset ($ this ->attributes ['serverSide ' ]) ?$ this ->attributes ['serverSide ' ] :true ) {
604- $ this ->ajax ['data ' ] =" function(data) {
604+ $ this ->ajax ['data ' ] =' function(data) {
605605 for (var i = 0, len = data.columns.length; i < len; i++) {
606606 if (!data.columns[i].search.value) delete data.columns[i].search;
607607 if (data.columns[i].searchable === true) delete data.columns[i].searchable;
608608 if (data.columns[i].orderable === true) delete data.columns[i].orderable;
609609 if (data.columns[i].data === data.columns[i].name) delete data.columns[i].name;
610610 }
611- delete data.search.regex; " ;
611+ delete data.search.regex; ' ;
612612 }else {
613- $ this ->ajax ['data ' ] =" function(data){ " ;
613+ $ this ->ajax ['data ' ] =' function(data){ ' ;
614614 }
615615
616616if ($ appendData ) {
@@ -621,7 +621,7 @@ public function minifiedAjax($url = '', $script = null, $data = [])
621621$ this ->ajax ['data ' ] .=$ script ;
622622 }
623623
624- $ this ->ajax ['data ' ] .=" } " ;
624+ $ this ->ajax ['data ' ] .=' } ' ;
625625
626626return $ this ;
627627 }
@@ -637,7 +637,7 @@ protected function encodeAjaxDataFunction($parameters)
637637$ ajaxData ='' ;
638638if (isset ($ parameters ['ajax ' ]['data ' ])) {
639639$ ajaxData =$ parameters ['ajax ' ]['data ' ];
640- $ parameters ['ajax ' ]['data ' ] =" #ajax_data# " ;
640+ $ parameters ['ajax ' ]['data ' ] =' #ajax_data# ' ;
641641 }
642642
643643return [$ ajaxData ,$ parameters ];
@@ -694,7 +694,7 @@ protected function encodeCallbackFunctions(array $parameters)
694694 */
695695protected function decodeAjaxDataFunction ($ function ,$ json )
696696 {
697- return str_replace ("\" #ajax_data# \"" ,$ function ,$ json );
697+ return str_replace (' " #ajax_data#" ' ,$ function ,$ json );
698698 }
699699
700700/**
@@ -794,7 +794,7 @@ private function compileTableHeaders()
794794 }
795795
796796/**
797- * Compile table search headers
797+ * Compile table search headers.
798798 *
799799 * @return array
800800 */