PhpBench\Formatter\Formatter::classesFromFile PHP Метод

classesFromFile() публичный Метод

Register classes from a given JSON encoded class definition file.
public classesFromFile ( string $filename )
$filename string
    public function classesFromFile($filename)
    {
        $classes = $this->loader->load($filename);
        $this->registerClasses($classes);
    }

Usage Example

Пример #1
0
 private function registerFormatter(Container $container)
 {
     $container->register('phpbench.formatter.registry', function (Container $container) {
         $registry = new FormatRegistry();
         $registry->register('printf', new PrintfFormat());
         $registry->register('balance', new BalanceFormat());
         $registry->register('number', new NumberFormat());
         $registry->register('truncate', new TruncateFormat());
         $registry->register('time', new TimeUnitFormat($container->get('benchmark.time_unit')));
         return $registry;
     });
     $container->register('phpbench.formatter', function (Container $container) {
         $formatter = new Formatter($container->get('phpbench.formatter.registry'));
         $formatter->classesFromFile(__DIR__ . '/config/class/main.json');
         return $formatter;
     });
 }