Creates the requested UUID

@param int $version
@param string $namespace
@param string $name
@return Uuid
541660
protected function createUuid($version, $namespace = null, $name = null)
    {
        switch ((int) $version) {
            case 1:
                $uuid = Uuid::uuid1();
                break;
            case 4:
                $uuid = Uuid::uuid4();
                break;
            case 3:
            case 5:
                $ns = $this->validateNamespace($namespace);
                if (empty($name)) {
                    throw new Exception('The name argument is required for version 3 or 5 UUIDs');
                }
                if ($version == 3) {
                    $uuid = Uuid::uuid3($ns, $name);
                } else {
                    $uuid = Uuid::uuid5($ns, $name);
                }
                break;
            default:
                throw new Exception('Invalid UUID version. Supported are version "1", "3", "4", and "5".');
        }

        return $uuid;
    }
307777
public function createByClassName(string $nameOrFullClassName): MetaEntityInterface
    {
        /** @var MetaEntityInterface $metaEntity */
        $metaEntity = new $this->metaEntityClass($nameOrFullClassName);
        $metaEntity->setUseCustomRepository($this->useCustomRepository);
        $ormTableAnnotation = $this->metaAnnotationFactory->createMetaAnnotation(
            $metaEntity,
            ['Doctrine\ORM\Mapping' => 'ORM'],
            'ORM\Table',
            ['name' => $metaEntity->getTableName()]
        ) ;
        $ormEntityAnnotation = $this->metaAnnotationFactory->createMetaAnnotation(
            $metaEntity,
            ['Doctrine\ORM\Mapping' => 'ORM'],
            'ORM\Entity'
        ) ;
        if ($metaEntity->hasCustomRepository()) {
            $ormEntityAnnotation->addAnnotationAttribute('repositoryClass', $metaEntity->getRepositoryFullClassName());
        }
        return $metaEntity
            ->addEntityAnnotation($ormTableAnnotation)
            ->addEntityAnnotation($ormEntityAnnotation)
        ;
    }
536065
public static function create($maniaLinkId = null, $version = null, $name = null, array $children = null)
    {
        return new static($maniaLinkId, $version, $name, $children);
    }
690596
public function ctcpVersionResponse($nickname, $name, $version, $environment)
    {
        return $this->getCtcpResponse($nickname, 'VERSION ' . $name . ':' . $version . ':' . $environment);
    }
961381
public static function createDocument( $name )
    {
        // Check if a document with the given name exists.
        if ( !isset( self::$documents[$name] ) )
        {
            throw new phpillowNoSuchPropertyException( $name );
        }

        // Instantiate and return document.
        $className = self::$documents[$name];
        return call_user_func( array( $className, 'createNew' ) );
    }
464300
public function create(
        string $name = 'windwalker',
        string $storage = 'array',
        string $serializer = 'php',
        array $options = []
    ): CacheInterface {
        $storage    = $storage ?: 'array';
        $serializer = $serializer ?: 'php';

        ksort($options);

        $hash = sha1($name . $storage . $serializer . serialize($options));

        if (!empty(static::$caches[$hash])) {
            return static::$caches[$hash];
        }

        $storage = $this->getStorage($storage, $options, $name);
        $handler = $this->getSerializer($serializer);

        $class = $this->cacheClass;
        $cache = $this->container->newInstance(
            $class,
            [$storage, $handler]
        );

        return static::$caches[$hash] = $cache;
    }
