Skip to content

Commit 05f450c

Browse files
committed
Merge branch 'main' of github.com:karam-mustafa/laravel-query-helper-1 into main
� Conflicts: � src/Classes/JoinHelper.php
2 parents 823efa3 + fc85b8f commit 05f450c

File tree

9 files changed

+18
-34
lines changed

9 files changed

+18
-34
lines changed

.php-cs-fixer.cache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"php":"8.1.1","version":"3.5.0","indent":" ","lineEnding":"\n","rules":{"blank_line_after_opening_tag":true,"braces":{"allow_single_line_anonymous_class_with_empty_body":true},"class_definition":{"space_before_parenthesis":true},"compact_nullable_typehint":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_braces":true,"no_blank_lines_after_class_opening":true,"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"sort_algorithm":"alpha"},"return_type_declaration":true,"short_scalar_cast":true,"single_blank_line_before_namespace":true,"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline","keep_multiple_spaces_after_comma":true},"no_break_comment":true,"no_closing_tag":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"short"},"no_unused_imports":true,"not_operator_with_successor_space":true,"trailing_comma_in_multiline":true,"phpdoc_scalar":true,"unary_operator_spaces":true,"binary_operator_spaces":true,"blank_line_before_statement":{"statements":["break","continue","declare","return","throw","try"]},"phpdoc_single_line_var_spacing":true,"phpdoc_var_without_name":true,"class_attributes_separation":{"elements":{"method":"one"}}},"hashes":{"src\/Providers\/ClassToBuildServiceProviders.php":894462343,"src\/Classes\/ClassToBuild.php":1863686418,"src\/Abstracts\/AbstractToBuild.php":4067261489,"src\/Interfaces\/ClassToBuildInterface.php":3639279532,"src\/Commands\/InstallCommand.php":800925523,"src\/Config\/package_config.php":1122705014,"src\/Facades\/ClassToBuildFacade.php":3267118586,"tests\/Feature\/ExampleTest.php":3639981892,"tests\/BaseTest.php":3538535820}}
1+
{"php":"8.1.1","version":"3.5.0","indent":" ","lineEnding":"\n","rules":{"blank_line_after_opening_tag":true,"braces":{"allow_single_line_anonymous_class_with_empty_body":true},"class_definition":{"space_before_parenthesis":true},"compact_nullable_typehint":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_braces":true,"no_blank_lines_after_class_opening":true,"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"sort_algorithm":"alpha"},"return_type_declaration":true,"short_scalar_cast":true,"single_blank_line_before_namespace":true,"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline","keep_multiple_spaces_after_comma":true},"no_break_comment":true,"no_closing_tag":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"short"},"no_unused_imports":true,"not_operator_with_successor_space":true,"trailing_comma_in_multiline":true,"phpdoc_scalar":true,"unary_operator_spaces":true,"binary_operator_spaces":true,"blank_line_before_statement":{"statements":["break","continue","declare","return","throw","try"]},"phpdoc_single_line_var_spacing":true,"phpdoc_var_without_name":true,"class_attributes_separation":{"elements":{"method":"one"}}},"hashes":{"src\/Providers\/ClassToBuildServiceProviders.php":894462343,"src\/Classes\/ClassToBuild.php":1863686418,"src\/Abstracts\/AbstractToBuild.php":4067261489,"src\/Interfaces\/ClassToBuildInterface.php":3639279532,"src\/Commands\/InstallCommand.php":3981754395,"src\/Config\/package_config.php":1122705014,"src\/Facades\/ClassToBuildFacade.php":3267118586,"tests\/Feature\/ExampleTest.php":3403803516,"tests\/BaseTest.php":364171998,"src\/Facade\/QueryHelperFacade.php":1424222852,"src\/Providers\/QueryHelperServiceProviders.php":608029189,"src\/Classes\/DeleteHelper.php":3423337787,"src\/Classes\/JoinHelper.php":941291578,"src\/Classes\/QueryHelper.php":4113349496,"src\/Classes\/BaseHelper.php":2396364014,"src\/Classes\/InsertHelper.php":3586087926,"src\/Classes\/UpdateHelper.php":3622326637,"src\/Config\/query_helper.php":3245707786}}

src/Classes/BaseHelper.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<?php
22

3-
43
namespace SOS\QueryHelper\Classes;
54

6-
75
use Illuminate\Support\Facades\DB;
86

97
abstract class BaseHelper
@@ -53,11 +51,12 @@ protected function getAllowedWhereInQueryNumber()
5351
public function setAllowedWhereInQueryNumber($allowedWhereInQueryNumber)
5452
{
5553
$this->allowedWhereInQueryNumber = $allowedWhereInQueryNumber;
54+
5655
return $this;
5756
}
5857

5958
/**
60-
* @var boolean
59+
* @var bool
6160
*/
6261
private $isSelectStatus = false;
6362

@@ -100,7 +99,7 @@ public function setSelection($selection)
10099
}
101100

