-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:cocur/chain
* 'master' of github.com:cocur/chain: Fix code style Fix code style Add AbstractChain Applied fixes from StyleCI
- Loading branch information
Showing
4 changed files
with
75 additions
and
63 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,66 @@ | ||
<?php | ||
|
||
namespace Cocur\Chain; | ||
|
||
use ArrayAccess; | ||
use ArrayIterator; | ||
use IteratorAggregate; | ||
|
||
/** | ||
* Chain. | ||
* | ||
* @author Florian Eckerstorfer | ||
* @copyright 2015 Florian Eckerstorfer | ||
*/ | ||
abstract class AbstractChain implements ArrayAccess, IteratorAggregate | ||
{ | ||
/** | ||
* @var array | ||
*/ | ||
public $array = []; | ||
|
||
/** | ||
* @return ArrayIterator | ||
*/ | ||
public function getIterator() | ||
{ | ||
return new ArrayIterator($this->array); | ||
} | ||
|
||
/** | ||
* @param mixed $offset | ||
* | ||
* @return bool | ||
*/ | ||
public function offsetExists($offset) | ||
{ | ||
return isset($this->array[$offset]); | ||
} | ||
|
||
/** | ||
* @param mixed $offset | ||
* | ||
* @return mixed | ||
*/ | ||
public function offsetGet($offset) | ||
{ | ||
return $this->array[$offset]; | ||
} | ||
|
||
/** | ||
* @param mixed $offset | ||
* @param mixed $value | ||
*/ | ||
public function offsetSet($offset, $value) | ||
{ | ||
$this->array[$offset] = $value; | ||
} | ||
|
||
/** | ||
* @param mixed $offset | ||
*/ | ||
public function offsetUnset($offset) | ||
{ | ||
unset($this->array[$offset]); | ||
} | ||
} |
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