Skip to content

Commit 0d7fd6a

Browse files
committed
WIP
1 parent fa31d11 commit 0d7fd6a

36 files changed

+103
-131
lines changed

src/Classes/RequestClass.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct()
3030
$this->ignoreReferenceErrorIngore = config('zammad.object_reference_error_ignore');
3131
$this->objectHasReferenceError = config('zammad.objet_reference_error');
3232

33-
$this->connector = new ZammadConnector();
33+
$this->connector = new ZammadConnector;
3434
}
3535

3636
private function performRequest(Request $request): Response

src/DTO/Attachment.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ public function __construct(
2828
public int $size,
2929
public string $name,
3030
public string $type,
31-
) {
32-
}
31+
) {}
3332

3433
public function url(): string
3534
{

src/DTO/Comment.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ public function __construct(
8989
public Collection $attachments,
9090
public Carbon $updated_at,
9191
public Carbon $created_at,
92-
) {
93-
}
92+
) {}
9493

9594
public static function fake(
9695
?int $id = null,

src/DTO/ObjectAttribute.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ public function __construct(
3131
public int $position,
3232
public array $data_option,
3333
public ?array $data_option_new,
34-
) {
35-
}
34+
) {}
3635

3736
public static function fake(
3837
?int $id = null,

src/DTO/User.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ public function __construct(
3131
public Carbon $updated_at,
3232
public Carbon $created_at,
3333
public ?array $expanded = null,
34-
) {
35-
}
34+
) {}
3635

3736
public static function fake(
3837
?int $id = null,

src/Events/ZammadResponseLog.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,5 @@ class ZammadResponseLog
1313
use InteractsWithSockets;
1414
use SerializesModels;
1515

16-
public function __construct(public Response $response)
17-
{
18-
}
16+
public function __construct(public Response $response) {}
1917
}

src/Requests/AccessTokens/CreateAccessTokenRequest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ class CreateAccessTokenRequest extends Request implements HasBody
1515

1616
public function __construct(
1717
protected array $payload
18-
) {
19-
}
18+
) {}
2019

2120
public function resolveEndpoint(): string
2221
{

src/Requests/AccessTokens/DestroyAccessTokenRequest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ class DestroyAccessTokenRequest extends Request
1212
public function __construct(
1313
public int $id,
1414
public bool $expand = false
15-
) {
16-
}
15+
) {}
1716

1817
public function resolveEndpoint(): string
1918
{

src/Requests/Attachment/GetAttachmentRequest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ public function __construct(
1313
public int $ticketId,
1414
public int $commentId,
1515
public int $attachmentId,
16-
) {
17-
}
16+
) {}
1817

1918
public function resolveEndpoint(): string
2019
{

src/Requests/Comments/CreateCommentRequest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ class CreateCommentRequest extends Request implements HasBody
1717

1818
public function __construct(
1919
protected array $payload
20-
) {
21-
}
20+
) {}
2221

2322
public function resolveEndpoint(): string
2423
{

src/Requests/Comments/DestroyCommentRequest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ class DestroyCommentRequest extends Request
1111

1212
public function __construct(
1313
public int $id
14-
) {
15-
}
14+
) {}
1615

1716
public function resolveEndpoint(): string
1817
{

src/Requests/Comments/GetCommentByTicketRequest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ class GetCommentByTicketRequest extends Request
1111

1212
public function __construct(
1313
public int $id
14-
) {
15-
}
14+
) {}
1615

1716
public function resolveEndpoint(): string
1817
{

src/Requests/Comments/GetCommentRequest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ class GetCommentRequest extends Request
1313

1414
public function __construct(
1515
public int $id
16-
) {
17-
}
16+
) {}
1817

1918
public function resolveEndpoint(): string
2019
{

src/Requests/ObjectAttribute/CreateObjectAttributeRequest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ class CreateObjectAttributeRequest extends Request implements HasBody
1717

1818
public function __construct(
1919
protected array $payload
20-
) {
21-
}
20+
) {}
2221