1152638
public function setName($contentId, $version, $name, $language)
    {
        try {
            return $this->innerGateway->setName($contentId, $version, $name, $language);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
333778
public function createDatabasePlatformForVersion($version)
    {
        $mariadb = stripos($version, 'mariadb') !== false;
        if ($mariadb && version_compare($this->getMariaDbMysqlVersionNumber($version), '10.2.7', '>=')) {
            return new MariaDb1027Platform();
        }

        if (! $mariadb) {
            $oracleMysqlVersion = $this->getOracleMysqlVersionNumber($version);
            if (version_compare($oracleMysqlVersion, '8', '>=')) {
                return new MySQL80Platform();
            }
            if (version_compare($oracleMysqlVersion, '5.7.9', '>=')) {
                return new MySQL57Platform();
            }
        }

        return $this->getDatabasePlatform();
    }
1096002
public function generateId($version = 4, $includeDash = false)
    {

        try {
            switch ($version) {
                case 1:
                    $uuid = Uuid::uuid1();

                    break;

                case 3:
                    $uuid = Uuid::uuid3(Uuid::NAMESPACE_DNS, php_uname('n'));

                    break;
                case 5:
                    $uuid = Uuid::uuid5(Uuid::NAMESPACE_DNS, php_uname('n'));

                    break;
                default:
                    $uuid = Uuid::uuid4();

                    break;
            }

            return $includeDash ? $uuid->toString() : str_replace('-', '', $uuid->toString());

        } catch (UnsatisfiedDependencyException $e) {

            // Some dependency was not met. Either the method cannot be called on a
            // 32-bit system, or it can, but it relies on Moontoast\Math to be present.
            echo 'Caught exception: ' . $e->getMessage() . "\n";
            exit();
        }
    }
1045616
public function get(string $namespace = null, string $service = null, string $method = null, int $version = null)
    {
        return $this->masterpage->render();
    }
710300
public function generateV5($namespace, $salt)
    {
        if (!$this->isValid($namespace)) {
            throw new \Exception('Provided $namespace is invalid: ' . $namespace);
        }

        // Get hexadecimal components of namespace
        $nhex = str_replace(array('-','{','}'), '', $namespace);

        // Binary Value
        $nstr = '';

        // Convert Namespace UUID to bits
        for ($i = 0; $i < strlen($nhex); $i += 2) {
            $nstr .= chr(hexdec($nhex[$i] . $nhex[$i+1]));
        }

        // Calculate hash value
        $hash = sha1($nstr . $salt);

        $guid = sprintf('%08s%04s%04x%04x%12s',
            // 32 bits for "time_low"
            substr($hash, 0, 8),

            // 16 bits for "time_mid"
            substr($hash, 8, 4),

            // 16 bits for "time_hi_and_version",
            // four most significant bits holds version number 3
            (hexdec(substr($hash, 12, 4)) & 0x0fff) | 0x3000,

            // 16 bits, 8 bits for "clk_seq_hi_res",
            // 8 bits for "clk_seq_low",
            // two most significant bits holds zero and one for variant DCE1.1
            (hexdec(substr($hash, 16, 4)) & 0x3fff) | 0x8000,

            // 48 bits for "node"
            substr($hash, 20, 12)
        );

        return $guid;
    }
415312
public static function create($namespace = null, $name = null)
    {
        if (null === $namespace) {
            return self::createNamespacelessUuid();
        }

        return self::createNamespacedUuid($namespace, $name);
    }
375112
public static function v5(string $namespace, string $name): string
	{
		$hash = sha1(static::toBinary($namespace) . $name);

		return sprintf
		(
			'%s-%s-%x-%x-%s',
			substr($hash, 0, 8),
			substr($hash, 8, 4),
			(hexdec(substr($hash, 12, 4)) & 0x0fff) | 0x5000,
			(hexdec(substr($hash, 16, 4)) & 0x3fff) | 0x8000,
			substr($hash, 20, 12)
		);
	}
503742
public static function uuid3(string $namespace, string $name): string
    {
        $bytes = static::getBytes($namespace);

        $hash = \md5($bytes . $name);

        return static::uuidFromHash($hash, 3);
    }
654121
protected function generateVersionTable($name, Annotation $annotation, EntityDefinition &$entityMetadata)
    {
        $annotation = clone $annotation;
        $annotation->name ='ref_' . $annotation->name;
        $annotation->autoIncrement = false;

        // copy primary key to version table
        $entityMetadata['versionTable']['columns'][] = $this->generateColumn($name, $annotation);
    }
1095284
protected function buildRemoteUrl($webServiceName, $version)
    {
        /*
         * The namespaces can be achieved through the Symfony2
         * container if defined, or as fallback through the configuration
         * specified on the static class PureBilling
         */
        $baseUrl = null;
        if ($this->isSymfony() && $this->symfonyContainer->hasParameter('ws_namespaces')) {
            $namespaces = $this->symfonyContainer->getParameter('ws_namespaces');
            $stringHelper = $this->symfonyContainer->get('pure_machine.sdk.string_helper');
            natsort($namespaces);

            foreach ($namespaces as $namespace => $url) {
                if ($stringHelper->startsWith($webServiceName, $namespace, false)) {
                    $baseUrl = $url;
                    break;
                }
            }
        } else {
            /*
             * Using fallback on static \PureBilling
             * configuration
             */
            if ($this->endPoint) {
                $baseUrl = $this->endPoint;
            } elseif (!class_exists('\PureBilling') || \PureBilling::getEndPoint()) {
                $baseUrl = \PureBilling::getEndPoint();
            } else {
                throw new WebServiceException('You need to pass the API enpoint using '
                        ."class contructor", WebServiceException::WS_005);
            }

        }

        if (!$baseUrl) {
            throw new WebServiceException("Can't find remote server in config for webService "
                                     .$webServiceName, WebServiceException::WS_005);
        }

        return "$baseUrl/$version/$webServiceName";
    }
526262
public function getPackage($name, $version = NULL, $variant = 'default')
	{
		$name = strtolower($name);
		if (!isset($this->packages[$name])) {
			throw new PackageNotFoundException('Package "' . $name . '" does not exist');
		}

		if (!$this->packages[$name]->hasVariant($variant)) {
			throw new PackageVariantNotFoundException('Package "' . $name . '" does not have variant "' . $variant . '"');
		}

		/* @var Package */
		$package = $this->packages[$name];

		if ($version) {
			$version = str_replace('~', NULL, $version);
			$version = str_replace('^', '>=', $version);
			$matches = Strings::match($version, '~(lt|<>|<=|le|>=|<|>|gt|ge|==|=|eq|!=|ne)*\s?(.+)~i');

			$versionNumber = $matches[2];
			$versionOperator = $matches[1];

			if (version_compare($package->getVersion(), $versionNumber, $versionOperator ?: '>=') === FALSE) {
				throw new BadPackageVersionException('Package "' . $name . '" is version "' . $package->getVersion() . '", but version "' . $version . '" required.');
			}
		}

		return $package;
	}