Creates request for publish new pact file

@param string            $baseUrl
@param string            $consumerName
@param string            $providerName
@param string            $version
@param \JsonSerializable $jsonObject

@return Request
555883
public function createPublishPactRequestFromObject($baseUrl, $consumerName, $providerName, $version, \JsonSerializable $jsonObject)
    {
        $url = $baseUrl . '/pacts/provider/' . $providerName . '/consumer/' . $consumerName . '/version/' . $version;

        $request = new Request('PUT', $url, [
            "Content-Type" => "application/json"
        ], json_encode($jsonObject));

        return $request;
    }
15723
public static function create(ProviderRepository $providerRepository = null)
    {
        $container = new Container(
            $providerRepository
        );


        if (!$container->isProvided(AnnotationServiceProvider::class)) {
            $container->addProvider(AnnotationServiceProvider::class);
        }

        $container->add(
            Container::class,
            function () use ($container) {
                return $container;
            }
        )->alias(ContainerInterface::class);

        return $container;
    }
569156
protected function buildApiRoute($class, $version, $endpoint, $vars)
    {
        return sprintf('	$api->version("%s", function ($api) {'.PHP_EOL.
            '		$api->resource("%s", "%s",'.PHP_EOL.'%s'.PHP_EOL.'		);'.PHP_EOL.
            '	});'.PHP_EOL,
            $version,
            $endpoint,
            addslashes($class),
            var_export($vars, true));
    }
766994
public JSONObject toJSONObject(MBeanServerExecutor pServerManager) {
        JSONObject ret = new JSONObject();
        addNullSafe(ret, "vendor", vendor);
        addNullSafe(ret, "product", product);
        addNullSafe(ret, "version", version);
        Map<String,String> extra = getExtraInfo(pServerManager);
        if (extra != null) {
            JSONObject jsonExtra = new JSONObject();
            for (Map.Entry<String,String> entry : extra.entrySet()) {
                jsonExtra.put(entry.getKey(),entry.getValue());
            }
            ret.put("extraInfo", jsonExtra);
        }
        return ret;
    }
1352336
public static function buildDefault(string $baseUri, string $username, string $password): EntryPoint
    {
        AnnotationRegistry::registerAutoloadNamespace(
            'JMS\Serializer\Annotation',
            __DIR__.'/../vendor/jms/serializer/src'
        );

        $client = new GuzzleAdapter(new Client());
        $client->withConfig($baseUri, $username, $password);

        $entryPoint = new self($client);

        $jmsSerializer = SerializerBuilder::create()->build();

        $entryPoint->addDefaultSerializers($jmsSerializer);
        $entryPoint->addDefaultDeserializers($jmsSerializer);

        return $entryPoint;
    }
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";
    }
164417
public VariationService createVariationService(final String endpointUrl) {
        return new RestAdapter.Builder()
            .setEndpoint(endpointUrl)
            .setErrorHandler(errorHandler)
            .setConverter(new JacksonVariationConverter(jsonFactory))
            .build().create(VariationService.class);
    }
424699
public function collection(
        ResourceManager $resourceManager,
        ApiRequest $request,
        int $version,
        string $resource
    )
    {
        $resourceManager->version($version);

        /** @var HandlesCollectionRequest $handler */
        $handler = $this->initializeHandler($resourceManager, $resource, $request, HandlesCollectionRequest::class);

        $parameters = $request->asParameters();

        $repository = $this->initializeRepository($resourceManager, $resource, $parameters);

        $result = $handler->index($repository, $parameters);

        $document = $this->makeDocumentFromCollection($resourceManager, $resource, $result, $parameters, $handler);

        return $this->respond($document);
    }
670259
public function newObject($entity, $jsonObject)
	{
		$retValue = array();

		if (! is_null($this->_conn)){
			$last_user_id = $this->_conn->insert($entity, array($jsonObject));

			if (! $this->error($this->_conn->error()))
				return $this->findObject($entity, $last_user_id);
		}
		
		return $retValue;
	}
1068355
private static function makeValueUrlsRelative(PersistentObject $object, $valueName, $baseUrl) {
    $value = $object->getValue($valueName);

    // find urls in texts
    $urls = StringUtil::getUrls($value);
    // find direct attribute urls
    if (strpos($value, 'http://') === 0 || strpos($value, 'https://') === 0) {
      $urls[] = $value;
    }
    // process urls
    foreach ($urls as $url) {
      // convert absolute urls matching baseUrl
      $urlConv = $url;
      if (strpos($url, $baseUrl) === 0) {
        $urlConv = str_replace($baseUrl, '', $url);
      }
      // replace url
      $value = str_replace($url, $urlConv, $value);
    }
    $object->setValue($valueName, $value);
  }