2322
public function resolveEndpoint(): string
2423
{

src/Requests/ObjectAttribute/DestroyObjectAttributeRequest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ class DestroyObjectAttributeRequest extends Request
1111

1212
public function __construct(
1313
public int $id
14-
) {
15-
}
14+
) {}
1615

1716
public function resolveEndpoint(): string
1817
{

src/Requests/ObjectAttribute/GetObjectAttributeRequest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ class GetObjectAttributeRequest extends Request
1313

1414
public function __construct(
1515
public int $id
16-
) {
17-
}
16+
) {}
1817

1918
public function resolveEndpoint(): string
2019
{

src/Requests/ObjectAttribute/UpdateObjectAttributeRequest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ class UpdateObjectAttributeRequest extends Request implements HasBody
1818
public function __construct(
1919
public int $id,
2020
public array $payload
21-
) {
22-
}
21+
) {}
2322

2423
public function resolveEndpoint(): string
2524
{

src/Requests/Tickets/AllTicketsRequest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ class AllTicketsRequest extends Request
1212
public function __construct(
1313
public ?int $perPage = null,
1414
public ?int $page = null,
15-
) {
16-
}
15+
) {}
1716

1817
public function resolveEndpoint(): string
1918
{

src/Requests/Tickets/CreateTicketRequest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ class CreateTicketRequest extends Request implements HasBody
1818
public function __construct(
1919
protected array $payload,
2020
public bool $expand = false
21-
) {
22-
}
21+
) {}
2322

2423
public function resolveEndpoint(): string
2524
{

src/Requests/Tickets/DestroyTicketRequest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ class DestroyTicketRequest extends Request
1111

1212
public function __construct(
1313
public int $id
14-
) {
15-
}
14+
) {}
1615

1716
public function resolveEndpoint(): string
1817
{

src/Requests/Tickets/GetTicketRequest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ class GetTicketRequest extends Request
1414
public function __construct(
1515
public int $id,
1616
public bool $expand = false
17-
) {
18-
}
17+
) {}
1918

2019
public function resolveEndpoint(): string
2120
{

src/Requests/Tickets/SearchTicketRequest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ public function __construct(
1414
public ?int $limit = null,
1515
public ?int $perPage = null,
1616
public ?int $page = null,
17-
) {
18-
}
17+
) {}
1918

2019
public function resolveEndpoint(): string
2120
{

src/Requests/Users/AllUsersRequest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ class AllUsersRequest extends Request
1212
public function __construct(
1313
public ?int $perPage = null,
1414
public ?int $page = null,
15-
) {
16-
}
15+
) {}
1716

1817
public function resolveEndpoint(): string
1918
{

src/Requests/Users/CreateUserRequest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ class CreateUserRequest extends Request implements HasBody
1818
public function __construct(
1919
protected array $payload,
2020
public bool $expand = false
21-
) {
22-
}
21+
) {}
2322

2423
public function resolveEndpoint(): string
2524
{

src/Requests/Users/DestroyUserRequest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ class DestroyUserRequest extends Request
1111

1212
public function __construct(
1313
public int $id
14-
) {
15-
}
14+
) {}
1615

1716
public function resolveEndpoint(): string
1817
{

src/Requests/Users/GetUserRequest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ class GetUserRequest extends Request
1414
public function __construct(
1515
public ?int $id = null,
1616
public bool $expand = false
17-
) {
18-
}
17+
) {}
1918

2019
public function resolveEndpoint(): string
2120
{

src/Requests/Users/SearchUserRequest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ class SearchUserRequest extends Request
1212
public function __construct(
1313
public string $term,
1414
public ?int $limit = null,
15-
) {
16-
}
15+
) {}
1716

