idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
43,900
public function getInRange ( $ range = null ) { if ( is_null ( $ range ) ) $ range = $ this -> range ; $ current_range = array ( ( $ this -> current_page - $ range < 1 ? 1 : $ this -> current_page - $ range ) , ( $ this -> current_page + $ range > $ this -> getMax ( ) ? $ this -> getMax ( ) : $ this -> current_page + $...
return all page numbers within the given range
43,901
public function serve ( ) { if ( is_null ( $ this -> linkPath ) ) { $ route = $ this -> fw -> get ( 'PARAMS.0' ) ; if ( $ this -> fw -> exists ( 'PARAMS.' . $ this -> routeKey ) ) $ route = preg_replace ( '/' . preg_quote ( $ this -> routeKeyPrefix . $ this -> fw -> get ( 'PARAMS.' . $ this -> routeKey ) ) . '$/' , '' ...
generates the pagination output
43,902
static public function renderTag ( $ args ) { $ attr = $ args [ '@attrib' ] ; $ tmp = Template :: instance ( ) ; foreach ( $ attr as & $ att ) $ att = $ tmp -> token ( $ att ) ; $ pn_code = '$pn = new Pagination(' . $ attr [ 'items' ] . ');' ; if ( array_key_exists ( 'limit' , $ attr ) ) $ pn_code .= '$pn->setLimit(' ....
magic render function for custom tags
43,903
public function _request ( $ body ) { if ( isset ( $ body [ 'params' ] ) ) { $ response = $ this -> client -> send ( $ this -> client -> request ( 0 , $ body [ 'method' ] , $ body [ 'params' ] ) ) ; } else { $ response = $ this -> client -> send ( $ this -> client -> request ( 0 , $ body [ 'method' ] ) ) ; } $ response...
Helper function for creating wallet requests
43,904
public function _buildTransfer ( $ options ) { $ destinations = $ options [ 'destinations' ] ; if ( gettype ( $ destinations ) == "object" ) { $ destinations -> amount = $ destinations -> amount * 1e12 ; $ destinations = array ( $ destinations ) ; } else { foreach ( $ destinations as & $ destination ) { $ destination -...
Helper function for building transfer or transfer split request body
43,905
public function transfer ( $ options ) { $ options [ 'method' ] = 'transfer' ; $ body = $ this -> _buildTransfer ( $ options ) ; return $ this -> _request ( $ body ) ; }
Transfer Monero to a single recipient or group of recipients
43,906
public function getBulkPayments ( $ payment_ids , $ height ) { $ params = [ 'payment_ids' => $ payment_ids , 'min_block_height' => $ height ] ; $ body = [ 'method' => 'get_bulk_payments' , 'params' => $ params ] ; return $ this -> _request ( $ body ) ; }
Get a list of incoming payments from a single payment ID or list of payment IDs from a given height .
43,907
public function integratedAddress ( $ payment_id = null ) { $ params = [ 'payment_id' => $ payment_id ] ; $ body = [ 'method' => 'make_integrated_address' , 'params' => $ params ] ; return $ this -> _request ( $ body ) ; }
Make an integrated address from the wallet address and a payment id .
43,908
public function getNextURLpart ( ) { $ url_list = ( $ this -> _url_list ) ? $ this -> _url_list : config ( 'yubikey.URL_LIST' ) ; return ( $ this -> _url_index >= count ( $ url_list ) ) ? false : $ url_list [ $ this -> _url_index ++ ] ; }
Get next URL part from list to use for validation .
43,909
public function parsePasswordOTP ( $ str , $ delim = '[:]' ) { if ( ! preg_match ( "/^((.*)" . $ delim . ")?(([cbdefghijklnrtuvCBDEFGHIJKLNRTUV]{0,16})([cbdefghijklnrtuvCBDEFGHIJKLNRTUV]{32}))$/" , $ str , $ matches ) ) { if ( ! preg_match ( "/^((.*)" . $ delim . ")?(([jxe.uidchtnbpygkJXE.UIDCHTNBPYGK]{0,16})([jxe.uidc...
Parse input string into password yubikey prefix ciphertext and OTP .
43,910
public function getParameters ( ) { $ params = explode ( "\n" , trim ( $ this -> _response ) ) ; foreach ( $ params as $ param ) { list ( $ key , $ val ) = explode ( '=' , $ param , 2 ) ; $ param_array [ $ key ] = $ val ; } $ param_array [ 'identity' ] = substr ( $ param_array [ 'otp' ] , 0 , 12 ) ; return $ param_arra...
Parse parameters from last response
43,911
public function getParameter ( $ parameter ) { $ param_array = $ this -> getParameters ( ) ; if ( ! empty ( $ param_array ) && array_key_exists ( $ parameter , $ param_array ) ) { return $ param_array [ $ parameter ] ; } else { throw new \ Exception ( 'UNKNOWN_PARAMETER' ) ; } }
Get one parameter from last response
43,912
protected static function hashEquals ( $ knownString , $ userString ) { static $ exists = null ; if ( $ exists === null ) $ exists = \ function_exists ( '\\hash_equals' ) ; if ( $ exists ) return \ hash_equals ( $ knownString , $ userString ) ; $ length = self :: safeStrlen ( $ knownString ) ; if ( $ length !== self ::...
Compare two hashes in constant time
43,913
protected static function getRandomBytes ( $ num = 16 ) { static $ which = null ; if ( $ which === null ) { if ( \ function_exists ( '\\random_bytes' ) && \ version_compare ( \ phpversion ( ) , '7.0.0' , '>=' ) ) { $ which = 'php7' ; } elseif ( \ function_exists ( '\\openssl_random_pseudo_bytes' ) ) { $ which = 'openss...
Get a string of cryptographically secure pseudorandom bytes
43,914
protected static function safeStrlen ( $ string ) { static $ exists = null ; if ( $ exists === null ) $ exists = \ function_exists ( 'mb_strlen' ) ; if ( $ exists ) return \ mb_strlen ( $ string , '8bit' ) ; return \ strlen ( $ string ) ; }
Get the length of a string irrespective to mbstring . func_overload
43,915
public function mergeHttpStatus ( $ code , $ text ) { $ code = $ this -> filterStatusCode ( $ code ) ; $ text = $ this -> filterReasonPhrase ( $ text ) ; if ( $ this -> hasReasonPhrase ( $ text ) && $ this -> getStatusCode ( $ text ) !== $ code ) { throw new RuntimeException ( 'The submitted reason phrase is already pr...
Add or Update the HTTP Status array .
43,916
protected function filterReasonPhrase ( $ text ) { if ( ! ( is_object ( $ text ) && method_exists ( $ text , '__toString' ) ) && ! is_string ( $ text ) ) { throw new InvalidArgumentException ( 'The reason phrase must be a string' ) ; } $ text = trim ( $ text ) ; if ( preg_match ( ',[\r\n],' , $ text ) ) { throw new Inv...
Filter a Reason Phrase .
43,917
public function getStatusCode ( $ statusText ) { $ statusText = $ this -> filterReasonPhrase ( $ statusText ) ; $ statusCode = $ this -> fetchStatusCode ( $ statusText ) ; if ( $ statusCode !== false ) { return $ statusCode ; } throw new OutOfBoundsException ( sprintf ( 'No Http status code is associated to `%s`' , $ s...
Get the code for a given status text .
43,918
public function hasStatusCode ( $ statusCode ) { try { $ statusCode = $ this -> filterStatusCode ( $ statusCode ) ; } catch ( InvalidArgumentException $ e ) { return false ; } return isset ( $ this -> httpStatus [ $ statusCode ] ) ; }
Check if the code exists in a collection .
43,919
public function hasReasonPhrase ( $ statusText ) { try { $ statusText = $ this -> filterReasonPhrase ( $ statusText ) ; } catch ( InvalidArgumentException $ e ) { return false ; } return ( bool ) $ this -> fetchStatusCode ( $ statusText ) ; }
Check if the hasReasonPhrase exists in a collection .
43,920
public function getResponseClass ( $ statusCode ) { $ responseClass = [ 1 => self :: CLASS_INFORMATIONAL , 2 => self :: CLASS_SUCCESS , 3 => self :: CLASS_REDIRECTION , 4 => self :: CLASS_CLIENT_ERROR , 5 => self :: CLASS_SERVER_ERROR , ] ; $ statusCode = $ this -> filterStatusCode ( $ statusCode ) ; return $ responseC...
Determines the response class of a response code .
43,921
public static function field ( $ name , $ id = null ) { return self :: getInstance ( ) -> getBuilder ( FieldBehavior :: class ) -> field ( $ name ) -> id ( $ id ) ; }
Return a new builder instance for a field call .
43,922
private function getBuilder ( $ behavior ) { if ( ! isset ( $ this -> behaviors [ $ behavior ] ) ) { $ this -> behaviors [ $ behavior ] = new $ behavior ( ) ; } return new Builder ( new Runner ( $ this -> behaviors [ $ behavior ] ) , $ this -> macros ) ; }
Return a builder instance with the given behavior .
43,923
public function get ( Builder $ builder ) { $ value = $ this -> behavior -> get ( $ builder -> field , $ builder -> id , ! $ builder -> raw ) ; foreach ( $ this -> components as $ component ) { if ( ! is_null ( $ builder -> $ component ) ) { $ method = 'run' . ucfirst ( $ component ) ; $ value = $ this -> $ method ( $ ...
Run the ACF get behavior from the given builder .
43,924
public function update ( Builder $ builder , $ value ) { $ this -> behavior -> update ( $ builder -> field , $ value , $ builder -> id ) ; }
Run the ACF update behavior from the given builder .
43,925
protected function runDefault ( $ default , $ value ) { if ( is_string ( $ value ) && strlen ( $ value ) === 0 ) { return $ default ; } elseif ( is_array ( $ value ) && empty ( $ value ) ) { return $ default ; } return $ value ?? $ default ; }
Return the default value if the given value is empty or null .
43,926
protected function runEscape ( $ func , $ value ) { if ( ! is_string ( $ value ) ) { throw new RunnerException ( 'Cannot escape value of type ' . gettype ( $ value ) ) ; } $ whitelist = [ 'esc_attr' , 'esc_html' , 'esc_js' , 'esc_textarea' , 'esc_url' , 'htmlspecialchars' , 'urlencode' , ] ; return ( in_array ( $ func ...
Escape the value with the given function .
43,927
protected function runShortcodes ( $ _ , $ value ) { if ( ! is_string ( $ value ) ) { throw new RunnerException ( 'Cannot do shortcode on value of type ' . gettype ( $ value ) ) ; } return do_shortcode ( $ value ) ; }
Do shortcodes on the given value .
43,928
public function getOperationByRel ( $ rel , $ single = true ) { $ operations = isset ( $ this -> object [ 'operations' ] ) ? $ this -> object [ 'operations' ] : [ ] ; $ operation = array_filter ( $ operations , function ( $ value , $ key ) use ( $ rel ) { return ( is_array ( $ value ) && $ value [ 'rel' ] === $ rel ) ;...
Extract operation value from operations list
43,929
protected function _transformCrudOptions ( array $ options ) { if ( isset ( $ options [ 'params' ] [ 'class' ] ) && ! isset ( $ options [ 'type' ] ) ) { $ class = $ options [ 'params' ] [ 'class' ] ; $ pos = strrpos ( $ class , ' ' ) ; if ( $ pos !== false ) { $ class = substr ( $ class , $ pos + 1 ) ; } $ options [ 't...
Transforms Crud plugin flashs into Flash messages .
43,930
public function render ( $ key = 'flash' , array $ options = [ ] ) { $ options += [ 'types' => [ ] ] ; $ messages = ( array ) $ this -> _View -> getRequest ( ) -> getSession ( ) -> read ( 'Flash.' . $ key ) ; $ transientMessages = ( array ) Configure :: read ( 'TransientFlash.' . $ key ) ; if ( $ transientMessages ) { ...
Displays flash messages .
43,931
public function message ( $ message , $ options = null ) { $ options = $ this -> _mergeOptions ( $ options ) ; $ options [ 'message' ] = $ message ; return $ this -> _View -> element ( $ options [ 'element' ] , $ options ) ; }
Outputs a single flash message directly . Note that this does not use the Session .
43,932
public function addTransientMessage ( $ message , $ options = null ) { $ options = $ this -> _mergeOptions ( $ options ) ; $ options [ 'message' ] = $ message ; $ messages = ( array ) Configure :: read ( 'TransientFlash.' . $ options [ 'key' ] ) ; if ( $ messages && count ( $ messages ) > $ this -> getConfig ( 'limit' ...
Add a message on the fly
43,933
public function collection ( $ data , $ transformer = null , $ resourceName = null ) { if ( ! is_null ( $ resourceName ) ) { $ this -> resourceName = $ resourceName ; } return $ this -> data ( 'collection' , $ data , $ transformer ) ; }
Set the collection data that must be transformed .
43,934
public function item ( $ data , $ transformer = null , $ resourceName = null ) { if ( ! is_null ( $ resourceName ) ) { $ this -> resourceName = $ resourceName ; } return $ this -> data ( 'item' , $ data , $ transformer ) ; }
Set the item data that must be transformed .
43,935
public function primitive ( $ data , $ transformer = null , $ resourceName = null ) { if ( ! is_null ( $ resourceName ) ) { $ this -> resourceName = $ resourceName ; } return $ this -> data ( 'primitive' , $ data , $ transformer ) ; }
Set the primitive data that must be transformed .
43,936
public function data ( $ dataType , $ data , $ transformer = null ) { $ this -> dataType = $ dataType ; $ this -> data = $ data ; if ( ! is_null ( $ transformer ) ) { $ this -> transformer = $ transformer ; } return $ this ; }
Set the data that must be transformed .
43,937
public function parseIncludes ( $ includes ) { $ includes = $ this -> normalizeIncludesOrExcludes ( $ includes ) ; $ this -> includes = array_merge ( $ this -> includes , ( array ) $ includes ) ; return $ this ; }
Specify the includes .
43,938
public function parseExcludes ( $ excludes ) { $ excludes = $ this -> normalizeIncludesOrExcludes ( $ excludes ) ; $ this -> excludes = array_merge ( $ this -> excludes , ( array ) $ excludes ) ; return $ this ; }
Specify the excludes .
43,939
public function parseFieldsets ( array $ fieldsets ) { foreach ( $ fieldsets as $ key => $ fields ) { if ( is_array ( $ fields ) ) { $ fieldsets [ $ key ] = implode ( ',' , $ fields ) ; } } $ this -> fieldsets = array_merge ( $ this -> fieldsets , $ fieldsets ) ; return $ this ; }
Specify the fieldsets to include in the response .
43,940
protected function normalizeIncludesOrExcludes ( $ includesOrExcludes = '' ) { if ( ! is_string ( $ includesOrExcludes ) ) { return $ includesOrExcludes ; } return array_map ( function ( $ value ) { return trim ( $ value ) ; } , explode ( ',' , $ includesOrExcludes ) ) ; }
Normalize the includes an excludes .
43,941
public function addMeta ( ) { foreach ( func_get_args ( ) as $ meta ) { if ( is_array ( $ meta ) ) { $ this -> meta += $ meta ; } } return $ this ; }
Set the meta data .
43,942
public function createData ( ) { if ( is_null ( $ this -> transformer ) ) { throw new NoTransformerSpecified ( ) ; } if ( is_string ( $ this -> serializer ) ) { $ this -> serializer = new $ this -> serializer ; } if ( ! is_null ( $ this -> serializer ) ) { $ this -> manager -> setSerializer ( $ this -> serializer ) ; }...
Create fractal data .
43,943
public function getResource ( ) { $ resourceClass = 'League\\Fractal\\Resource\\' . ucfirst ( $ this -> dataType ) ; if ( ! class_exists ( $ resourceClass ) ) { throw new InvalidTransformation ( ) ; } if ( is_string ( $ this -> transformer ) ) { $ this -> transformer = new $ this -> transformer ; } $ resource = new $ r...
Get the resource .
43,944
public function addSitemap ( $ location , $ lastModified = null ) { $ sitemap = $ location instanceof SitemapTag ? $ location : new SitemapTag ( $ location , $ lastModified ) ; $ this -> sitemaps [ ] = $ sitemap ; }
Add new sitemap to the sitemaps index .
43,945
public function index ( ) { if ( $ cachedView = $ this -> getCachedView ( ) ) { return response ( ) -> make ( $ cachedView , 200 , [ 'Content-type' => 'text/xml' ] ) ; } $ sitemapIndex = response ( ) -> view ( 'sitemap::sitemaps' , [ '__sitemaps' => $ this -> getSitemaps ( ) ] , 200 , [ 'Content-type' => 'text/xml' ] )...
Render an index of sitemaps .
43,946
public function addTag ( $ location , $ lastModified = null , $ changeFrequency = null , $ priority = null ) { $ tag = $ location instanceof Tag ? $ location : new Tag ( $ location , $ lastModified , $ changeFrequency , $ priority ) ; $ this -> tags [ ] = $ tag ; return $ tag ; }
Add a new sitemap tag to the sitemap .
43,947
public function addExpiredTag ( $ location , $ expired = null ) { $ tag = $ location instanceof ExpiredTag ? $ location : new ExpiredTag ( $ location , $ expired ) ; $ this -> tags [ ] = $ tag ; }
Add a new expired tag to the sitemap .
43,948
public function render ( ) { if ( $ cachedView = $ this -> getCachedView ( ) ) { return response ( ) -> make ( $ cachedView , 200 , [ 'Content-type' => 'text/xml' ] ) ; } $ sitemap = response ( ) -> view ( 'sitemap::sitemap' , [ '__tags' => $ this -> getTags ( ) , '__hasImages' => $ this -> imagesPresent ( ) , '__hasVi...
Render a sitemap .
43,949
public function hasCachedView ( ) { if ( config ( 'sitemap.cache_enabled' ) ) { $ key = $ this -> getCacheKey ( ) ; return $ this -> cache -> has ( $ key ) ; } return false ; }
Check whether the sitemap has a cached view or not .
43,950
protected function getCachedView ( ) { if ( $ this -> hasCachedView ( ) ) { $ key = $ this -> getCacheKey ( ) ; return $ this -> cache -> get ( $ key ) ; } return false ; }
Check to see whether a view has already been cached for the current route and if so return it .
43,951
protected function saveCachedView ( Response $ response ) { if ( config ( 'sitemap.cache_enabled' ) ) { $ key = $ this -> getCacheKey ( ) ; $ content = $ response -> getOriginalContent ( ) -> render ( ) ; if ( ! $ this -> cache -> get ( $ key ) ) { $ this -> cache -> put ( $ key , $ content , config ( 'sitemap.cache_le...
Save a cached view if caching is enabled .
43,952
public function setLastModified ( $ lastModified ) { if ( $ lastModified instanceof DateTime ) { $ this -> lastModified = $ lastModified ; return ; } elseif ( $ lastModified instanceof Model ) { $ this -> lastModified = $ lastModified -> updated_at ; return ; } $ this -> lastModified = new DateTime ( $ lastModified ) ;...
Set the last modified timestamp .
43,953
public function addImage ( $ location , $ caption = null , $ geoLocation = null , $ title = null , $ license = null ) { $ image = $ location instanceof ImageTag ? $ location : new ImageTag ( $ location , $ caption , $ geoLocation , $ title , $ license ) ; $ this -> images [ ] = $ image ; }
Add an image tag to the tag .
43,954
public function addVideo ( $ location , $ title = null , $ description = null , $ thumbnailLocation = null ) { $ video = $ location instanceof VideoTag ? $ location : new VideoTag ( $ location , $ title , $ description , $ thumbnailLocation ) ; $ this -> videos [ ] = $ video ; }
Add a video tag to the tag .
43,955
public function setExpired ( $ expired ) { if ( $ expired instanceof DateTime ) { $ this -> expired = $ expired ; return ; } elseif ( $ expired instanceof Model ) { $ this -> expired = $ expired -> deleted_at ? : $ expired -> updated_at ; return ; } $ this -> expired = new DateTime ( $ expired ) ; }
Set the expiration date
43,956
protected function executeNextWaitingRequest ( ) { if ( ( $ this -> numberOfParallelRequests === 0 || count ( $ this -> runningRequests ) < $ this -> numberOfParallelRequests ) && count ( $ this -> waitingRequests ) > 0 ) { $ this -> executeRequest ( reset ( $ this -> waitingRequests ) ) ; } return $ this ; }
Executes the next waiting request if there is still one to be executed .
43,957
protected function executeRequest ( Request $ request ) { $ index = array_search ( $ request , $ this -> waitingRequests ) ; if ( $ index !== false ) { unset ( $ this -> waitingRequests [ $ index ] ) ; $ this -> hydrateCurlFromRequest ( $ request , $ request -> getCurl ( ) ) -> triggerCallback ( $ request -> getOnIniti...
Executes the specified request if it is still waiting .
43,958
protected function hydrateCurlFromRequest ( Request $ request , Curl $ curl ) { $ curl -> setOption ( CURLOPT_CUSTOMREQUEST , $ request -> getMethod ( ) ) -> setOption ( CURLOPT_URL , $ request -> getUrl ( ) ) -> setOption ( CURLOPT_RETURNTRANSFER , true ) -> setOption ( CURLOPT_HEADER , true ) -> setOption ( CURLOPT_F...
Hydrates the cURL instance with the data from the specified request .
43,959
protected function prepareRequestHeader ( Header $ header ) : array { $ result = [ ] ; foreach ( $ header as $ name => $ value ) { $ result [ ] = $ name . ': ' . $ value ; } return $ result ; }
Prepares the header for the request .
43,960
protected function executeMultiCurl ( ) { do { $ this -> multiCurl -> execute ( ) ; $ this -> checkStatusMessages ( ) ; } while ( $ this -> multiCurl -> getCurrentExecutionCode ( ) === CURLM_CALL_MULTI_PERFORM ) ; return $ this ; }
Executes the requests of the multi cUrl .
43,961
protected function checkStatusMessages ( ) { while ( ( $ message = $ this -> multiCurl -> readInfo ( ) ) !== false ) { $ this -> processCurlResponse ( ( int ) $ message [ 'result' ] , $ message [ 'handle' ] ) -> executeNextWaitingRequest ( ) ; } return $ this ; }
Checks for any waiting status messages of the cURL requests .
43,962
protected function processCurlResponse ( int $ statusCode , $ curlHandle ) { foreach ( $ this -> runningRequests as $ index => $ request ) { if ( $ request -> getCurl ( ) -> getHandle ( ) === $ curlHandle ) { $ this -> parseResponse ( $ request , $ statusCode ) -> triggerCallback ( $ request -> getOnCompleteCallback ( ...
processes the response of the specified curl handle .
43,963
protected function parseResponse ( Request $ request , int $ errorCode ) { $ curl = $ request -> getCurl ( ) ; $ response = $ request -> getResponse ( ) ; $ response -> setErrorCode ( $ errorCode ) -> setErrorMessage ( $ curl -> getErrorMessage ( ) ) ; if ( $ errorCode === CURLE_OK ) { $ this -> hydrateResponseFromCurl...
Creates the response of the specified request .
43,964
protected function hydrateResponseFromCurl ( Response $ response , Curl $ curl ) { $ headerSize = $ curl -> getInfo ( CURLINFO_HEADER_SIZE ) ; $ rawContent = $ this -> multiCurl -> getContent ( $ curl ) ; $ response -> setStatusCode ( $ curl -> getInfo ( CURLINFO_HTTP_CODE ) ) -> setContent ( substr ( $ rawContent , $ ...
Hydrates the response from the specified cUrl request .
43,965
protected function parseResponseHeaders ( Response $ response , string $ headerString ) { foreach ( array_filter ( explode ( "\r\n\r\n" , $ headerString ) ) as $ responseHeader ) { $ header = new Header ( ) ; foreach ( explode ( "\r\n" , $ responseHeader ) as $ headerLine ) { $ parts = explode ( ':' , $ headerLine , 2 ...
Parses the header string into the response .
43,966
public function waitForAllRequests ( ) { while ( $ this -> multiCurl -> getStillRunningRequests ( ) > 0 && $ this -> multiCurl -> getCurrentExecutionCode ( ) === CURLM_OK ) { $ this -> multiCurl -> select ( ) ; $ this -> executeMultiCurl ( ) ; } return $ this ; }
Delays the script execution until all requests have been finished .
43,967
public function waitForSingleRequest ( Request $ request ) { $ this -> executeRequest ( $ request ) ; while ( $ this -> multiCurl -> getStillRunningRequests ( ) > 0 && $ this -> multiCurl -> getCurrentExecutionCode ( ) === CURLM_OK && in_array ( $ request , $ this -> runningRequests ) ) { $ this -> multiCurl -> select ...
Delays the script execution until at least the specified request has been finished .
43,968
public function set ( string $ name , string $ value ) { $ this -> values [ $ name ] = $ value ; return $ this ; }
Sets a value to the header .
43,969
protected function moveChildNamespacesToEnvelope ( \ SimpleXMLElement $ element ) : \ SimpleXMLElement { $ dom = dom_import_simplexml ( $ element ) ; foreach ( $ element -> getNamespaces ( true ) as $ prefix => $ namespace ) { if ( ! in_array ( $ namespace , $ element -> getDocNamespaces ( ) ) ) { $ dom -> setAttribute...
Move all underlying namespaces to root element .
43,970
protected function getSoapNamespace ( ) : string { if ( ! array_key_exists ( $ this -> soapVersion , static :: SOAP_NAMESPACES ) ) { throw new InvalidArgumentException ( 'Unsupported SOAP version' ) ; } return static :: SOAP_NAMESPACES [ $ this -> soapVersion ] ; }
Get the namespace for the current SOAP version .
43,971
public function setOption ( string $ name , $ value ) { curl_setopt ( $ this -> handle , $ name , $ value ) ; return $ this ; }
Sets an option for the cURL instance .
43,972
public function setRequestData ( $ requestData ) { if ( is_array ( $ requestData ) ) { $ this -> requestData = http_build_query ( $ requestData ) ; } else { $ this -> requestData = $ requestData ; } return $ this ; }
Sets the request data to send with the request .
43,973
public function setBasicAuth ( string $ username , string $ password ) { $ this -> basicAuthUsername = $ username ; $ this -> basicAuthPassword = $ password ; return $ this ; }
Sets the credentials for the basic authentication .
43,974
public function synchronizeTreeOffline ( $ vocabulary , array $ categories , $ storeId = '' ) { $ this -> resetResults ( ) ; $ this -> loadVocabulary ( $ vocabulary ) ; $ this -> syncCategory ( $ categories , NULL , $ storeId ) ; return ( $ this -> results ) ; }
Synchronize categories in offline mode i . e . not connected to connector .
43,975
protected function getPromotionNodes ( $ view_mode ) { $ nodes = [ ] ; $ query = \ Drupal :: entityQuery ( 'node' ) -> condition ( 'type' , 'acm_promotion' ) -> condition ( 'status' , NodeInterface :: PUBLISHED ) ; if ( $ view_mode === 'sku_limit' ) { $ viewing_node = \ Drupal :: routeMatch ( ) -> getParameter ( 'node'...
Gets the relavent promotion nodes to be displayed .
43,976
public function obj ( ) { if ( $ this -> obj === null ) { $ formGroup = $ this -> formGroup ( ) ; if ( $ formGroup instanceof self ) { $ prop = $ formGroup -> storageProperty ( ) ; $ val = $ formGroup -> obj ( ) -> propertyValue ( $ prop -> ident ( ) ) ; $ this -> obj = $ prop -> structureVal ( $ val , [ 'default_data'...
Retrieve the form s object .
43,977
public function setStorageProperty ( $ propertyIdent ) { $ property = null ; if ( $ propertyIdent instanceof PropertyInterface ) { $ property = $ propertyIdent ; $ propertyIdent = $ property -> ident ( ) ; } elseif ( ! is_string ( $ propertyIdent ) ) { throw new InvalidArgumentException ( 'Storage Property identifier m...
Set the form group s storage target .
43,978
public function structProperties ( ) { $ property = $ this -> storageProperty ( ) ; if ( $ property ) { $ struct = $ property -> structureMetadata ( ) ; if ( isset ( $ struct [ 'properties' ] ) ) { return $ struct [ 'properties' ] ; } } return [ ] ; }
Retrieve the properties from the storage property s structure .
43,979
public function getPlugin ( $ plugin_id ) { $ cart = $ this -> getCart ( ) ; $ paymentMethodManager = \ Drupal :: service ( 'plugin.manager.acm_payment_method' ) ; return $ paymentMethodManager -> createInstance ( $ plugin_id , [ ] , $ cart ) ; }
Gets a specific payment method plugin .
43,980
public function getSelectedPlugin ( ) { $ cart = $ this -> getCart ( ) ; $ plugin_id = $ cart -> getPaymentMethod ( FALSE ) ; return $ this -> getPlugin ( $ plugin_id ) ; }
Gets the customer selected plugin .
43,981
public function productFullSync ( $ skus = '' , $ product_page_size = 0 , $ store_id = "" , $ langcode = "" , $ categoryId = "" ) { if ( empty ( $ product_page_size ) ) { $ product_page_size = ( int ) $ this -> productPageSize ; } else { $ product_page_size = ( int ) $ product_page_size ; } if ( ! ( $ store_id && $ lan...
Performs full connector sync .
43,982
public function viewLink ( ) { $ link = null ; $ locale = $ this -> lang ( ) ; if ( $ locale !== null ) { $ translator = $ this -> translator ( ) ; $ origLocale = $ translator -> getLocale ( ) ; $ translator -> setLocale ( $ this -> lang ( ) ) ; $ link = $ this -> renderTemplate ( '{{# withBaseUrl }}{{ obj.url }}{{/ wi...
Get the permalink s absolute URI .
43,983
public function baseRoute ( ) { if ( $ this -> baseRoute === null ) { $ this -> baseRoute = $ this -> baseUrl ( ) ; } $ link = $ this -> baseRoute ; $ locale = $ this -> lang ( ) ; if ( $ locale !== null ) { $ translator = $ this -> translator ( ) ; $ origLocale = $ translator -> getLocale ( ) ; $ translator -> setLoca...
Get the permalink s immutable base .
43,984
public function editableRoute ( ) { $ link = $ this -> inputVal ( ) ; if ( empty ( $ link ) ) { $ link = $ this -> placeholder ( ) ; } return $ link ; }
Get the permalink s editable part .
43,985
public function baseUrl ( ) { if ( ! isset ( $ this -> baseUrl ) ) { throw new RuntimeException ( sprintf ( 'The base URI is not defined for [%s]' , get_class ( $ this ) ) ) ; } return $ this -> baseUrl ; }
Get the base URI of the project .
43,986
public function samples ( ) { if ( $ this -> p ( ) -> l10n ( ) === false ) { $ origLang = $ this -> lang ( ) ; $ locales = $ this -> translator ( ) -> availableLocales ( ) ; $ sampleId = $ this -> sampleId ( ) ; foreach ( $ locales as $ langCode ) { $ this -> setSampleId ( $ sampleId . '_' . $ langCode ) ; $ this -> se...
Iterate the samples to display .
43,987
public function sampleId ( ) { if ( ! $ this -> sampleId ) { $ this -> sampleId = $ this -> inputId ( ) ? : $ this -> generateSampleId ( ) ; } return $ this -> sampleId ; }
Get the sample ID .
43,988
public function getConfigurableAttributeWeights ( $ attribute_set = 'default' ) { $ attribute_set = strtolower ( $ attribute_set ) ; $ weights = $ this -> config -> get ( 'attribute_weights' ) ; $ set_weights = $ weights [ $ attribute_set ] ?? $ weights [ 'default' ] ; asort ( $ set_weights ) ; return $ set_weights ; }
Get the attribute codes with weight for particular attribute set .
43,989
public function setConfigurableAttributeWeights ( $ attribute_set = 'default' , array $ weights = [ ] ) { $ attribute_set = strtolower ( $ attribute_set ) ; $ existing_weights = $ this -> config -> get ( 'attribute_weights' ) ; $ existing_weights [ $ attribute_set ] = $ weights ; $ config = $ this -> configFactory -> g...
Set the attribute codes with weight for particular attribute set .
43,990
public function getFirstAttribute ( $ attribute_set = 'default' ) { $ weights = $ this -> getConfigurableAttributeWeights ( $ attribute_set ) ; $ attributes = $ weights ? array_keys ( $ weights ) : [ ] ; return ! empty ( $ attributes ) ? reset ( $ attributes ) : '' ; }
Get first attribute code based on weights for particular attribute set .
43,991
public function getStoreLanguageMapping ( ) { $ mapping = [ ] ; $ languages = $ this -> languageManager -> getLanguages ( ) ; foreach ( $ languages as $ lang => $ language ) { if ( $ lang == $ this -> languageManager -> getDefaultLanguage ( ) -> getId ( ) ) { $ config = $ this -> configFactory -> get ( 'acm.store' ) ; ...
Helper method to get mapping of all store ids and language codes .
43,992
public function getStoreIdFromLangcode ( $ langcode = '' ) { if ( empty ( $ langcode ) ) { $ langcode = $ this -> languageManager -> getCurrentLanguage ( ) -> getId ( ) ; } $ mapping = $ this -> getStoreLanguageMapping ( ) ; return ! empty ( $ mapping [ $ langcode ] ) ? $ mapping [ $ langcode ] : NULL ; }
Helper method to get store id from language code .
43,993
public function getLangcodeFromStoreId ( $ store_id ) { $ mapping = $ this -> getStoreLanguageMapping ( ) ; $ mapping = is_array ( $ mapping ) && ! empty ( $ mapping ) ? array_flip ( array_filter ( $ mapping ) ) : NULL ; if ( empty ( $ store_id ) ) { return array_shift ( $ mapping ) ; } return ! empty ( $ mapping [ $ s...
Helper method to get language code from store id .
43,994
public function formatPrice ( $ price ) { $ config = $ this -> configFactory -> get ( 'acm.currency' ) ; $ locale = \ Drupal :: languageManager ( ) -> getCurrentLanguage ( ) -> getId ( ) ; $ currency = \ Drupal :: service ( 'repository.currency' ) ; $ numberFormat = \ Drupal :: service ( 'repository.number_format' ) ; ...
Helper function to format price string .
43,995
public function setPlaceholder ( $ placeholder ) { if ( $ placeholder === null || $ placeholder === '' ) { $ this -> placeholder = '' ; return $ this ; } $ this -> placeholder = $ this -> translator ( ) -> translation ( $ placeholder ) ; if ( $ this -> placeholder instanceof Translation ) { $ this -> placeholder -> isR...
Set the form control s placeholder .
43,996
public function placeholder ( ) { if ( $ this -> placeholder === null ) { $ metadata = $ this -> metadata ( ) ; if ( isset ( $ metadata [ 'data' ] [ 'placeholder' ] ) ) { $ this -> setPlaceholder ( $ metadata [ 'data' ] [ 'placeholder' ] ) ; } else { $ this -> placeholder = '' ; } } if ( $ this -> placeholder instanceo...
Retrieve the placeholder .
43,997
public function inputName ( ) { if ( $ this -> inputName ) { $ name = $ this -> inputName ; } else { $ name = $ this -> propertyIdent ( ) ; } if ( $ this -> p ( ) -> l10n ( ) ) { $ name .= '[' . $ this -> lang ( ) . ']' ; } if ( $ this -> multiple ( ) ) { $ name .= '[]' ; } return $ name ; }
Retrieve the input name .
43,998
public function renderTranslatableTemplate ( $ templateString ) { if ( $ templateString instanceof Translation ) { $ origLang = $ this -> translator ( ) -> getLocale ( ) ; foreach ( $ this -> translator ( ) -> availableLocales ( ) as $ lang ) { if ( ! isset ( $ templateString [ $ lang ] ) ) { continue ; } $ translation...
Render the given template from string .
43,999
public function syncProducts ( $ langcode , $ page_size , array $ options = [ 'skus' => NULL , 'category_id' => NULL ] ) { $ langcode = strtolower ( $ langcode ) ; $ store_id = $ this -> i18nhelper -> getStoreIdFromLangcode ( $ langcode ) ; if ( empty ( $ store_id ) ) { $ this -> output -> writeln ( dt ( "Store id not ...
Run a full synchronization of all commerce product records .