diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6dcd721..e8d598e 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,7 +26,7 @@ jobs: - name: Setup Composer run: composer install - name: Autoformat - run: 'vendor/bin/php-cs-fixer fix ./ --rules=''{"array_syntax": {"syntax": "short"}, "blank_line_after_namespace": true, "global_namespace_import": {"import_classes": false, "import_constants": false, "import_functions": false}, "binary_operator_spaces": {"operators": {"=": "align", ".=": "align", "+=": "align", "-=": "align", "*=": "align", "/=": "align", "|=": "align", "&=": "align", "=>": "align", "??=": "align"}}, "cast_spaces": {"space": "single"}, "class_attributes_separation": { "elements": {"const": "one", "method": "one", "property": "one"} }, "combine_consecutive_issets": true, "compact_nullable_typehint": true, "declare_strict_types": true, "declare_equal_normalize": {"space": "none"}, "elseif": true, "encoding": true, "explicit_indirect_variable": true, "explicit_string_variable": true, "function_to_constant": true, "implode_call": true, "increment_style": {"style": "pre"}, "is_null": true, "yoda_style": {"equal": false, "identical": false, "less_and_greater": false}, "line_ending": true, "logical_operators": true, "lowercase_cast": true, "constant_case": {"case": "lower"}, "lowercase_keywords": true, "modernize_types_casting": true, "native_constant_invocation": true, "native_function_casing": true, "native_function_invocation": {"include": ["@all"]}, "new_with_braces": true, "no_extra_blank_lines": {"tokens": ["break", "case", "continue", "curly_brace_block", "extra", "return", "switch", "throw", "use"]}, "no_spaces_after_function_name": true, "no_alias_functions": true, "no_closing_tag": true, "no_empty_comment": true, "no_empty_phpdoc": true, "no_empty_statement": true, "no_homoglyph_names": true, "no_mixed_echo_print": {"use": "echo"}, "no_php4_constructor": true, "no_singleline_whitespace_before_semicolons": true, "no_spaces_inside_parenthesis": true, "no_trailing_whitespace": true, "no_unneeded_final_method": true, "no_unused_imports": true, "no_useless_return": true, "no_whitespace_before_comma_in_array": true, "no_whitespace_in_blank_line": true, "non_printable_character": true, "normalize_index_brace": true, "ordered_imports": {"sort_algorithm": "alpha"}, "ordered_interfaces": {"order": "alpha"}, "php_unit_construct": true, "php_unit_internal_class": true, "php_unit_set_up_tear_down_visibility": true, "phpdoc_indent": true, "phpdoc_align": {"align": "vertical"}, "phpdoc_annotation_without_dot": true, "phpdoc_scalar": true, "phpdoc_return_self_reference": {"replacements": {"this": "self"}}, "phpdoc_trim": true, "phpdoc_trim_consecutive_blank_line_separation": true, "random_api_migration": true, "self_accessor": true, "return_type_declaration": {"space_before": "one"}, "semicolon_after_instruction": true, "set_type_to_cast": true, "short_scalar_cast": true, "single_blank_line_at_eof": true, "single_line_after_imports": true, "standardize_increment": true, "trailing_comma_in_multiline": true, "trim_array_spaces": true, "visibility_required": true, "void_return": true}'' --allow-risky=yes' + run: 'vendor/bin/php-cs-fixer fix ./ --rules=''{"array_syntax": {"syntax": "short"}, "blank_line_after_namespace": true, "global_namespace_import": {"import_classes": false, "import_constants": false, "import_functions": false}, "binary_operator_spaces": {"operators": {"=": "align", ".=": "align", "+=": "align", "-=": "align", "*=": "align", "/=": "align", "|=": "align", "&=": "align", "=>": "align", "??=": "align", ">>=": "align", "<<=": "align"}}, "cast_spaces": {"space": "single"}, "class_attributes_separation": { "elements": {"const": "one", "method": "one", "property": "one"} }, "combine_consecutive_issets": true, "compact_nullable_typehint": true, "declare_strict_types": true, "declare_equal_normalize": {"space": "none"}, "elseif": true, "encoding": true, "explicit_indirect_variable": true, "explicit_string_variable": true, "function_to_constant": true, "implode_call": true, "increment_style": {"style": "pre"}, "is_null": true, "yoda_style": {"equal": false, "identical": false, "less_and_greater": false}, "line_ending": true, "logical_operators": true, "lowercase_cast": true, "constant_case": {"case": "lower"}, "lowercase_keywords": true, "modernize_types_casting": true, "native_constant_invocation": true, "native_function_casing": true, "native_function_invocation": {"include": ["@all"]}, "new_with_braces": true, "no_extra_blank_lines": {"tokens": ["break", "case", "continue", "curly_brace_block", "extra", "return", "switch", "throw", "use"]}, "no_spaces_after_function_name": true, "no_alias_functions": true, "no_closing_tag": true, "no_empty_comment": true, "no_empty_phpdoc": true, "no_empty_statement": true, "no_homoglyph_names": true, "no_mixed_echo_print": {"use": "echo"}, "no_php4_constructor": true, "no_singleline_whitespace_before_semicolons": true, "no_spaces_inside_parenthesis": true, "no_trailing_whitespace": true, "no_unneeded_final_method": true, "no_unused_imports": true, "no_useless_return": true, "no_whitespace_before_comma_in_array": true, "no_whitespace_in_blank_line": true, "non_printable_character": true, "normalize_index_brace": true, "ordered_imports": {"sort_algorithm": "alpha"}, "ordered_interfaces": {"order": "alpha"}, "php_unit_construct": true, "php_unit_internal_class": true, "php_unit_set_up_tear_down_visibility": true, "phpdoc_indent": true, "phpdoc_align": {"align": "vertical"}, "phpdoc_annotation_without_dot": true, "phpdoc_scalar": true, "phpdoc_return_self_reference": {"replacements": {"this": "self"}}, "phpdoc_trim": true, "phpdoc_trim_consecutive_blank_line_separation": true, "random_api_migration": true, "self_accessor": true, "return_type_declaration": {"space_before": "one"}, "semicolon_after_instruction": true, "set_type_to_cast": true, "short_scalar_cast": true, "single_blank_line_at_eof": true, "single_line_after_imports": true, "standardize_increment": true, "trailing_comma_in_multiline": true, "trim_array_spaces": true, "visibility_required": true, "void_return": true}'' --allow-risky=yes' - name: Check for modified files id: git-check run: echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi) diff --git a/Models/Event.php b/Models/Event.php index b06dbb5..8ef6ce7 100755 --- a/Models/Event.php +++ b/Models/Event.php @@ -107,6 +107,7 @@ class Event public Location $location; public \DateTime $start; + public \DateTime $end; public int $showAs = 0; diff --git a/Models/EventMapper.php b/Models/EventMapper.php index 3975cd4..4a31e90 100755 --- a/Models/EventMapper.php +++ b/Models/EventMapper.php @@ -38,26 +38,26 @@ final class EventMapper extends DataMapperFactory * @since 1.0.0 */ public const COLUMNS = [ - 'calendar_event_id' => ['name' => 'calendar_event_id', 'type' => 'int', 'internal' => 'id'], - 'calendar_event_name' => ['name' => 'calendar_event_name', 'type' => 'string', 'internal' => 'name'], - 'calendar_event_description' => ['name' => 'calendar_event_description', 'type' => 'string', 'internal' => 'description'], - 'calendar_event_location' => ['name' => 'calendar_event_location', 'type' => 'Serializable', 'internal' => 'location'], - 'calendar_event_type' => ['name' => 'calendar_event_type', 'type' => 'int', 'internal' => 'type'], - 'calendar_event_status' => ['name' => 'calendar_event_status', 'type' => 'int', 'internal' => 'status'], - 'calendar_event_show_as' => ['name' => 'calendar_event_show_as', 'type' => 'int', 'internal' => 'showAs'], - 'calendar_event_hidden_attendees' => ['name' => 'calendar_event_hidden_attendees', 'type' => 'bool', 'internal' => 'hiddenAttendees'], - 'calendar_event_is_all_day' => ['name' => 'calendar_event_is_all_day', 'type' => 'bool', 'internal' => 'isAllDay'], - 'calendar_event_is_cancelled' => ['name' => 'calendar_event_is_cancelled', 'type' => 'bool', 'internal' => 'isCancelled'], - 'calendar_event_is_draft' => ['name' => 'calendar_event_is_draft', 'type' => 'bool', 'internal' => 'isDraft'], + 'calendar_event_id' => ['name' => 'calendar_event_id', 'type' => 'int', 'internal' => 'id'], + 'calendar_event_name' => ['name' => 'calendar_event_name', 'type' => 'string', 'internal' => 'name'], + 'calendar_event_description' => ['name' => 'calendar_event_description', 'type' => 'string', 'internal' => 'description'], + 'calendar_event_location' => ['name' => 'calendar_event_location', 'type' => 'Serializable', 'internal' => 'location'], + 'calendar_event_type' => ['name' => 'calendar_event_type', 'type' => 'int', 'internal' => 'type'], + 'calendar_event_status' => ['name' => 'calendar_event_status', 'type' => 'int', 'internal' => 'status'], + 'calendar_event_show_as' => ['name' => 'calendar_event_show_as', 'type' => 'int', 'internal' => 'showAs'], + 'calendar_event_hidden_attendees' => ['name' => 'calendar_event_hidden_attendees', 'type' => 'bool', 'internal' => 'hiddenAttendees'], + 'calendar_event_is_all_day' => ['name' => 'calendar_event_is_all_day', 'type' => 'bool', 'internal' => 'isAllDay'], + 'calendar_event_is_cancelled' => ['name' => 'calendar_event_is_cancelled', 'type' => 'bool', 'internal' => 'isCancelled'], + 'calendar_event_is_draft' => ['name' => 'calendar_event_is_draft', 'type' => 'bool', 'internal' => 'isDraft'], 'calendar_event_is_online_meeting' => ['name' => 'calendar_event_is_online_meeting', 'type' => 'bool', 'internal' => 'isOnlineMeeting'], - 'calendar_event_web_link' => ['name' => 'calendar_event_web_link', 'type' => 'string', 'internal' => 'webLink'], - 'calendar_event_external_id' => ['name' => 'calendar_event_external_id', 'type' => 'string', 'internal' => 'externalId'], - 'calendar_event_schedule' => ['name' => 'calendar_event_schedule', 'type' => 'int', 'internal' => 'schedule'], - 'calendar_event_calendar' => ['name' => 'calendar_event_calendar', 'type' => 'int', 'internal' => 'calendar'], - 'calendar_event_start' => ['name' => 'calendar_event_start', 'type' => 'DateTime', 'internal' => 'start'], - 'calendar_event_end' => ['name' => 'calendar_event_end', 'type' => 'DateTime', 'internal' => 'end'], - 'calendar_event_created_by' => ['name' => 'calendar_event_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true], - 'calendar_event_created_at' => ['name' => 'calendar_event_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true], + 'calendar_event_web_link' => ['name' => 'calendar_event_web_link', 'type' => 'string', 'internal' => 'webLink'], + 'calendar_event_external_id' => ['name' => 'calendar_event_external_id', 'type' => 'string', 'internal' => 'externalId'], + 'calendar_event_schedule' => ['name' => 'calendar_event_schedule', 'type' => 'int', 'internal' => 'schedule'], + 'calendar_event_calendar' => ['name' => 'calendar_event_calendar', 'type' => 'int', 'internal' => 'calendar'], + 'calendar_event_start' => ['name' => 'calendar_event_start', 'type' => 'DateTime', 'internal' => 'start'], + 'calendar_event_end' => ['name' => 'calendar_event_end', 'type' => 'DateTime', 'internal' => 'end'], + 'calendar_event_created_by' => ['name' => 'calendar_event_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true], + 'calendar_event_created_at' => ['name' => 'calendar_event_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true], ]; /** diff --git a/Models/Schedule.php b/Models/Schedule.php index 7178386..348b74a 100755 --- a/Models/Schedule.php +++ b/Models/Schedule.php @@ -237,13 +237,13 @@ class Schedule public function toArray() : array { return [ - 'id' => $this->id, - 'uuid' => $this->uid, - 'status' => $this->status, - 'freqType' => $this->freqType, + 'id' => $this->id, + 'uuid' => $this->uid, + 'status' => $this->status, + 'freqType' => $this->freqType, 'patternInterval' => $this->patternInterval, - 'start' => $this->start, - 'createdAt' => $this->createdAt, + 'start' => $this->start, + 'createdAt' => $this->createdAt, ]; } diff --git a/Models/ScheduleMapper.php b/Models/ScheduleMapper.php index 931ae01..c285062 100755 --- a/Models/ScheduleMapper.php +++ b/Models/ScheduleMapper.php @@ -37,22 +37,22 @@ final class ScheduleMapper extends DataMapperFactory * @since 1.0.0 */ public const COLUMNS = [ - 'schedule_id' => ['name' => 'schedule_id', 'type' => 'int', 'internal' => 'id'], - 'schedule_uid' => ['name' => 'schedule_uid', 'type' => 'string', 'internal' => 'uid'], - 'schedule_status' => ['name' => 'schedule_status', 'type' => 'int', 'internal' => 'status'], - 'schedule_freq_type' => ['name' => 'schedule_freq_type', 'type' => 'int', 'internal' => 'freqType'], - 'schedule_date' => ['name' => 'schedule_date', 'type' => 'DateTime', 'internal' => 'date'], - 'schedule_start' => ['name' => 'schedule_start', 'type' => 'DateTime', 'internal' => 'start'], - 'schedule_end' => ['name' => 'schedule_end', 'type' => 'DateTime', 'internal' => 'end'], - 'schedule_pattern_numberofoccurrences' => ['name' => 'schedule_pattern_numberofoccurrences', 'type' => 'int', 'internal' => 'numberOfOccurrences'], - 'schedule_pattern_type' => ['name' => 'schedule_pattern_type', 'type' => 'int', 'internal' => 'intervalType'], + 'schedule_id' => ['name' => 'schedule_id', 'type' => 'int', 'internal' => 'id'], + 'schedule_uid' => ['name' => 'schedule_uid', 'type' => 'string', 'internal' => 'uid'], + 'schedule_status' => ['name' => 'schedule_status', 'type' => 'int', 'internal' => 'status'], + 'schedule_freq_type' => ['name' => 'schedule_freq_type', 'type' => 'int', 'internal' => 'freqType'], + 'schedule_date' => ['name' => 'schedule_date', 'type' => 'DateTime', 'internal' => 'date'], + 'schedule_start' => ['name' => 'schedule_start', 'type' => 'DateTime', 'internal' => 'start'], + 'schedule_end' => ['name' => 'schedule_end', 'type' => 'DateTime', 'internal' => 'end'], + 'schedule_pattern_numberofoccurrences' => ['name' => 'schedule_pattern_numberofoccurrences', 'type' => 'int', 'internal' => 'numberOfOccurrences'], + 'schedule_pattern_type' => ['name' => 'schedule_pattern_type', 'type' => 'int', 'internal' => 'intervalType'], 'schedule_pattern_pattern_interval' => ['name' => 'schedule_pattern_pattern_interval', 'type' => 'int', 'internal' => 'patternInterval'], - 'schedule_pattern_dayofmonth' => ['name' => 'schedule_pattern_dayofmonth', 'type' => 'int', 'internal' => 'dayOfMonth'], - 'schedule_pattern_daysofweek' => ['name' => 'schedule_pattern_daysofweek', 'type' => 'int', 'internal' => 'daysOfWeek'], - 'schedule_pattern_index' => ['name' => 'schedule_pattern_index', 'type' => 'int', 'internal' => 'patternIndex'], - 'schedule_pattern_month' => ['name' => 'schedule_pattern_month', 'type' => 'int', 'internal' => 'patternMonth'], - 'schedule_created_by' => ['name' => 'schedule_created_by', 'type' => 'int', 'internal' => 'createdBy'], - 'schedule_created_at' => ['name' => 'schedule_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'], + 'schedule_pattern_dayofmonth' => ['name' => 'schedule_pattern_dayofmonth', 'type' => 'int', 'internal' => 'dayOfMonth'], + 'schedule_pattern_daysofweek' => ['name' => 'schedule_pattern_daysofweek', 'type' => 'int', 'internal' => 'daysOfWeek'], + 'schedule_pattern_index' => ['name' => 'schedule_pattern_index', 'type' => 'int', 'internal' => 'patternIndex'], + 'schedule_pattern_month' => ['name' => 'schedule_pattern_month', 'type' => 'int', 'internal' => 'patternMonth'], + 'schedule_created_by' => ['name' => 'schedule_created_by', 'type' => 'int', 'internal' => 'createdBy'], + 'schedule_created_at' => ['name' => 'schedule_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'], ]; /** diff --git a/tests/Models/ScheduleTest.php b/tests/Models/ScheduleTest.php index f06db20..41285f1 100755 --- a/tests/Models/ScheduleTest.php +++ b/tests/Models/ScheduleTest.php @@ -14,8 +14,6 @@ declare(strict_types=1); namespace Modules\Calendar\tests\Models; -use Modules\Calendar\Models\FrequencyInterval; -use Modules\Calendar\Models\FrequencyRelative; use Modules\Calendar\Models\FrequencyType; use Modules\Calendar\Models\IntervalType; use Modules\Calendar\Models\Schedule;