idx
int64 0
60.3k
| question
stringlengths 101
6.21k
| target
stringlengths 7
803
|
|---|---|---|
52,700
|
protected function normalizeOptions ( ) { ! $ this -> containerTag && $ this -> containerTag = 'div' ; if ( ! isset ( $ this -> containerOptions [ 'id' ] ) || empty ( $ this -> containerOptions [ 'id' ] ) ) { $ this -> containerOptions [ 'id' ] = $ this -> getId ( ) ; } }
|
Preparing some options for this widgets
|
52,701
|
protected function registerClientScript ( ) { $ view = $ this -> getView ( ) ; SlickAsset :: register ( $ view ) ; $ options = Json :: encode ( $ this -> clientOptions ) ; $ id = $ this -> containerOptions [ 'id' ] ; $ js [ ] = ";" ; $ js [ ] = "jQuery('#$id').slick($options);" ; $ view -> registerJs ( implode ( PHP_EOL , $ js ) , $ this -> jsPosition ) ; foreach ( $ this -> events as $ key => $ value ) { $ view -> registerJs ( new JsExpression ( "$('#" . $ this -> id . "').on('" . $ key . "', " . $ value . ");" ) , $ this -> jsPosition ) ; } }
|
Register required scripts for the Slick plugin
|
52,702
|
public function getComponentsFlattened ( ) { $ components = [ ] ; foreach ( $ this -> getComponents ( ) as $ component ) { $ components [ ] = $ component ; if ( $ component instanceof ComponentNested ) { $ descendants = $ component -> getComponentsFlattened ( ) ; array_merge ( $ components , $ descendants ) ; } } return $ components ; }
|
Gets nested components as a flattened list .
|
52,703
|
public function addComponentTextStyle ( $ name , ComponentTextStyle $ component_text_style ) { $ this -> componentTextStyles [ ( string ) $ name ] = $ component_text_style ; return $ this ; }
|
Setter for componentTextStyles .
|
52,704
|
public function setAdvertisingSettings ( $ value ) { if ( is_object ( $ value ) && ! $ value instanceof AdvertisingSettings ) { $ this -> triggerError ( 'Object not of type AdvertisingSettings' ) ; } else { $ this -> advertisingSettings = $ value ; } return $ this ; }
|
Setter for advertisingSettings .
|
52,705
|
public function addTextStyle ( $ name , TextStyle $ text_style ) { $ this -> textStyles [ ( string ) $ name ] = $ text_style ; return $ this ; }
|
Setter for textStyles .
|
52,706
|
public function addComponentStyle ( $ name , ComponentStyle $ component_style ) { $ this -> componentStyles [ ( string ) $ name ] = $ component_style ; return $ this ; }
|
Setter for componentStyles .
|
52,707
|
public function addComponentLayout ( $ name , ComponentLayout $ component_layout ) { $ this -> componentLayouts [ ( string ) $ name ] = $ component_layout ; return $ this ; }
|
Setter for componentLayouts .
|
52,708
|
public function getMatchHistory ( $ id , $ name , $ region = '1' , array $ options = [ ] ) { return $ this -> request ( '/profile/' . ( string ) $ id . '/' . ( string ) $ region . '/' . ( string ) $ name . '/matches' , $ options ) ; }
|
Get match history
|
52,709
|
public function getProfileUser ( $ accessToken = null , array $ options = [ ] ) { if ( null === $ accessToken ) { $ options [ 'access_token' ] = $ this -> blizzardClient -> getAccessToken ( ) ; } else { $ options [ 'access_token' ] = $ accessToken ; } return $ this -> request ( '/profile/user' , $ options ) ; }
|
Get profile user
|
52,710
|
protected function parseResponse ( $ data ) { if ( ! array_key_exists ( $ this -> arrayKey , $ data ) ) { throw new \ Paysafe \ PaysafeException ( 'Missing array key from results' ) ; } foreach ( $ data [ $ this -> arrayKey ] as $ row ) { array_push ( $ this -> results , new $ this -> className ( $ row ) ) ; } $ this -> nextPage = null ; if ( array_key_exists ( 'links' , $ data ) ) { foreach ( $ data [ 'links' ] as $ link ) { if ( $ link [ 'rel' ] == 'next' ) { $ this -> nextPage = new \ Paysafe \ Link ( $ link ) ; } } } }
|
Parse the response for the result set and next page .
|
52,711
|
public function hasComponentType ( $ class_name ) { foreach ( $ this -> components as $ comp ) { if ( $ comp instanceof $ class_name ) { return TRUE ; } if ( $ comp instanceof ComponentNested ) { if ( $ comp -> hasComponentType ( $ class_name ) ) { return TRUE ; } } } return FALSE ; }
|
Component has a child of a certain type .
|
52,712
|
public function setTextColor ( $ value ) { $ value = strtoupper ( $ value ) ; if ( $ this -> validateTextColor ( $ value ) ) { $ this -> textColor = $ value ; } return $ this ; }
|
Setter for textColor .
|
52,713
|
public function setUnderline ( $ value ) { if ( is_object ( $ value ) && ! $ value instanceof TextStrokeStyle ) { $ this -> triggerError ( 'Object not of type TextStrokeStyle' ) ; } else { $ this -> underline = $ value ; } return $ this ; }
|
Setter for underline .
|
52,714
|
public function setStrikethrough ( $ value ) { if ( is_object ( $ value ) && ! $ value instanceof TextStrokeStyle ) { $ this -> triggerError ( 'Object not of type TextStrokeStyle' ) ; } else { $ this -> strikethrough = $ value ; } return $ this ; }
|
Setter for strikethrough .
|
52,715
|
public function deleteProfile ( CustomerVault \ Profile $ profile ) { $ profile -> setRequiredFields ( array ( 'id' ) ) ; $ profile -> checkRequiredFields ( ) ; $ request = new Request ( array ( 'method' => Request :: DELETE , 'uri' => $ this -> prepareURI ( "/profiles/" . $ profile -> id ) ) ) ; $ this -> client -> processRequest ( $ request ) ; return true ; }
|
Delete profile .
|
52,716
|
public function createAddress ( CustomerVault \ Address $ address ) { $ address -> setRequiredFields ( array ( 'profileID' ) ) ; $ address -> checkRequiredFields ( ) ; $ address -> setRequiredFields ( array ( 'country' ) ) ; $ address -> setOptionalFields ( array ( 'nickName' , 'street' , 'street2' , 'city' , 'state' , 'zip' , 'recipientName' , 'phone' , 'defaultShippingAddressIndicator' , ) ) ; $ request = new Request ( array ( 'method' => Request :: POST , 'uri' => $ this -> prepareURI ( "/profiles/" . $ address -> profileID . "/addresses" ) , 'body' => $ address ) ) ; $ response = $ this -> client -> processRequest ( $ request ) ; $ response [ 'profileID' ] = $ address -> profileID ; return new CustomerVault \ Address ( $ response ) ; }
|
Create address .
|
52,717
|
public function updateAddress ( CustomerVault \ Address $ address ) { $ address -> setRequiredFields ( array ( 'profileID' , 'id' ) ) ; $ address -> checkRequiredFields ( ) ; $ address -> setRequiredFields ( array ( 'country' ) ) ; $ address -> setOptionalFields ( array ( 'nickName' , 'street' , 'street2' , 'city' , 'state' , 'zip' , 'recipientName' , 'phone' , 'defaultShippingAddressIndicator' , ) ) ; $ request = new Request ( array ( 'method' => Request :: PUT , 'uri' => $ this -> prepareURI ( "/profiles/" . $ address -> profileID . "/addresses/" . $ address -> id ) , 'body' => $ address ) ) ; $ response = $ this -> client -> processRequest ( $ request ) ; $ response [ 'profileID' ] = $ address -> profileID ; return new CustomerVault \ Address ( $ response ) ; }
|
Update address .
|
52,718
|
public function deleteAddress ( CustomerVault \ Address $ address ) { $ address -> setRequiredFields ( array ( 'profileID' , 'id' ) ) ; $ address -> checkRequiredFields ( ) ; $ request = new Request ( array ( 'method' => Request :: DELETE , 'uri' => $ this -> prepareURI ( "/profiles/" . $ address -> profileID . "/addresses/" . $ address -> id ) , ) ) ; $ this -> client -> processRequest ( $ request ) ; return true ; }
|
Delete address .
|
52,719
|
public function getAddress ( CustomerVault \ Address $ address ) { $ address -> setRequiredFields ( array ( 'profileID' , 'id' ) ) ; $ address -> checkRequiredFields ( ) ; $ request = new Request ( array ( 'method' => Request :: GET , 'uri' => $ this -> prepareURI ( "/profiles/" . $ address -> profileID . "/addresses/" . $ address -> id ) , ) ) ; $ response = $ this -> client -> processRequest ( $ request ) ; $ response [ 'profileID' ] = $ address -> profileID ; return new CustomerVault \ Address ( $ response ) ; }
|
Get the address .
|
52,720
|
public function createCard ( CustomerVault \ Card $ card ) { $ card -> setRequiredFields ( array ( 'profileID' ) ) ; $ card -> checkRequiredFields ( ) ; $ card -> setRequiredFields ( array ( 'cardNum' , 'cardExpiry' ) ) ; $ card -> setOptionalFields ( array ( 'nickName' , 'merchantRefNum' , 'holderName' , 'billingAddressId' , ) ) ; $ request = new Request ( array ( 'method' => Request :: POST , 'uri' => $ this -> prepareURI ( "/profiles/" . $ card -> profileID . "/cards" ) , 'body' => $ card ) ) ; $ response = $ this -> client -> processRequest ( $ request ) ; $ response [ 'profileID' ] = $ card -> profileID ; return new CustomerVault \ Card ( $ response ) ; }
|
Create card .
|
52,721
|
public function updateCard ( CustomerVault \ Card $ card ) { $ card -> setRequiredFields ( array ( 'profileID' , 'id' ) ) ; $ card -> checkRequiredFields ( ) ; $ card -> setRequiredFields ( array ( ) ) ; $ card -> setOptionalFields ( array ( 'cardExpiry' , 'nickName' , 'merchantRefNum' , 'holderName' , 'billingAddressId' , 'defaultCardIndicator' , ) ) ; $ request = new Request ( array ( 'method' => Request :: PUT , 'uri' => $ this -> prepareURI ( "/profiles/" . $ card -> profileID . "/cards/" . $ card -> id ) , 'body' => $ card ) ) ; $ response = $ this -> client -> processRequest ( $ request ) ; $ response [ 'profileID' ] = $ card -> profileID ; return new CustomerVault \ Card ( $ response ) ; }
|
Update card .
|
52,722
|
public function deleteCard ( CustomerVault \ Card $ card ) { $ card -> setRequiredFields ( array ( 'profileID' , 'id' ) ) ; $ card -> checkRequiredFields ( ) ; $ request = new Request ( array ( 'method' => Request :: DELETE , 'uri' => $ this -> prepareURI ( "/profiles/" . $ card -> profileID . "/cards/" . $ card -> id ) , ) ) ; $ this -> client -> processRequest ( $ request ) ; return true ; }
|
Delete card .
|
52,723
|
public function getCard ( CustomerVault \ Card $ card ) { $ card -> setRequiredFields ( array ( 'profileID' , 'id' ) ) ; $ card -> checkRequiredFields ( ) ; $ request = new Request ( array ( 'method' => Request :: GET , 'uri' => $ this -> prepareURI ( "/profiles/" . $ card -> profileID . "/cards/" . $ card -> id ) , ) ) ; $ response = $ this -> client -> processRequest ( $ request ) ; $ response [ 'profileID' ] = $ card -> profileID ; return new CustomerVault \ Card ( $ response ) ; }
|
Get the card .
|
52,724
|
public function createACHBankAccount ( CustomerVault \ ACHBankaccounts $ bankDetails ) { $ bankDetails -> setRequiredFields ( array ( 'accountHolderName' , 'accountNumber' , 'routingNumber' , 'billingAddressId' , 'accountType' ) ) ; $ bankDetails -> checkRequiredFields ( ) ; $ bankDetails -> setOptionalFields ( array ( 'nickName' , 'merchantRefNum' ) ) ; $ request = new Request ( array ( 'method' => Request :: POST , 'uri' => $ this -> prepareURI ( "/profiles/" . $ bankDetails -> id . "/achbankaccounts" ) , 'body' => $ bankDetails ) ) ; $ response = $ this -> client -> processRequest ( $ request ) ; return new CustomerVault \ ACHBankaccounts ( $ response ) ; }
|
Creates ACH bank account for given profile id .
|
52,725
|
public function createEFTBankAccount ( CustomerVault \ EFTBankaccounts $ bankDetails ) { $ bankDetails -> setRequiredFields ( array ( 'accountNumber' , 'transitNumber' , 'institutionId' , 'accountHolderName' , 'billingAddressId' ) ) ; $ bankDetails -> checkRequiredFields ( ) ; $ bankDetails -> setOptionalFields ( array ( 'nickName' , 'merchantRefNum' ) ) ; $ request = new Request ( array ( 'method' => Request :: POST , 'uri' => $ this -> prepareURI ( "/profiles/" . $ bankDetails -> id . "/eftbankaccounts" ) , 'body' => $ bankDetails ) ) ; $ response = $ this -> client -> processRequest ( $ request ) ; return new CustomerVault \ EFTBankaccounts ( $ response ) ; }
|
Creates EFT bank account for given profile id .
|
52,726
|
public function createBACSBankAccount ( CustomerVault \ BACSBankaccounts $ bankDetails ) { $ bankDetails -> setRequiredFields ( array ( 'accountNumber' , 'sortCode' , 'accountHolderName' , 'billingAddressId' ) ) ; $ bankDetails -> checkRequiredFields ( ) ; $ bankDetails -> setOptionalFields ( array ( 'mandates' , 'nickName' , 'merchantRefNum' ) ) ; $ request = new Request ( array ( 'method' => Request :: POST , 'uri' => $ this -> prepareURI ( "/profiles/" . $ bankDetails -> id . "/bacsbankaccounts" ) , 'body' => $ bankDetails ) ) ; $ response = $ this -> client -> processRequest ( $ request ) ; return new CustomerVault \ BACSBankaccounts ( $ response ) ; }
|
Creates BACS bank account for given profile id .
|
52,727
|
public function createSEPABankAccount ( CustomerVault \ SEPABankaccounts $ bankDetails ) { $ bankDetails -> setRequiredFields ( array ( 'iban' , 'accountHolderName' , 'billingAddressId' ) ) ; $ bankDetails -> checkRequiredFields ( ) ; $ bankDetails -> setOptionalFields ( array ( 'bic' , 'mandates' , 'nickName' , 'merchantRefNum' ) ) ; $ request = new Request ( array ( 'method' => Request :: POST , 'uri' => $ this -> prepareURI ( "/profiles/" . $ bankDetails -> id . "/sepabankaccounts" ) , 'body' => $ bankDetails ) ) ; $ response = $ this -> client -> processRequest ( $ request ) ; return new CustomerVault \ SEPABankaccounts ( $ response ) ; }
|
Creates SEPA bank account for given profile id .
|
52,728
|
public function getACHBankAccount ( CustomerVault \ Profile $ profile , CustomerVault \ ACHBankaccounts $ bankDetails ) { $ profile -> setRequiredFields ( array ( 'id' ) ) ; $ profile -> checkRequiredFields ( ) ; $ bankDetails -> setRequiredFields ( array ( 'id' ) ) ; $ bankDetails -> checkRequiredFields ( ) ; $ request = new Request ( array ( 'method' => Request :: GET , 'uri' => $ this -> prepareURI ( "/profiles/" . $ profile -> id . "/achbankaccounts/" . $ bankDetails -> id ) , 'body' => $ profile ) ) ; print_r ( $ request ) ; $ response = $ this -> client -> processRequest ( $ request ) ; print_r ( $ response ) ; return new CustomerVault \ ACHBankaccounts ( $ response ) ; }
|
Lookup ACH bank account
|
52,729
|
public function getEFTBankAccount ( CustomerVault \ Profile $ profile , CustomerVault \ EFTBankaccounts $ bankDetails ) { $ profile -> setRequiredFields ( array ( 'id' ) ) ; $ profile -> checkRequiredFields ( ) ; $ bankDetails -> setRequiredFields ( array ( 'id' ) ) ; $ bankDetails -> checkRequiredFields ( ) ; $ request = new Request ( array ( 'method' => Request :: GET , 'uri' => $ this -> prepareURI ( "/profiles/" . $ profile -> id . "/eftbankaccounts/" . $ bankDetails -> id ) , 'body' => $ profile ) ) ; $ response = $ this -> client -> processRequest ( $ request ) ; return new CustomerVault \ EFTBankaccounts ( $ response ) ; }
|
Lookup EFT bank account
|
52,730
|
public function getBACSBankAccount ( CustomerVault \ Profile $ profile , CustomerVault \ BACSBankaccounts $ bankDetails ) { $ profile -> setRequiredFields ( array ( 'id' ) ) ; $ profile -> checkRequiredFields ( ) ; $ bankDetails -> setRequiredFields ( array ( 'id' ) ) ; $ bankDetails -> checkRequiredFields ( ) ; $ request = new Request ( array ( 'method' => Request :: GET , 'uri' => $ this -> prepareURI ( "/profiles/" . $ profile -> id . "/bacsbankaccounts/" . $ bankDetails -> id ) , 'body' => $ profile ) ) ; $ response = $ this -> client -> processRequest ( $ request ) ; return new CustomerVault \ BACSBankaccounts ( $ response ) ; }
|
Lookup BACS bank account
|
52,731
|
public function getSEPABankAccount ( CustomerVault \ Profile $ profile , CustomerVault \ SEPABankaccounts $ bankDetails ) { $ profile -> setRequiredFields ( array ( 'id' ) ) ; $ profile -> checkRequiredFields ( ) ; $ bankDetails -> setRequiredFields ( array ( 'id' ) ) ; $ bankDetails -> checkRequiredFields ( ) ; $ request = new Request ( array ( 'method' => Request :: GET , 'uri' => $ this -> prepareURI ( "/profiles/" . $ profile -> id . "/sepabankaccounts/" . $ bankDetails -> id ) , 'body' => $ profile ) ) ; $ response = $ this -> client -> processRequest ( $ request ) ; return new CustomerVault \ SEPABankaccounts ( $ response ) ; }
|
Lookup SEPA bank account
|
52,732
|
public function updateEFTBankAccount ( CustomerVault \ Profile $ profile , CustomerVault \ EFTBankaccounts $ bankDetails ) { $ profile -> setRequiredFields ( array ( 'id' ) ) ; $ profile -> checkRequiredFields ( ) ; $ bankDetails -> setRequiredFields ( array ( 'transitNumber' , 'institutionId' , 'accountHolderName' , 'billingAddressId' ) ) ; $ bankDetails -> checkRequiredFields ( ) ; $ bankDetails -> setOptionalFields ( array ( 'nickName' , 'merchantRefNum' , 'accountNumber' ) ) ; $ request = new Request ( array ( 'method' => Request :: PUT , 'uri' => $ this -> prepareURI ( "/profiles/" . $ profile -> id . "/eftbankaccounts/" . $ bankDetails -> id ) , 'body' => $ bankDetails ) ) ; $ response = $ this -> client -> processRequest ( $ request ) ; return new CustomerVault \ EFTBankaccounts ( $ response ) ; }
|
Update EFT bank account
|
52,733
|
public function deleteACHBankAccount ( CustomerVault \ Profile $ profile , CustomerVault \ ACHBankaccounts $ bankDetails ) { $ bankDetails -> setRequiredFields ( array ( 'id' ) ) ; $ bankDetails -> checkRequiredFields ( ) ; $ profile -> setRequiredFields ( array ( 'id' ) ) ; $ profile -> checkRequiredFields ( ) ; $ request = new Request ( array ( 'method' => Request :: DELETE , 'uri' => $ this -> prepareURI ( "/profiles/" . $ profile -> id . "/achbankaccounts/" . $ bankDetails -> id ) ) ) ; $ response = $ this -> client -> processRequest ( $ request ) ; return $ response ; }
|
Delete ACH bank account
|
52,734
|
public function deleteEFTBankAccount ( CustomerVault \ Profile $ profile , CustomerVault \ EFTBankaccounts $ bankDetails ) { $ bankDetails -> setRequiredFields ( array ( 'id' ) ) ; $ bankDetails -> checkRequiredFields ( ) ; $ profile -> setRequiredFields ( array ( 'id' ) ) ; $ profile -> checkRequiredFields ( ) ; $ request = new Request ( array ( 'method' => Request :: DELETE , 'uri' => $ this -> prepareURI ( "/profiles/" . $ profile -> id . "/eftbankaccounts/" . $ bankDetails -> id ) ) ) ; $ response = $ this -> client -> processRequest ( $ request ) ; return $ response ; }
|
Delete EFT bank account
|
52,735
|
public function deleteBACSBankAccount ( CustomerVault \ Profile $ profile , CustomerVault \ BACSBankaccounts $ bankDetails ) { $ bankDetails -> setRequiredFields ( array ( 'id' ) ) ; $ bankDetails -> checkRequiredFields ( ) ; $ profile -> setRequiredFields ( array ( 'id' ) ) ; $ profile -> checkRequiredFields ( ) ; $ request = new Request ( array ( 'method' => Request :: DELETE , 'uri' => $ this -> prepareURI ( "/profiles/" . $ profile -> id . "/bacsbankaccounts/" . $ bankDetails -> id ) ) ) ; $ response = $ this -> client -> processRequest ( $ request ) ; return $ response ; }
|
Delete BACS bank account
|
52,736
|
public function deleteSEPABankAccount ( CustomerVault \ Profile $ profile , CustomerVault \ SEPABankaccounts $ bankDetails ) { $ profile -> setRequiredFields ( array ( 'id' ) ) ; $ profile -> checkRequiredFields ( ) ; $ bankDetails -> setRequiredFields ( array ( 'id' ) ) ; $ bankDetails -> checkRequiredFields ( ) ; $ request = new Request ( array ( 'method' => Request :: DELETE , 'uri' => $ this -> prepareURI ( "/profiles/" . $ profile -> id . "/sepabankaccounts/" . $ bankDetails -> id ) ) ) ; $ response = $ this -> client -> processRequest ( $ request ) ; return $ response ; }
|
Delete SEPA bank account
|
52,737
|
public function createMandates ( CustomerVault \ Mandates $ mandates , $ bankaccounts ) { $ mandates -> setRequiredFields ( array ( 'reference' ) ) ; $ mandates -> checkRequiredFields ( ) ; $ request = new Request ( array ( 'method' => Request :: POST , 'uri' => $ this -> prepareURI ( "/profiles/" . $ mandates -> profileID . "/" . $ bankaccounts . "/" . $ mandates -> bankAccountId . "/mandates" ) , 'body' => $ mandates ) ) ; $ response = $ this -> client -> processRequest ( $ request ) ; return new CustomerVault \ Mandates ( $ response ) ; }
|
Process Create a Mandate .
|
52,738
|
public function getMandates ( CustomerVault \ Mandates $ mandates ) { $ mandates -> setRequiredFields ( array ( 'id' ) ) ; $ mandates -> checkRequiredFields ( ) ; $ request = new Request ( array ( 'method' => Request :: GET , 'uri' => $ this -> prepareURI ( "/profiles/" . $ mandates -> profileID . "/mandates/" . $ mandates -> id ) , 'body' => $ mandates ) ) ; $ response = $ this -> client -> processRequest ( $ request ) ; return new CustomerVault \ Mandates ( $ response ) ; }
|
Process Look Up a Mandates
|
52,739
|
public function updateMandates ( CustomerVault \ Mandates $ mandates ) { $ mandates -> setRequiredFields ( array ( 'status' ) ) ; $ mandates -> checkRequiredFields ( ) ; $ request = new Request ( array ( 'method' => Request :: PUT , 'uri' => $ this -> prepareURI ( "/profiles/" . $ mandates -> profileID . "/mandates/" . $ mandates -> id ) , 'body' => $ mandates ) ) ; $ response = $ this -> client -> processRequest ( $ request ) ; return new CustomerVault \ Mandates ( $ response ) ; }
|
Process Update a Mandates
|
52,740
|
public function deleteMandates ( CustomerVault \ Mandates $ mandates ) { $ request = new Request ( array ( 'method' => Request :: DELETE , 'uri' => $ this -> prepareURI ( "/profiles/" . $ mandates -> profileID . "/mandates/" . $ mandates -> id ) , 'body' => $ mandates ) ) ; $ response = $ this -> client -> processRequest ( $ request ) ; return $ response ; }
|
Process Delete a Mandates
|
52,741
|
public function setMargin ( $ value ) { if ( is_object ( $ value ) && ! $ value instanceof Margin ) { $ this -> triggerError ( 'Object not of type Margin' ) ; } else { $ this -> margin = $ value ; } return $ this ; }
|
Setter for margin .
|
52,742
|
public function setContentInset ( $ value ) { if ( is_object ( $ value ) && ! $ value instanceof ContentInset ) { $ this -> triggerError ( 'Object not of type ContentInset' ) ; } else { $ this -> contentInset = $ value ; } return $ this ; }
|
Setter for contentInset .
|
52,743
|
public function setIgnoreDocumentMargin ( $ value = TRUE ) { if ( $ this -> validateIgnoreDocumentMargin ( $ value ) ) { $ this -> ignoreDocumentMargin = $ value ; } return $ this ; }
|
Setter for ignoreDocumentMargin .
|
52,744
|
public function setIgnoreDocumentGutter ( $ value = TRUE ) { if ( $ this -> validateIgnoreDocumentGutter ( $ value ) ) { $ this -> ignoreDocumentGutter = $ value ; } return $ this ; }
|
Setter for ignoreDocumentGutter .
|
52,745
|
protected function validateIgnoreDocumentMargin ( $ value ) { if ( ! is_bool ( $ value ) && ! in_array ( $ value , [ 'none' , 'left' , 'right' , 'both' ] ) ) { $ this -> triggerError ( 'ignoreDocumentMargin is not valid' ) ; return FALSE ; } return TRUE ; }
|
Validates the ignoreDocumentMargin attribute .
|
52,746
|
protected function validateIgnoreDocumentGutter ( $ value ) { if ( ! is_bool ( $ value ) && ! in_array ( $ value , [ 'none' , 'left' , 'right' , 'both' ] ) ) { $ this -> triggerError ( 'ignoreDocumentGutter is not valid' ) ; return FALSE ; } return TRUE ; }
|
Validates the ignoreDocumentGutter attribute .
|
52,747
|
protected function validateMinimumHeight ( $ value ) { if ( ! is_int ( $ value ) && ! $ this -> isSupportedUnit ( $ value ) ) { $ this -> triggerError ( 'minimumHeight is not valid' ) ; return FALSE ; } return TRUE ; }
|
Validates the minimumHeight attribute .
|
52,748
|
protected function validateMaximumContentWidth ( $ value ) { if ( ! is_int ( $ value ) && ! $ this -> isSupportedUnit ( $ value ) ) { $ this -> triggerError ( 'maximumContentWidth is not valid' ) ; return FALSE ; } return TRUE ; }
|
Validates the maximumContentWidth attribute .
|
52,749
|
public function getGuild ( $ realm , $ guildName , array $ options = [ ] ) { return $ this -> request ( '/guild/' . ( string ) $ realm . '/' . ( string ) $ guildName , $ options ) ; }
|
Get guild profile
|
52,750
|
public function getProfileCharacters ( $ accessToken = null , array $ options = [ ] ) { if ( null === $ accessToken ) { $ options [ 'access_token' ] = $ this -> blizzardClient -> getAccessToken ( ) ; } else { $ options [ 'access_token' ] = $ accessToken ; } return $ this -> request ( '/user/characters' , $ options ) ; }
|
Get profile characters
|
52,751
|
private function submitPurchaseBACS ( DirectDebit \ Purchase $ purchase ) { $ fields = array ( 'merchantRefNum' , 'amount' , 'bacs' ) ; if ( ! isset ( $ purchase -> bacs -> paymentToken ) ) { $ fields [ ] = 'profile' ; $ fields [ ] = 'billingDetails' ; $ fields2 = array ( "firstName" , "lastName" ) ; $ purchase -> profile -> setRequiredFields ( $ fields2 ) ; $ purchase -> profile -> checkRequiredFields ( $ fields2 ) ; } $ purchase -> setRequiredFields ( $ fields ) ; $ purchase -> checkRequiredFields ( ) ; $ purchase -> setOptionalFields ( array ( 'customerIp' , 'dupCheck' ) ) ; $ request = new Request ( array ( 'method' => Request :: POST , 'uri' => $ this -> prepareURI ( $ this -> purchasePath ) , 'body' => $ purchase ) ) ; $ response = $ this -> client -> processRequest ( $ request ) ; return new DirectDebit \ Purchase ( $ response ) ; }
|
Process Purchase using BACS without payment token .
|
52,752
|
public function cancelPurchase ( DirectDebit \ Purchase $ purchase ) { $ purchase -> setRequiredFields ( array ( 'id' , 'status' ) ) ; $ purchase -> checkRequiredFields ( ) ; $ request = new Request ( array ( 'method' => Request :: PUT , 'uri' => $ this -> prepareURI ( $ this -> purchasePath . $ this -> uriseparator . $ purchase -> id ) , 'body' => $ purchase ) ) ; $ response = $ this -> client -> processRequest ( $ request ) ; return new DirectDebit \ Purchase ( $ response ) ; }
|
Cancel Purchase .
|
52,753
|
public function standaloneCredits ( DirectDebit \ StandaloneCredits $ standalonecredits ) { if ( isset ( $ standalonecredits -> ach ) ) { $ return = $ this -> standalonecreditsACH ( $ standalonecredits ) ; } else if ( isset ( $ standalonecredits -> eft ) ) { $ return = $ this -> standalonecreditsEFT ( $ standalonecredits ) ; } else if ( isset ( $ standalonecredits -> bacs ) ) { $ return = $ this -> standalonecreditsBACS ( $ standalonecredits ) ; } return $ return ; }
|
Submit Standalone Cedits
|
52,754
|
private function standalonecreditsBACS ( DirectDebit \ StandaloneCredits $ standalonecredits ) { $ fields = array ( 'merchantRefNum' , 'amount' , 'bacs' ) ; if ( ! isset ( $ standalonecredits -> bacs -> paymentToken ) ) { $ fields [ ] = 'profile' ; $ fields [ ] = 'billingDetails' ; $ fields2 = array ( "firstName" , "lastName" ) ; $ standalonecredits -> profile -> setRequiredFields ( $ fields2 ) ; $ standalonecredits -> profile -> checkRequiredFields ( $ fields2 ) ; } $ standalonecredits -> setRequiredFields ( $ fields ) ; $ standalonecredits -> checkRequiredFields ( ) ; $ standalonecredits -> setOptionalFields ( array ( 'customerIp' , 'dupCheck' ) ) ; $ request = new Request ( array ( 'method' => Request :: POST , 'uri' => $ this -> prepareURI ( $ this -> standalonePath ) , 'body' => $ standalonecredits ) ) ; $ response = $ this -> client -> processRequest ( $ request ) ; return new DirectDebit \ StandaloneCredits ( $ response ) ; }
|
Process Standalone Credits using BACS without payment token .
|
52,755
|
public function cancelStandalonecredits ( DirectDebit \ StandaloneCredits $ standalonecredits ) { $ standalonecredits -> setRequiredFields ( array ( 'id' ) ) ; $ standalonecredits -> checkRequiredFields ( ) ; $ tmpAuth = new DirectDebit \ StandaloneCredits ( array ( 'status' => 'CANCELLED' ) ) ; $ request = new Request ( array ( 'method' => Request :: PUT , 'uri' => $ this -> prepareURI ( $ this -> standalonePath . $ this -> uriseparator . $ standalonecredits -> id ) , 'body' => $ tmpAuth ) ) ; $ response = $ this -> client -> processRequest ( $ request ) ; return new DirectDebit \ StandaloneCredits ( $ response ) ; }
|
Cancel StandaloneCredits .
|
52,756
|
public function setHeaders ( array $ headers , $ reset = false ) { if ( $ reset === true ) { $ this -> api_headers = $ headers ; } else { $ this -> api_headers += $ headers ; } return $ this ; }
|
Set the headers for all requests
|
52,757
|
public function get ( $ method , $ params = [ ] , $ headers = [ ] ) { return $ this -> makeRequest ( $ method , self :: METHOD_GET , $ params , $ headers ) ; }
|
Get an object or list .
|
52,758
|
public function post ( $ method , $ params = [ ] , $ headers = [ ] ) { return $ this -> makeRequest ( $ method , self :: METHOD_POST , $ params , $ headers ) ; }
|
Post to an endpoint .
|
52,759
|
public function update ( $ method , $ params = [ ] , $ headers = [ ] ) { return $ this -> makeRequest ( $ method , self :: METHOD_PUT , $ params , $ headers ) ; }
|
Update an object . Must include the ID .
|
52,760
|
public function delete ( $ method , $ params = [ ] , $ headers = [ ] ) { return $ this -> makeRequest ( $ method , self :: METHOD_DELETE , $ params , $ headers ) ; }
|
Delete an object . Must include the ID .
|
52,761
|
private function makeRequest ( $ method , $ request , $ params = [ ] , $ headers = [ ] ) { $ url = $ this -> getEndpoint ( ) . '/' . $ method ; if ( $ params && ( $ request == self :: METHOD_GET || $ request == self :: METHOD_DELETE ) ) { $ url .= '?' . http_build_query ( $ params ) ; } $ ch = curl_init ( ) ; curl_setopt ( $ ch , CURLOPT_URL , $ url ) ; curl_setopt ( $ ch , CURLOPT_USERAGENT , 'WhenIWork-PHP/' . static :: VERSION ) ; $ headers += $ this -> getHeaders ( ) ; $ headers [ 'Content-Type' ] = 'application/json' ; if ( $ this -> api_token ) { $ headers [ 'W-Token' ] = $ this -> api_token ; } $ headers_data = [ ] ; foreach ( $ headers as $ k => $ v ) { $ headers_data [ ] = $ k . ': ' . $ v ; } curl_setopt ( $ ch , CURLOPT_HTTPHEADER , $ headers_data ) ; curl_setopt ( $ ch , CURLOPT_CUSTOMREQUEST , strtoupper ( $ request ) ) ; curl_setopt ( $ ch , CURLOPT_FOLLOWLOCATION , true ) ; curl_setopt ( $ ch , CURLOPT_HEADER , false ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( $ ch , CURLOPT_TIMEOUT , 10 ) ; curl_setopt ( $ ch , CURLOPT_SSL_VERIFYPEER , $ this -> verify_ssl ) ; if ( in_array ( $ request , [ self :: METHOD_POST , self :: METHOD_PUT , self :: METHOD_PATCH ] ) ) { curl_setopt ( $ ch , CURLOPT_POSTFIELDS , json_encode ( $ params ) ) ; } $ result = curl_exec ( $ ch ) ; curl_close ( $ ch ) ; return $ result ? json_decode ( $ result ) : false ; }
|
Performs the underlying HTTP request . Exciting stuff happening here . Not really .
|
52,762
|
public static function login ( $ key , $ email , $ password ) { $ params = [ "username" => $ email , "password" => $ password , ] ; $ headers = [ 'W-Key' => $ key ] ; $ login = new static ( ) ; $ response = $ login -> makeRequest ( "login" , self :: METHOD_POST , $ params , $ headers ) ; return $ response ; }
|
Login helper using developer key and credentials to get back a login response
|
52,763
|
protected function dependencyIsValid ( string $ asset , string $ dependency , array $ original , array $ assets ) : bool { $ isCircular = function ( $ asset , $ dependency , $ assets ) { return isset ( $ assets [ $ dependency ] ) && \ in_array ( $ asset , $ assets [ $ dependency ] [ 'dependencies' ] ) ; } ; if ( ! isset ( $ original [ $ dependency ] ) ) { return false ; } elseif ( $ dependency === $ asset ) { throw new RuntimeException ( "Asset [$asset] is dependent on itself." ) ; } elseif ( $ isCircular ( $ asset , $ dependency , $ assets ) ) { throw new RuntimeException ( "Assets [$asset] and [$dependency] have a circular dependency." ) ; } return true ; }
|
Verify that an asset s dependency is valid .
|
52,764
|
public function call ( $ method = 'GET' , $ uri = null , $ headers = null , $ body = null , array $ options = array ( ) , $ classToUnserialize = null ) { $ request = $ this -> client -> createRequest ( $ method , $ uri , $ headers , $ body , $ options ) ; if ( $ classToUnserialize ) { return $ this -> serializer -> deserialize ( ( string ) $ this -> send ( $ request ) -> getBody ( ) , $ classToUnserialize , 'xml' ) ; } return $ this -> send ( $ request ) ; }
|
Use this method to call a specific API resource .
|
52,765
|
public static function mock ( $ namespace , $ name ) { $ delegateBuilder = new MockDelegateFunctionBuilder ( ) ; $ delegateBuilder -> build ( $ name ) ; $ mockeryMock = Mockery :: mock ( $ delegateBuilder -> getFullyQualifiedClassName ( ) ) ; $ mockeryMock -> makePartial ( ) -> shouldReceive ( MockDelegateFunctionBuilder :: METHOD ) ; $ builder = new MockBuilder ( ) ; $ builder -> setNamespace ( $ namespace ) -> setName ( $ name ) -> setFunctionProvider ( $ mockeryMock ) ; $ mock = $ builder -> build ( ) ; $ mock -> enable ( ) ; $ disabler = new MockDisabler ( $ mock ) ; Mockery :: getContainer ( ) -> rememberMock ( $ disabler ) ; return new ExpectationProxy ( $ mockeryMock ) ; }
|
Builds a function mock .
|
52,766
|
public function text ( $ name , $ options = [ ] ) { $ requiredClass = ( isset ( $ options [ 'required' ] ) && $ options [ 'required' ] == true ) ? 'required ' : '' ; $ hasError = $ this -> errorBag -> has ( $ this -> formatArrayName ( $ name ) ) ; $ hasErrorClass = $ hasError ? 'has-error' : '' ; $ htmlForm = '<div class="form-group ' . $ requiredClass . $ hasErrorClass . '">' ; $ htmlForm .= $ this -> setFormFieldLabel ( $ name , $ options ) ; if ( isset ( $ options [ 'addon' ] ) ) { $ htmlForm .= '<div class="input-group">' ; } if ( isset ( $ options [ 'addon' ] [ 'before' ] ) ) { $ htmlForm .= '<span class="input-group-prepend"><div class="input-group-text">' . $ options [ 'addon' ] [ 'before' ] . '</div></span>' ; } $ type = isset ( $ options [ 'type' ] ) ? $ options [ 'type' ] : 'text' ; $ value = isset ( $ options [ 'value' ] ) ? $ options [ 'value' ] : null ; $ fieldAttributes = $ this -> getFieldAttributes ( $ options ) ; if ( isset ( $ options [ 'placeholder' ] ) ) { $ fieldAttributes += [ 'placeholder' => $ options [ 'placeholder' ] ] ; } if ( $ hasError ) { $ fieldAttributes [ 'class' ] .= ' is-invalid' ; } $ htmlForm .= FormFacade :: input ( $ type , $ name , $ value , $ fieldAttributes ) ; if ( isset ( $ options [ 'addon' ] [ 'after' ] ) ) { $ htmlForm .= '<span class="input-group-append"><div class="input-group-text">' . $ options [ 'addon' ] [ 'after' ] . '</div></span>' ; } if ( isset ( $ options [ 'addon' ] ) ) { $ htmlForm .= '</div>' ; } $ htmlForm .= $ this -> getInfoTextLine ( $ options ) ; $ htmlForm .= $ this -> errorBag -> first ( $ this -> formatArrayName ( $ name ) , '<span class="invalid-feedback" role="alert">:message</span>' ) ; $ htmlForm .= '</div>' ; return $ htmlForm ; }
|
Text input field that wrapped with form - group bootstrap div .
|
52,767
|
public function radios ( $ name , $ radioOptions , $ options = [ ] ) { $ requiredClass = ( isset ( $ options [ 'required' ] ) && $ options [ 'required' ] == true ) ? 'required ' : '' ; $ hasError = $ this -> errorBag -> has ( $ this -> formatArrayName ( $ name ) ) ; $ hasErrorClass = $ hasError ? 'has-error' : '' ; $ htmlForm = '<div class="form-group ' . $ requiredClass . $ hasErrorClass . '">' ; $ htmlForm .= $ this -> setFormFieldLabel ( $ name , $ options ) ; $ htmlForm .= '<div>' ; foreach ( $ radioOptions as $ key => $ option ) { $ value = null ; $ fieldParams = [ 'id' => $ name . '_' . $ key , 'class' => 'form-check-input' ] ; if ( isset ( $ options [ 'value' ] ) && $ options [ 'value' ] == $ key ) { $ value = true ; } if ( isset ( $ options [ 'v-model' ] ) ) { $ fieldParams += [ 'v-model' => $ options [ 'v-model' ] ] ; } if ( isset ( $ options [ 'required' ] ) && $ options [ 'required' ] == true ) { $ fieldParams += [ 'required' => true ] ; } if ( $ hasError ) { $ fieldParams [ 'class' ] .= ' is-invalid' ; } $ listStyle = isset ( $ options [ 'list_style' ] ) ? $ options [ 'list_style' ] : 'form-check-inline' ; $ htmlForm .= '<div class="form-check ' . $ listStyle . '">' ; $ htmlForm .= FormFacade :: radio ( $ name , $ key , $ value , $ fieldParams ) ; $ htmlForm .= '<label for="' . $ name . '_' . $ key . '" class="form-check-label">' . $ option . '</label>' ; $ htmlForm .= '</div>' ; } $ htmlForm .= '</div>' ; $ htmlForm .= $ this -> getInfoTextLine ( $ options ) ; $ htmlForm .= $ this -> errorBag -> first ( $ this -> formatArrayName ( $ name ) , '<span class="small text-danger" role="alert">:message</span>' ) ; $ htmlForm .= '</div>' ; return $ htmlForm ; }
|
Radio field wrapped with form - group bootstrap div .
|
52,768
|
public function checkboxes ( $ name , array $ checkboxOptions , $ options = [ ] ) { $ requiredClass = ( isset ( $ options [ 'required' ] ) && $ options [ 'required' ] == true ) ? 'required ' : '' ; $ hasError = $ this -> errorBag -> has ( $ name ) ; $ hasErrorClass = $ hasError ? 'has-error' : '' ; $ htmlForm = '<div class="form-group ' . $ requiredClass . $ hasErrorClass . '">' ; $ htmlForm .= $ this -> setFormFieldLabel ( $ name , $ options ) ; $ htmlForm .= '<div>' ; if ( isset ( $ options [ 'value' ] ) ) { $ value = $ options [ 'value' ] ; if ( is_array ( $ options [ 'value' ] ) ) { $ value = new Collection ( $ options [ 'value' ] ) ; } } else { $ value = new Collection ( ) ; } foreach ( $ checkboxOptions as $ key => $ option ) { $ fieldParams = [ 'id' => $ name . '_' . $ key , 'class' => 'form-check-input' ] ; if ( isset ( $ options [ 'v-model' ] ) ) { $ fieldParams += [ 'v-model' => $ options [ 'v-model' ] ] ; } if ( $ hasError ) { $ fieldParams [ 'class' ] .= ' is-invalid' ; } $ listStyle = isset ( $ options [ 'list_style' ] ) ? $ options [ 'list_style' ] : 'form-check-inline' ; $ htmlForm .= '<div class="form-check ' . $ listStyle . '">' ; $ htmlForm .= FormFacade :: checkbox ( $ name . '[]' , $ key , $ value -> contains ( $ key ) , $ fieldParams ) ; $ htmlForm .= '<label for="' . $ name . '_' . $ key . '" class="form-check-label">' . $ option . '</label>' ; $ htmlForm .= '</div>' ; } $ htmlForm .= '</div>' ; $ htmlForm .= $ this -> getInfoTextLine ( $ options ) ; $ htmlForm .= $ this -> errorBag -> first ( $ this -> formatArrayName ( $ name ) , '<span class="small text-danger" role="alert">:message</span>' ) ; $ htmlForm .= '</div>' ; return $ htmlForm ; }
|
Multi checkbox with array input wrapped with bootstrap form - group div .
|
52,769
|
public function textDisplay ( $ name , $ value , $ options = [ ] ) { $ label = isset ( $ options [ 'label' ] ) ? $ options [ 'label' ] : $ this -> formatFieldLabel ( $ name ) ; $ requiredClass = '' ; if ( isset ( $ options [ 'required' ] ) && $ options [ 'required' ] == true ) { $ requiredClass .= ' required ' ; } $ fieldId = isset ( $ options [ 'id' ] ) ? 'id="' . $ options [ 'id' ] . '" ' : '' ; $ htmlForm = '<div class="form-group' . $ requiredClass . '">' ; $ htmlForm .= FormFacade :: label ( $ name , $ label , [ 'class' => 'form-label' ] ) ; $ htmlForm .= '<div class="form-control" ' . $ fieldId . 'readonly>' . $ value . '</div>' ; $ htmlForm .= '</div>' ; return $ htmlForm ; }
|
Display a text on the form as disabled input .
|
52,770
|
public function delete ( $ form_params = [ ] , $ button_label = 'x' , $ button_options = [ ] , $ hiddenFields = [ ] ) { $ form_params [ 'method' ] = 'delete' ; $ form_params [ 'class' ] = isset ( $ form_params [ 'class' ] ) ? $ form_params [ 'class' ] : 'del-form pull-right float-right' ; if ( isset ( $ form_params [ 'onsubmit' ] ) ) { if ( $ form_params [ 'onsubmit' ] != false ) { $ form_params [ 'onsubmit' ] = $ form_params [ 'onsubmit' ] ; } } else { $ form_params [ 'onsubmit' ] = 'Are you sure to delete this?' ; } if ( ! isset ( $ button_options [ 'title' ] ) ) { $ button_options [ 'title' ] = 'Delete this item' ; } return $ this -> formButton ( $ form_params , $ button_label , $ button_options , $ hiddenFields ) ; }
|
A form button that dedicated for submitting a delete request .
|
52,771
|
public function price ( $ name , $ options = [ ] ) { $ options [ 'addon' ] = [ 'before' => isset ( $ options [ 'currency' ] ) ? $ options [ 'currency' ] : 'Rp' ] ; $ options [ 'class' ] = isset ( $ options [ 'class' ] ) ? $ options [ 'class' ] . ' text-right' : 'text-right' ; return $ this -> text ( $ name , $ options ) ; }
|
Price input field that wrapped with form - group bootstrap div .
|
52,772
|
private function setFormFieldLabel ( $ name , $ options ) { if ( isset ( $ options [ 'label' ] ) && $ options [ 'label' ] != false ) { $ label = isset ( $ options [ 'label' ] ) ? $ options [ 'label' ] : $ this -> formatFieldLabel ( $ name ) ; return FormFacade :: label ( $ name , $ label , [ 'class' => 'form-label' ] ) . ' ' ; } elseif ( ! isset ( $ options [ 'label' ] ) ) { return FormFacade :: label ( $ name , $ this -> formatFieldLabel ( $ name ) , [ 'class' => 'form-label' ] ) . ' ' ; } }
|
Set the form field label .
|
52,773
|
private function getFieldAttributes ( array $ options ) { $ fieldAttributes = [ 'class' => 'form-control' ] ; if ( isset ( $ options [ 'class' ] ) ) { $ fieldAttributes [ 'class' ] .= ' ' . $ options [ 'class' ] ; } if ( isset ( $ options [ 'id' ] ) ) { $ fieldAttributes += [ 'id' => $ options [ 'id' ] ] ; } if ( isset ( $ options [ 'readonly' ] ) && $ options [ 'readonly' ] == true ) { $ fieldAttributes += [ 'readonly' ] ; } if ( isset ( $ options [ 'disabled' ] ) && $ options [ 'disabled' ] == true ) { $ fieldAttributes += [ 'disabled' ] ; } if ( isset ( $ options [ 'required' ] ) && $ options [ 'required' ] == true ) { $ fieldAttributes += [ 'required' ] ; } if ( isset ( $ options [ 'min' ] ) ) { $ fieldAttributes += [ 'min' => $ options [ 'min' ] ] ; } if ( isset ( $ options [ 'max' ] ) ) { $ fieldAttributes += [ 'max' => $ options [ 'max' ] ] ; } if ( isset ( $ options [ 'step' ] ) ) { $ fieldAttributes += [ 'step' => $ options [ 'step' ] ] ; } if ( isset ( $ options [ 'style' ] ) ) { $ fieldAttributes += [ 'style' => $ options [ 'style' ] ] ; } return $ fieldAttributes ; }
|
Get field attributes based on given option .
|
52,774
|
private function getInfoTextLine ( $ options ) { $ htmlForm = '' ; if ( isset ( $ options [ 'info' ] ) ) { $ class = isset ( $ options [ 'info' ] [ 'class' ] ) ? $ options [ 'info' ] [ 'class' ] : 'info' ; $ htmlForm .= '<p class="text-' . $ class . ' small">' . $ options [ 'info' ] [ 'text' ] . '</p>' ; } return $ htmlForm ; }
|
Get the info text line for input field .
|
52,775
|
protected function register ( string $ type , $ name , string $ source , $ dependencies , $ attributes , $ replaces ) : void { $ dependencies = ( array ) $ dependencies ; $ attributes = ( array ) $ attributes ; $ replaces = ( array ) $ replaces ; if ( \ is_array ( $ name ) ) { $ replaces = \ array_merge ( $ name , $ replaces ) ; $ name = '*' ; } $ this -> assets [ $ type ] [ $ name ] = [ 'source' => $ source , 'dependencies' => $ dependencies , 'attributes' => $ attributes , 'replaces' => $ replaces , ] ; }
|
Add an asset to the array of registered assets .
|
52,776
|
protected function zeroPoint ( ) { if ( $ this -> shouldSwitchToZeroPoint ( ) ) { $ this -> switchState ( self :: STATE_READ_DIRECTIVE ) ; } elseif ( $ this -> newLine ( ) ) { $ this -> current_word = '' ; $ this -> increment ( ) ; } else { $ this -> increment ( ) ; } return $ this ; }
|
Process state ZERO_POINT
|
52,777
|
protected function increment ( ) { $ this -> current_char = mb_substr ( $ this -> content , $ this -> char_index , 1 ) ; $ this -> current_word .= $ this -> current_char ; $ this -> current_word = ltrim ( $ this -> current_word ) ; $ this -> char_index ++ ; }
|
Move to the following step
|
52,778
|
private function addValueToDirective ( ) { $ this -> convert ( 'trim' ) ; switch ( $ this -> current_directive ) { case self :: DIRECTIVE_USERAGENT : $ this -> setCurrentUserAgent ( ) ; break ; case self :: DIRECTIVE_CACHE_DELAY : case self :: DIRECTIVE_CRAWL_DELAY : $ this -> convert ( 'floatval' ) ; $ this -> addRule ( false ) ; break ; case self :: DIRECTIVE_HOST : $ this -> addHost ( ) ; break ; case self :: DIRECTIVE_SITEMAP : $ this -> addSitemap ( ) ; break ; case self :: DIRECTIVE_CLEAN_PARAM : $ this -> addCleanParam ( ) ; break ; case self :: DIRECTIVE_ALLOW : case self :: DIRECTIVE_DISALLOW : $ this -> addRule ( ) ; break ; } $ this -> current_word = '' ; $ this -> switchState ( self :: STATE_ZERO_POINT ) ; }
|
Add value to directive
|
52,779
|
private function setCurrentUserAgent ( ) { $ ua = mb_strtolower ( trim ( $ this -> current_word ) ) ; if ( $ this -> previous_directive !== self :: DIRECTIVE_USERAGENT ) { $ this -> current_UserAgent = [ ] ; } $ this -> current_UserAgent [ ] = $ ua ; if ( empty ( $ this -> rules [ $ ua ] ) ) { $ this -> rules [ $ ua ] = [ ] ; } }
|
Set current user agent for internal usage only
|
52,780
|
private function addRule ( $ append = true ) { if ( empty ( $ this -> current_word ) ) { return ; } foreach ( $ this -> current_UserAgent as $ ua ) { if ( $ append === true ) { $ this -> rules [ $ ua ] [ $ this -> current_directive ] [ ] = $ this -> current_word ; continue ; } $ this -> rules [ $ ua ] [ $ this -> current_directive ] = $ this -> current_word ; } }
|
Add group - member rule
|
52,781
|
protected static function encode_url ( $ url ) { $ reserved = array ( ':' => '!%3A!ui' , '/' => '!%2F!ui' , '?' => '!%3F!ui' , '#' => '!%23!ui' , '[' => '!%5B!ui' , ']' => '!%5D!ui' , '@' => '!%40!ui' , '!' => '!%21!ui' , '$' => '!%24!ui' , '&' => '!%26!ui' , "'" => '!%27!ui' , '(' => '!%28!ui' , ')' => '!%29!ui' , '*' => '!%2A!ui' , '+' => '!%2B!ui' , ',' => '!%2C!ui' , ';' => '!%3B!ui' , '=' => '!%3D!ui' , '%' => '!%25!ui' ) ; $ url = preg_replace ( array_values ( $ reserved ) , array_keys ( $ reserved ) , rawurlencode ( $ url ) ) ; return $ url ; }
|
URL encoder according to RFC 3986 Returns a string containing the encoded URL with disallowed characters converted to their percentage encodings .
|
52,782
|
private function addCleanParam ( ) { $ cleanParam = $ this -> explodeCleanParamRule ( $ this -> current_word ) ; foreach ( $ cleanParam [ 'param' ] as $ param ) { $ this -> cleanparam [ $ cleanParam [ 'path' ] ] [ ] = $ param ; $ this -> cleanparam [ $ cleanParam [ 'path' ] ] = array_unique ( $ this -> cleanparam [ $ cleanParam [ 'path' ] ] ) ; } }
|
Add Clean - Param record
|
52,783
|
private function explodeCleanParamRule ( $ rule ) { $ rule = preg_replace ( '/\s+/S' , ' ' , $ rule ) ; $ array = explode ( ' ' , $ rule , 2 ) ; $ cleanParam = array ( ) ; $ cleanParam [ 'path' ] = isset ( $ array [ 1 ] ) ? $ this -> encode_url ( preg_replace ( '/[^A-Za-z0-9\.-\/\*\_]/' , '' , $ array [ 1 ] ) ) : '/*' ; $ param = explode ( '&' , $ array [ 0 ] ) ; foreach ( $ param as $ key ) { $ cleanParam [ 'param' ] [ ] = trim ( $ key ) ; } return $ cleanParam ; }
|
Explode Clean - Param rule
|
52,784
|
public function setHttpStatusCode ( $ code ) { $ code = intval ( $ code ) ; if ( ! is_int ( $ code ) || $ code < 100 || $ code > 599 ) { trigger_error ( 'Invalid HTTP status code, not taken into account.' , E_USER_WARNING ) ; return false ; } $ this -> httpStatusCode = $ code ; return true ; }
|
Set the HTTP status code
|
52,785
|
private function checkHttpStatusCodeRule ( ) { if ( isset ( $ this -> httpStatusCode ) && $ this -> httpStatusCode >= 500 && $ this -> httpStatusCode <= 599 ) { $ this -> log [ ] = 'Disallowed by HTTP status code 5xx' ; return true ; } return false ; }
|
Check HTTP status code rule
|
52,786
|
protected function checkRuleSwitch ( $ rule , $ path ) { switch ( $ this -> isInlineDirective ( $ rule ) ) { case self :: DIRECTIVE_CLEAN_PARAM : if ( $ this -> checkCleanParamRule ( $ this -> stripInlineDirective ( $ rule ) , $ path ) ) { return true ; } break ; case self :: DIRECTIVE_HOST ; if ( $ this -> checkHostRule ( $ this -> stripInlineDirective ( $ rule ) ) ) { return true ; } break ; default : if ( $ this -> checkBasicRule ( $ rule , $ path ) ) { return true ; } } return false ; }
|
Check rule switch
|
52,787
|
protected function isInlineDirective ( $ rule ) { foreach ( $ this -> directiveArray ( ) as $ directive ) { if ( 0 === strpos ( mb_strtolower ( $ rule ) , $ directive . ':' ) ) { return $ directive ; } } return false ; }
|
Check if the rule contains a inline directive
|
52,788
|
private function checkCleanParamRule ( $ rule , $ path ) { $ cleanParam = $ this -> explodeCleanParamRule ( $ rule ) ; if ( ! $ this -> checkBasicRule ( $ cleanParam [ 'path' ] , $ path ) ) { return false ; } foreach ( $ cleanParam [ 'param' ] as $ param ) { if ( ! strpos ( $ path , "?$param=" ) && ! strpos ( $ path , "&$param=" ) ) { return false ; } } $ this -> log [ ] = 'Rule match: ' . self :: DIRECTIVE_CLEAN_PARAM . ' directive' ; return true ; }
|
Check Clean - Param rule
|
52,789
|
private function checkBasicRule ( $ rule , $ path ) { $ rule = $ this -> prepareRegexRule ( $ this -> encode_url ( $ rule ) ) ; $ escaped = strtr ( $ rule , array ( '@' => '\@' ) ) ; if ( preg_match ( '@' . $ escaped . '@' , $ path ) ) { $ this -> log [ ] = 'Rule match: Path' ; return true ; } return false ; }
|
Check basic rule
|
52,790
|
protected function prepareRegexRule ( $ value ) { $ escape = [ '$' => '\$' , '?' => '\?' , '.' => '\.' , '*' => '.*' ] ; foreach ( $ escape as $ search => $ replace ) { $ value = str_replace ( $ search , $ replace , $ value ) ; } if ( mb_strlen ( $ value ) > 2 && mb_substr ( $ value , - 2 ) == '\$' ) { $ value = substr ( $ value , 0 , - 2 ) . '$' ; } if ( mb_strrpos ( $ value , '/' ) == ( mb_strlen ( $ value ) - 1 ) || mb_strrpos ( $ value , '=' ) == ( mb_strlen ( $ value ) - 1 ) || mb_strrpos ( $ value , '?' ) == ( mb_strlen ( $ value ) - 1 ) ) { $ value .= '.*' ; } if ( substr ( $ value , 0 , 2 ) != '.*' ) { $ value = '^' . $ value ; } return $ value ; }
|
Convert robots . txt rules to php regex
|
52,791
|
protected function stripInlineDirective ( $ rule ) { $ directive = $ this -> isInlineDirective ( $ rule ) ; if ( $ directive !== false ) { $ rule = trim ( str_ireplace ( $ directive . ':' , '' , $ rule ) ) ; } return $ rule ; }
|
Strip inline directive prefix
|
52,792
|
private function checkHostRule ( $ rule ) { if ( ! isset ( $ this -> url ) ) { $ error_msg = 'Inline host directive detected. URL not set, result may be inaccurate.' ; $ this -> log [ ] = $ error_msg ; trigger_error ( "robots.txt: $error_msg" , E_USER_NOTICE ) ; return false ; } $ url = $ this -> parseURL ( $ this -> url ) ; $ host = trim ( str_ireplace ( self :: DIRECTIVE_HOST . ':' , '' , mb_strtolower ( $ rule ) ) ) ; if ( in_array ( $ host , array ( $ url [ 'host' ] , $ url [ 'host' ] . ':' . $ url [ 'port' ] , $ url [ 'scheme' ] . '://' . $ url [ 'host' ] , $ url [ 'scheme' ] . '://' . $ url [ 'host' ] . ':' . $ url [ 'port' ] ) ) ) { $ this -> log [ ] = 'Rule match: ' . self :: DIRECTIVE_HOST . ' directive' ; return true ; } return false ; }
|
Check Host rule
|
52,793
|
public function getCleanParam ( ) { if ( empty ( $ this -> cleanparam ) ) { $ this -> log [ ] = self :: DIRECTIVE_CLEAN_PARAM . ' directive: Not found' ; } return $ this -> cleanparam ; }
|
Get Clean - Param
|
52,794
|
public function getRules ( $ userAgent = null ) { if ( $ userAgent === null ) { return $ this -> rules ; } $ this -> setUserAgent ( $ userAgent ) ; if ( isset ( $ this -> rules [ $ this -> userAgentMatch ] ) ) { return $ this -> rules [ $ this -> userAgentMatch ] ; } $ this -> log [ ] = 'Rules not found for the given User-Agent' ; return array ( ) ; }
|
Get rules based on user agent
|
52,795
|
public function getSitemaps ( ) { if ( empty ( $ this -> sitemap ) ) { $ this -> log [ ] = self :: DIRECTIVE_SITEMAP . ' directive: No sitemaps found' ; } return $ this -> sitemap ; }
|
Get sitemaps wrapper
|
52,796
|
public function connectOauth2 ( $ options ) { $ token = false ; $ oauthProvider = $ this -> getProvider ( ) ; if ( \ Craft \ craft ( ) -> request -> getParam ( 'error' ) ) { throw new \ Exception ( "An error occured: " . \ Craft \ craft ( ) -> request -> getParam ( 'error' ) ) ; } $ state = \ Craft \ craft ( ) -> request -> getParam ( 'state' ) ; $ code = \ Craft \ craft ( ) -> request -> getParam ( 'code' ) ; $ oauth2state = \ Craft \ craft ( ) -> httpSession -> get ( 'oauth2state' ) ; if ( is_null ( $ code ) ) { $ authorizationOptions = $ options [ 'authorizationOptions' ] ; if ( count ( $ options [ 'scope' ] ) > 0 ) { $ authorizationOptions [ 'scope' ] = $ options [ 'scope' ] ; } $ authorizationUrl = $ oauthProvider -> getAuthorizationUrl ( $ authorizationOptions ) ; $ state = $ oauthProvider -> getState ( ) ; \ Craft \ craft ( ) -> httpSession -> add ( 'oauth2state' , $ state ) ; OauthPlugin :: log ( 'OAuth 2.0 Connect - Redirect to the authorization URL' . "\r\n" . "authorizationUrl: " . $ authorizationUrl . "\r\n" . "oauth2state: " . \ Craft \ craft ( ) -> httpSession -> get ( 'oauth2state' ) , LogLevel :: Info ) ; \ Craft \ craft ( ) -> request -> redirect ( $ authorizationUrl ) ; } elseif ( ! $ state || $ state !== $ oauth2state ) { OauthPlugin :: log ( 'OAuth 2.0 Connect - Invalid State' . "\r\n" . print_r ( [ 'state' => $ state , 'oauth2state' => $ oauth2state , ] , true ) , LogLevel :: Info ) ; \ Craft \ craft ( ) -> httpSession -> remove ( 'oauth2state' ) ; throw new \ Exception ( "Invalid state" ) ; } else { OauthPlugin :: log ( 'OAuth 2.0 Connect - Authorization code retrieved: ' . $ code , LogLevel :: Info ) ; $ token = $ oauthProvider -> getAccessToken ( 'authorization_code' , [ 'code' => $ code ] ) ; OauthPlugin :: log ( "OAuth 2.0 Connect - Get Access Token\r\n" . "Access token: \r\n" . print_r ( $ token , true ) , LogLevel :: Info ) ; } return $ token ; }
|
Connect OAuth 2 . 0
|
52,797
|
public function connectOauth1 ( $ options ) { $ token = false ; $ oauthProvider = $ this -> getProvider ( ) ; if ( \ Craft \ craft ( ) -> request -> getParam ( 'denied' ) ) { throw new \ Exception ( "An error occured: " . \ Craft \ craft ( ) -> request -> getParam ( 'denied' ) ) ; } $ user = \ Craft \ craft ( ) -> request -> getParam ( 'user' ) ; $ oauth_token = \ Craft \ craft ( ) -> request -> getParam ( 'oauth_token' ) ; $ oauth_verifier = \ Craft \ craft ( ) -> request -> getParam ( 'oauth_verifier' ) ; $ denied = \ Craft \ craft ( ) -> request -> getParam ( 'denied' ) ; if ( $ oauth_token && $ oauth_verifier ) { $ temporaryCredentials = unserialize ( \ Craft \ craft ( ) -> httpSession -> get ( 'temporary_credentials' ) ) ; $ token = $ oauthProvider -> getTokenCredentials ( $ temporaryCredentials , $ oauth_token , $ oauth_verifier ) ; \ Craft \ craft ( ) -> httpSession -> add ( 'token_credentials' , serialize ( $ token ) ) ; OauthPlugin :: log ( 'OAuth 1.0 Connect - Get token credentials' . "\r\n" . print_r ( [ 'temporaryCredentials' => $ temporaryCredentials , 'oauth_token' => $ oauth_token , 'oauth_verifier' => $ oauth_verifier , 'token' => $ token , ] , true ) , LogLevel :: Info ) ; } elseif ( $ denied ) { $ errorMsg = "Client access denied by user" ; OauthPlugin :: log ( 'OAuth 1.0 Connect - ' . $ errorMsg , LogLevel :: Info ) ; throw new \ Exception ( $ errorMsg ) ; } else { $ temporaryCredentials = $ oauthProvider -> getTemporaryCredentials ( ) ; \ Craft \ craft ( ) -> httpSession -> add ( 'temporary_credentials' , serialize ( $ temporaryCredentials ) ) ; $ authorizationUrl = $ oauthProvider -> getAuthorizationUrl ( $ temporaryCredentials ) ; \ Craft \ craft ( ) -> request -> redirect ( $ authorizationUrl ) ; OauthPlugin :: log ( 'OAuth 1.0 Connect - Redirect to the authorization URL' . "\r\n" . print_r ( [ 'temporaryCredentials' => $ temporaryCredentials , 'authorizationUrl' => $ authorizationUrl , ] , true ) , LogLevel :: Info ) ; } return $ token ; }
|
Connect OAuth 1 . 0
|
52,798
|
public function getRemoteResourceOwner ( $ token ) { $ provider = $ this -> getProvider ( ) ; $ realToken = OauthHelper :: getRealToken ( $ token ) ; switch ( $ this -> getOauthVersion ( ) ) { case 1 : return $ provider -> getUserDetails ( $ realToken ) ; break ; case 2 : return $ provider -> getResourceOwner ( $ realToken ) ; break ; } }
|
Returns the remote resource owner .
|
52,799
|
public function getResourceOwner ( $ token ) { $ remoteResourceOwner = $ this -> getRemoteResourceOwner ( $ token ) ; $ resourceOwner = new Oauth_ResourceOwnerModel ; $ resourceOwner -> remoteId = $ remoteResourceOwner -> getId ( ) ; if ( method_exists ( $ remoteResourceOwner , 'getEmail' ) ) { $ resourceOwner -> email = $ remoteResourceOwner -> getEmail ( ) ; } if ( method_exists ( $ remoteResourceOwner , 'getName' ) ) { $ resourceOwner -> name = $ remoteResourceOwner -> getName ( ) ; } elseif ( method_exists ( $ remoteResourceOwner , 'getFirstName' ) && method_exists ( $ remoteResourceOwner , 'getLastName' ) ) { $ resourceOwner -> name = trim ( $ remoteResourceOwner -> getFirstName ( ) . " " . $ remoteResourceOwner -> getLastName ( ) ) ; } elseif ( method_exists ( $ remoteResourceOwner , 'getFirstName' ) ) { $ resourceOwner -> name = $ remoteResourceOwner -> getFirstName ( ) ; } elseif ( method_exists ( $ remoteResourceOwner , 'getLasttName' ) ) { $ resourceOwner -> name = $ remoteResourceOwner -> getLasttName ( ) ; } return $ resourceOwner ; }
|
Returns the resource owner .
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.