Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
257 additions
and
52 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
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,143 @@ | ||
<?php | ||
|
||
|
||
namespace TheCodingMachine\TDBM; | ||
|
||
use Iterator; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
class EmptyInnerResultIterator implements Iterator, InnerResultIteratorInterface | ||
{ | ||
|
||
/** | ||
* Return the current element | ||
* @link https://php.net/manual/en/iterator.current.php | ||
* @return mixed Can return any type. | ||
* @since 5.0.0 | ||
*/ | ||
public function current() | ||
{ | ||
return null; | ||
} | ||
|
||
/** | ||
* Move forward to next element | ||
* @link https://php.net/manual/en/iterator.next.php | ||
* @return void Any returned value is ignored. | ||
* @since 5.0.0 | ||
*/ | ||
public function next() | ||
{ | ||
} | ||
|
||
/** | ||
* Return the key of the current element | ||
* @link https://php.net/manual/en/iterator.key.php | ||
* @return mixed scalar on success, or null on failure. | ||
* @since 5.0.0 | ||
*/ | ||
public function key() | ||
{ | ||
return null; | ||
} | ||
|
||
/** | ||
* Checks if current position is valid | ||
* @link https://php.net/manual/en/iterator.valid.php | ||
* @return boolean The return value will be casted to boolean and then evaluated. | ||
* Returns true on success or false on failure. | ||
* @since 5.0.0 | ||
*/ | ||
public function valid() | ||
{ | ||
return false; | ||
} | ||
|
||
/** | ||
* Rewind the Iterator to the first element | ||
* @link https://php.net/manual/en/iterator.rewind.php | ||
* @return void Any returned value is ignored. | ||
* @since 5.0.0 | ||
*/ | ||
public function rewind() | ||
{ | ||
} | ||
|
||
/** | ||
* Whether a offset exists | ||
* @link https://php.net/manual/en/arrayaccess.offsetexists.php | ||
* @param mixed $offset <p> | ||
* An offset to check for. | ||
* </p> | ||
* @return boolean true on success or false on failure. | ||
* </p> | ||
* <p> | ||
* The return value will be casted to boolean if non-boolean was returned. | ||
* @since 5.0.0 | ||
*/ | ||
public function offsetExists($offset) | ||
{ | ||
return false; | ||
} | ||
|
||
/** | ||
* Offset to retrieve | ||
* @link https://php.net/manual/en/arrayaccess.offsetget.php | ||
* @param mixed $offset <p> | ||
* The offset to retrieve. | ||
* </p> | ||
* @return mixed Can return all value types. | ||
* @since 5.0.0 | ||
*/ | ||
public function offsetGet($offset) | ||
{ | ||
throw new TDBMInvalidOffsetException('Offset "'.$offset.'" does not exist in result set.'); | ||
} | ||
|
||
/** | ||
* Offset to set | ||
* @link https://php.net/manual/en/arrayaccess.offsetset.php | ||
* @param mixed $offset <p> | ||
* The offset to assign the value to. | ||
* </p> | ||
* @param mixed $value <p> | ||
* The value to set. | ||
* </p> | ||
* @return void | ||
* @since 5.0.0 | ||
*/ | ||
public function offsetSet($offset, $value) | ||
{ | ||
throw new TDBMInvalidOperationException('You cannot set values in a TDBM result set.'); | ||
} | ||
|
||
/** | ||
* Offset to unset | ||
* @link https://php.net/manual/en/arrayaccess.offsetunset.php | ||
* @param mixed $offset <p> | ||
* The offset to unset. | ||
* </p> | ||
* @return void | ||
* @since 5.0.0 | ||
*/ | ||
public function offsetUnset($offset) | ||
{ | ||
throw new TDBMInvalidOperationException('You cannot unset values in a TDBM result set.'); | ||
} | ||
|
||
/** | ||
* Count elements of an object | ||
* @link https://php.net/manual/en/countable.count.php | ||
* @return int The custom count as an integer. | ||
* </p> | ||
* <p> | ||
* The return value is cast to an integer. | ||
* @since 5.1.0 | ||
*/ | ||
public function count() | ||
{ | ||
return 0; | ||
} | ||
} |
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
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
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,11 @@ | ||
<?php | ||
|
||
|
||
namespace TheCodingMachine\TDBM; | ||
|
||
/** | ||
* Interface implemented by all "inner result iterators" | ||
*/ | ||
interface InnerResultIteratorInterface extends \Traversable, \Countable, \ArrayAccess | ||
{ | ||
} |
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
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
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
Oops, something went wrong.