_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q255600
SplitItem.setDefaultSelectedItem
test
private function setDefaultSelectedItem() : void { foreach ($this->items as $index => $item) { if ($item->canSelect()) { $this->canBeSelected = true; $this->selectedItemIndex = $index; return; } } $this->canBeSelected =...
php
{ "resource": "" }
q255601
SplitItem.canSelectIndex
test
public function canSelectIndex(int $index) : bool { return isset($this->items[$index]) && $this->items[$index]->canSelect(); }
php
{ "resource": "" }
q255602
SplitItem.setSelectedItemIndex
test
public function setSelectedItemIndex(int $index) : void { if (!isset($this->items[$index])) { throw new \InvalidArgumentException(sprintf('Index: "%s" does not exist', $index)); } $this->selectedItemIndex = $index; }
php
{ "resource": "" }
q255603
SplitItem.getSelectedItem
test
public function getSelectedItem() : MenuItemInterface { if (null === $this->selectedItemIndex) { throw new \RuntimeException('No item is selected'); } return $this->items[$this->selectedItemIndex]; }
php
{ "resource": "" }
q255604
StringUtil.wordwrap
test
public static function wordwrap(string $string, int $width, string $break = "\n") : string { return implode( $break, array_map(function (string $line) use ($width, $break) { $line = rtrim($line); if (mb_strlen($line) <= $width) { re...
php
{ "resource": "" }
q255605
MenuStyle.generateColoursSetCode
test
private function generateColoursSetCode() : void { if (!ctype_digit($this->fg)) { $fgCode = self::$availableForegroundColors[$this->fg]; } else { $fgCode = sprintf("38;5;%s", $this->fg); } if (!ctype_digit($this->bg)) { $bgCode = self::$availableB...
php
{ "resource": "" }
q255606
MenuStyle.calculateContentWidth
test
protected function calculateContentWidth() : void { $this->contentWidth = $this->width - ($this->paddingLeftRight * 2) - ($this->borderRightWidth + $this->borderLeftWidth); if ($this->contentWidth < 0) { $this->contentWidth = 0; } }
php
{ "resource": "" }
q255607
MenuStyle.getRightHandPadding
test
public function getRightHandPadding(int $contentLength) : int { $rightPadding = $this->getContentWidth() - $contentLength + $this->getPaddingLeftRight(); if ($rightPadding < 0) { $rightPadding = 0; } return $rightPadding; }
php
{ "resource": "" }
q255608
MenuStyle.setBorder
test
public function setBorder( int $topWidth, $rightWidth = null, $bottomWidth = null, $leftWidth = null, string $colour = null ) : self { if (!is_int($rightWidth)) { $colour = $rightWidth; $rightWidth = $bottomWidth = $leftWidth = $topWidth; ...
php
{ "resource": "" }
q255609
Flash.display
test
public function display() : void { $this->assertMenuOpen(); $this->terminal->moveCursorToRow($this->y); $this->emptyRow(); $this->write(sprintf( "%s%s%s%s%s\n", $this->style->getColoursSetCode(), str_repeat(' ', $this->style->getPaddingLeftRight...
php
{ "resource": "" }
q255610
Dialogue.calculateCoordinates
test
protected function calculateCoordinates() : void { //y $textLines = count(explode("\n", $this->text)) + 2; $this->y = (int) (ceil($this->parentMenu->getCurrentFrame()->count() / 2) - ceil($textLines / 2) + 1); //x $parentStyle = $this->parentMenu->getStyle(); $dialog...
php
{ "resource": "" }
q255611
Dialogue.emptyRow
test
protected function emptyRow() : void { $this->write( sprintf( "%s%s%s%s%s\n", $this->style->getColoursSetCode(), str_repeat(' ', $this->style->getPaddingLeftRight()), str_repeat(' ', mb_strlen($this->text)), str_repe...
php
{ "resource": "" }
q255612
Dialogue.write
test
protected function write(string $text, int $column = null) : void { $this->terminal->moveCursorToColumn($column ?: $this->x); $this->terminal->write($text); }
php
{ "resource": "" }
q255613
AsciiArtItem.setText
test
public function setText(string $text) : void { $this->text = implode("\n", array_map(function (string $line) { return rtrim($line, ' '); }, explode("\n", $text))); $this->calculateArtLength(); }
php
{ "resource": "" }
q255614
AsciiArtItem.calculateArtLength
test
private function calculateArtLength() : void { $this->artLength = (int) max(array_map('mb_strlen', explode("\n", $this->text))); }
php
{ "resource": "" }
q255615
Confirm.display
test
public function display(string $confirmText = 'OK') : void { $this->assertMenuOpen(); $this->terminal->moveCursorToRow($this->y); $promptWidth = mb_strlen($this->text) + 4; $this->emptyRow(); $this->write(sprintf( "%s%s%s%s%s\n", $this->style->getC...
php
{ "resource": "" }
q255616
Manager.connection
test
public function connection(string $name = null): Client { $name = $name ?: $this->getDefaultConnection(); if (!isset($this->connections[$name])) { $client = $this->makeConnection($name); $this->connections[$name] = $client; } return $this->connections[$name...
php
{ "resource": "" }
q255617
Manager.makeConnection
test
protected function makeConnection(string $name): Client { $config = $this->getConfig($name); return $this->factory->make($config); }
php
{ "resource": "" }
q255618
Manager.getConfig
test
protected function getConfig(string $name) { $connections = $this->app['config']['elasticsearch.connections']; if (null === $config = array_get($connections, $name)) { throw new \InvalidArgumentException("Elasticsearch connection [$name] not configured."); } return $con...
php
{ "resource": "" }
q255619
DeflateCompressor.Compress
test
public function Compress(&$curl_headers, &$requestBody) { if (!function_exists('gzencode')) { return; } $requestBody = gzencode($requestBody); $curl_headers['content-encoding']='deflate'; $curl_headers['content-length']=strlen($requestBody); }
php
{ "resource": "" }
q255620
Zend_Console_Getopt.__isset
test
public function __isset($key) { $this->parse(); if (isset($this->_ruleMap[$key])) { $key = $this->_ruleMap[$key]; return isset($this->_options[$key]); } return false; }
php
{ "resource": "" }
q255621
Zend_Console_Getopt.addArguments
test
public function addArguments($argv) { if (!is_array($argv)) { require_once 'Zend/Console/Getopt/Exception.php'; throw new Zend_Console_Getopt_Exception( "Parameter #1 to addArguments should be an array"); } $this->_argv = array_merge($this->_argv, $arg...
php
{ "resource": "" }
q255622
Zend_Console_Getopt.setArguments
test
public function setArguments($argv) { if (!is_array($argv)) { require_once 'Zend/Console/Getopt/Exception.php'; throw new Zend_Console_Getopt_Exception( "Parameter #1 to setArguments should be an array"); } $this->_argv = $argv; $this->_parsed ...
php
{ "resource": "" }
q255623
Zend_Console_Getopt.setOptions
test
public function setOptions($getoptConfig) { if (isset($getoptConfig)) { foreach ($getoptConfig as $key => $value) { $this->setOption($key, $value); } } return $this; }
php
{ "resource": "" }
q255624
Zend_Console_Getopt.addRules
test
public function addRules($rules) { $ruleMode = $this->_getoptConfig['ruleMode']; switch ($this->_getoptConfig['ruleMode']) { case self::MODE_ZEND: if (is_array($rules)) { $this->_addRulesModeZend($rules); break; } ...
php
{ "resource": "" }
q255625
Zend_Console_Getopt.toString
test
public function toString() { $this->parse(); $s = array(); foreach ($this->_options as $flag => $value) { $s[] = $flag . '=' . ($value === true ? 'true' : $value); } return implode(' ', $s); }
php
{ "resource": "" }
q255626
Zend_Console_Getopt.toArray
test
public function toArray() { $this->parse(); $s = array(); foreach ($this->_options as $flag => $value) { $s[] = $flag; if ($value !== true) { $s[] = $value; } } return $s; }
php
{ "resource": "" }
q255627
Zend_Console_Getopt.toJson
test
public function toJson() { $this->parse(); $j = array(); foreach ($this->_options as $flag => $value) { $j['options'][] = array( 'option' => array( 'flag' => $flag, 'parameter' => $value ) ); ...
php
{ "resource": "" }
q255628
Zend_Console_Getopt.toXml
test
public function toXml() { $this->parse(); $doc = new DomDocument('1.0', 'utf-8'); $optionsNode = $doc->createElement('options'); $doc->appendChild($optionsNode); foreach ($this->_options as $flag => $value) { $optionNode = $doc->createElement('option'); ...
php
{ "resource": "" }
q255629
Zend_Console_Getopt.getOption
test
public function getOption($flag) { $this->parse(); if ($this->_getoptConfig[self::CONFIG_IGNORECASE]) { $flag = strtolower($flag); } if (isset($this->_ruleMap[$flag])) { $flag = $this->_ruleMap[$flag]; if (isset($this->_options[$flag])) { ...
php
{ "resource": "" }
q255630
Zend_Console_Getopt.getUsageMessage
test
public function getUsageMessage() { $usage = "Usage: {$this->_progname} [ options ]\n"; $maxLen = 20; $lines = array(); foreach ($this->_rules as $rule) { $flags = array(); if (is_array($rule['alias'])) { foreach ($rule['alias'] as $flag) { ...
php
{ "resource": "" }
q255631
Zend_Console_Getopt.setAliases
test
public function setAliases($aliasMap) { foreach ($aliasMap as $flag => $alias) { if ($this->_getoptConfig[self::CONFIG_IGNORECASE]) { $flag = strtolower($flag); $alias = strtolower($alias); } if (!isset($this->_ruleMap[$flag])) { ...
php
{ "resource": "" }
q255632
Zend_Console_Getopt.setHelp
test
public function setHelp($helpMap) { foreach ($helpMap as $flag => $help) { if (!isset($this->_ruleMap[$flag])) { continue; } $flag = $this->_ruleMap[$flag]; $this->_rules[$flag]['help'] = $help; } return $this; }
php
{ "resource": "" }
q255633
Zend_Console_Getopt.parse
test
public function parse() { if ($this->_parsed === true) { return; } $argv = $this->_argv; $this->_options = array(); $this->_remainingArgs = array(); while (count($argv) > 0) { if ($argv[0] == '--') { array_shift($argv); ...
php
{ "resource": "" }
q255634
Zend_Console_Getopt._parseShortOptionCluster
test
protected function _parseShortOptionCluster(&$argv) { $flagCluster = ltrim(array_shift($argv), '-'); foreach (str_split($flagCluster) as $flag) { $this->_parseSingleOption($flag, $argv); } }
php
{ "resource": "" }
q255635
Zend_Console_Getopt._parseSingleOption
test
protected function _parseSingleOption($flag, &$argv) { if ($this->_getoptConfig[self::CONFIG_IGNORECASE]) { $flag = strtolower($flag); } if (!isset($this->_ruleMap[$flag])) { require_once 'Zend/Console/Getopt/Exception.php'; throw new Zend_Console_Getopt_E...
php
{ "resource": "" }
q255636
Zend_Console_Getopt._addRulesModeGnu
test
protected function _addRulesModeGnu($rules) { $ruleArray = array(); /** * Options may be single alphanumeric characters. * Options may have a ':' which indicates a required string parameter. * No long options or option aliases are supported in GNU style. */ ...
php
{ "resource": "" }
q255637
Zend_Console_Getopt._addRulesModeZend
test
protected function _addRulesModeZend($rules) { foreach ($rules as $ruleCode => $helpMessage) { // this may have to translate the long parm type if there // are any complaints that =string will not work (even though that use // case is not documented) if (in_ar...
php
{ "resource": "" }
q255638
OAuth1.getOAuthHeader
test
public function getOAuthHeader($uri, $queryParameters, $httpMethod){ $this->sign($uri, $queryParameters, $httpMethod); foreach($this->oauthParameters as $k => $v){ $this->oauthParameters[$k] = $k . '="' . rawurlencode($v) . '"'; } return 'OAuth ' . implode(',', $this->oauthParameters)...
php
{ "resource": "" }
q255639
OAuth1.getBaseString
test
public function getBaseString($uri, $method, array $parameters = array()){ $baseString = $this->prepareHttpMethod($method) . '&' . $this->prepareURL($uri) . '&' . $this->prepareQueryParams($parameters); return $baseString; }
php
{ "resource": "" }
q255640
OAuth1.prepareHttpMethod
test
private function prepareHttpMethod($method){ $trimmedMethod = trim($method); $upperMethod = strtoupper($trimmedMethod); return rawurlencode($method); }
php
{ "resource": "" }
q255641
OAuth1.setNonce
test
private function setNonce($length = 6){ $result = ''; $cLength = strlen(self::NONCE_CHARS); for ($i=0; $i < $length; $i++) { $rnum = rand(0,$cLength - 1); $result .= substr(self::NONCE_CHARS,$rnum,1); } $this->oauthNonce = $result; }
php
{ "resource": "" }
q255642
OAuth1.appendOAuthPartsTo
test
private function appendOAuthPartsTo(array $queryParameters = null){ if($queryParameters == null){ $queryParameters = array(); } $queryParameters['oauth_consumer_key'] = $this->consumerKey; $queryParameters['oauth_token'] = $this->oauthToken; $queryParameters['oauth_signature_meth...
php
{ "resource": "" }
q255643
QueryMessage.getString
test
public function getString() { if (empty($this->sql) || empty($this->entity)) { return null; } $query = ""; $query .= $this->sql; if (0==count($this->projection)) { $query .= " "."*"; } else { if (count($this->projection)) { ...
php
{ "resource": "" }
q255644
ClientFactory.createClient
test
public static function createClient($clientName = CoreConstants::CLIENT_CURL){ if($clientName == CoreConstants::CLIENT_CURL){ if(extension_loaded('curl')){ return new CurlHttpClient(); }else{ throw new SdkException("curl extension is not enabled. Cannot create curl http c...
php
{ "resource": "" }
q255645
LogRequestsToDisk.GetLogDestination
test
public function GetLogDestination() { if ($this->EnableServiceRequestsLogging) { if (false === file_exists($this->ServiceRequestLoggingLocation)) { $this->ServiceRequestLoggingLocation = sys_get_temp_dir(); } } return $this->ServiceRequestLoggingLocati...
php
{ "resource": "" }
q255646
LogRequestsToDisk.LogPlatformRequests
test
public function LogPlatformRequests($xml, $url, $headers, $isRequest) { if ($this->EnableServiceRequestsLogging) { if (false === file_exists($this->ServiceRequestLoggingLocation)) { $this->ServiceRequestLoggingLocation = sys_get_temp_dir(); } // Use filec...
php
{ "resource": "" }
q255647
OperationControlList.isAllowed
test
public function isAllowed($entity, $operation) { //fallback to global rules if entity wasn't specified in the rules $lookupEn = array_key_exists($entity, $this->operationList) ? $entity : self::ALL; //fallback to global rules if operat...
php
{ "resource": "" }
q255648
AbstractWsdl.prepareReflection
test
private function prepareReflection() { $methods = $this->getClassMethods(); foreach ($methods as $method) { $this->methodsMeta[$method->name] = $this->getMethodIO($method->name); } }
php
{ "resource": "" }
q255649
AbstractWsdl.toXml
test
public function toXml() { if (is_string($this->wsdlXmlSource) && $this->wsdlXmlSource != '') { return $this->wsdlXmlSource; } else { $this->prepareDom(); $this->prepareReflection(); $this->prepare(); $this->wsdlXmlSource = $this->dom->saveX...
php
{ "resource": "" }
q255650
AbstractWsdl.copyToPublic
test
public function copyToPublic($path, $overwrite = false) { $publicPath = realpath($this->getPublicPath()); $targetFilePath = $publicPath.DIRECTORY_SEPARATOR.basename($path); if (($overwrite === true && file_exists($targetFilePath)) || !file_exists($targetFilePath)) { if...
php
{ "resource": "" }
q255651
Php2Xml.castToStringZero
test
private function castToStringZero($prop, $obj) { if ($this->isEmptyInt($prop->getValue($obj))) { //reset value in very specific case to keep it intact $prop->setValue($obj, (string) $prop->getValue($obj)); } }
php
{ "resource": "" }
q255652
LocalConfigReader.ReadConfigurationFromFile
test
public static function ReadConfigurationFromFile($filePath, $OAuthOption = CoreConstants::OAUTH1) { $ippConfig = new IppConfiguration(); try { if (isset($filePath) && file_exists($filePath)) { $xmlObj = simplexml_load_file($filePath); } else { ...
php
{ "resource": "" }
q255653
LocalConfigReader.initializeAPIEntityRules
test
public static function initializeAPIEntityRules($xmlObj, $ippConfig) { $rules=CoreConstants::getQuickBooksOnlineAPIEntityRules(); LocalConfigReader::initOperationControlList($ippConfig, $rules); $specialConfig = LocalConfigReader::populateJsonOnlyEntities($xmlObj); if (is_array($spec...
php
{ "resource": "" }
q255654
LocalConfigReader.populateJsonOnlyEntities
test
public static function populateJsonOnlyEntities($xmlObj) { if (isset($xmlObj) && isset($xmlObj->intuit->ipp->specialConfiguration)) { $specialCnf = $xmlObj->intuit->ipp->specialConfiguration; if (!$specialCnf instanceof SimpleXMLElement) { return false; ...
php
{ "resource": "" }
q255655
LocalConfigReader.initializeOAuthSettings
test
public static function initializeOAuthSettings($xmlObj, $ippConfig, $OAuthOption) { // if it is OAuth1 Settings. if (isset($xmlObj) && isset($xmlObj->intuit->ipp->security) && $OAuthOption == CoreConstants::OAUTH1 && isset($xmlObj->intuit->ipp->s...
php
{ "resource": "" }
q255656
LocalConfigReader.initializeRequestAndResponseSerializationAndCompressionFormat
test
public static function initializeRequestAndResponseSerializationAndCompressionFormat($xmlObj, $ippConfig) { LocalConfigReader::intializeMessage($ippConfig); $requestSerializationFormat = null; $requestCompressionFormat = null; $responseSerializationFormat = null; $resp...
php
{ "resource": "" }
q255657
LocalConfigReader.intializaeServiceBaseURLAndLogger
test
public static function intializaeServiceBaseURLAndLogger($xmlObj, $ippConfig) { // Initialize BaseUrl Configuration Object $ippConfig->BaseUrl = new BaseUrl(); if (isset($xmlObj) && isset($xmlObj->intuit->ipp->service->baseUrl)) { $responseAttr = $xmlObj->intuit-...
php
{ "resource": "" }
q255658
IntuitCDCResponse.getEntity
test
public function getEntity($key) { foreach ($this->entities as $entityKey => $entityVal) { if ($entityKey==$key) { return $entityVal; } } return null; }
php
{ "resource": "" }
q255659
IntuitErrorHandler.IsValidXml
test
public static function IsValidXml($inputString) { if (0!==strpos($inputString, '<')) { return false; } try { $doc = simplexml_load_string($inputString); } catch (\Exception $e) { return false; } return true; }
php
{ "resource": "" }
q255660
ContentWriterSettings.verifyConfiguration
test
public function verifyConfiguration() { if (($this->strategy === CoreConstants::EXPORT_STRATEGY) && !empty($this->strategy)) { if (is_null($this->exportDir)) { throw new SdkException("Invalid value for exportDirectory property. It can not be null with 'export' strategy. "); ...
php
{ "resource": "" }
q255661
ReflectionUtil.loadWebServicesClassAndReturnNames
test
public static function loadWebServicesClassAndReturnNames($dir = null) { if ($dir == null) { $dir = dirname(__DIR__) . DIRECTORY_SEPARATOR . UtilityConstants::WEBHOOKSDIR; } $webhooksClassNames = array(); foreach (glob("{$dir}/*.php") as $fileName) { require...
php
{ "resource": "" }
q255662
ReflectionUtil.isValidWebhooksClass
test
public static function isValidWebhooksClass($className, $classCollection = null) { if (!isset($classCollection)) { $classCollection = ReflectionUtil::loadWebServicesClassAndReturnNames(); } if (!isset($className) || trim($className) === '') { return null; } ...
php
{ "resource": "" }
q255663
Zend_Soap_Server.getOptions
test
public function getOptions() { $options = array(); if (null !== $this->_actor) { $options['actor'] = $this->_actor; } if (null !== $this->_classmap) { $options['classmap'] = $this->_classmap; } if (null !== $this->_encoding) { $op...
php
{ "resource": "" }
q255664
Zend_Soap_Server.validateUrn
test
public function validateUrn($urn) { $scheme = parse_url($urn, PHP_URL_SCHEME); if ($scheme === false || $scheme === null) { require_once 'Zend/Soap/Server/Exception.php'; throw new Zend_Soap_Server_Exception('Invalid URN'); } return true; }
php
{ "resource": "" }
q255665
Zend_Soap_Server.addFunction
test
public function addFunction($function, $namespace = '') { // Bail early if set to SOAP_FUNCTIONS_ALL if ($this->_functions == SOAP_FUNCTIONS_ALL) { return $this; } if (is_array($function)) { foreach ($function as $func) { if (is_string($func) ...
php
{ "resource": "" }
q255666
Zend_Soap_Server.setClass
test
public function setClass($class, $namespace = '', $argv = null) { if (isset($this->_class)) { require_once 'Zend/Soap/Server/Exception.php'; throw new Zend_Soap_Server_Exception('A class has already been registered with this soap server instance'); } if (!is_string($...
php
{ "resource": "" }
q255667
Zend_Soap_Server.setObject
test
public function setObject($object) { if (!is_object($object)) { require_once 'Zend/Soap/Server/Exception.php'; throw new Zend_Soap_Server_Exception('Invalid object argument ('.gettype($object).')'); } if (isset($this->_object)) { require_once 'Zend/Soap/S...
php
{ "resource": "" }
q255668
Zend_Soap_Server.getFunctions
test
public function getFunctions() { $functions = array(); if (null !== $this->_class) { $functions = get_class_methods($this->_class); } elseif (null !== $this->_object) { $functions = get_class_methods($this->_object); } return array_merge((array) $this...
php
{ "resource": "" }
q255669
Zend_Soap_Server.setPersistence
test
public function setPersistence($mode) { if (!in_array($mode, array(SOAP_PERSISTENCE_SESSION, SOAP_PERSISTENCE_REQUEST))) { require_once 'Zend/Soap/Server/Exception.php'; throw new Zend_Soap_Server_Exception('Invalid persistence mode specified'); } $this->_persistence...
php
{ "resource": "" }
q255670
Zend_Soap_Server._getSoap
test
protected function _getSoap() { $options = $this->getOptions(); $server = new SoapServer($this->_wsdl, $options); if (!empty($this->_functions)) { $server->addFunction($this->_functions); } if (!empty($this->_class)) { $args = $this->_classArgs; ...
php
{ "resource": "" }
q255671
Zend_Soap_Server.handle
test
public function handle($request = null) { if (null === $request) { $request = file_get_contents('php://input'); } // Set Zend_Soap_Server error handler $displayErrorsOriginalState = $this->_initializeSoapErrorContext(); $setRequestException = null; /** ...
php
{ "resource": "" }
q255672
Zend_Soap_Server.deregisterFaultException
test
public function deregisterFaultException($class) { if (in_array($class, $this->_faultExceptions, true)) { $index = array_search($class, $this->_faultExceptions); unset($this->_faultExceptions[$index]); return true; } return false; }
php
{ "resource": "" }
q255673
Zend_Soap_Server.fault
test
public function fault($fault = null, $code = "Receiver") { if ($fault instanceof Exception) { $class = get_class($fault); if (in_array($class, $this->_faultExceptions)) { $message = $fault->getMessage(); $eCode = $fault->getCode(); $c...
php
{ "resource": "" }
q255674
Zend_Soap_Server.handlePhpErrors
test
public function handlePhpErrors($errno, $errstr, $errfile = null, $errline = null, array $errcontext = null) { throw $this->fault($errstr, "Receiver"); }
php
{ "resource": "" }
q255675
OAuth2LoginHelper.getAccessToken
test
public function getAccessToken(){ if(isset($this->oauth2AccessToken) && !empty($this->oauth2AccessToken)){ return $this->oauth2AccessToken; }else{ throw new SdkException("Can't get OAuth 2 Access Token Object. It is not set yet."); } }
php
{ "resource": "" }
q255676
OAuth2LoginHelper.getAuthorizationCodeURL
test
public function getAuthorizationCodeURL(){ $parameters = array( 'client_id' => $this->getClientID(), 'scope' => $this->getScope(), 'redirect_uri' => $this->getRedirectURL(), 'response_type' => 'code', 'state' => $this->getState() ); $authoriza...
php
{ "resource": "" }
q255677
OAuth2LoginHelper.refreshToken
test
public function refreshToken(){ $refreshToken = $this->getAccessToken()->getRefreshToken(); $http_header = $this->constructRefreshTokenHeader(); $requestBody = $this->constructRefreshTokenBody($refreshToken); $intuitResponse = $this->curlHttpClient->makeAPICall(CoreConstants::OAUTH2_TOKEN_EN...
php
{ "resource": "" }
q255678
OAuth2LoginHelper.OAuth1ToOAuth2Migration
test
public function OAuth1ToOAuth2Migration($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret, $scope){ $oauth1Encrypter = new OAuth1($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret); $parameters = array( 'scope' => $scope, 'redirect_uri' => "https://develop...
php
{ "resource": "" }
q255679
OAuth2LoginHelper.parseNewAccessTokenFromResponse
test
private function parseNewAccessTokenFromResponse($body, $realmID = null){ if(is_string($body)){ $json_body = json_decode($body, true); if(json_last_error() === JSON_ERROR_NONE){ $tokenExpiresTime = $json_body[CoreConstants::EXPIRES_IN]; $refreshToken = $json_bod...
php
{ "resource": "" }
q255680
OAuth2LoginHelper.checkIfEmptyValueReturned
test
private function checkIfEmptyValueReturned($tokenExpiresTime, $refreshToken, $refreshTokenExpiresTime, $accessToken){ if(empty($tokenExpiresTime)){ throw new SdkException("Error Retrieve RefreshToken from Response. Token Expires In Time is Empty."); } if(empty($refreshToken)){ throw n...
php
{ "resource": "" }
q255681
OAuth2LoginHelper.generateAuthorizationHeader
test
private function generateAuthorizationHeader(){ $encodedClientIDClientSecrets = base64_encode($this->getClientID() . ':' . $this->getClientSecret()); $authorizationheader = CoreConstants::OAUTH2_AUTHORIZATION_TYPE . $encodedClientIDClientSecrets; return $authorizationheader; }
php
{ "resource": "" }
q255682
OAuth2LoginHelper.constructRefreshTokenHeader
test
private function constructRefreshTokenHeader(){ $authorizationHeaderInfo = $this->generateAuthorizationHeader(); $http_header = array( 'Accept' => CoreConstants::CONTENTTYPE_APPLICATIONJSON, 'Authorization' => $authorizationHeaderInfo, 'Content-Type' => CoreConstants:...
php
{ "resource": "" }
q255683
JsonObjectSerializer.checkResult
test
private function checkResult($result) { $this->lastError = json_last_error(); if (JSON_ERROR_NONE !== $this->lastError) { IdsExceptionManager::HandleException($this->getMessageFromErrorCode($this->lastError)); } //TODO add logger here return $result; }
php
{ "resource": "" }
q255684
JsonObjectSerializer.getMessageFromErrorCode
test
private function getMessageFromErrorCode($error) { if (function_exists('json_last_error_msg')) { return json_last_error_msg(); } $errors = array( JSON_ERROR_NONE => null, JSON_ERROR_DEPTH => 'Maximum stack d...
php
{ "resource": "" }
q255685
JsonObjectSerializer.convertObject
test
private function convertObject($object, $limitToOne) { if ($object instanceof \stdClass) { $result = array(); $vars = get_object_vars($object); if (empty($vars)) { return null; } foreach ($vars as $ke...
php
{ "resource": "" }
q255686
JsonObjectSerializer.Serialize
test
public function Serialize($entity) { $this->collectResourceURL($entity); $arrayObj = $this->customerConvertObjectToArray($entity); $array = $this->removeNullProperties($arrayObj); return $this->checkResult(json_encode($array, true)); }
php
{ "resource": "" }
q255687
JsonObjectSerializer.removeNullProperties
test
private function removeNullProperties($val){ $filterArray = array_filter($val); $returned = array(); foreach($filterArray as $k => $v){ if(is_array($v)){ if(FacadeHelper::isRecurrsiveArray($v)){ $list = array(); foreach($v as $kk => $vv){ ...
php
{ "resource": "" }
q255688
Zend_Soap_Wsdl_Strategy_DefaultComplexType.addComplexType
test
public function addComplexType($type) { if (!class_exists($type)) { require_once "Zend/Soap/Wsdl/Exception.php"; throw new Zend_Soap_Wsdl_Exception(sprintf( "Cannot add a complex type %s that is not an object or where ". "class could not be found in 'D...
php
{ "resource": "" }
q255689
Wsdl.getWsdl
test
public function getWsdl($class = null) { /* if ($class != null) { $this->class = $class; } elseif ($this->class == null) { throw new \RuntimeException("No class defined"); } if (!is_object($this->class) && !is_string($this->class)) { throw...
php
{ "resource": "" }
q255690
Wsdl.addBindings
test
private function addBindings() { $this->binding = $this->wsdl->addBinding($this->refl->getShortName().$this->bindingNameSuffix, $this->targetNsPrefix.":".$this->getBindingTypeName()); $this->wsdl->addSoapBinding($this->binding, ...
php
{ "resource": "" }
q255691
Wsdl.addPortType
test
private function addPortType() { $this->portType = $this->wsdl->addPortType($this->getPortName()); $this->addPortOperations(); return $this->portType; }
php
{ "resource": "" }
q255692
Wsdl.addTypes
test
public function addTypes() { $methods = $this->getClassMethods(); foreach ($methods as $method) { $data = $this->getMethodIO($method->name); $element = array('name' => $method->name, 'sequence' => array() ); if (array_key_exists("para...
php
{ "resource": "" }
q255693
Wsdl.addBindingOperations
test
public function addBindingOperations() { $methods = $this->getClassMethods(); //@todo Check if binding is instantiated foreach ($methods as $method) { $data = $this->getMethodIO($method->name); $bindingInput = false; $bindingOutput = false; i...
php
{ "resource": "" }
q255694
Wsdl.addPortOperations
test
private function addPortOperations() { $methods = $this->getClassMethods(); foreach ($methods as $method) { $data = $this->getMethodIO($method->name); $input = false; $output = false; $bindingInput = false; $bindingOutput ...
php
{ "resource": "" }
q255695
Wsdl.isLocalType
test
public function isLocalType($type) { if (preg_match('/:/', $type)) { list($ns, $typeName) = explode(":", $type); if ($ns == $this->targetNsPrefix || $ns == $this->xmlSchemaPreffix) { return true; // Local type } else { return false; ...
php
{ "resource": "" }
q255696
Wsdl.addServices
test
private function addServices() { $this->wsdl->addService($this->getServiceName(), $this->getPortName(), $this->getBindingName(), $this->getLocation()); }
php
{ "resource": "" }
q255697
Xsd2Php.getTargetNS
test
private function getTargetNS($xpath) { $query = "//*[local-name()='schema' and namespace-uri()='http://www.w3.org/2001/XMLSchema']/@targetNamespace"; $targetNs = $xpath->query($query); if ($targetNs) { foreach ($targetNs as $entry) { return $entry->nodeValue; ...
php
{ "resource": "" }
q255698
Xsd2Php.getNamespaces
test
public function getNamespaces($xpath) { $query = "//namespace::*"; $entries = $xpath->query($query); $nspaces = array(); foreach ($entries as $entry) { if ($entry->nodeValue == "http://www.w3.org/2001/XMLSchema") { $this->xsdNs = preg_replace('/xmlns:(...
php
{ "resource": "" }
q255699
Xsd2Php.saveClasses
test
public function saveClasses($dir, $createDirectory = false) { $this->setXmlSource($this->getXML()->saveXML()); $this->savePhpFiles($dir, $createDirectory); }
php
{ "resource": "" }