Advertisement
Guest User

BBC developer login picture text

a guest
Jun 14th, 2021
387
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.63 KB | None | 0 0
  1.  
  2. <?php
  3. namespace JnsBundleXhprofBundleEventListener;
  4. use SymfonyComponentConsoleEventConsoleCommandEvent;
  5. use SymfonyComponentConsoleEventConsoleTerminateEvent;
  6. use SymfonyComponentConsoleInputInputOption;
  7. use SymfonyComponentDependencyInjectionContainerInterface;
  8. use JnsBundleXhprofBundleDataCollectorXhprofCollector;
  9. /**
  10.  * A command listener to profile command runs.
  11.  *
  12.  * The methods must be connected to the console.command and console.terminate
  13.  * events.
  14.  *
  15.  * @author David Buchmann <mail@davidbu.ch>
  16.  */
  17. class CommandListener
  18. {
  19.     private $collector;
  20.     private $container;
  21.     private $optionName;
  22.     private $mode;
  23.     private $filters = array();
  24.     private $webLocation;
  25.     public function __construct(XhprofCollector $collector, ContainerInterface $container)
  26.     {
  27.         $this->collector = $collector;
  28.         $this->container = $container;
  29.     }
  30.     /**
  31.      * @param string $mode on|off|option
  32.      */
  33.     public function setEnabled($mode)
  34.     {
  35.         $this->mode = $mode;
  36.     }
  37.     /**
  38.      * @param string $option name of the cli option for enabled mode "option"
  39.      */
  40.     public function setOptionName($option)
  41.     {
  42.         $this->optionName = $option;
  43.     }
  44.     /**
  45.      * @param array $excludes List of regular expressions for command names to exclude
  46.      */
  47.     public function setFilters(array $excludes)
  48.     {
  49.         $this->filters = $excludes;
  50.     }
  51.     /**
  52.      * Configure the base url to the xhprof web gui.
  53.      *
  54.      * @param string $webLocation
  55.      */
  56.     public function setWebLocation($webLocation)
  57.     {
  58.         $this->webLocation = $webLocation;
  59.     }
  60.  
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement