#!/usr/bin/env php

<?php

require __DIR__ . '/vendor/autoload.php';

use BapCat\Hashing\Algorithms\Sha1WeakHasher;
use BapCat\Nom\Compiler;
use BapCat\Nom\Pipeline;
use BapCat\Persist\Drivers\Local\LocalDriver;
use BapCat\Tailor\Tailor;

// Grab filesystem directories
$persist = new LocalDriver(__DIR__ . '/storage');
$templates = $persist->getDirectory('templates');
$cache     = $persist->getDirectory('compiled');

// Compilers translate PHP templates into actual PHP code
$compiler = new Compiler();
$pipeline = new Pipeline($cache, $compiler);

$hasher = new Sha1WeakHasher();

// Create an instance of Tailor to actually do the autoloading
$tailor = new Tailor($templates, $cache, $pipeline, $hasher);

use NS1\ASDD as A1;
use NS2\ASDD as A2;

$tailor->bind(A1::class, 'ASDD', ['namespace' => 'NS1']);
$tailor->bind(A2::class, 'ASDD', ['namespace' => 'NS2']);

var_dump(new A1());
var_dump(new A2());
