mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Adhere to PEAR Coding Standards' best practices
Doesn't fix any bug but makes example consistent with the rest of the manual and consistent git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@335080 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
95f7837cdc
commit
dac4478916
1 changed files with 6 additions and 1 deletions
|
@ -45,8 +45,9 @@
|
|||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
class obj implements arrayaccess {
|
||||
class obj implements ArrayAccess {
|
||||
private $container = array();
|
||||
|
||||
public function __construct() {
|
||||
$this->container = array(
|
||||
"one" => 1,
|
||||
|
@ -54,6 +55,7 @@ class obj implements arrayaccess {
|
|||
"three" => 3,
|
||||
);
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value) {
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
|
@ -61,12 +63,15 @@ class obj implements arrayaccess {
|
|||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
public function offsetExists($offset) {
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
public function offsetUnset($offset) {
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
public function offsetGet($offset) {
|
||||
return isset($this->container[$offset]) ? $this->container[$offset] : null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue