Пример #1
0
 /**
  * Return a new instance of tabular with a default configuration.
  *
  * @return Tabular
  */
 public static function getInstance()
 {
     $registry = new ArrayRegistry();
     $registry->register('printf', new Format\PrintfFormat());
     $registry->register('balance', new Format\BalanceFormat());
     $registry->register('number', new Format\NumberFormat());
     $formatter = new Formatter($registry);
     $tableBuilder = new TableBuilder();
     $loader = new Loader();
     $expander = new Expander();
     return new self($tableBuilder, $loader, $formatter, $expander);
 }
Пример #2
0
 private function registerTabular(Container $container)
 {
     $container->register('tabular.xpath_resolver', function () {
         require_once __DIR__ . '/../Dom/xpath_functions.php';
         $resolver = new XPathResolver();
         $resolver->registerFunction('parameters_to_json', 'PhpBench\\Dom\\functions\\parameters_to_json');
         $resolver->registerFunction('class_name', 'PhpBench\\Dom\\functions\\class_name');
         $resolver->registerFunction('join_node_values', 'PhpBench\\Dom\\functions\\join_node_values');
         $resolver->registerFunction('kde_mode', 'PhpBench\\Dom\\functions\\join_node_values');
         $resolver->registerFunction('suite', 'PhpBench\\Dom\\functions\\suite');
         return $resolver;
     });
     $container->register('tabular.table_builder', function (Container $container) {
         return new TableBuilder($container->get('tabular.xpath_resolver'));
     });
     $container->register('tabular.formatter.registry', function (Container $container) {
         $registry = new ArrayRegistry();
         $registry->register('printf', new PrintfFormat());
         $registry->register('balance', new BalanceFormat());
         $registry->register('number', new NumberFormat());
         $registry->register('truncate', new TruncateFormat());
         $registry->register('json_format', new JSONFormat());
         $registry->register('time', new TimeFormat($container->get('benchmark.time_unit')));
         return $registry;
     });
     $container->register('tabular.formatter', function (Container $container) {
         return new Formatter($container->get('tabular.formatter.registry'));
     });
     $container->register('tabular', function (Container $container) {
         return new Tabular($container->get('tabular.table_builder'), $container->get('tabular.definition_loader'), $container->get('tabular.formatter'), $container->get('tabular.expander'));
     });
     $container->register('tabular.definition_loader', function (Container $container) {
         return new Loader($container->get('json_schema.validator'));
     });
     $container->register('tabular.expander', function (Container $container) {
         return new Expander();
     });
 }
Пример #3
0
 private function registerTabular(Container $container)
 {
     $container->register('tabular.xpath_resolver', function () {
         $resolver = new XPathResolver();
         $resolver->registerFunction('parameters_to_json', 'PhpBench\\Report\\Dom\\functions\\parameters_to_json');
         $resolver->registerFunction('class_name', 'PhpBench\\Report\\Dom\\functions\\class_name');
         return $resolver;
     });
     $container->register('tabular.table_builder', function (Container $container) {
         return new TableBuilder($container->get('tabular.xpath_resolver'));
     });
     $container->register('tabular.formatter.registry', function (Container $container) {
         $registry = new ArrayRegistry();
         $registry->register('printf', new PrintfFormat());
         $registry->register('balance', new BalanceFormat());
         $registry->register('number', new NumberFormat());
         return $registry;
     });
     $container->register('tabular.formatter', function (Container $container) {
         return new Formatter($container->get('tabular.formatter.registry'));
     });
     $container->register('tabular', function (Container $container) {
         return new Tabular($container->get('tabular.table_builder'), $container->get('tabular.definition_loader'), $container->get('tabular.formatter'), $container->get('tabular.expander'));
     });
     $container->register('tabular.definition_loader', function (Container $container) {
         return new Loader($container->get('json_schema.validator'));
     });
     $container->register('tabular.expander', function (Container $container) {
         return new Expander();
     });
 }