Skip to content

Commit 5ed232c

Browse files
committed
#3 - refactor extensions to utilize abstract data handling in AbstractExtension
1 parent aec44b4 commit 5ed232c

File tree

5 files changed

+9
-38
lines changed

5 files changed

+9
-38
lines changed

src/Shop/Extension/AbstractExtension.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@
66

77
abstract class AbstractExtension
88
{
9-
abstract public function getType(): string;
9+
public function __construct(protected array $data)
10+
{
11+
}
12+
13+
public function getData(): array
14+
{
15+
return $this->data;
16+
}
1017

11-
abstract public function getData(): array;
18+
abstract public function getType(): string;
1219
}

src/Shop/Extension/CodesExtension.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,8 @@
66

77
class CodesExtension extends AbstractExtension
88
{
9-
public function __construct(private array $data)
10-
{
11-
}
12-
139
public function getType(): string
1410
{
1511
return 'codes';
1612
}
17-
18-
public function getData(): array
19-
{
20-
return $this->data;
21-
}
2213
}

src/Shop/Extension/PromotionsExtension.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,8 @@
66

77
class PromotionsExtension extends AbstractExtension
88
{
9-
public function __construct(private array $data)
10-
{
11-
}
12-
139
public function getType(): string
1410
{
1511
return 'promotions';
1612
}
17-
18-
public function getData(): array
19-
{
20-
return $this->data;
21-
}
2213
}

src/Shop/Extension/RedirectsExtension.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,8 @@
66

77
class RedirectsExtension extends AbstractExtension
88
{
9-
public function __construct(private array $data)
10-
{
11-
}
12-
139
public function getType(): string
1410
{
1511
return 'redirects';
1612
}
17-
18-
public function getData(): array
19-
{
20-
return $this->data;
21-
}
2213
}

src/Shop/Extension/TeaserExtension.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,8 @@
66

77
class TeaserExtension extends AbstractExtension
88
{
9-
public function __construct(private array $data)
10-
{
11-
}
12-
139
public function getType(): string
1410
{
1511
return 'teaser';
1612
}
17-
18-
public function getData(): array
19-
{
20-
return $this->data;
21-
}
2213
}

0 commit comments

Comments
 (0)