1198928
protected ApiVersionBean createApiVersionInternal(NewApiVersionBean bean,
            ApiBean api, GatewaySummaryBean gateway) throws Exception, StorageException {
        if (!BeanUtils.isValidVersion(bean.getVersion())) {
            throw new StorageException("Invalid/illegal API version: " + bean.getVersion()); //$NON-NLS-1$
        }

        ApiVersionBean newVersion = new ApiVersionBean();
        newVersion.setVersion(bean.getVersion());
        newVersion.setCreatedBy(securityContext.getCurrentUser());
        newVersion.setCreatedOn(new Date());
        newVersion.setModifiedBy(securityContext.getCurrentUser());
        newVersion.setModifiedOn(new Date());
        newVersion.setStatus(ApiStatus.Created);
        newVersion.setApi(api);
        newVersion.setEndpoint(bean.getEndpoint());
        newVersion.setEndpointType(bean.getEndpointType());
        newVersion.setEndpointContentType(bean.getEndpointContentType());
        if (bean.getPublicAPI() != null) {
            newVersion.setPublicAPI(bean.getPublicAPI());
        }
        if (bean.getParsePayload() != null) {
            newVersion.setParsePayload(bean.getParsePayload());
        }
        if (bean.getPlans() != null) {
            newVersion.setPlans(bean.getPlans());
        }
        if (bean.getDefinitionType() != null) {
            newVersion.setDefinitionType(bean.getDefinitionType());
        }

        if (gateway != null && newVersion.getGateways() == null) {
            newVersion.setGateways(new HashSet<>());
            ApiGatewayBean sgb = new ApiGatewayBean();
            sgb.setGatewayId(gateway.getId());
            newVersion.getGateways().add(sgb);
        }

        if (apiValidator.isReady(newVersion)) {
            newVersion.setStatus(ApiStatus.Ready);
        } else {
            newVersion.setStatus(ApiStatus.Created);
        }

        // Ensure all of the plans are in the right status (locked)
        Set<ApiPlanBean> plans = newVersion.getPlans();
        if (plans != null) {
            for (ApiPlanBean splanBean : plans) {
                String orgId = newVersion.getApi().getOrganization().getId();
                PlanVersionBean pvb = storage.getPlanVersion(orgId, splanBean.getPlanId(), splanBean.getVersion());
                if (pvb == null) {
                    throw new StorageException(Messages.i18n.format("PlanVersionDoesNotExist", splanBean.getPlanId(), splanBean.getVersion())); //$NON-NLS-1$
                }
                if (pvb.getStatus() != PlanStatus.Locked) {
                    throw new StorageException(Messages.i18n.format("PlanNotLocked", splanBean.getPlanId(), splanBean.getVersion())); //$NON-NLS-1$
                }
            }
        }

        storage.createApiVersion(newVersion);
        storage.createAuditEntry(AuditUtils.apiVersionCreated(newVersion, securityContext));

        if (bean.getDefinitionUrl() != null) {
            InputStream definition = null;
            try {
                definition = new URL(bean.getDefinitionUrl()).openStream();
                storage.updateApiDefinition(newVersion, definition);
            } catch (Exception e) {
                log.error("Unable to store API definition from: " + bean.getDefinitionUrl(), e); //$NON-NLS-1$
            } finally {
                IOUtils.closeQuietly(definition);
            }
        }

        return newVersion;
    }
240822
public ArchiveService createArchiveService(final String endpointUrl) {
        return new RestAdapter.Builder()
            .setEndpoint(endpointUrl)
            .setErrorHandler(errorHandler)
            .setConverter(new JacksonArchivedSequenceConverter(jsonFactory))
            .build().create(ArchiveService.class);
    }
551357
protected function createJsonApi($source, DocumentHydrator $hydrator): JsonApiObject
    {
        $jsonApi = isset($source->version)
            ? new JsonApiObject($source->version)
            : new JsonApiObject();

        $hydrator->hydrateObject($jsonApi, $source);

        return $jsonApi;
    }
327215
private function getRelationshipSelfSubUrl(ModelInterface $model, string $jsonRelName): string
    {
        return $this->getSelfSubUrl($model) . '/relationships/' . $jsonRelName;
    }
489367
public function createCommunity($name, $summary, $description, $rules, $accessToken)
    {
        if (!$this->apiVersionIsGreaterThanV3()) {
            throw new EndpointNotSupportedByApiVersionException();
        }

        if (strlen($name) < 3 || strlen($name) > 25) {
            throw new InvalidParameterLengthException('name');
        }

        if (strlen($summary) > 160) {
            throw new InvalidParameterLengthException('summary');
        }

        if (strlen($description) > 1572864) { // 1.5MB
            throw new InvalidParameterLengthException('description');
        }

        if (strlen($rules) > 1572864) { // 1.5MB
            throw new InvalidParameterLengthException('rules');
        }

        $params = [
            'name' => $name,
            'summary' => $summary,
            'description' => $description,
            'rules' => $rules,
        ];

        return $this->post('communities', $params, $accessToken);
    }
381532
private function packageJSON() {
        return new JsonObject(
            trim(substr($this->stream, 0, ++$this->cursor)),
            ++$this->object_num
        );
    }
1006912
public function updateObject($entity, $_id, $jsonObject)
	{
		return $this->_v3wh->updateObject($entity, $_id, $jsonObject);
	}