public function wp_hook_begin() {

		foreach ( Logger::$active_loggers as $logger ) {
			$logger->start_hook_timer();
		}

		$current_filter = current_filter();
		if ( ( 'stage' === $this->type && in_array( $current_filter, $this->current_stage_hooks ) )
			|| ( 'hook' === $this->type && ! $this->focus ) ) {
			$pseudo_hook = "{$current_filter}:before";
			if ( isset( $this->loggers[ $pseudo_hook ] ) ) {
				$this->loggers[ $pseudo_hook ]->stop();
			}
			$callback_count = 0;
			$callbacks      = self::get_filter_callbacks( $current_filter );
			if ( false !== $callbacks ) {
				foreach ( $callbacks as $priority => $cbs ) {
					$callback_count += count( $cbs );
				}
			}
			$this->loggers[ $current_filter ] = new Logger(
				array(
					'hook'           => $current_filter,
					'callback_count' => $callback_count,
				)
			);
			$this->loggers[ $current_filter ]->start();
		}

		if ( 0 === $this->filter_depth
			&& ! is_null( $this->previous_filter_callbacks ) ) {
			self::set_filter_callbacks( $this->previous_filter, $this->previous_filter_callbacks );
			$this->previous_filter_callbacks = null;
		}

		if ( 'hook' === $this->type
			&& 0 === $this->filter_depth
			&& ( $current_filter === $this->focus || true === $this->focus ) ) {
			$this->wrap_current_filter_callbacks( $current_filter );
		}

		$this->filter_depth++;

		WP_CLI::add_wp_hook( $current_filter, array( $this, 'wp_hook_end' ), 9999 );
	}
public function wp_hook_begin() {

		foreach ( Logger::$active_loggers as $logger ) {
			$logger->start_hook_timer();
		}

		$current_filter = current_filter();
		if ( ( 'stage' === $this->type && in_array( $current_filter, $this->current_stage_hooks ) )
			|| ( 'hook' === $this->type && ! $this->focus ) ) {
			$pseudo_hook = "{$current_filter}:before";
			if ( isset( $this->loggers[ $pseudo_hook ] ) ) {
				$this->loggers[ $pseudo_hook ]->stop();
			}
			$callback_count = 0;
			$callbacks      = self::get_filter_callbacks( $current_filter );
			if ( false !== $callbacks ) {
				foreach ( $callbacks as $priority => $cbs ) {
					$callback_count += count( $cbs );
				}
			}
			$this->loggers[ $current_filter ] = new Logger(
				array(
					'hook'           => $current_filter,
					'callback_count' => $callback_count,
				)
			);
			$this->loggers[ $current_filter ]->start();
		}

		if ( 0 === $this->filter_depth
			&& ! is_null( $this->previous_filter_callbacks ) ) {
			self::set_filter_callbacks( $this->previous_filter, $this->previous_filter_callbacks );
			$this->previous_filter_callbacks = null;
		}

		if ( 'hook' === $this->type
			&& 0 === $this->filter_depth
			&& ( $current_filter === $this->focus || true === $this->focus ) ) {
			$this->wrap_current_filter_callbacks( $current_filter );
		}

		$this->filter_depth++;

		WP_CLI::add_wp_hook( $current_filter, array( $this, 'wp_hook_end' ), 9999 );
	}
public function wp_hook_begin ( ) { foreach ( Logger :: $ active_loggers as $ logger ) { $ logger -> start_hook_timer ( ) ; } $ current_filter = current_filter ( ) ; if ( ( 'stage' === $ this -> type && in_array ( $ current_filter , $ this -> current_stage_hooks ) ) || ( 'hook' === $ this -> type && ! $ this -> focus ) ) { $ pseudo_hook = "{$current_filter}:before" ; if ( isset ( $ this -> loggers [ $ pseudo_hook ] ) ) { $ this -> loggers [ $ pseudo_hook ] -> stop ( ) ; } $ callback_count = 0 ; $ callbacks = self :: get_filter_callbacks ( $ current_filter ) ; if ( false !== $ callbacks ) { foreach ( $ callbacks as $ priority => $ cbs ) { $ callback_count += count ( $ cbs ) ; } } $ this -> loggers [ $ current_filter ] = new Logger ( array ( 'hook' => $ current_filter , 'callback_count' => $ callback_count , ) ) ; $ this -> loggers [ $ current_filter ] -> start ( ) ; } if ( 0 === $ this -> filter_depth && ! is_null ( $ this -> previous_filter_callbacks ) ) { self :: set_filter_callbacks ( $ this -> previous_filter , $ this -> previous_filter_callbacks ) ; $ this -> previous_filter_callbacks = null ; } if ( 'hook' === $ this -> type && 0 === $ this -> filter_depth && ( $ current_filter === $ this -> focus || true === $ this -> focus ) ) { $ this -> wrap_current_filter_callbacks ( $ current_filter ) ; } $ this -> filter_depth ++ ; WP_CLI :: add_wp_hook ( $ current_filter , array ( $ this , 'wp_hook_end' ) , 9999 ) ; }
Profiling verbosity at the beginning of every action and filter
Profiling verbosity at the beginning of every action and filter