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:
Maciej Sobaczewski 2014-10-18 16:56:53 +00:00
parent 95f7837cdc
commit dac4478916

View file

@ -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;
}