使用Silex进行接口注入

I'm trying to implement interface injection with Silex\Application. I have my bootstrapping in one PHP file, mind, this is simplified without the interfaces actually:

$app = new Silex\Application();
$app->register(
    new ServiceProvider($app)
);

$app['testme'] = function() {
    throw new Exception('I am invoked');
};

$app->run();

And I have the ServiceProvider:

class ServiceProvider implements ServiceProviderInterface
{
    public function register(Application $app) {
        foreach ($app as $key => $val) {
            if ($key == 'testme') {
               throw new Exception('it works!');
            }
        }
    }
}

The first exception should not be thrown but I expected the second one to trigger.

Why does the above not work and where might be the spot in silex to inject configuration into interfaces according to $app[....] instanceof MyAwareInterface ?

Your exemple updated with Silex's IOC and my poor knowledges about interface injection:

$app = new Silex\Application();

$app->register(
    new ServiceProvider($app)
);

$app['testme'] = function() {
   return new ThisObjectImplementsMyInterface();
};

$app->run();

And I have the ServiceProvider:

class ServiceProvider implements ServiceProviderInterface{
    public function register(Application $app) {
        $app['configure.interface'] = function() use ($app) {
            foreach ($app as $val) {
                if ($val instanceOf 'MyInterface') {
                   $val->configureInterfaceMethod($app['param1'], $app['param2'] /*, ...*/);
                }
            }
        }
    }

    public function boot(Application $app) {
        $app['configure.interface'];
    }
}