Skip to content

Commit 478f53d

Browse files
committed
Move filter interfaces into production repository for custom filters in a single class
1 parent 25bc423 commit 478f53d

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

src/Filter/FilterInterface.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
namespace PHPModelGenerator\Filter;
6+
7+
interface FilterInterface
8+
{
9+
/**
10+
* Return a list of accepted data types for the filter (eg. ['string', 'int']). If the filter is applied to a
11+
* value which doesn't match an accepted type an exception will be thrown. If an empty array is returned the filter
12+
* will accept all types.
13+
*
14+
* @return array
15+
*/
16+
public function getAcceptedTypes(): array;
17+
18+
/**
19+
* Return the token for the filter
20+
*
21+
* @return string
22+
*/
23+
public function getToken(): string;
24+
25+
/**
26+
* Return the filter to apply. Make sure the returned array is a callable which is also callable after the
27+
* render process
28+
*
29+
* @return array
30+
*/
31+
public function getFilter(): array;
32+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
namespace PHPModelGenerator\Filter;
6+
7+
interface TransformingFilterInterface extends FilterInterface
8+
{
9+
/**
10+
* Return the serializer to apply to transformed values.
11+
* Make sure the returned array is a callable which is also callable after the render process
12+
*
13+
* @return array
14+
*/
15+
public function getSerializer(): array;
16+
}

0 commit comments

Comments
 (0)