102101
/**
103-
* @param boolean $implode
102+
* @param bool $implode
104103
*
105104
* @return string
106105
* @author karam mustaf
@@ -110,6 +109,7 @@ protected function getSelection($implode = true)
110109
if ($implode) {
111110
return implode(',', $this->selection);
112111
}
112+
113113
return $this->selection;
114114
}
115115

@@ -196,6 +196,7 @@ protected function getValues()
196196
public function setValues($values)
197197
{
198198
$this->values = $values;
199+
199200
return $this;
200201
}
201202

@@ -237,8 +238,8 @@ protected function getIds()
237238
public function setIds($ids)
238239
{
239240
$this->ids = $ids;
240-
return $this;
241241

242+
return $this;
242243
}
243244

244245
/**
@@ -277,18 +278,19 @@ public function setSavedItems($savedItems)
277278
*/
278279
public function checkIfQueryAllowed($ids, $callbackIfPassed = null, $chunkCountAllowed = null)
279280
{
280-
if (!isset($chunckCountAllowed)) {
281+
if (! isset($chunckCountAllowed)) {
281282
$chunkCountAllowed = $this->getAllowedWhereInQueryNumber();
282283
}
283284

284285
$items = [];
285286
$lists = collect($ids)->chunk($chunkCountAllowed + 1);
286-
if (!is_null($callbackIfPassed)) {
287+
if (! is_null($callbackIfPassed)) {
287288
foreach ($lists as $index => $list) {
288289
$items[] = $callbackIfPassed($list, $index);
289290
}
290291
}
291292
$this->savedItems = $items;
293+
292294
return $items;
293295
}
294296

@@ -365,7 +367,7 @@ protected function checkIfInteger($index)
365367
* loop through specific array and each iteration will execute by a callback.
366368
*
367369
* @param array $arr
368-
* @param callback $callback
370+
* @param callable $callback
369371
*
370372
* @return void
371373
* @author karam mustafa

src/Classes/DeleteHelper.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<?php
22

3-
43
namespace SOS\QueryHelper\Classes;
54

6-
75
use Illuminate\Support\Facades\DB;
86

97
/**
@@ -14,7 +12,6 @@
1412
*/
1513
class DeleteHelper extends BaseHelper
1614
{
17-
1815
/**
1916
* drop multiple tables by their names in the database
2017
*

src/Classes/InsertHelper.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
<?php
22

3-
43
namespace SOS\QueryHelper\Classes;
54

6-
75
class InsertHelper extends BaseHelper
86
{
9-
107
}

src/Classes/QueryHelper.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<?php
22

3-
43
namespace SOS\QueryHelper\Classes;
54

6-
75
/**
86
* Class QueryHelper
97
*
@@ -44,10 +42,10 @@ class QueryHelper extends BaseHelper
4442
public function __construct()
4543
{
4644
$this->initContainer(
47-
new UpdateHelper,
48-
new DeleteHelper,
49-
new InsertHelper,
50-
new JoinHelper
45+
new UpdateHelper(),
46+
new DeleteHelper(),
47+
new InsertHelper(),
48+
new JoinHelper()
5149
);
5250
$this->setAllowedWhereInQueryNumber(config('query_helper.allowed_chunk_number'));
5351
}
@@ -114,5 +112,4 @@ public function initContainer($updateHelper, $deleteHelper, $insertHelper, $join
114112
$this->insertHelper = $insertHelper;
115113
$this->joinHelper = $joinHelper;
116114
}
117-
118115
}

src/Classes/UpdateHelper.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
<?php
22

3-
43
namespace SOS\QueryHelper\Classes;
54

6-
75
class UpdateHelper extends BaseHelper
86
{
9-
107
/**
118
* @var mixed
129
*/
@@ -29,6 +26,7 @@ public function getCases()
2926
public function setCases($cases)
3027
{
3128
$this->cases = $cases;
29+
3230
return $this;
3331
}
3432

@@ -52,7 +50,6 @@ public function executeUpdateMultiRows($key = null)
5250
$this->buildStatement()->executeAll();
5351

5452
return $this;
55-
5653
} catch (\Exception $e) {
5754
throw new \Exception($e->getMessage());
5855
}
@@ -83,7 +80,6 @@ public function buildStatement()
8380
$this->setQuery($query);
8481

8582
return $this;
86-
8783
} catch (\Exception $e) {
8884
throw new \Exception($e->getMessage());
8985
}
@@ -135,6 +131,7 @@ public function fastUpdate($tableName, $ids, $vales, $column)
135131
->setField($column)
136132
->bindIdsWithValues()
137133
->executeUpdateMultiRows();
134+
138135
return $this;
139136
}
140137
}

src/Commands/InstallCommand.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
<?php
22

3-
43
namespace SOS\QueryHelper\Commands;
54

6-
75
use Illuminate\Console\Command;
86
use Illuminate\Support\Facades\Artisan;
97

108
class InstallCommand extends Command
119
{
12-
1310
public $packageLink = 'https://github.com/karam-mustafa/laravel-query-helper';
1411

1512
/**

src/Facade/QueryHelperFacade.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22

3-
43
namespace SOS\QueryHelper\Facade;
54

65
use Illuminate\Support\Facades\Facade;

src/Providers/QueryHelperServiceProviders.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
*/
1515
class QueryHelperServiceProviders extends ServiceProvider
1616
{
17-
1817
/**
1918
*
2019
*
@@ -53,7 +52,7 @@ protected function registerFacades()
5352
protected function publishesPackages()
5453
{
5554
$this->publishes([
56-
__DIR__."/../Config/query_helper.php" => config_path("query_helper.php")
55+
__DIR__."/../Config/query_helper.php" => config_path("query_helper.php"),
5756
], "query-helper-config");
5857
}
5958

@@ -70,5 +69,4 @@ private function resolveCommands()
7069
]);
7170
}
7271
}
73-
7472
}

0 commit comments

Comments
 (0)