Skip to content

Commit 5f91fc0

Browse files
authored
Feature a Few Fixes (#199)
* Fixed #197 * Resolved #189, updated Docs and Tests for Enums * Removed phpunit cache * Resolved #188 * wip * Minor code improvements * Improved TransferDocument Request
1 parent 00d2c10 commit 5f91fc0

File tree

9 files changed

+238
-13
lines changed

9 files changed

+238
-13
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ vendor
1010
node_modules
1111
.phpactor.json
1212
build
13+
.phpunit.cache
1314

1415
## Annotations
1516
src/DTO/Documents/AnnotationsStamps/*

.phpunit.cache/test-results

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,52 @@ $connector = new DocuWareConnector(
315315
);
316316
```
317317

318+
### Enums
319+
320+
The package provides several enums to ensure type safety and consistency when working with DocuWare API values.
321+
322+
#### ConnectionEnum
323+
324+
Represents different connection types for DocuWare authentication:
325+
326+
```php
327+
use CodebarAg\DocuWare\Enums\ConnectionEnum;
328+
329+
ConnectionEnum::WITHOUT_COOKIE;
330+
ConnectionEnum::STATIC_COOKIE;
331+
ConnectionEnum::DYNAMIC_COOKIE;
332+
```
333+
334+
#### DialogType
335+
336+
Represents different types of dialogs in DocuWare:
337+
338+
```php
339+
use CodebarAg\DocuWare\Enums\DialogType;
340+
341+
DialogType::SEARCH;
342+
DialogType::STORE;
343+
DialogType::RESULT;
344+
DialogType::INDEX;
345+
DialogType::LIST;
346+
DialogType::FOLDERS;
347+
```
348+
349+
#### DocuWareFieldTypeEnum
350+
351+
Represents different field types used in DocuWare document indexing:
352+
353+
```php
354+
use CodebarAg\DocuWare\Enums\DocuWareFieldTypeEnum;
355+
356+
DocuWareFieldTypeEnum::STRING;
357+
DocuWareFieldTypeEnum::INT;
358+
DocuWareFieldTypeEnum::DECIMAL;
359+
DocuWareFieldTypeEnum::DATE;
360+
DocuWareFieldTypeEnum::DATETIME;
361+
DocuWareFieldTypeEnum::TABLE;
362+
```
363+
318364
### Available Requests
319365

320366
The following sections provide examples for each available request type. All functionality is documented inline below with code examples.

src/DTO/General/UserManagement/GetUsers/OutOfOffice.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,22 @@ final class OutOfOffice
1010
{
1111
public static function fromJson(array $data): self
1212
{
13-
if ($startDateTime = Arr::get($data, 'StartDateTime')) {
13+
$startDateTime = Arr::get($data, 'StartDateTime');
14+
15+
$timeZone = config('app.timezone', 'UTC');
16+
17+
if (filled($startDateTime)) {
1418
$startDateTime = Str::of($startDateTime)->after('(')->before(')');
15-
$startDateTime = Carbon::createFromTimestamp($startDateTime);
19+
$milliseconds = (int) (string) $startDateTime;
20+
$startDateTime = Carbon::createFromTimestampMs($milliseconds, $timeZone);
1621
}
1722

18-
if ($endDateTime = Arr::get($data, 'EndDateTime')) {
23+
$endDateTime = Arr::get($data, 'EndDateTime');
24+
25+
if (filled($endDateTime)) {
1926
$endDateTime = Str::of($endDateTime)->after('(')->before(')');
20-
$endDateTime = Carbon::createFromTimestamp($endDateTime);
27+
$milliseconds = (int) (string) $endDateTime;
28+
$endDateTime = Carbon::createFromTimestampMs($milliseconds, $timeZone);
2129
}
2230

2331
return new self(
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace CodebarAg\DocuWare\Enums;
4+
5+
enum DocuWareFieldTypeEnum: string
6+
{
7+
case STRING = 'String';
8+
case INT = 'Int';
9+
case DECIMAL = 'Decimal';
10+
case DATE = 'Date';
11+
case DATETIME = 'DateTime';
12+
case TABLE = 'Table';
13+
}

0 commit comments

Comments
 (0)