Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace JnsBundleXhprofBundleEventListener;
- use SymfonyComponentConsoleEventConsoleCommandEvent;
- use SymfonyComponentConsoleEventConsoleTerminateEvent;
- use SymfonyComponentConsoleInputInputOption;
- use SymfonyComponentDependencyInjectionContainerInterface;
- use JnsBundleXhprofBundleDataCollectorXhprofCollector;
- /**
- * A command listener to profile command runs.
- *
- * The methods must be connected to the console.command and console.terminate
- * events.
- *
- * @author David Buchmann <mail@davidbu.ch>
- */
- class CommandListener
- {
- private $collector;
- private $container;
- private $optionName;
- private $mode;
- private $filters = array();
- private $webLocation;
- public function __construct(XhprofCollector $collector, ContainerInterface $container)
- {
- $this->collector = $collector;
- $this->container = $container;
- }
- /**
- * @param string $mode on|off|option
- */
- public function setEnabled($mode)
- {
- $this->mode = $mode;
- }
- /**
- * @param string $option name of the cli option for enabled mode "option"
- */
- public function setOptionName($option)
- {
- $this->optionName = $option;
- }
- /**
- * @param array $excludes List of regular expressions for command names to exclude
- */
- public function setFilters(array $excludes)
- {
- $this->filters = $excludes;
- }
- /**
- * Configure the base url to the xhprof web gui.
- *
- * @param string $webLocation
- */
- public function setWebLocation($webLocation)
- {
- $this->webLocation = $webLocation;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement