container = $initializer; $this->deprecatedProperties = $deprecatedProperties; $this->name = $name; $this->component = $component; } public function offsetExists( $offset ) { $this->checkDeprecatedAccess( $offset, 'exists' ); return isset( $this->container[$offset] ); } public function offsetGet( $offset ) { if ( $this->checkDeprecatedAccess( $offset, 'get' ) ) { if ( is_callable( $this->container[$offset] ) ) { $this->container[$offset] = call_user_func( $this->container[$offset] ); } } return $this->container[$offset] ?? null; } public function offsetSet( $offset, $value ) { if ( $offset === null ) { $this->container[] = $value; } else { $this->container[$offset] = $value; } } public function offsetUnset( $offset ) { $this->checkDeprecatedAccess( $offset, 'unset' ); unset( $this->container[$offset] ); } /** * @param string|int $offset * @param string $fname * @return bool */ private function checkDeprecatedAccess( $offset, string $fname ) : bool { if ( array_key_exists( $offset, $this->deprecatedProperties ) ) { $deprecatedVersion = $this->deprecatedProperties[$offset]; wfDeprecated( "{$this->name} {$fname} '{$offset}'", $deprecatedVersion, $this->component ?? false, 3 ); return true; } return false; } }