: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
namespace ET\Builder\Codeception\WPUnit;
* Records how many time gettext is called for the same string.
protected static $stats = array();
public static function gettext( $translation, $text, $domain ) {
if ( isset( self::$stats[ $domain ][ $text ] ) ) {
self::$stats[ $domain ][ $text ] += 1;
self::$stats[ $domain ][ $text ] = 1;
public static function gettext_with_context( $translation, $text, $context, $domain ) {
return self::gettext( $translation, $text, $domain );
public static function stats() {
public static function add_filters() {
add_filter( 'gettext', __CLASS__ . '::gettext', 99, 3 );
add_filter( 'gettext_with_context', __CLASS__ . '::gettext_with_context', 99, 4 );
Translations::add_filters();