<commit_before><?php

namespace Phpro\SoapClient\CodeGenerator\Util;

/**
 * Class Normalizer
 *
 * @package Phpro\SoapClient\CodeGenerator\Util
 */
class Normalizer
{

    /**
     * @param string $namespace
     *
     * @return string
     */
    public static function normalizeNamespace($namespace)
    {
        return trim(str_replace('/', '\\', $namespace), '\\');
    }

    /**
     * @param $name
     *
     * @return string
     */
    public static function normalizeClassname($name)
    {
        return ucfirst(preg_replace('{[^a-z0-9_]}i', '', $name));
    }

    /**
     * @param $property
     *
     * @return mixed
     */
    public static function normalizeProperty($property)
    {
        return preg_replace('{[^a-z0-9_]}i', '', $property);
    }

    /**
     * @param string $type
     *
     * @return string
     */
    public static function normalizeDataType($type)
    {
        $normalizations = [
            'long' => 'int',
            'short' => 'int',
            'dateTime' => '\\DateTime',
            'date' => '\\DateTime',
            'boolean' => 'bool',
            'decimal' => 'float',
            'double' => 'float',
        ];

        return preg_replace(
            array_map(
                function ($search) {
                    return '/^' . $search. '$/i';
                },
                array_keys($normalizations)
            ),
            array_values($normalizations),
            $type
        );
    }

    /**
     * @param $prefix
     * @param $property
     *
     * @return string
     */
    public static function generatePropertyMethod($prefix, $property)
    {<commit_msg>Make type normalization code easier to understand<commit_after><?php

namespace Phpro\SoapClient\CodeGenerator\Util;

/**
 * Class Normalizer
 *
 * @package Phpro\SoapClient\CodeGenerator\Util
 */
class Normalizer
{

    /**
     * @param string $namespace
     *
     * @return string
     */
    public static function normalizeNamespace($namespace)
    {
        return trim(str_replace('/', '\\', $namespace), '\\');
    }

    /**
     * @param $name
     *
     * @return string
     */
    public static function normalizeClassname($name)
    {
        return ucfirst(preg_replace('{[^a-z0-9_]}i', '', $name));
    }

    /**
     * @param $property
     *
     * @return mixed
     */
    public static function normalizeProperty($property)
    {
        return preg_replace('{[^a-z0-9_]}i', '', $property);
    }

    /**
     * @param string $type
     *
     * @return string
     */
    public static function normalizeDataType($type)
    {
        $normalizations = [
            'long' => 'int',
            'short' => 'int',
            'datetime' => '\\DateTime',
            'date' => '\\DateTime',
            'boolean' => 'bool',
            'decimal' => 'float',
            'double' => 'float',
        ];

        $searchType = strtolower($type);

        return array_key_exists($searchType, $normalizations) ? $normalizations[$searchType] : $type;
    }

    /**
     * @param $prefix
     * @param $property
     *
     * @return string
     */
    public static function generatePropertyMethod($prefix, $property)
    {
{'fraction_non_alphanumeric': 0.15348546420756487, 'fraction_numerical': 0.0025007814942169426, 'mean_word_length': 1.7898866608544028, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '3397739', 'n_tokens_mistral': 951, 'n_tokens_neox': 925, 'n_words': 180}