_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q255800
IntuitBatchResponse.getResult
test
public function getResult(){ if(isset($this->entity)){ return $this->entity; }else if(isset($this->entities)){ return $this->entities; } else{ return null; } }
php
{ "resource": "" }
q255801
Zend_Soap_AutoDiscover.setUri
test
public function setUri($uri) { if (!is_string($uri) && !($uri instanceof Zend_Uri)) { require_once "Zend/Soap/AutoDiscover/Exception.php"; throw new Zend_Soap_AutoDiscover_Exception("No uri given to Zend_Soap_AutoDiscover::setUri as string or Zend_Uri instance."); } $...
php
{ "resource": "" }
q255802
Zend_Soap_AutoDiscover.getUri
test
public function getUri() { if ($this->_uri !== null) { $uri = $this->_uri; } else { $schema = $this->getSchema(); $host = $this->getHostName(); $scriptName = $this->getRequestUriWithoutParameters(); $uri = Zend_Uri::factory($schem...
php
{ "resource": "" }
q255803
Zend_Soap_AutoDiscover.getRequestUriWithoutParameters
test
protected function getRequestUriWithoutParameters() { if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { // check this first so IIS will catch $requestUri = $_SERVER['HTTP_X_REWRITE_URL']; } elseif (isset($_SERVER['REQUEST_URI'])) { $requestUri = $_SERVER['REQUEST_URI']; } ...
php
{ "resource": "" }
q255804
Zend_Soap_AutoDiscover.setComplexTypeStrategy
test
public function setComplexTypeStrategy($strategy) { $this->_strategy = $strategy; if ($this->_wsdl instanceof Zend_Soap_Wsdl) { $this->_wsdl->setComplexTypeStrategy($strategy); } return $this; }
php
{ "resource": "" }
q255805
Zend_Soap_AutoDiscover.setClass
test
public function setClass($class, $namespace = '', $argv = null) { $uri = $this->getUri(); $wsdl = new Zend_Soap_Wsdl($class, $uri, $this->_strategy); // The wsdl:types element must precede all other elements (WS-I Basic Profile 1.1 R2023) $wsdl->addSchemaTypeSection(); $po...
php
{ "resource": "" }
q255806
Zend_Soap_AutoDiscover.addFunction
test
public function addFunction($function, $namespace = '') { static $port; static $operation; static $binding; if (!is_array($function)) { $function = (array) $function; } $uri = $this->getUri(); if (!($this->_wsdl instanceof Zend_Soap_Wsdl)) { ...
php
{ "resource": "" }
q255807
Zend_Soap_AutoDiscover.dump
test
public function dump($filename) { if ($this->_wsdl !== null) { return $this->_wsdl->dump($filename); } else { /** * @see Zend_Soap_AutoDiscover_Exception */ require_once "Zend/Soap/AutoDiscover/Exception.php"; throw new Zend_S...
php
{ "resource": "" }
q255808
SyncRestHandler.updateContext
test
public function updateContext($newServiceContext){ if(isset($newServiceContext) && $newServiceContext instanceof ServiceContext){ $this->context = $newServiceContext; }else{ throw new SdkException("Cannot Update Service Context. The service context either is undefined or not an in...
php
{ "resource": "" }
q255809
SyncRestHandler.sendRequest
test
public function sendRequest($requestParameters, $requestBody, $specifiedRequestUri, $throwExceptionOnError = false) { // This step is required since the configuration settings might have been changed. $this->resetCompressorAndSerializer(); //Get the OAuth Authorization Mode for the request, ...
php
{ "resource": "" }
q255810
SyncRestHandler.OAuth1APICall
test
private function OAuth1APICall($baseURL, $queryParameters, $HttpMethod, $requestUri, $requestParameters, $requestBody, $throwExceptionOnError){ $AuthorizationHeader = $this->getOAuth1AuthorizationHeader($baseURL, $queryParameters, $HttpMethod); $httpHeaders = $this->setCommonHeadersForPHPSDK($AuthorizationH...
php
{ "resource": "" }
q255811
SyncRestHandler.getOAuth1AuthorizationHeader
test
private function getOAuth1AuthorizationHeader($baseURL, $queryParameters, $HttpMethod){ $oauth1 = new OAuth1( $this->context->requestValidator->ConsumerKey, $this->context->requestValidator->ConsumerSecret, $this->context->requestValidator->AccessToken, $this->context->requestValid...
php
{ "resource": "" }
q255812
SyncRestHandler.OAuth2APICall
test
private function OAuth2APICall($baseURL, $queryParameters, $HttpMethod, $requestUri, $requestParameters, $requestBody, $throwExceptionOnError){ $AuthorizationHeader = $this->getOAuth2AuthorizationHeader($this->context->requestValidator); //We only support QBO for PHP SDK. No QBD support, change ...
php
{ "resource": "" }
q255813
SyncRestHandler.getOAuth2AuthorizationHeader
test
private function getOAuth2AuthorizationHeader($OAuth2AccessToken){ if(!$OAuth2AccessToken instanceof OAuth2AccessToken){ throw new SdkException("Internal Error. The OAuth 2 configuration is not complete."); } $accessToken = $OAuth2AccessToken->getAccessToken(); $AuthorizationHeader = "...
php
{ "resource": "" }
q255814
SyncRestHandler.LogAPIResponseToLog
test
public function LogAPIResponseToLog($body, $requestUri, $httpHeaders){ if(strcasecmp($httpHeaders[CoreConstants::CONTENT_TYPE], CoreConstants::CONTENTTYPE_APPLICATIONXML) == 0 || strcasecmp($httpHeaders[CoreConstants::CONTENT_TYPE], CoreConstants::CONTENTTYPE_APPLICATIONXML_WITH_CHARSET) == 0){ ...
php
{ "resource": "" }
q255815
SyncRestHandler.LogAPIRequestToLog
test
public function LogAPIRequestToLog($requestBody, $requestUri, $httpHeaders){ $this->RequestLogging->LogPlatformRequests($requestBody, $requestUri, $httpHeaders, true); if ($requestBody && $this->RequestCompressor) { $this->RequestCompressor->Compress($httpHeaders, $requestBody); } if...
php
{ "resource": "" }
q255816
SyncRestHandler.parseStringToDom
test
private function parseStringToDom($string){ $dom = new \DOMDocument(); $dom->preserveWhiteSpace = FALSE; $dom->loadXML($string); $dom->formatOutput = TRUE; return $dom->saveXml(); }
php
{ "resource": "" }
q255817
SyncRestHandler.resetCompressorAndSerializer
test
private function resetCompressorAndSerializer(){ $this->RequestCompressor = CoreHelper::GetCompressor($this->context, true); $this->ResponseCompressor = CoreHelper::GetCompressor($this->context, false); $this->RequestSerializer = CoreHelper::GetSerializer($this->context, true); $this->ResponseSe...
php
{ "resource": "" }
q255818
SyncRestHandler.getDestinationURL
test
private function getDestinationURL($requestParameters, $oMode, $specifiedRequestUri){ // For Platform Discconect/Reconenct call, only for OAuth 1 if (isset($requestParameters->ApiName)) { if(strcasecmp($oMode, CoreConstants::OAUTH1) == 0) { // Example: "https://appcenter.intu...
php
{ "resource": "" }
q255819
SyncRestHandler.appendMinorVersionToRequestURI
test
private function appendMinorVersionToRequestURI($requestUri){ $setMinorVersion = $this->context->minorVersion; if (isset($setMinorVersion)) { if ($this->queryToArray($requestUri) == false) { //if no query string params $requestUri .= "?minorversion=" . $this->context->minorVersion; ...
php
{ "resource": "" }
q255820
SyncRestHandler.checkHTTPMethod
test
private function checkHTTPMethod($requestParameters){ $verb = $requestParameters->HttpVerbType; if(strcasecmp($verb, CoreConstants::HTTP_POST) == 0){ return CoreConstants::HTTP_POST; } else if(strcasecmp($verb, CoreConstants::HTTP_GET) == 0){ return CoreConstants::HTTP_GET; } e...
php
{ "resource": "" }
q255821
SyncRestHandler.parseURL
test
private function parseURL($url){ $query_str = parse_url($url, PHP_URL_QUERY); parse_str($query_str, $parameters); return $parameters; }
php
{ "resource": "" }
q255822
SyncRestHandler.getAcceptContentType
test
private function getAcceptContentType($value) { if (CoreConstants::CONTENTTYPE_APPLICATIONXML === $value) { return $value; } if (CoreConstants::CONTENTTYPE_APPLICATIONJSON === $value) { return $value; } if (CoreConstants::CONTENTTYPE_APPLICATIONPDF === $valu...
php
{ "resource": "" }
q255823
SyncRestHandler.queryToArray
test
private function queryToArray($qry) { $result = array(); //string must contain at least one = and cannot be in first position if (strpos($qry, '=')) { if (strpos($qry, '?')!==false) { $q = parse_url($qry); $q...
php
{ "resource": "" }
q255824
TokenVerifier.verifyPayLoad
test
public function verifyPayLoad($payLoad, $sig, $algo = null) { $encryptedPayload = $this->encryptPayLoadBasedOnToken($payLoad, $algo); if (strcmp($sig, $encryptedPayload) == 0) { return true; } else { return false; } }
php
{ "resource": "" }
q255825
TokenVerifier.encryptPayLoadBasedOnToken
test
private function encryptPayLoadBasedOnToken($payLoad, $hashAlgorithm = null) { if ($hashAlgorithm == null) { $hashAlgorithm = TokenVerifier::HASH_ALGORITHM; } $hashedPayLoad = hash_hmac($hashAlgorithm, $payLoad, $this->verifierToken); $encodedHashedPayLoad = base64_encode...
php
{ "resource": "" }
q255826
Batch.IntuitBatchResponse
test
public function IntuitBatchResponse($id) { if(array_key_exists($id, $this->intuitBatchItemResponses)){ return $this->intuitBatchItemResponses[$id]; }else{ return null; } }
php
{ "resource": "" }
q255827
Batch.Remove
test
public function Remove($id) { if (!$id) { $exception = new IdsException('BatchItemIdNotFound: id'); IdsExceptionManager::HandleException($exception); } $revisedBatchRequests = array(); foreach ($this->batchRequests as $oneBatchRequest) { if ($oneB...
php
{ "resource": "" }
q255828
Batch.arrayToMessageAndCode
test
private function arrayToMessageAndCode(array $array) { if (empty($array)) { return array(null,null); } if (1 == count($array)) { $item = array_pop($array); return array($item->message,$item->code); } $message = ""; $code = ""; ...
php
{ "resource": "" }
q255829
Batch.IterateFaultAndPrepareException
test
public function IterateFaultAndPrepareException($fault) { if (!$this->verifyFault($fault)) { return null; } // Collect information from XML entity $type = (string)$fault->attributes()->type; list($message, $code) = $this->arrayToMessageAndCode($this->...
php
{ "resource": "" }
q255830
Zend_Soap_Client.getOptions
test
public function getOptions() { $options = array(); $options['classmap'] = $this->getClassmap(); $options['encoding'] = $this->getEncoding(); $options['soap_version'] = $this->getSoapVersion(); $options['wsdl'] = $this->getWsdl(); $options['uri...
php
{ "resource": "" }
q255831
Zend_Soap_Client.setStyle
test
public function setStyle($style) { if (!in_array($style, array(SOAP_RPC, SOAP_DOCUMENT))) { require_once 'Zend/Soap/Client/Exception.php'; throw new Zend_Soap_Client_Exception('Invalid request style specified. Use SOAP_RPC or SOAP_DOCUMENT constants.'); } $this->_sty...
php
{ "resource": "" }
q255832
Zend_Soap_Client.setEncodingMethod
test
public function setEncodingMethod($use) { if (!in_array($use, array(SOAP_ENCODED, SOAP_LITERAL))) { require_once 'Zend/Soap/Client/Exception.php'; throw new Zend_Soap_Client_Exception('Invalid message encoding method. Use SOAP_ENCODED or SOAP_LITERAL constants.'); } ...
php
{ "resource": "" }
q255833
Zend_Soap_Client.setProxyPort
test
public function setProxyPort($proxyPort) { $this->_proxy_port = (int)$proxyPort; $this->_soapClient = null; return $this; }
php
{ "resource": "" }
q255834
Zend_Soap_Client.setHttpsCertificate
test
public function setHttpsCertificate($localCert) { if (!is_readable($localCert)) { require_once 'Zend/Soap/Client/Exception.php'; throw new Zend_Soap_Client_Exception('Invalid HTTPS client certificate path.'); } $this->_local_cert = $localCert; $this->_soapCl...
php
{ "resource": "" }
q255835
Zend_Soap_Client.setStreamContext
test
public function setStreamContext($context) { if (!is_resource($context) || get_resource_type($context) !== "stream-context") { /** * @see Zend_Soap_Client_Exception */ require_once "Zend/Soap/Client/Exception.php"; throw new Zend_Soap_Client_Exce...
php
{ "resource": "" }
q255836
Zend_Soap_Client.setUserAgent
test
public function setUserAgent($userAgent) { if ($userAgent === null) { $this->_user_agent = null; } else { $this->_user_agent = (string)$userAgent; } return $this; }
php
{ "resource": "" }
q255837
Zend_Soap_Client._doRequest
test
public function _doRequest(Zend_Soap_Client_Common $client, $request, $location, $action, $version, $one_way = null) { // Perform request as is if ($one_way == null) { return call_user_func(array($client,'SoapClient::__doRequest'), $request, $location, $action, $version); } else ...
php
{ "resource": "" }
q255838
Zend_Soap_Client._initSoapClientObject
test
protected function _initSoapClientObject() { $wsdl = $this->getWsdl(); $options = array_merge($this->getOptions(), array('trace' => true)); if ($wsdl == null) { if (!isset($options['location'])) { require_once 'Zend/Soap/Client/Exception.php'; thr...
php
{ "resource": "" }
q255839
Zend_Soap_Client.addSoapInputHeader
test
public function addSoapInputHeader(SoapHeader $header, $permanent = false) { if ($permanent) { $this->_permanentSoapInputHeaders[] = $header; } else { $this->_soapInputHeaders[] = $header; } return $this; }
php
{ "resource": "" }
q255840
Zend_Soap_Client.getFunctions
test
public function getFunctions() { if ($this->getWsdl() == null) { require_once 'Zend/Soap/Client/Exception.php'; throw new Zend_Soap_Client_Exception('\'getFunctions\' method is available only in WSDL mode.'); } $soapClient = $this->getSoapClient(); return $so...
php
{ "resource": "" }
q255841
Zend_Soap_Client.getTypes
test
public function getTypes() { if ($this->getWsdl() == null) { require_once 'Zend/Soap/Client/Exception.php'; throw new Zend_Soap_Client_Exception('\'getTypes\' method is available only in WSDL mode.'); } $soapClient = $this->getSoapClient(); return $soapClien...
php
{ "resource": "" }
q255842
Zend_Soap_Wsdl_Strategy_ArrayOfTypeSequence._getTypeNameBasedOnNestingLevel
test
protected function _getTypeNameBasedOnNestingLevel($singularType, $level) { if ($level == 0) { // This is not an Array anymore, return the xsd simple type return $singularType; } else { $prefix = str_repeat("ArrayOf", $level); $xsdType = $this->_getStr...
php
{ "resource": "" }
q255843
Zend_Soap_Wsdl_Strategy_ArrayOfTypeSequence._addElementFromWsdlAndChildTypes
test
protected function _addElementFromWsdlAndChildTypes($arrayType, $childTypeName) { if (!in_array($arrayType, $this->getContext()->getTypes())) { $dom = $this->getContext()->toDomDocument(); $complexType = $dom->createElement('xsd:complexType'); $complexType->setAttribute(...
php
{ "resource": "" }
q255844
Wsdl_1_1.prepare
test
public function prepare() { $this->dom->createAttributeNS($this->namespaces['soap'], 'soap:definitions'); $this->dom->createAttributeNS($this->namespaces[$this->xmlSchemaPreffix], $this->xmlSchemaPreffix.':definitions'); //@todo this only required when we have arrays $this->...
php
{ "resource": "" }
q255845
Wsdl_1_1.addBindingOperations
test
private function addBindingOperations($operation, $input = false, $output = false) { $el = $this->dom->createElement('wsdl:operation'); $el->setAttribute('name', $operation); $soapOperation = $this->dom->createElement('soap:operation'); $soapOperation->setAttribute('soapActi...
php
{ "resource": "" }
q255846
Wsdl_1_1.addPortOperations
test
private function addPortOperations($operation, $input = false, $output = false) { $el = $this->dom->createElement("wsdl:operation"); $el->setAttribute('name', $operation); if ($input === true) { $input = $this->dom->createElement('wsdl:input'); $input->setAttribute('m...
php
{ "resource": "" }
q255847
Wsdl_1_1.createRefElement
test
private function createRefElement($ref) { $el = $this->dom->createElement($this->xmlSchemaPreffix.':element'); $el->setAttribute('ref', $ref); return $el; }
php
{ "resource": "" }
q255848
Wsdl_1_1.createElementWithComplexType
test
private function createElementWithComplexType($name, $elements) { //print_r('Create complex type '.$name."\n"); $el = $this->dom->createElement($this->xmlSchemaPreffix.':element'); $el->setAttribute('name', $name); $compType = $this->dom->createElement($this->xmlSchemaPreffi...
php
{ "resource": "" }
q255849
Wsdl_1_1.createSimpleElement
test
private function createSimpleElement($name, $type) { $el = $this->dom->createElement($this->xmlSchemaPreffix.':element'); $el->setAttribute('name', $name); if (preg_match('/:/', $type)) { $el->setAttribute('type', $type); } else { $el->setAttribute('type', $th...
php
{ "resource": "" }
q255850
Common.resolveNamespace
test
public function resolveNamespace($shortNs) { if (!($this->dom instanceof \DOMDocument)) { throw new RuntimeException("DOM is not initialized"); } if (!is_array($this->namespaces)) { $this->namespaces = $this->getDocNamespaces($this->dom); } if (array...
php
{ "resource": "" }
q255851
Common.parseDocComments
test
public function parseDocComments($comments) { $comments = explode("\n", $comments); $commentsOut = array(); $params = array(); foreach ($comments as $com) { if (preg_match('/@/', $com)) { $com = preg_replace('/\* /', '', $com); $com = preg_...
php
{ "resource": "" }
q255852
ArrayUtil.isAssociateArray
test
public static function isAssociateArray(array $arr) { if (!empty($arr)) { foreach ($arr as $k => $v) { if (is_int($k)) { return false; } } return true; } return false; }
php
{ "resource": "" }
q255853
WebhooksService.getWebhooksEvent
test
public static function getWebhooksEvent($payLoad) { JsonValidator::validate($payLoad); $string_arry = json_decode($payLoad, true); $obj = ReflectionUtil::constructObjectFromWebhooksArray($string_arry, WebhooksService::WEBHOOKSWRAPPERNAME); return $obj; }
php
{ "resource": "" }
q255854
WebhooksService.verifyPayload
test
public static function verifyPayload($token, $payload, $intuitHeaderSignature) { $verifier = new TokenVerifier($token); return $verifier->verifyPayLoad($payload, $intuitHeaderSignature); }
php
{ "resource": "" }
q255855
FacadeHelper.isKeyInComplexList
test
private static function isKeyInComplexList($key, $complexList = NULL){ if(isset($complexList)) {$ObjectMap = $complexList;} else {$ObjectMap = FacadeClassMapper::classMethodToList();} foreach($ObjectMap as $objectMethodName => $entityType) { if(in_array($key, $entityType)){ ret...
php
{ "resource": "" }
q255856
FacadeHelper.getClassMethod
test
public static function getClassMethod($className, $methodName){ try { $helperRefelctionMethod = new \ReflectionMethod($className, $methodName); return $helperRefelctionMethod; } catch(\Exception $e){ return null; } }
php
{ "resource": "" }
q255857
FacadeHelper.getIPPReferenceTypeBasedOnArray
test
public static function getIPPReferenceTypeBasedOnArray($data){ $trimedDataArray = FacadeHelper::trimSpacesForArrayKeys($data); if(is_object($trimedDataArray)){ if($trimedDataArray instanceof IPPReferenceType){ return $trimedDataArray; }else{ throw new \Exc...
php
{ "resource": "" }
q255858
FacadeHelper.getIPPId
test
public static function getIPPId($data){ //Convert an IPPId based on the Data if(!isset($data)) throw new \Exception("Passed param for IPPid can't be null"); if(is_object($data)){ if($data instanceof IPPid){ return $data; }else{ throw new \Exception("The assigned o...
php
{ "resource": "" }
q255859
FacadeHelper.mergeObj
test
public static function mergeObj($objA, $objB){ if(get_class($objA) != get_class($objB)) throw new \Exception("Can't assign object value to a different type."); $property_fields = get_object_vars($objA); foreach ($property_fields as $propertyName => $val){ $BsValue = $objB->$propertyName; ...
php
{ "resource": "" }
q255860
CurlHttpClient.getHeaders
test
private function getHeaders($headers){ if(!isset($headers) || empty($headers)){ throw new SdkException("Error. The headers set for cURL are either NULL or Empty"); }else{ $convertedHeaders = $this->convertHeaderArrayToHeaders($headers); return $convertedHeaders; } }
php
{ "resource": "" }
q255861
CurlHttpClient.setSSL
test
private function setSSL(&$curl_opt, $verifySSL){ $tlsVersion = $this->basecURL->versionOfTLS(); $versions = ['TLS 1.2', 'TLS 1.3']; if(! in_array($tlsVersion, $versions)){ throw new SdkException("Error. Checking TLS 1.2/1.3 version failed. Please make sure your PHP cURL supports TSL 1.2/1.3"...
php
{ "resource": "" }
q255862
CurlHttpClient.convertHeaderArrayToHeaders
test
public function convertHeaderArrayToHeaders(array $headerArray){ $headers = array(); foreach($headerArray as $k => $v){ $headers[] = $k . ":" . $v; } return $headers; }
php
{ "resource": "" }
q255863
File.addWarning
test
public function addWarning($warning, $stackPtr, $code, $data = [], $severity = 0, $fixable = false): bool { if (! $this->isSniffClassWarningAllowed($this->activeSniffClass)) { return false; } return $this->addError($warning, $stackPtr, $code, $data, $severity, $fixable); }
php
{ "resource": "" }
q255864
Configuration.resolveFromInput
test
public function resolveFromInput(InputInterface $input): void { /** @var string[] $sources */ $sources = $input->getArgument(Option::SOURCE); $this->setSources($sources); $this->isFixer = (bool) $input->getOption(Option::FIX); $this->shouldClearCache = (bool) $input->getOptio...
php
{ "resource": "" }
q255865
Tag.setNameAttribute
test
public function setNameAttribute($value) { $value = trim($value); $this->attributes['name'] = $value; $this->attributes['normalized'] = app(TagService::class)->normalize($value); }
php
{ "resource": "" }
q255866
Tag.scopeByName
test
public function scopeByName(Builder $query, string $value): Builder { $normalized = app(TagService::class)->normalize($value); return $query->where('normalized', $normalized); }
php
{ "resource": "" }
q255867
Taggable.bootTaggable
test
protected static function bootTaggable(): void { static::deleting(function ($model) { if (!method_exists($model, 'runSoftDelete') || $model->isForceDeleting()) { $model->detag(); } }); }
php
{ "resource": "" }
q255868
Taggable.tag
test
public function tag($tags): self { $tags = app(TagService::class)->buildTagArray($tags); foreach ($tags as $tagName) { $this->addOneTag($tagName); $this->load('tags'); } event(new ModelTagged($this, $tags)); return $this; }
php
{ "resource": "" }
q255869
Taggable.untag
test
public function untag($tags): self { $tags = app(TagService::class)->buildTagArray($tags); foreach ($tags as $tagName) { $this->removeOneTag($tagName); } event(new ModelUntagged($this, $tags)); return $this->load('tags'); }
php
{ "resource": "" }
q255870
Taggable.addOneTag
test
protected function addOneTag(string $tagName): void { /** @var Tag $tag */ $tag = app(TagService::class)->findOrCreate($tagName); $tagKey = $tag->getKey(); if (!$this->getAttribute('tags')->contains($tagKey)) { $this->tags()->attach($tagKey); } }
php
{ "resource": "" }
q255871
Taggable.removeOneTag
test
protected function removeOneTag(string $tagName): void { $tag = app(TagService::class)->find($tagName); if ($tag) { $this->tags()->detach($tag); } }
php
{ "resource": "" }
q255872
Taggable.hasTag
test
public function hasTag($tag): bool { if ($tag instanceof Tag) { $normalized = $tag->getAttribute('normalized'); } else { $normalized = app(TagService::class)->normalize($tag); } return in_array($normalized, $this->getTagArrayNormalizedAttribute(), true); ...
php
{ "resource": "" }
q255873
Taggable.scopeWithAllTags
test
public function scopeWithAllTags(Builder $query, $tags): Builder { /** @var TagService $service */ $service = app(TagService::class); $normalized = $service->buildTagArrayNormalized($tags); // If there are no tags specified, then there // can't be any results so short-circui...
php
{ "resource": "" }
q255874
Taggable.scopeIsTagged
test
public function scopeIsTagged(Builder $query): Builder { $alias = $this->taggableCreateNewAlias(__FUNCTION__); return $this->prepareTableJoin($query, 'inner', $alias); }
php
{ "resource": "" }
q255875
Taggable.scopeWithoutAllTags
test
public function scopeWithoutAllTags(Builder $query, $tags, bool $includeUntagged = false): Builder { /** @var TagService $service */ $service = app(TagService::class); $normalized = $service->buildTagArrayNormalized($tags); $tagKeys = $service->getTagModelKeys($normalized); $...
php
{ "resource": "" }
q255876
Taggable.scopeIsNotTagged
test
public function scopeIsNotTagged(Builder $query): Builder { $alias = $this->taggableCreateNewAlias(__FUNCTION__); $morphForeignKeyName = $this->getQualifiedForeignPivotKeyNameWithAlias($alias); return $this->prepareTableJoin($query, 'left', $alias) ->havingRaw("COUNT(DISTINCT {$...
php
{ "resource": "" }
q255877
Taggable.renameTag
test
public static function renameTag(string $oldTag, string $newTag): int { return app(TagService::class)->renameTags($oldTag, $newTag, static::class); }
php
{ "resource": "" }
q255878
Taggable.popularTags
test
public static function popularTags(int $limit = null, int $minCount = 1): array { /** @var Collection $tags */ $tags = app(TagService::class)->getPopularTags($limit, static::class, $minCount); return $tags->pluck('taggable_count', 'name')->all(); }
php
{ "resource": "" }
q255879
Taggable.getQualifiedRelatedPivotKeyNameWithAlias
test
private function getQualifiedRelatedPivotKeyNameWithAlias(string $alias): string { $morph = $this->tags(); return $morph->getTable() . '_' . $alias . '.' . $morph->getRelatedPivotKeyName(); }
php
{ "resource": "" }
q255880
Taggable.getQualifiedForeignPivotKeyNameWithAlias
test
private function getQualifiedForeignPivotKeyNameWithAlias(string $alias): string { $morph = $this->tags(); return $morph->getTable() . '_' . $alias . '.' . $morph->getForeignPivotKeyName(); }
php
{ "resource": "" }
q255881
Taggable.taggableCreateNewAlias
test
private function taggableCreateNewAlias(string $scope): string { $this->taggableAliasSequence++; $alias = strtolower($scope) . '_' . $this->taggableAliasSequence; return $alias; }
php
{ "resource": "" }
q255882
TagService.buildTagArray
test
public function buildTagArray($tags): array { if (is_array($tags)) { $array = $tags; } elseif ($tags instanceof BaseCollection) { $array = $this->buildTagArray($tags->all()); } elseif (is_string($tags)) { $array = preg_split( '#[' . preg_qu...
php
{ "resource": "" }
q255883
TagService.getTagModelKeys
test
public function getTagModelKeys(array $normalized = []): array { if (count($normalized) === 0) { return []; } return $this->tagModel::whereIn('normalized', $normalized) ->pluck('tag_id') ->toArray(); }
php
{ "resource": "" }
q255884
TagService.makeTagList
test
public function makeTagList(Model $model, string $field = 'name'): string { $tags = $this->makeTagArray($model, $field); return $this->joinList($tags); }
php
{ "resource": "" }
q255885
TagService.makeTagArray
test
public function makeTagArray(Model $model, string $field = 'name'): array { /** @var Collection $tags */ $tags = $model->tags; return $tags->pluck($field)->all(); }
php
{ "resource": "" }
q255886
TagService.getAllTags
test
public function getAllTags($class = null): Collection { if ($class === null) { return $this->tagModel::all(); } if ($class instanceof Model) { $class = get_class($class); } $tagTable = $this->getQualifiedTagTableName(); $pivotTable = $this->g...
php
{ "resource": "" }
q255887
TagService.getAllUnusedTags
test
public function getAllUnusedTags(): Collection { $tagTable = $this->getQualifiedTagTableName(); $pivotTable = $this->getQualifiedPivotTableName(); $sql = "SELECT t.* FROM {$tagTable} t LEFT JOIN {$pivotTable} tt ON tt.tag_id=t.tag_id WHERE tt.taggable_id ...
php
{ "resource": "" }
q255888
TagService.renameTags
test
public function renameTags(string $oldName, string $newName, $class = null): int { // If no class is specified, we can do the rename with a simple SQL update if ($class === null) { return $this->tagModel::where('normalized', $this->normalize($oldName)) ->update([ ...
php
{ "resource": "" }
q255889
TagService.getQualifiedTagTableName
test
private function getQualifiedTagTableName(): string { /** @var Tag $tag */ $tag = new $this->tagModel; return $tag->getConnection()->getTablePrefix() . $tag->getTable(); }
php
{ "resource": "" }
q255890
TagService.getQualifiedPivotTableName
test
private function getQualifiedPivotTableName(string $class=null): string { /** @var \Cviebrock\EloquentTaggable\Taggable $instance */ $instance = $class ? new $class : new class extends Model { use Taggable; }; return $instance->tags()->getConnection()->getTablePrefix() . $in...
php
{ "resource": "" }
q255891
CompoundParameter.saveCompoundParameterData
test
protected function saveCompoundParameterData(array $compoundData) { foreach ($compoundData as $name => $value) { $matchExists = false; foreach ($this->parameterNameMapper as $regex => $parameterName) { if (preg_match($regex, $name, $matches) === 1) { ...
php
{ "resource": "" }
q255892
PrepareUrl.build
test
public function build($url, array $singleParameters, array $compoundParameters) { $singlesPost = $this->getSingleParametersPayload($singleParameters); $compoundsPost = $this->getCompoundParametersPayload($compoundParameters); $this->payloadParameters = array_merge($singlesPost, $compoundsP...
php
{ "resource": "" }
q255893
PrepareUrl.getSingleParametersPayload
test
private function getSingleParametersPayload(array $singleParameters) { $postData = []; $cacheBuster = new CacheBuster(); foreach ($singleParameters as $parameterObj) { if ($parameterObj->getName() === $cacheBuster->getName()) { $this->cacheBuster = $parameterObj-...
php
{ "resource": "" }
q255894
PrepareUrl.getCompoundParametersPayload
test
private function getCompoundParametersPayload(array $compoundParameters) { $postData = []; foreach ($compoundParameters as $compoundCollection) { $parameterArray = $compoundCollection->getParametersArray(); $postData = array_merge($postData, $parameterArray); } ...
php
{ "resource": "" }
q255895
Indexable.addIndex
test
protected function addIndex($string, $index) { if (empty($string)) { throw new InvalidNameException('Name attribute not defined for class ' . get_class($this)); } if (strpos($string, $this->indexPlaceholder) !== false) { if (!is_numeric($index) || $index < $this->min...
php
{ "resource": "" }
q255896
AnalyticsResponse.getDebugResponse
test
public function getDebugResponse() { $debugResponse = []; if (!empty($this->responseBody)) { $debugResponse = json_decode($this->responseBody, true); $debugResponse = (is_array($debugResponse)) ? $debugResponse : []; } return $debugResponse; }
php
{ "resource": "" }
q255897
Analytics.getEndpoint
test
protected function getEndpoint() { return ($this->isDebug) ? $this->uriScheme . $this->debugEndpoint : $this->uriScheme . $this->endpoint; }
php
{ "resource": "" }
q255898
Analytics.sendHit
test
protected function sendHit($methodName) { $hitType = strtoupper(substr($methodName, 4)); $hitConstant = $this->getParameterClassConstant( 'TheIconic\Tracking\GoogleAnalytics\Parameters\Hit\HitType::HIT_TYPE_' . $hitType, 'Hit type ' . $hitType . ' is not defined, check spell...
php
{ "resource": "" }
q255899
Analytics.getHttpClientOptions
test
protected function getHttpClientOptions() { $options = ['async' => $this->isAsyncRequest]; if (isset($this->options['timeout'])) { $options['timeout'] = $this->options['timeout']; } return $options; }
php
{ "resource": "" }