Resolve a Dcotrine DataType Class

@param string the random generator type name
@access public
@return ReverseRegex\RandomInterface
@throws PHPStats\Exception
337473
public function create($type,$seed = null)
    {
        $type = strtolower($type);
        
        # check extension list
        
        if(isset(self::$types[$type]) === true) {
            # assign platform the full namespace
            if(class_exists(self::$types[$type]) === false) {
                throw new ReverseRegexException('Unknown Generator at::'.$type);    
            }
            
            $type = self::$types[$type];
            
        } else {
            throw new ReverseRegexException('Unknown Generator at::'.$type);
        }
       
        return new $type($seed);
    }
1374229
public function resolve()
    {
        if (isset($_SERVER['REQUEST_METHOD'])) {
            if (strtoupper($_SERVER['REQUEST_METHOD']) === 'GET') {
                $params = static::getInputParams($_SERVER, $_GET, false);
            } else {
                $params = static::getInputParams($_SERVER, $_POST, true);
            }

            return new PhpRequest($_SERVER,
                empty($_SESSION) ? [] : $_SESSION,
                empty($_COOKIE) ? [] : $_COOKIE,
                static::getRequestHeaders($_SERVER),
                $params);
        }

        if (PHP_SAPI === 'cli' && isset($_SERVER['argv'])) {
            return new ConsoleRequest($_SERVER['argv']);
        }

        return new NullRequest();
    }
130361
public function resolveClass( $class )
	{
		if ( !is_string( $class ) )
			throw new ResolverException( "Class must be a string" );

		// Check if a class has been mapped to a key
		if ( array_key_exists( $class, $this->classAlias ) )
			try
			{
				return $this->resolve( null, $this->classAlias[$class] );
			}
			catch ( ResolverException $e )
			{
				// Ignore
			}

		// Check if the class has been initialized
		foreach ( $this->instances as $instance )
			if ( get_class( $instance ) == $class )
				return $instance;

		// TODO Other methods to check?

		return false;
	}
190975
public function generate(&$result,GeneratorInterface $generator)
    {
        if($this->literals->count() === 0) {
            throw new GeneratorException('There are no literals to choose from');
        }
        
       $repeat_x = $this->calculateRepeatQuota($generator);
        
        while($repeat_x > 0) {
             $randomIndex = 0;
             
             if($this->literals->count() > 1) {
                $randomIndex = \round($generator->generate(1,($this->literals->count())));        
             }
             
             $result     .= $this->literals->getAt($randomIndex);
             
             --$repeat_x;
        }
        
        return $result;
        
    }
758333
public function randomMutable(int $number = null): self
    {
        $this->generatorToArray();

        if (\count($this->array, \COUNT_NORMAL) === 0) {
            return static::create(
                [],
                $this->iteratorClass,
                false
            );
        }

        if ($number === null) {
            /** @noinspection NonSecureArrayRandUsageInspection */
            $arrayRandValue = [$this->array[\array_rand($this->array)]];
            $this->array = $arrayRandValue;

            return $this;
        }

        /** @noinspection NonSecureShuffleUsageInspection */
        \shuffle($this->array);

        return $this->firstsMutable($number);
    }
651830
protected function resolveType($type)
    {
        switch ($type) {
            case IndexMapping::TYPE_BOOLEAN:
                return ["type" => "boolean"];

            case IndexMapping::TYPE_FLOAT:
                return ["type" => "float"];

            case IndexMapping::TYPE_INTEGER:
                return ["type" => "integer"];

            case IndexMapping::TYPE_DATE:
                return ["type" => "date", "format" => "YYYY-MM-dd"];

            case IndexMapping::TYPE_DATETIME:
                return ["type" => "date"];

            case IndexMapping::TYPE_TIME:
                return ["type" => "date", "format" => "HH:mm:ss"];

            default:
            case IndexMapping::TYPE_STRING:
            case IndexMapping::TYPE_BIG_TEXT:
                return ["type" => "string", "analyzer" => "standard"];
        }
    }
1081450
public function randomImmutable(int $number = null): self
    {
        $this->generatorToArray();

        if (\count($this->array, \COUNT_NORMAL) === 0) {
            return static::create(
                [],
                $this->iteratorClass,
                false
            );
        }

        if ($number === null) {
            /** @noinspection NonSecureArrayRandUsageInspection */
            $arrayRandValue = [$this->array[\array_rand($this->array)]];

            return static::create(
                $arrayRandValue,
                $this->iteratorClass,
                false
            );
        }

        $arrayTmp = $this->array;
        /** @noinspection NonSecureShuffleUsageInspection */
        \shuffle($arrayTmp);

        return static::create(
            $arrayTmp,
            $this->iteratorClass,
            false
        )->firstsImmutable($number);
    }
315358
protected function _getRandomGenerator()
    {
        return $this->_randomizer ? $this->_randomizer->getArrayValue($this->_generators) : $this->_generators[array_rand($this->_generators)];
    }
