Profile.php 716 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\twig;
  8. use Twig_Profiler_Profile;
  9. use yii\web\View;
  10. class Profile extends \Twig_Extension_Profiler
  11. {
  12. protected $view;
  13. protected $profiler;
  14. public function __construct(Twig_Profiler_Profile $profile)
  15. {
  16. $profile = new \Twig_Profiler_Profile();
  17. $dumper = new \Twig_Profiler_Dumper_Text();
  18. parent::__construct($profile);
  19. $view = \Yii::$app->getView();
  20. $view->on(View::EVENT_AFTER_RENDER, function () use ($profile, $dumper) {
  21. \Yii::trace($dumper->dump($profile));
  22. });
  23. }
  24. }