Skip to content
This repository has been archived by the owner on Nov 28, 2019. It is now read-only.

Commit

Permalink
Introduce interfaces for (meta) value filters #56
Browse files Browse the repository at this point in the history
  • Loading branch information
dnaber-de committed Feb 14, 2016
1 parent db6928e commit 0052e7a
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
21 changes: 21 additions & 0 deletions inc/Import/Filter/ValueFilterInterface.php
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 );
}
27 changes: 27 additions & 0 deletions inc/Import/Filter/ValueFilterableInterface.php
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 );
}

0 comments on commit 0052e7a

Please sign in to comment.