740937
public final function detectFetchType($fetchType): int
    {
        switch (gettype($fetchType)) {
            case 'NULL':
                return ResultInterface::AS_OBJECT;
            case 'integer':
                if (in_array($fetchType, [ResultInterface::AS_OBJECT, ResultInterface::AS_ARRAY_ASC,
                    ResultInterface::AS_ARRAY_NUM, ResultInterface::AS_ARRAY_ASCNUM])) {
                    return $fetchType;
                }
                break;
            case 'string':
                // shorthands
                if ($fetchType == 'array') return ResultInterface::AS_ARRAY_ASC;
                if ($fetchType == 'object') return ResultInterface::AS_OBJECT;

                //  object, array_asc etc.
                $fetchTypeConst = 'Oppa\Query\Result\ResultInterface::AS_'. strtoupper($fetchType);
                if (defined($fetchTypeConst)) {
                    return constant($fetchTypeConst);
                }

                // user classes
                if (class_exists($fetchType)) {
                    $this->setFetchObject($fetchType);

                    return ResultInterface::AS_OBJECT;
                }
                break;
        }

        throw new InvalidValueException("Given '{$fetchType}' fetch type is not implemented!");
    }
397925
public function logTypeId($object)
    {
        $reflection = new ReflectionClass($object);
        $filename   = $reflection->getFileName();

        $match = null;

        if (!preg_match("'src(.*?)src'si", $filename, $match)) {
            throw new Exception('Unable to resolve current module name.');
        }
        if (!isset($match[1])) {
            throw new Exception('Unable to resolve current module namespace.');
        }

        $reserved = [
            'components', 'modules'
        ];
        $name     = (str_contains($match[1], 'core')) ? 'core' : trim(str_replace($reserved, '', $match[1]), DIRECTORY_SEPARATOR);
        return $this->getLogTypeByName($name);
    }
1185050
public static function guessType($value)
    {
        if (is_scalar($value)) {
            if (is_int($value) || is_float($value)) {
                return \PDO::PARAM_INT;
            } else if (is_bool($value)) {
                return \PDO::PARAM_BOOL;
            }
        }

        return \PDO::PARAM_STR;
    }
1269013
function dataType()
    {
        $dataType = null;
        if( $this->DataTypeString !== null )
            $dataType = eZDataType::create( $this->DataTypeString );

        return $dataType;
    }
704153
public function resolve($type)
    {
        if (!is_string($type)) {
            throw new InvalidArgumentException(
                'Can not resolve class ident: type must be a string'
            );
        }

        // Normalize requested type with prefix / suffix, if applicable.
        $type = $this->prefix.$type.$this->suffix;

        $capitalizeNext = function(&$i) {
            $i = ucfirst($i);
        };

        $capitals = $this->capitals;
        foreach ($capitals as $cap) {
            $expl = explode($cap, $type);
            array_walk($expl, $capitalizeNext);
            $type = implode($cap, $expl);
        }

        $replacements = $this->replacements;
        foreach ($replacements as $rep => $target) {
            $type = str_replace($rep, $target, $type);
        }

        $class = '\\'.trim($type, '\\');

        return $class;
    }
1046648
public static function create($generatorType)
    {
        switch ($generatorType) {
            case ClassMetadata::GENERATOR_TYPE_ASSIGNED:
                $instance = new AssignedIdGenerator();
                break;
            case ClassMetadata::GENERATOR_TYPE_REPOSITORY:
                $instance = new RepositoryIdGenerator();
                break;
            case ClassMetadata::GENERATOR_TYPE_PARENT:
                $instance = new ParentIdGenerator();
                break;
            case ClassMetadata::GENERATOR_TYPE_AUTO:
                $instance = new AutoIdGenerator();
                break;

            default:
                throw new InvalidArgumentException("ID Generator does not exist: $generatorType");
        }

        return $instance;
    }
476559
public function random(int $num = 1): CollectionInterface
    {
        if ($this->isEmpty()) {
            return static::make();
        }

        $keys = array_rand($this->toArray(), $num);

        $return = $this->getMultiple((array) $keys);

        return static::make($return);
    }
323745
public function getPDOParamType($phpType)
    {
        switch ($phpType) {
            case 'boolean':
                return PDO::PARAM_BOOL;
            case 'NULL':
                return PDO::PARAM_NULL;
            case 'integer':
                return PDO::PARAM_INT;
            case 'object': // Allowed if the object or resource has a __toString method
            case 'resource':
            case 'float': // Not actually returnable from get_type
            case 'double':
            case 'string':
                return PDO::PARAM_STR;
            case 'blob':
                return PDO::PARAM_LOB;
            case 'array':
            case 'unknown type':
            default:
                throw new InvalidArgumentException("Cannot bind parameter as it is an unsupported type ($phpType)");
        }
    }
89381
public function checkGenerated(): ?GeneratorVerifier
    {
        $cardinality = $this->resetCardinality();

        $calls = $this->spy->allCalls();
        $matchingEvents = [];
        $totalCount = count($calls);
        $matchCount = 0;

        foreach ($calls as $call) {
            if (!$call->responseEvent()) {
                continue;
            }

            list(, $returnValue) = $call->response();

            if ($returnValue instanceof Generator) {
                $matchingEvents[] = $call;
                ++$matchCount;
            }
        }

        if ($cardinality->matches($matchCount, $totalCount)) {
            return $this->assertionRecorder->createSuccessFromEventCollection(
                $this->generatorVerifierFactory
                    ->create($this->spy, $matchingEvents)
            );
        }

        return null;
    }