<?php
/**
 * Keeps queries generated by the firing of an action.
 *
 * @package tad\WPBrowser\Iterators\Filters
 */

namespace tad\WPBrowser\Iterators\Filters;

class ActionsQueriesFilter extends QueriesCallerBasedKeepingFilterIterator
{
    /**
     * ClassMethodQueriesFilter constructor.
     *
     * @param \Iterator<string> $iterator The iterator to filter.
     * @param string            $action   The action to filter queries by.
     */
    public function __construct(\Iterator $iterator, $action)
    {
        parent::__construct($iterator);

        $this->needles = [
            "do_action('{$action}')"
        ];
    }
}
