<commit_before><?php namespace ProcessWire\GraphQL\Type\Fieldtype;

use ProcessWire\GraphQL\Cache;
use ProcessWire\GraphQL\Type\Fieldtype\Traits\FieldTrait;

class FieldtypeThirdParty
{
  use FieldTrait;

  public static function &type($field)
  {
    $thirdPartyClassName = self::getThirdPartyClassName($field);
    $type =& Cache::type($thirdPartyClassName, function () use ($field, $thirdPartyClassName) {
      return $thirdPartyClassName::getType($field);
    });
    return $type;
  }

  public static function &inputField($field)
  {
    $inputType =& Cache::field("input--{$field->name}", function () use ($field) {
      $fieldSettings = self::field($field);
      $thirdPartyClassName = self::getThirdPartyClassName($field);
      if (method_exists($thirdPartyClassName, 'getInputType')) {
        $fieldSettings['type'] = $thirdPartyClassName::getInputType($field);
      }
      return $fieldSettings;
    });
    return $inputType;
  }

  public static function setValue($page, $field, $value)
  {
    $thirdPartyClassName = self::getThirdPartyClassName($field);
    return $thirdPartyClassName::setValue($page, $field, $value);
  }<commit_msg>fix(third-party-fieldtype): allow multiple types to be created by third-party fieldtypes<commit_after><?php namespace ProcessWire\GraphQL\Type\Fieldtype;

use ProcessWire\GraphQL\Cache;
use ProcessWire\GraphQL\Type\Fieldtype\Traits\FieldTrait;

class FieldtypeThirdParty
{
  use FieldTrait;

  public static function &type($field)
  {
    $thirdPartyClassName = self::getThirdPartyClassName($field);
    $type =& Cache::type("type--{$field->name}", function () use ($field, $thirdPartyClassName) {
      return $thirdPartyClassName::getType($field);
    });
    return $type;
  }

  public static function &inputField($field)
  {
    $inputType =& Cache::field("input--{$field->name}", function () use ($field) {
      $fieldSettings = self::field($field);
      $thirdPartyClassName = self::getThirdPartyClassName($field);
      if (method_exists($thirdPartyClassName, 'getInputType')) {
        $fieldSettings['type'] = $thirdPartyClassName::getInputType($field);
      }
      return $fieldSettings;
    });
    return $inputType;
  }

  public static function setValue($page, $field, $value)
  {
    $thirdPartyClassName = self::getThirdPartyClassName($field);
    return $thirdPartyClassName::setValue($page, $field, $value);
  }
{'fraction_non_alphanumeric': 0.14303638644918445, 'fraction_numerical': 0.0, 'mean_word_length': 4.75, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '241110', 'n_tokens_mistral': 731, 'n_tokens_neox': 686, 'n_words': 131}