andrew-kandels/contain — pull request #29 by mwillbanks (2014-07-17 21:21:17+00:00)
Title: Updated as this one works for all

```php
'Digideck\\Entity\\Definition\\Foo',
'/var/www/library/Foo/Bar/Doo' => 'Foo\\Bar\\Doo',
'/var/www/module/Foo/src/Foo/Entity/Definition/Foo' => 'Foo\\Entity\\Definition\\Foo',
);

foreach ($paths as $path => $class) {
$search = explode('\\', $class);
$search = array_shift($search);
if (preg_match("!.*($search)/(.*)!", $path, $matches)) {
var_dump($matches[1] . '/' . $matches[2]);
}
}
```

```
string(30) "Digideck/Entity/Definition/Foo"
string(11) "Foo/Bar/Doo"
string(25) "Foo/Entity/Definition/Foo"
```