<commit_before><?php

/*!
 * This file is part of {@link https://github.com/MovLib MovLib}.
 *
 * Copyright © 2013-present {@link http://movlib.org/ MovLib}.
 *
 * MovLib is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public
 * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * MovLib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License along with MovLib.
 * If not, see {@link http://www.gnu.org/licenses/ gnu.org/licenses}.
 */
namespace MovLib\Utility;

/**
 * Special object to execute method calls after the response was sent to the user.
 *
 * @author <NAME> <<EMAIL>>
 * @copyright © 2013–present, MovLib
 * @license http://www.gnu.org/licenses/agpl.html AGPL-3.0
 * @link http://movlib.org/
 * @since 0.0.1-dev
 */
class DelayedMethodCalls {

  /**
   * Numeric array to collect the delayed method calls.
   *
   * @var array
   */
  private static $stack = [];

  /**
   * Execute each delayed method.
   */
  public static function run() {
    foreach (self::$stack as list($callable, $params)) {
      call_user_func_array($callable, $params);
    }
  }

  /**
   * Add a delayed method call to the stack.
   *
   * @param object $obj
   *   The object that contains the method which will be executed after the response was sent to the user.
   * @param string $method
   *   The name of the method to call.
   * @param array $params
   *   The parameters for the method call.
   */
  public static function stack($obj, $method, $params) {
    delayed_register(__CLASS__);
    self::$stack[] = [[ $obj, $method ], $params];
  }

}<commit_msg>Made params optional, some methods simply don't need them.<commit_after><?php

/*!
 * This file is part of {@link https://github.com/MovLib MovLib}.
 *
 * Copyright © 2013-present {@link http://movlib.org/ MovLib}.
 *
 * MovLib is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public
 * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * MovLib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License along with MovLib.
 * If not, see {@link http://www.gnu.org/licenses/ gnu.org/licenses}.
 */
namespace MovLib\Utility;

/**
 * Special object to execute method calls after the response was sent to the user.
 *
 * @author <NAME> <<EMAIL>>
 * @copyright © 2013–present, MovLib
 * @license http://www.gnu.org/licenses/agpl.html AGPL-3.0
 * @link http://movlib.org/
 * @since 0.0.1-dev
 */
class DelayedMethodCalls {

  /**
   * Numeric array to collect the delayed method calls.
   *
   * @var array
   */
  private static $stack = [];

  /**
   * Execute each delayed method.
   */
  public static function run() {
    foreach (self::$stack as list($callable, $params)) {
      call_user_func_array($callable, $params);
    }
  }

  /**
   * Add a delayed method call to the stack.
   *
   * @param object $obj
   *   The object that contains the method which will be executed after the response was sent to the user.
   * @param string $method
   *   The name of the method to call.
   * @param array $params
   *   [Optional] The parameters for the method call.
   */
  public static function stack($obj, $method, $params = []) {
    delayed_register(__CLASS__);
    self::$stack[] = [[ $obj, $method ], $params];
  }

}
{'fraction_non_alphanumeric': 0.1096236423339227, 'fraction_numerical': 0.007072493053801465, 'mean_word_length': 3.1993637327677624, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1071735', 'n_tokens_mistral': 1158, 'n_tokens_neox': 1136, 'n_words': 479}