for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Maps;
class ElementOptions {
private $options = [];
/**
* @since 3.0
*
* @param string $name
* @param mixed $value
* @throws \InvalidArgumentException
*/
public function setOption( $name, $value ) {
if ( !is_string( $name ) ) {
throw new \InvalidArgumentException( 'Option name should be a string' );
}
$this->options[$name] = $value;
* @throws \OutOfBoundsException
public function getOption( $name ) {
if ( !array_key_exists( $name, $this->options ) ) {
throw new \OutOfBoundsException( 'Tried to obtain option "' . $name . '" while it has not been set' );
return $this->options[$name];
* @return boolean
public function hasOption( $name ) {
return array_key_exists( $name, $this->options );