original_string: public function boot(Application $app)
  	{
  		$assets = $this;
  		$app->before(function(Request $request) use($app, $assets){
  			$baseUrl = rtrim($request->getScheme().'://'.$request->getHttpHost().$request->getBasePath()).'/';
  			$assets->setCoreUrl($baseUrl);
  			$assets->setOption('baseUrl', $baseUrl);
  			$assets->setOption('jsPosition',$assets::ON_BODY);
  			return $assets;
  		});
  
  		// Registering preloaded options
  		$options = isset($app['assets.options'])?$app['assets.options']:array();
  		if(!empty($options))
  			array_walk($options, function($optionValue, $optionName) use($assets){
  				$assets->setOption($optionName, $optionValue);
  			});	
  
  		// Registering preloaded javascript files
  		$js = isset($app['assets.js'])?$app['assets.js']:array();
  		if(!empty($js))
  			array_walk($js, function($value) use($assets){
  				$assets->registerJs($value);
  			});
  
  		// Registering preloaded css files
  		$css = isset($app['assets.css'])?$app['assets.css']:array();
  		if(!empty($css))
  			array_walk($css, function($value) use($assets){
  				$assets->registerCss($value);
  			});
  
  		$app->after(function(Request $request, Response $response) use($app, $assets){
  			// print_r($response->headers->get('content_type'));
  			if($response->headers->get('content_type')!='application/json')
  			{
  				$content = $response->getContent();
  				$assets->renderAssets($content);
  				$response->setContent($content);
  			}
  			return $response;
  		});
  	}
code: public function boot(Application $app)
  	{
  		$assets = $this;
  		$app->before(function(Request $request) use($app, $assets){
  			$baseUrl = rtrim($request->getScheme().'://'.$request->getHttpHost().$request->getBasePath()).'/';
  			$assets->setCoreUrl($baseUrl);
  			$assets->setOption('baseUrl', $baseUrl);
  			$assets->setOption('jsPosition',$assets::ON_BODY);
  			return $assets;
  		});
  
  		// Registering preloaded options
  		$options = isset($app['assets.options'])?$app['assets.options']:array();
  		if(!empty($options))
  			array_walk($options, function($optionValue, $optionName) use($assets){
  				$assets->setOption($optionName, $optionValue);
  			});	
  
  		// Registering preloaded javascript files
  		$js = isset($app['assets.js'])?$app['assets.js']:array();
  		if(!empty($js))
  			array_walk($js, function($value) use($assets){
  				$assets->registerJs($value);
  			});
  
  		// Registering preloaded css files
  		$css = isset($app['assets.css'])?$app['assets.css']:array();
  		if(!empty($css))
  			array_walk($css, function($value) use($assets){
  				$assets->registerCss($value);
  			});
  
  		$app->after(function(Request $request, Response $response) use($app, $assets){
  			// print_r($response->headers->get('content_type'));
  			if($response->headers->get('content_type')!='application/json')
  			{
  				$content = $response->getContent();
  				$assets->renderAssets($content);
  				$response->setContent($content);
  			}
  			return $response;
  		});
  	}
code_tokens: public function boot ( Application $ app ) { $ assets = $ this ; $ app -> before ( function ( Request $ request ) use ( $ app , $ assets ) { $ baseUrl = rtrim ( $ request -> getScheme ( ) . '://' . $ request -> getHttpHost ( ) . $ request -> getBasePath ( ) ) . '/' ; $ assets -> setCoreUrl ( $ baseUrl ) ; $ assets -> setOption ( 'baseUrl' , $ baseUrl ) ; $ assets -> setOption ( 'jsPosition' , $ assets :: ON_BODY ) ; return $ assets ; } ) ; // Registering preloaded options $ options = isset ( $ app [ 'assets.options' ] ) ? $ app [ 'assets.options' ] : array ( ) ; if ( ! empty ( $ options ) ) array_walk ( $ options , function ( $ optionValue , $ optionName ) use ( $ assets ) { $ assets -> setOption ( $ optionName , $ optionValue ) ; } ) ; // Registering preloaded javascript files $ js = isset ( $ app [ 'assets.js' ] ) ? $ app [ 'assets.js' ] : array ( ) ; if ( ! empty ( $ js ) ) array_walk ( $ js , function ( $ value ) use ( $ assets ) { $ assets -> registerJs ( $ value ) ; } ) ; // Registering preloaded css files $ css = isset ( $ app [ 'assets.css' ] ) ? $ app [ 'assets.css' ] : array ( ) ; if ( ! empty ( $ css ) ) array_walk ( $ css , function ( $ value ) use ( $ assets ) { $ assets -> registerCss ( $ value ) ; } ) ; $ app -> after ( function ( Request $ request , Response $ response ) use ( $ app , $ assets ) { // print_r($response->headers->get('content_type')); if ( $ response -> headers -> get ( 'content_type' ) != 'application/json' ) { $ content = $ response -> getContent ( ) ; $ assets -> renderAssets ( $ content ) ; $ response -> setContent ( $ content ) ; } return $ response ; } ) ; }
docstring: implementation of Silex Service Provider boot method
docstring_tokens: implementation of Silex Service Provider boot method