forked from etrepat/baum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
boris
executable file
·32 lines (23 loc) · 822 Bytes
/
boris
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env php
<?php
require __DIR__.'/bootstrap.php';
// Prepare the DB
with(new CategoryMigrator)->up();
with(new ClusterMigrator)->up();
// Seed the database with some data
// ...
// Set up a custom inspector for our models
class BaumNodeInspector extends \Boris\ColoredInspector {
public function objectVars($value) {
if ( $value instanceof Baum\Node )
return array_merge($value->getAttributes(), get_object_vars($value));
return parent::objectVars($value);
}
}
// Start-up boris REPL and import any defined var (in scope) which happens to be
// a Baum\Node instance into the context
$boris = new \Boris\Boris('> ');
$boris->setInspector(new BaumNodeInspector);
$boris->setLocal(array_filter(get_defined_vars(), function($var) {
return $var instanceof Baum\Node; }));
$boris->start();