Exemplo n.º 1
0
<?php

/*
 * This file is part of the kompakt/directory-runner package.
 *
 * (c) Christian Hoegl <*****@*****.**>
 *
 */
use Kompakt\DirectoryRunner\Subscriber\Debugger;
use Kompakt\DirectoryRunner\Runner;
use Kompakt\DirectoryRunner\EventNames;
use Symfony\Component\EventDispatcher\EventDispatcher;
require sprintf('%s/bootstrap.php', __DIR__);
$dir = sprintf("%s/lib", dirname(__DIR__));
$dispatcher = new EventDispatcher();
$eventNames = new EventNames();
$runner = new Runner($dispatcher, $eventNames, $dir);
$debugger = new Debugger($dispatcher, $eventNames);
$debugger->activate();
$callback = function ($fileInfo) {
    return preg_match('/\\.php$/', $fileInfo->getFilename());
};
$runner->run($callback);
Exemplo n.º 2
0
use Kompakt\B3d\Util\File\Reader;
use Kompakt\DirectoryRunner\Runner;
use Kompakt\DirectoryRunner\EventNames;
use Kompakt\DirectoryRunner\Subscriber\Debugger;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Stopwatch\Stopwatch;
require sprintf('%s/bootstrap.php', dirname(__DIR__));
$canonicalProductDirPathname = sprintf('%s/php-cache-product-xml', EXAMPLE_KOMPAKT_B3D_TEMP_DIR);
if (!is_dir($canonicalProductDirPathname)) {
    die(sprintf("%s\n", 'Please fetch and serialize first'));
}
$dispatcher = new EventDispatcher();
$eventNames = new EventNames();
$fileReader = new Reader();
$domLoader = new DomLoader();
$runner = new Runner($dispatcher, $eventNames, $canonicalProductDirPathname);
$price = new Price();
$product = new Product();
$track = new Track();
$domMapper = new DomProductMapper($product, $track, $price);
$repository = new ProductRepository();
$debugger = new Debugger($dispatcher, $eventNames);
$unserializer = new Unserializer($fileReader, $domLoader, $domMapper);
$populator = new Populator($dispatcher, $eventNames, $unserializer, $repository);
// run
$stopwatch = new Stopwatch();
$stopwatch->start('b3d', 'b3d');
#$debugger->activate();
$populator->activate();
$runner->run();
$event = $stopwatch->stop('b3d');