This repository has been archived by the owner on May 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Abstract common functionality as protected methods in an abstract cla…
…ss (#6)
- Loading branch information
Showing
5 changed files
with
84 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"php":"7.4.8","version":"2.16.4:v2.16.4#1023c3458137ab052f6ff1e09621a721bfdeca13","indent":" ","lineEnding":"\n","rules":{"blank_line_after_namespace":true,"braces":true,"class_definition":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"},"no_break_comment":true,"no_closing_tag":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,"visibility_required":true,"encoding":true,"full_opening_tag":true,"ordered_imports":{"sort_algorithm":"length"}},"hashes":{"src\/Repository\/AbstractPaginatorRepository.php":1476324894,"src\/Repository\/PaginationQueryManagerInterface.php":2483929998,"src\/Helper\/NativeSqlHelper.php":1346947594,"src\/Particle\/ParticleFilterFactory.php":3398098011,"tests\/phpunit\/Rule\/UpperCaseCharacterRuleTest.php":3187295278,"tests\/phpunit\/Rule\/MinimumLengthRuleTest.php":1503783452,"tests\/phpunit\/Rule\/AllRulesTest.php":1356751865,"tests\/phpunit\/Rule\/SpecialCharacterRuleTest.php":1220784808,"tests\/phpunit\/Rule\/DigitRuleTest.php":2593523549,"tests\/phpunit\/Format\/HumanReadablePolicyTest.php":2918699308,"tests\/phpunit\/Policy\/JsonPolicyTest.php":1409930937,"src\/Repository\/Filter.php":2062942533,"src\/Paginator.php":1549210670,"src\/Repository\/PaginatorConfigInterface.php":2959026211,"tests\/phpunit\/Repository\/FilterTest.php":3979093524,"tests\/phpunit\/GridPaginatorTest.php":2964267577,"src\/GridPaginator.php":630471002}} | ||
{"php":"7.4.8","version":"2.16.4:v2.16.4#1023c3458137ab052f6ff1e09621a721bfdeca13","indent":" ","lineEnding":"\n","rules":{"blank_line_after_namespace":true,"braces":true,"class_definition":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"},"no_break_comment":true,"no_closing_tag":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,"visibility_required":true,"encoding":true,"full_opening_tag":true,"ordered_imports":{"sort_algorithm":"length"}},"hashes":{"src\/Repository\/AbstractPaginatorRepository.php":2036465871,"src\/Repository\/PaginationQueryManagerInterface.php":3740590114,"src\/Helper\/NativeSqlHelper.php":1346947594,"src\/Particle\/ParticleFilterFactory.php":3398098011,"tests\/phpunit\/Rule\/UpperCaseCharacterRuleTest.php":3187295278,"tests\/phpunit\/Rule\/MinimumLengthRuleTest.php":1503783452,"tests\/phpunit\/Rule\/AllRulesTest.php":1356751865,"tests\/phpunit\/Rule\/SpecialCharacterRuleTest.php":1220784808,"tests\/phpunit\/Rule\/DigitRuleTest.php":2593523549,"tests\/phpunit\/Format\/HumanReadablePolicyTest.php":2918699308,"tests\/phpunit\/Policy\/JsonPolicyTest.php":1409930937,"src\/Repository\/Filter.php":2062942533,"src\/Paginator.php":1549210670,"src\/Repository\/PaginatorConfigInterface.php":2959026211,"tests\/phpunit\/Repository\/FilterTest.php":3979093524,"tests\/phpunit\/GridPaginatorTest.php":2964267577,"src\/GridPaginator.php":630471002,"src\/Repository\/AbstractPaginationQueryManager.php":2155519270,"src\/Meta\/GridMetadata.php":1226617945,"src\/Meta\/MetadataInterface.php":4218364040}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
C:37:"PHPUnit\Runner\DefaultTestResultCache":1797:{a:2:{s:7:"defects";a:3:{s:7:"Warning";i:6;s:82:"StaySafe\Paginator\DataGrid\Test\Repository\FilterTest::can_add_multiple_mind_maps";i:4;s:115:"StaySafe\Paginator\DataGrid\Test\GridPaginatorTest::sanitize_grid_metadata_returns_empty_array_for_invalid_datatype";i:3;}s:5:"times";a:14:{s:7:"Warning";d:0.004;s:85:"StaySafe\Paginator\DataGrid\Test\Repository\FilterTest::invalid_type_throws_exception";d:0.003;s:82:"StaySafe\Paginator\DataGrid\Test\Repository\FilterTest::can_add_multiple_mind_maps";d:0;s:105:"StaySafe\Paginator\DataGrid\Test\Repository\FilterTest::can_add_bind_map_with_valid_type with data set #0";d:0.004;s:105:"StaySafe\Paginator\DataGrid\Test\Repository\FilterTest::can_add_bind_map_with_valid_type with data set #1";d:0.003;s:105:"StaySafe\Paginator\DataGrid\Test\Repository\FilterTest::can_add_bind_map_with_valid_type with data set #2";d:0.002;s:105:"StaySafe\Paginator\DataGrid\Test\Repository\FilterTest::can_add_bind_map_with_valid_type with data set #3";d:0.002;s:82:"StaySafe\Paginator\DataGrid\Test\Repository\FilterTest::can_add_multiple_bind_maps";d:0.002;s:115:"StaySafe\Paginator\DataGrid\Test\GridPaginatorTest::sanitize_grid_metadata_returns_empty_array_for_invalid_datatype";d:0.005;s:104:"StaySafe\Paginator\DataGrid\Test\GridPaginatorTest::sanitize_empty_grid_metadata_returns_valid_construct";d:0.009;s:98:"StaySafe\Paginator\DataGrid\Test\GridPaginatorTest::decode_submitted_search_query with data set #0";d:0.003;s:98:"StaySafe\Paginator\DataGrid\Test\GridPaginatorTest::decode_submitted_search_query with data set #1";d:0.002;s:98:"StaySafe\Paginator\DataGrid\Test\GridPaginatorTest::decode_submitted_search_query with data set #2";d:0.002;s:98:"StaySafe\Paginator\DataGrid\Test\GridPaginatorTest::decode_submitted_search_query with data set #3";d:0.002;}}} | ||
C:37:"PHPUnit\Runner\DefaultTestResultCache":1777:{a:2:{s:7:"defects";a:3:{s:7:"Warning";i:6;s:82:"StaySafe\Paginator\DataGrid\Test\Repository\FilterTest::can_add_multiple_mind_maps";i:4;s:115:"StaySafe\Paginator\DataGrid\Test\GridPaginatorTest::sanitize_grid_metadata_returns_empty_array_for_invalid_datatype";i:3;}s:5:"times";a:14:{s:7:"Warning";d:0.004;s:85:"StaySafe\Paginator\DataGrid\Test\Repository\FilterTest::invalid_type_throws_exception";d:0.001;s:82:"StaySafe\Paginator\DataGrid\Test\Repository\FilterTest::can_add_multiple_mind_maps";d:0;s:105:"StaySafe\Paginator\DataGrid\Test\Repository\FilterTest::can_add_bind_map_with_valid_type with data set #0";d:0.002;s:105:"StaySafe\Paginator\DataGrid\Test\Repository\FilterTest::can_add_bind_map_with_valid_type with data set #1";d:0;s:105:"StaySafe\Paginator\DataGrid\Test\Repository\FilterTest::can_add_bind_map_with_valid_type with data set #2";d:0;s:105:"StaySafe\Paginator\DataGrid\Test\Repository\FilterTest::can_add_bind_map_with_valid_type with data set #3";d:0;s:82:"StaySafe\Paginator\DataGrid\Test\Repository\FilterTest::can_add_multiple_bind_maps";d:0;s:115:"StaySafe\Paginator\DataGrid\Test\GridPaginatorTest::sanitize_grid_metadata_returns_empty_array_for_invalid_datatype";d:0.005;s:104:"StaySafe\Paginator\DataGrid\Test\GridPaginatorTest::sanitize_empty_grid_metadata_returns_valid_construct";d:0.005;s:98:"StaySafe\Paginator\DataGrid\Test\GridPaginatorTest::decode_submitted_search_query with data set #0";d:0.001;s:98:"StaySafe\Paginator\DataGrid\Test\GridPaginatorTest::decode_submitted_search_query with data set #1";d:0.001;s:98:"StaySafe\Paginator\DataGrid\Test\GridPaginatorTest::decode_submitted_search_query with data set #2";d:0;s:98:"StaySafe\Paginator\DataGrid\Test\GridPaginatorTest::decode_submitted_search_query with data set #3";d:0.001;}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace StaySafe\Paginator\DataGrid\Repository; | ||
|
||
abstract class AbstractPaginationQueryManager implements PaginationQueryManagerInterface | ||
{ | ||
private array $columns = []; | ||
|
||
/** | ||
* @param string $name | ||
* @param mixed $value | ||
* | ||
* @return $this | ||
*/ | ||
public function addColumn(string $name, $value): self | ||
{ | ||
$this->columns[$name] = $value; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @param string $name | ||
* | ||
* @return bool | ||
*/ | ||
public function hasColumn(string $name): bool | ||
{ | ||
return array_key_exists($name, $this->columns); | ||
} | ||
|
||
/** | ||
* @param string $name | ||
* | ||
* @return mixed|null | ||
*/ | ||
public function getColumn(string $name) | ||
{ | ||
if ($this->hasColumn($name)) { | ||
return $this->columns[$name]; | ||
} | ||
|
||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters