Skip to content
Permalink
Browse files

Drop MetaYaml and Yaml-based schema parsing. It's too much overhead f…

…or our needs
  • Loading branch information...
danielbachhuber committed Mar 22, 2014
1 parent 40757dc commit e280be19fec7d0ee42dcbb808a6255ce9620a1ea
Showing with 4 additions and 134 deletions.
  1. +0 −3 .gitmodules
  2. +0 −21 autoload.php
  3. +2 −2 dictator.php
  4. +0 −3 php/class-dictator-cli-command.php
  5. +2 −6 php/class-dictator.php
  6. +0 −37 schemas/network.yml
  7. +0 −62 schemas/site.yml
@@ -1,6 +1,3 @@
[submodule "lib/MetaYaml"]
path = lib/MetaYaml
url = git@github.com:romaricdrigon/MetaYaml.git
[submodule "lib/ramsey/array_column"]
path = lib/ramsey/array_column
url = git@github.com:ramsey/array_column.git
@@ -27,24 +27,3 @@ function dictator_autoloader( $class ) {
}
spl_autoload_register( 'dictator_autoloader' );
function meta_yaml_autoloader( $class ) {
if ( $class[0] === '\\') {
$class = substr( $class, 1 );
}
if ( 0 !== strpos( $class, 'RomaricDrigon' ) ) {
return;
}
$file_parts = explode( '\\', $class );
$file_name = array_pop( $file_parts );
$file_name = $file_name . '.php';
$file_path = dirname( __FILE__ ) . '/lib/MetaYaml/src/' . implode( '/', $file_parts ) . '/' . $file_name;
if ( is_file( $file_path ) ) {
require $file_path;
}
}
spl_autoload_register( 'meta_yaml_autoloader' );
@@ -18,5 +18,5 @@
require_once dirname( __FILE__ ) . '/php/class-dictator.php';
require_once dirname( __FILE__ ) . '/php/class-dictator-cli-command.php';
Dictator::add_state( 'network', '\Dictator\States\Network', 'network.yml' );
Dictator::add_state( 'site', '\Dictator\States\Site', 'site.yml' );
Dictator::add_state( 'network', '\Dictator\States\Network' );
Dictator::add_state( 'site', '\Dictator\States\Site' );
@@ -1,8 +1,5 @@
<?php
use RomaricDrigon\MetaYaml\MetaYaml;
use RomaricDrigon\MetaYaml\Exception\NodeValidatorException;
/**
* The Dictator controls the State of WordPress.
*/
@@ -1,7 +1,5 @@
<?php
use \RomaricDrigon\MetaYaml\MetaYaml;
class Dictator {
private static $instance;
@@ -40,19 +38,17 @@ private static function called_statically() {
*
* @param string $name Name of the state
* @param string $class Class that represents state's relationship with WP
* @param string $schema Schema file
*/
public static function add_state( $name, $class, $schema ) {
public static function add_state( $name, $class ) {
if ( self::called_statically() ) {
return Dictator::get_instance()->add_state( $name, $class, $schema );
return Dictator::get_instance()->add_state( $name, $class );
}
// @todo validate the class is callable and the schema exists
$state = array(
'class' => $class,
'schema' => $schema,
);
self::$instance->states[ $name ] = $state;

This file was deleted.

This file was deleted.

0 comments on commit e280be1

Please sign in to comment.
You can’t perform that action at this time.