<commit_before><?php
/**
 *@file
 * Contains \Drupal\AppConsole\Command\Validators.
 */

namespace Drupal\AppConsole\Command;

class Validators
{

  public function __construct()
  {
  }

  // TODO: validate module name
  public function validateModuleName($module)
  {
    if (!empty($module))
      return $module;
    else
      throw new \InvalidArgumentException(sprintf('Module name "%s" is invalid.', $module));
  }

  public function validateModulePath($module_path)
  {
    if (!is_dir($module_path)) {
      throw new \InvalidArgumentException(sprintf(
        'Module path "%s" is invalid. You need to provide a valid path.',
        $module_path)
      );
    }

    return $module_path;
  }

  /**
   * Validate if module name exist
   * @param  string $module  Module name
   * @param  array  $modules List of modules
   * @return string          Module name
   */
  public function validateModuleExist($module, $modules)
  {
    if (!in_array($module, array_values($modules))) {
      throw new \InvalidArgumentException(sprintf(
        'Module "%s" is invalid. You can use first generate:module command.',
        $module)
      );
    }

    return $module;
  }

  /**
   * Validate if service name exist
   * @param  string $service  Service name
   * @param  array  $services Array of services
   * @return string
   */
  public function validateServiceExist($service, $services)
  {
    if ($service == '') {
      return null;
    }

    if (!in_array($service, array_values($services))) {
      throw new \InvalidArgumentException(sprintf("Service \"%s\" is invalid.", $service));
    }
<commit_msg>Update return statement on validateModuleExist<commit_after><?php
/**
 *@file
 * Contains \Drupal\AppConsole\Utils\Validators.
 */

namespace Drupal\AppConsole\Utils;

class Validators
{

  public function __construct()
  {
  }

  // TODO: validate module name
  public function validateModuleName($module)
  {
    if (!empty($module))
      return $module;
    else
      throw new \InvalidArgumentException(sprintf('Module name "%s" is invalid.', $module));
  }

  public function validateModulePath($module_path)
  {
    if (!is_dir($module_path)) {
      throw new \InvalidArgumentException(sprintf(
        'Module path "%s" is invalid. You need to provide a valid path.',
        $module_path)
      );
    }

    return $module_path;
  }

  /**
   * Validate if module name exist
   * @param  string $module  Module name
   * @param  array  $modules List of modules
   * @return string
   */
  public function validateModuleExist($module, $modules)
  {
    if (!in_array($module, array_values($modules))) {
      throw new \InvalidArgumentException(sprintf(
        'Module "%s" is invalid. You can use first generate:module command.',
        $module)
      );
    }

    return $module;
  }

  /**
   * Validate if service name exist
   * @param  string $service  Service name
   * @param  array  $services Array of services
   * @return string
   */
  public function validateServiceExist($service, $services)
  {
    if ($service == '') {
      return null;
    }

    if (!in_array($service, array_values($services))) {
      throw new \InvalidArgumentException(sprintf("Service \"%s\" is invalid.", $service));
    }

{'fraction_non_alphanumeric': 0.11992619926199262, 'fraction_numerical': 0.0, 'mean_word_length': 2.9004796163069546, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '4406654', 'n_tokens_mistral': 943, 'n_tokens_neox': 934, 'n_words': 268}