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 Type\MetaRecordIndexInterface
Uses by meta filter API to address clearly an object related meta record #56
- Loading branch information
Showing
2 changed files
with
110 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,35 @@ | ||
<?php # -*- coding: utf-8 -*- | ||
|
||
namespace W2M\Import\Type; | ||
|
||
/** | ||
* Interface MetaRecordIndexInterface | ||
* | ||
* Describes a »pointer« to a concrete ImportMeta record | ||
* | ||
* @package W2M\Import\Type | ||
*/ | ||
interface MetaRecordIndexInterface { | ||
|
||
/** | ||
* The type the meta data belongs to | ||
* | ||
* @return string | ||
*/ | ||
public function type(); | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function object_id(); | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function key(); | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function index(); | ||
} |
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,75 @@ | ||
<?php # -*- coding: utf-8 -*- | ||
|
||
namespace W2M\Import\Type; | ||
|
||
class WpMetaRecordIndex implements MetaRecordIndexInterface { | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $type = ''; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $key = ''; | ||
|
||
/** | ||
* @var int | ||
*/ | ||
private $object_id = 0; | ||
|
||
/** | ||
* @var int | ||
*/ | ||
private $index = 0; | ||
|
||
/** | ||
* @param $key | ||
* @param $object_id | ||
* @param int $index | ||
* @param string $type | ||
*/ | ||
public function __construct( $key, $object_id, $index = 0, $type = 'post' ) { | ||
|
||
$this->key = (string) $key; | ||
$this->object_id = (int) $object_id; | ||
$this->index = (int) $index; | ||
$this->type = (string) $type; | ||
} | ||
|
||
/** | ||
* The type the meta data belongs to | ||
* | ||
* @return string | ||
*/ | ||
public function type() { | ||
|
||
return $this->type; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function object_id() { | ||
|
||
return $this->object_id; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function key() { | ||
|
||
return $this->key; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function index() { | ||
|
||
return $this->index; | ||
} | ||
|
||
} |