1817
public function resolveEndpoint(): string
1918
{

src/Requests/Users/UpdateUserRequest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ public function __construct(
1919
public int $id,
2020
public array $payload,
2121
public bool $expand = false
22-
) {
23-
}
22+
) {}
2423

2524
public function resolveEndpoint(): string
2625
{

src/Zammad.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,31 @@ class Zammad
1313
{
1414
public function user(): UserResource
1515
{
16-
return new UserResource();
16+
return new UserResource;
1717
}
1818

1919
public function userAccessToken(): UserAccessToken
2020
{
21-
return new UserAccessToken();
21+
return new UserAccessToken;
2222
}
2323

2424
public function ticket(): TicketResource
2525
{
26-
return new TicketResource();
26+
return new TicketResource;
2727
}
2828

2929
public function comment(): CommentResource
3030
{
31-
return new CommentResource();
31+
return new CommentResource;
3232
}
3333

3434
public function attachment(): AttachmentResource
3535
{
36-
return new AttachmentResource();
36+
return new AttachmentResource;
3737
}
3838

3939
public function object(): ObjectAttributeResource
4040
{
41-
return new ObjectAttributeResource();
41+
return new ObjectAttributeResource;
4242
}
4343
}

tests/Feature/AttachmentResourceTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Illuminate\Support\Facades\Event;
66

77
it('can download an attachment', function () {
8-
$content = (new Zammad())->attachment()->download(
8+
$content = (new Zammad)->attachment()->download(
99
ticketId: 32,
1010
commentId: 111,
1111
attachmentId: 42,

tests/Feature/CommentResourceTest.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
it('does show by ticket', function () {
1414
$id = 32;
1515

16-
$comments = (new Zammad())->comment()->showByTicket($id);
16+
$comments = (new Zammad)->comment()->showByTicket($id);
1717

1818
$this->assertInstanceOf(Collection::class, $comments);
1919

@@ -28,7 +28,7 @@
2828
it('does show comment', function () {
2929
$id = 66;
3030

31-
$comment = (new Zammad())->comment()->show($id);
31+
$comment = (new Zammad)->comment()->show($id);
3232

3333
$this->assertInstanceOf(Comment::class, $comment);
3434
$this->assertSame($id, $comment->id);
@@ -50,7 +50,7 @@
5050
],
5151
];
5252

53-
$comment = (new Zammad())->comment()->create($data);
53+
$comment = (new Zammad)->comment()->create($data);
5454

5555
$this->assertInstanceOf(Comment::class, $comment);
5656
$this->assertSame('::subject::', $comment->subject);
@@ -64,12 +64,12 @@
6464
$this->assertSame('text/plain', $attachment->type);
6565
});
6666
Event::assertDispatched(ZammadResponseLog::class, 1);
67-
(new Zammad())->comment()->delete($comment->id);
67+
(new Zammad)->comment()->delete($comment->id);
6868
Event::assertDispatched(ZammadResponseLog::class, 2);
6969
})->group('comments');
7070

7171
it('does parse body from comment', function () {
72-
$comment = (new Zammad())->comment()->show(342);
72+
$comment = (new Zammad)->comment()->show(342);
7373

7474
$this->assertStringContainsString(
7575
'Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans.',
@@ -88,7 +88,7 @@
8888
it('has a from name helper', function () {
8989
$id = 66;
9090

91-
$comment = (new Zammad())->comment()->show($id);
91+
$comment = (new Zammad)->comment()->show($id);
9292

9393
$this->assertSame(
9494
Str::before(Str::between($comment->from, '"', '"'), '<'),
@@ -99,7 +99,7 @@
9999
it('has a from email helper', function () {
100100
$id = 66;
101101

102-
$comment = (new Zammad())->comment()->show($id);
102+
$comment = (new Zammad)->comment()->show($id);
103103

104104
$this->assertSame(
105105
Str::between($comment->from, '<', '>'),

0 commit comments

Comments
 (0)