This repository has been archived by the owner on Nov 28, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce interfaces for (meta) value filters #56
- Loading branch information
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php # -*- coding: utf-8 -*- | ||
|
||
namespace W2M\Import\Filter; | ||
|
||
/** | ||
* Interface ValueFilterInterface | ||
* | ||
* Describes a unified filter for (meta) data | ||
* | ||
* @package W2M\Import\Filter | ||
*/ | ||
interface ValueFilterInterface { | ||
|
||
/** | ||
* @param mixed $value | ||
* @param int $object_id | ||
* | ||
* @return mixed (Same type as $value) | ||
*/ | ||
public function filter( $value, $object_id ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php # -*- coding: utf-8 -*- | ||
|
||
namespace W2M\Import\Filter; | ||
|
||
/** | ||
* Interface ValueFilterableInterface | ||
* | ||
* During the process of (XML pull) import it is not stated that | ||
* referenced instances already exists. With this interface, implementors | ||
* have the ability to report this situation to get queued to the | ||
* end of the process. | ||
* | ||
* @package W2M\Import\Filter | ||
*/ | ||
interface ValueFilterableInterface extends ValueFilterInterface { | ||
|
||
/** | ||
* Return FALSE when the filter is not filterable due to missing data. E.g. a post | ||
* ID refers to a post which was not imported yet. | ||
* | ||
* @param mixed $value | ||
* @param int $object_id | ||
* | ||
* @return bool | ||
*/ | ||
public function is_filterable( $value, $object_id ); | ||
} |