for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace SMW\SQLStore\TableBuilder;
use RuntimeException;
/**
* @private
*
* @license GNU GPL v2+
* @since 2.5
* @author mwjames
*/
class Table {
* @var string
private $name;
* @var array
private $configuration = array();
* @param string $name
public function __construct( $name ) {
$this->name = $name;
}
* @param string
public function getName() {
return $this->name;
* @param string|null $key
* @param array
public function getConfiguration( $key = null ) {
if ( isset( $this->configuration[$key] ) ) {
return $this->configuration[$key];
return $this->configuration;
* @param string $column
* @param string $type
public function addColumn( $column, $type ) {
$this->configuration['fields'][$column] = $type;
* @param string|array $index
public function addIndex( $index ) {
$this->configuration['indicies'][] = $index;
* @param string $key
public function addIndexWithKey( $key, $index ) {
$this->configuration['indicies'][$key] = $index;
* @param string $option
* @throws RuntimeException
public function addOption( $key, $option ) {
if ( $key === 'fields' || $key === 'indicies' ) {
throw new RuntimeException( "$key is a reserved option key." );
$this->configuration[$key] = $option;