<?php
/**
* The basic registry interface.
*
* @author Time.ly Network, Inc.
* @since 2.0
* @package Ai1EC
* @subpackage Ai1EC.Object
*/
interface Ai1ec_Registry {
/**
* Retrieves the key from the registry
*
* @param string $key
*
* @return mixed the value associated to the key.
*/
public function get( $key );
/**
* Set the key into the registry.
*
* @param string $key
* @param mixed $value
*/
public function set( $key, $value );
}
/**
* Application Registry: handles application wide variables.
*
* @author Time.ly Network, Inc.
* @since 2.0
* @package Ai1EC
* @subpackage Ai1EC.Object
*/
class Ai1ec_Registry_Application implements Ai1ec_Registry {
/**
* @var array
*/
protected $_environment = array();
/* (non-PHPdoc)
* @see Ai1ec_Registry::get()
*/
public function get( $key ) {
if ( ! isset ( $this->_environment[$key] ) ) {
return false;
}
return $this->_environment[$key];
}
/* (non-PHPdoc)
* @see Ai1ec_Registry::set()
*/
public function set( $key, $value ) {
$this->_environment[$key] = $value;
}
}
$app = new Ai1ec_Registry_Application();
$app->set( 'foo', 'baz' );
echo $app->get( 'foo' );
- Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
- baz
- Output for 4.4.2 - 4.4.9
- Parse error: syntax error, unexpected T_STRING in /in/ie1nQ on line 10
Process exited with code 255. - Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
- Parse error: parse error, unexpected T_STRING in /in/ie1nQ on line 10
Process exited with code 255. - Output for 4.3.2 - 4.3.4
- Parse error: parse error in /in/ie1nQ on line 10
Process exited with code 255.
preferences:
294.21 ms | 401 KiB | 460 Q