idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
22,900
public function pushMiddleware ( callable $ middleware , string $ name = null ) { if ( ! is_null ( $ name ) ) { $ this -> middlewares [ $ name ] = $ middleware ; } else { array_push ( $ this -> middlewares , $ middleware ) ; } return $ this ; }
Add a middleware .
22,901
public function getHandlerStack ( ) : HandlerStack { if ( $ this -> handlerStack ) { return $ this -> handlerStack ; } $ this -> handlerStack = HandlerStack :: create ( $ this -> getGuzzleHandler ( ) ) ; foreach ( $ this -> middlewares as $ name => $ middleware ) { $ this -> handlerStack -> push ( $ middleware , $ name...
Build a handler stack .
22,902
protected function getGuzzleHandler ( ) { if ( property_exists ( $ this , 'app' ) && isset ( $ this -> app [ 'guzzle_handler' ] ) && is_string ( $ this -> app [ 'guzzle_handler' ] ) ) { $ handler = $ this -> app [ 'guzzle_handler' ] ; return new $ handler ( ) ; } return \ GuzzleHttp \ choose_handler ( ) ; }
Get guzzle handler .
22,903
public function update ( int $ tagId , string $ name ) { $ params = [ 'tag' => [ 'id' => $ tagId , 'name' => $ name , ] , ] ; return $ this -> httpPostJson ( 'cgi-bin/tags/update' , $ params ) ; }
Update a tag name .
22,904
public function usersOfTag ( int $ tagId , string $ nextOpenId = '' ) { $ params = [ 'tagid' => $ tagId , 'next_openid' => $ nextOpenId , ] ; return $ this -> httpPostJson ( 'cgi-bin/user/tag/get' , $ params ) ; }
Get users from a tag .
22,905
public function sendVoice ( string $ mediaId , $ reception = null , array $ attributes = [ ] ) { return $ this -> sendMessage ( new Media ( $ mediaId , 'voice' ) , $ reception , $ attributes ) ; }
Send a voice message .
22,906
public function sendImage ( string $ mediaId , $ reception = null , array $ attributes = [ ] ) { return $ this -> sendMessage ( new Image ( $ mediaId ) , $ reception , $ attributes ) ; }
Send a image message .
22,907
public function sendCard ( string $ cardId , $ reception = null , array $ attributes = [ ] ) { return $ this -> sendMessage ( new Card ( $ cardId ) , $ reception , $ attributes ) ; }
Send a card message .
22,908
public function previewText ( string $ message , $ reception , $ method = self :: PREVIEW_BY_OPENID ) { return $ this -> previewMessage ( new Text ( $ message ) , $ reception , $ method ) ; }
Preview a text message .
22,909
public function previewImage ( string $ mediaId , $ reception , $ method = self :: PREVIEW_BY_OPENID ) { return $ this -> previewMessage ( new Image ( $ mediaId ) , $ reception , $ method ) ; }
Preview a image message .
22,910
public function previewVideo ( string $ mediaId , $ reception , $ method = self :: PREVIEW_BY_OPENID ) { return $ this -> previewMessage ( new Media ( $ mediaId , 'mpvideo' ) , $ reception , $ method ) ; }
Preview a video message .
22,911
public function previewCard ( string $ cardId , $ reception , $ method = self :: PREVIEW_BY_OPENID ) { return $ this -> previewMessage ( new Card ( $ cardId ) , $ reception , $ method ) ; }
Preview a card message .
22,912
public function idCard ( string $ path , string $ type = 'photo' ) { if ( ! \ in_array ( $ type , $ this -> allowTypes , true ) ) { throw new InvalidArgumentException ( sprintf ( "Unsupported type: '%s'" , $ type ) ) ; } return $ this -> httpGet ( 'cv/ocr/idcard' , [ 'type' => $ type , 'img_url' => $ path , ] ) ; }
ID card OCR .
22,913
public function searchFromMap ( int $ districtId , string $ keyword ) { $ params = [ 'districtid' => $ districtId , 'keyword' => $ keyword , ] ; return $ this -> httpPostJson ( 'wxa/search_map_poi' , $ params ) ; }
Search store from tencent map .
22,914
public function list ( int $ offset = 0 , int $ limit = 10 ) { $ params = [ 'offset' => $ offset , 'limit' => $ limit , ] ; return $ this -> httpPostJson ( 'wxa/get_store_list' , $ params ) ; }
List store .
22,915
public static function randomBytes ( $ length = 16 ) { if ( function_exists ( 'random_bytes' ) ) { $ bytes = random_bytes ( $ length ) ; } elseif ( function_exists ( 'openssl_random_pseudo_bytes' ) ) { $ bytes = openssl_random_pseudo_bytes ( $ length , $ strong ) ; if ( false === $ bytes || false === $ strong ) { throw...
Generate a more truly random bytes .
22,916
public function update ( int $ poiId , array $ baseInfo ) { $ params = [ 'business' => [ 'base_info' => array_merge ( $ baseInfo , [ 'poi_id' => $ poiId ] ) , ] , ] ; return $ this -> httpPostJson ( 'cgi-bin/poi/updatepoi' , $ params ) ; }
Update a POI .
22,917
public function setSubMerchant ( string $ mchId , string $ appId = null ) { $ this [ 'config' ] -> set ( 'sub_mch_id' , $ mchId ) ; $ this [ 'config' ] -> set ( 'sub_appid' , $ appId ) ; return $ this ; }
Set sub - merchant .
22,918
public function query ( string $ keyword , string $ categories , array $ optional = [ ] ) { $ params = [ 'query' => $ keyword , 'category' => $ categories , 'appid' => $ this -> app [ 'config' ] [ 'app_id' ] , ] ; return $ this -> httpPostJson ( 'semantic/semproxy/search' , array_merge ( $ params , $ optional ) ) ; }
Get the semantic content of giving string .
22,919
public function handleAuthorize ( string $ authCode = null ) { $ params = [ 'component_appid' => $ this -> app [ 'config' ] [ 'app_id' ] , 'authorization_code' => $ authCode ?? $ this -> app [ 'request' ] -> get ( 'auth_code' ) , ] ; return $ this -> httpPostJson ( 'cgi-bin/component/api_query_auth' , $ params ) ; }
Get authorization info .
22,920
public function getAuthorizer ( string $ appId ) { $ params = [ 'component_appid' => $ this -> app [ 'config' ] [ 'app_id' ] , 'authorizer_appid' => $ appId , ] ; return $ this -> httpPostJson ( 'cgi-bin/component/api_get_authorizer_info' , $ params ) ; }
Get authorizer info .
22,921
public function setAuthorizerOption ( string $ appId , string $ name , string $ value ) { $ params = [ 'component_appid' => $ this -> app [ 'config' ] [ 'app_id' ] , 'authorizer_appid' => $ appId , 'option_name' => $ name , 'option_value' => $ value , ] ; return $ this -> httpPostJson ( 'cgi-bin/component/api_set_autho...
Set authorizer option .
22,922
public function getAuthorizers ( $ offset = 0 , $ count = 500 ) { $ params = [ 'component_appid' => $ this -> app [ 'config' ] [ 'app_id' ] , 'offset' => $ offset , 'count' => $ count , ] ; return $ this -> httpPostJson ( 'cgi-bin/component/api_get_authorizer_list' , $ params ) ; }
Get authorizer list .
22,923
public function update ( int $ tagId , string $ tagName ) { $ params = [ 'tagid' => $ tagId , 'tagname' => $ tagName , ] ; return $ this -> httpPostJson ( 'cgi-bin/tag/update' , $ params ) ; }
Update tag .
22,924
public function send ( array $ params ) { $ params [ 'appid' ] = $ this -> app [ 'config' ] -> app_id ; $ params [ 'openid_count' ] = 1 ; return $ this -> safeRequest ( 'mmpaymkttransfers/send_coupon' , $ params ) ; }
send a cash coupon .
22,925
public function close ( string $ account , string $ openid ) { $ params = [ 'kf_account' => $ account , 'openid' => $ openid , ] ; return $ this -> httpPostJson ( 'customservice/kfsession/close' , $ params ) ; }
Close a session .
22,926
public function getTicket ( bool $ refresh = false , string $ type = 'jsapi' ) : array { $ cacheKey = sprintf ( 'easywechat.basic_service.jssdk.ticket.%s.%s' , $ type , $ this -> getAppId ( ) ) ; if ( ! $ refresh && $ this -> getCache ( ) -> has ( $ cacheKey ) ) { return $ this -> getCache ( ) -> get ( $ cacheKey ) ; }...
Get js ticket .
22,927
public function getTicketSignature ( $ ticket , $ nonce , $ timestamp , $ url ) : string { return sha1 ( sprintf ( 'jsapi_ticket=%s&noncestr=%s&timestamp=%s&url=%s' , $ ticket , $ nonce , $ timestamp , $ url ) ) ; }
Sign the params .
22,928
public function checkinRecords ( int $ startTime , int $ endTime , array $ userList , int $ type = 3 ) { $ params = [ 'opencheckindatatype' => $ type , 'starttime' => $ startTime , 'endtime' => $ endTime , 'useridlist' => $ userList , ] ; return $ this -> httpPostJson ( 'cgi-bin/checkin/getcheckindata' , $ params ) ; }
Get the checkin data .
22,929
public function approvalRecords ( int $ startTime , int $ endTime , int $ nextNumber = null ) { $ params = [ 'starttime' => $ startTime , 'endtime' => $ endTime , 'next_spnum' => $ nextNumber , ] ; return $ this -> httpPostJson ( 'cgi-bin/corp/getapprovaldata' , $ params ) ; }
Get Approval Data .
22,930
public function update ( int $ groupId , string $ name ) { $ params = [ 'group_id' => $ groupId , 'group_name' => $ name , ] ; return $ this -> httpPostJson ( 'shakearound/device/group/update' , $ params ) ; }
Update a device group name .
22,931
public function list ( int $ begin , int $ count ) { $ params = [ 'begin' => $ begin , 'count' => $ count , ] ; return $ this -> httpPostJson ( 'shakearound/device/group/getlist' , $ params ) ; }
List all device groups .
22,932
public function get ( int $ groupId , int $ begin , int $ count ) { $ params = [ 'group_id' => $ groupId , 'begin' => $ begin , 'count' => $ count , ] ; return $ this -> httpPostJson ( 'shakearound/device/group/getdetail' , $ params ) ; }
Get detail of a device group .
22,933
public function addDevices ( int $ groupId , array $ deviceIdentifiers ) { $ params = [ 'group_id' => $ groupId , 'device_identifiers' => $ deviceIdentifiers , ] ; return $ this -> httpPostJson ( 'shakearound/device/group/adddevice' , $ params ) ; }
Add one or more devices to a device group .
22,934
public function removeDevices ( int $ groupId , array $ deviceIdentifiers ) { $ params = [ 'group_id' => $ groupId , 'device_identifiers' => $ deviceIdentifiers , ] ; return $ this -> httpPostJson ( 'shakearound/device/group/deletedevice' , $ params ) ; }
Remove one or more devices from a device group .
22,935
protected function checkRequiredAttributes ( ) { foreach ( $ this -> getRequired ( ) as $ attribute ) { if ( is_null ( $ this -> get ( $ attribute ) ) ) { throw new InvalidArgumentException ( sprintf ( '"%s" cannot be empty.' , $ attribute ) ) ; } } }
Check required attributes .
22,936
public function uploadImage ( string $ path , string $ type = 'icon' ) { if ( ! file_exists ( $ path ) || ! is_readable ( $ path ) ) { throw new InvalidArgumentException ( sprintf ( 'File does not exist, or the file is unreadable: "%s"' , $ path ) ) ; } return $ this -> httpUpload ( 'shakearound/material/add' , [ 'medi...
Upload image material .
22,937
public function toArray ( ) { $ content = $ this -> removeControlCharacters ( $ this -> getBodyContents ( ) ) ; if ( false !== stripos ( $ this -> getHeaderLine ( 'Content-Type' ) , 'xml' ) || 0 === stripos ( $ content , '<xml' ) ) { return XML :: parse ( $ content ) ; } $ array = json_decode ( $ content , true , 512 ,...
Build to array .
22,938
public function list ( string $ type , int $ offset = 0 , int $ count = 20 ) { $ params = [ 'type' => $ type , 'offset' => $ offset , 'count' => $ count , ] ; return $ this -> httpPostJson ( 'cgi-bin/material/batchget_material' , $ params ) ; }
List materials .
22,939
protected function registerHandlers ( ) { $ this -> on ( self :: EVENT_AUTHORIZED , Authorized :: class ) ; $ this -> on ( self :: EVENT_UNAUTHORIZED , Unauthorized :: class ) ; $ this -> on ( self :: EVENT_UPDATE_AUTHORIZED , UpdateAuthorized :: class ) ; $ this -> on ( self :: EVENT_COMPONENT_VERIFY_TICKET , VerifyTi...
Register event handlers .
22,940
protected function reverse ( string $ number , string $ type ) { $ params = [ 'appid' => $ this -> app [ 'config' ] -> app_id , $ type => $ number , ] ; return $ this -> safeRequest ( $ this -> wrap ( 'secapi/pay/reverse' ) , $ params ) ; }
Reverse order .
22,941
protected function resolve ( $ name ) { $ config = $ this -> app [ 'config' ] -> get ( \ sprintf ( 'log.channels.%s' , $ name ) ) ; if ( is_null ( $ config ) ) { throw new \ InvalidArgumentException ( \ sprintf ( 'Log [%s] is not defined.' , $ name ) ) ; } if ( isset ( $ this -> customCreators [ $ config [ 'driver' ] ]...
Resolve the given log instance by name .
22,942
protected function formatter ( ) { $ formatter = new LineFormatter ( null , null , true , true ) ; $ formatter -> includeStacktraces ( ) ; return $ formatter ; }
Get a Monolog formatter instance .
22,943
public function send ( $ data = [ ] ) { $ params = $ this -> formatMessage ( $ data ) ; $ this -> restoreMessage ( ) ; return $ this -> httpPostJson ( static :: API_SEND , $ params ) ; }
Send a template message .
22,944
public function sendSubscription ( array $ data = [ ] ) { $ params = $ this -> formatMessage ( $ data ) ; $ this -> restoreMessage ( ) ; return $ this -> httpPostJson ( 'cgi-bin/message/template/subscribe' , $ params ) ; }
Send template - message for subscription .
22,945
public function unify ( array $ params ) { if ( empty ( $ params [ 'spbill_create_ip' ] ) ) { $ params [ 'spbill_create_ip' ] = ( 'NATIVE' === $ params [ 'trade_type' ] ) ? Support \ get_server_ip ( ) : Support \ get_client_ip ( ) ; } $ params [ 'appid' ] = $ this -> app [ 'config' ] -> app_id ; $ params [ 'notify_url'...
Unify order .
22,946
public function close ( string $ tradeNo ) { $ params = [ 'appid' => $ this -> app [ 'config' ] -> app_id , 'out_trade_no' => $ tradeNo , ] ; return $ this -> request ( $ this -> wrap ( 'pay/closeorder' ) , $ params ) ; }
Close order by out_trade_no .
22,947
public function getDepartmentUsers ( int $ departmentId , bool $ fetchChild = false ) { $ params = [ 'department_id' => $ departmentId , 'fetch_child' => ( int ) $ fetchChild , ] ; return $ this -> httpGet ( 'cgi-bin/user/simplelist' , $ params ) ; }
Get simple user list .
22,948
public function userIdToOpenid ( string $ userId , int $ agentId = null ) { $ params = [ 'userid' => $ userId , 'agentid' => $ agentId , ] ; return $ this -> httpPostJson ( 'cgi-bin/user/convert_to_openid' , $ params ) ; }
Convert userId to openid .
22,949
public function user ( string $ ticket , bool $ needPoi = false ) { $ params = [ 'ticket' => $ ticket , ] ; if ( $ needPoi ) { $ params [ 'need_poi' ] = 1 ; } return $ this -> httpPostJson ( 'shakearound/user/getshakeinfo' , $ params ) ; }
Get shake info .
22,950
public function deviceSummary ( array $ deviceIdentifier , int $ beginTime , int $ endTime ) { $ params = [ 'device_identifier' => $ deviceIdentifier , 'begin_date' => $ beginTime , 'end_date' => $ endTime , ] ; return $ this -> httpPostJson ( 'shakearound/statistics/device' , $ params ) ; }
Fetch statistics data by deviceId .
22,951
public function devicesSummary ( int $ timestamp , int $ pageIndex ) { $ params = [ 'date' => $ timestamp , 'page_index' => $ pageIndex , ] ; return $ this -> httpPostJson ( 'shakearound/statistics/devicelist' , $ params ) ; }
Fetch all devices statistics data by date .
22,952
public function pageSummary ( int $ pageId , int $ beginTime , int $ endTime ) { $ params = [ 'page_id' => $ pageId , 'begin_date' => $ beginTime , 'end_date' => $ endTime , ] ; return $ this -> httpPostJson ( 'shakearound/statistics/page' , $ params ) ; }
Fetch statistics data by pageId .
22,953
public function pagesSummary ( int $ timestamp , int $ pageIndex ) { $ params = [ 'date' => $ timestamp , 'page_index' => $ pageIndex , ] ; return $ this -> httpPostJson ( 'shakearound/statistics/pagelist' , $ params ) ; }
Fetch all pages statistics data by date .
22,954
public static function parse ( $ xml ) { $ backup = libxml_disable_entity_loader ( true ) ; $ result = self :: normalize ( simplexml_load_string ( self :: sanitize ( $ xml ) , 'SimpleXMLElement' , LIBXML_COMPACT | LIBXML_NOCDATA | LIBXML_NOBLANKS ) ) ; libxml_disable_entity_loader ( $ backup ) ; return $ result ; }
XML to array .
22,955
protected static function normalize ( $ obj ) { $ result = null ; if ( is_object ( $ obj ) ) { $ obj = ( array ) $ obj ; } if ( is_array ( $ obj ) ) { foreach ( $ obj as $ key => $ value ) { $ res = self :: normalize ( $ value ) ; if ( ( '@attributes' === $ key ) && ( $ key ) ) { $ result = $ res ; } else { $ result [ ...
Object to array .
22,956
public function info ( $ mchBillno ) { $ params = is_array ( $ mchBillno ) ? $ mchBillno : [ 'mch_billno' => $ mchBillno ] ; $ base = [ 'appid' => $ this -> app [ 'config' ] -> app_id , 'bill_type' => 'MCHT' , ] ; return $ this -> safeRequest ( 'mmpaymkttransfers/gethbinfo' , array_merge ( $ base , $ params ) ) ; }
Query redpack .
22,957
public function sendNormal ( array $ params ) { $ base = [ 'total_num' => 1 , 'client_ip' => $ params [ 'client_ip' ] ?? Support \ get_server_ip ( ) , 'wxappid' => $ this -> app [ 'config' ] -> app_id , ] ; return $ this -> safeRequest ( 'mmpaymkttransfers/sendredpack' , array_merge ( $ base , $ params ) ) ; }
Send normal redpack .
22,958
public function sendGroup ( array $ params ) { $ base = [ 'amt_type' => 'ALL_RAND' , 'wxappid' => $ this -> app [ 'config' ] -> app_id , ] ; return $ this -> safeRequest ( 'mmpaymkttransfers/sendgroupredpack' , array_merge ( $ base , $ params ) ) ; }
Send group redpack .
22,959
public function forever ( $ sceneValue ) { if ( is_int ( $ sceneValue ) && $ sceneValue > 0 && $ sceneValue < self :: SCENE_MAX_VALUE ) { $ type = self :: SCENE_QR_FOREVER ; $ sceneKey = 'scene_id' ; } else { $ type = self :: SCENE_QR_FOREVER_STR ; $ sceneKey = 'scene_str' ; } $ scene = [ $ sceneKey => $ sceneValue ] ;...
Create forever QR code .
22,960
public function temporary ( $ sceneValue , $ expireSeconds = null ) { if ( is_int ( $ sceneValue ) && $ sceneValue > 0 ) { $ type = self :: SCENE_QR_TEMPORARY ; $ sceneKey = 'scene_id' ; } else { $ type = self :: SCENE_QR_TEMPORARY_STR ; $ sceneKey = 'scene_str' ; } $ scene = [ $ sceneKey => $ sceneValue ] ; return $ t...
Create temporary QR code .
22,961
public function upload ( string $ type , string $ path ) { $ files = [ 'media' => $ path , ] ; return $ this -> httpUpload ( 'cgi-bin/media/upload' , $ files , [ ] , compact ( 'type' ) ) ; }
Upload media .
22,962
public function get ( string $ path , array $ optional = [ ] ) { $ params = array_merge ( [ 'path' => $ path , ] , $ optional ) ; return $ this -> getStream ( 'wxa/getwxacode' , $ params ) ; }
Get AppCode .
22,963
public function getUnlimit ( string $ scene , array $ optional = [ ] ) { $ params = array_merge ( [ 'scene' => $ scene , ] , $ optional ) ; return $ this -> getStream ( 'wxa/getwxacodeunlimit' , $ params ) ; }
Get AppCode unlimit .
22,964
protected function getStream ( string $ endpoint , array $ params ) { $ response = $ this -> requestRaw ( $ endpoint , 'POST' , [ 'json' => $ params ] ) ; if ( false !== stripos ( $ response -> getHeaderLine ( 'Content-disposition' ) , 'attachment' ) ) { return StreamResponse :: buildFromPsrResponse ( $ response ) ; } ...
Get stream .
22,965
public function queryBalanceOrder ( string $ partnerTradeNo ) { $ params = [ 'appid' => $ this -> app [ 'config' ] -> app_id , 'mch_id' => $ this -> app [ 'config' ] -> mch_id , 'partner_trade_no' => $ partnerTradeNo , ] ; return $ this -> safeRequest ( 'mmpaymkttransfers/gettransferinfo' , $ params ) ; }
Query MerchantPay to balance .
22,966
public function toBalance ( array $ params ) { $ base = [ 'mch_id' => null , 'mchid' => $ this -> app [ 'config' ] -> mch_id , 'mch_appid' => $ this -> app [ 'config' ] -> app_id , ] ; if ( empty ( $ params [ 'spbill_create_ip' ] ) ) { $ params [ 'spbill_create_ip' ] = get_server_ip ( ) ; } return $ this -> safeRequest...
Send MerchantPay to balance .
22,967
public function queryBankCardOrder ( string $ partnerTradeNo ) { $ params = [ 'mch_id' => $ this -> app [ 'config' ] -> mch_id , 'partner_trade_no' => $ partnerTradeNo , ] ; return $ this -> safeRequest ( 'mmpaysptrans/query_bank' , $ params ) ; }
Query MerchantPay order to BankCard .
22,968
public function toBankCard ( array $ params ) { foreach ( [ 'bank_code' , 'partner_trade_no' , 'enc_bank_no' , 'enc_true_name' , 'amount' ] as $ key ) { if ( empty ( $ params [ $ key ] ) ) { throw new RuntimeException ( \ sprintf ( '"%s" is required.' , $ key ) ) ; } } $ publicKey = file_get_contents ( $ this -> app [ ...
Send MerchantPay to BankCard .
22,969
public function encrypt ( $ xml , $ nonce = null , $ timestamp = null ) : string { try { $ xml = $ this -> pkcs7Pad ( str_random ( 16 ) . pack ( 'N' , strlen ( $ xml ) ) . $ xml . $ this -> appId , $ this -> blockSize ) ; $ encrypted = base64_encode ( AES :: encrypt ( $ xml , $ this -> aesKey , substr ( $ this -> aesKe...
Encrypt the message and return XML .
22,970
public function add ( string $ name , string $ credential , string $ address , string $ proofMaterial = null ) { return $ this -> httpPostJson ( 'wxa/addnearbypoi' , [ 'related_name' => $ name , 'related_credential' => $ credential , 'related_address' => $ address , 'related_proof_material' => $ proofMaterial , ] ) ; }
Add nearby poi .
22,971
public function setVisibility ( string $ poiId , int $ status ) { if ( ! in_array ( $ status , [ 0 , 1 ] , true ) ) { throw new InvalidArgumentException ( 'status should be 0 or 1.' ) ; } return $ this -> httpPostJson ( 'wxa/setnearbypoishowstatus' , [ 'poi_id' => $ poiId , 'status' => $ status , ] ) ; }
Set nearby poi show status .
22,972
public function pay ( array $ params ) { $ params [ 'appid' ] = $ this -> app [ 'config' ] -> app_id ; return $ this -> request ( $ this -> wrap ( 'pay/micropay' ) , $ params ) ; }
Pay the order .
22,973
public function toResponse ( ) : Response { $ base = [ 'return_code' => is_null ( $ this -> fail ) ? static :: SUCCESS : static :: FAIL , 'return_msg' => $ this -> fail , ] ; $ attributes = array_merge ( $ base , $ this -> attributes ) ; if ( $ this -> sign ) { $ attributes [ 'sign' ] = Support \ generate_sign ( $ attr...
Build xml and return the response to WeChat .
22,974
public function getMessage ( ) : array { if ( ! empty ( $ this -> message ) ) { return $ this -> message ; } try { $ message = XML :: parse ( strval ( $ this -> app [ 'request' ] -> getContent ( ) ) ) ; } catch ( \ Throwable $ e ) { throw new Exception ( 'Invalid request XML: ' . $ e -> getMessage ( ) , 400 ) ; } if ( ...
Return the notify message from request .
22,975
public function getCache ( ) { if ( $ this -> cache ) { return $ this -> cache ; } if ( property_exists ( $ this , 'app' ) && $ this -> app instanceof ServiceContainer && isset ( $ this -> app [ 'cache' ] ) && $ this -> app [ 'cache' ] instanceof CacheInterface ) { return $ this -> cache = $ this -> app [ 'cache' ] ; }...
Get cache instance .
22,976
protected function sendRequest ( array $ credentials ) : ResponseInterface { $ options = [ ( 'GET' === $ this -> requestMethod ) ? 'query' : 'json' => $ credentials , ] ; return $ this -> setHttpClient ( $ this -> app [ 'http_client' ] ) -> request ( $ this -> getEndpoint ( ) , $ this -> requestMethod , $ options ) ; }
Send http request .
22,977
public static function random ( array $ array , int $ amount = null ) { if ( is_null ( $ amount ) ) { return $ array [ array_rand ( $ array ) ] ; } $ keys = array_rand ( $ array , $ amount ) ; $ results = [ ] ; foreach ( ( array ) $ keys as $ key ) { $ results [ ] = $ array [ $ key ] ; } return $ results ; }
Get a 1 value from an array .
22,978
public function byOutTradeNumber ( string $ number , string $ refundNumber , int $ totalFee , int $ refundFee , array $ optional = [ ] ) { return $ this -> refund ( $ refundNumber , $ totalFee , $ refundFee , array_merge ( $ optional , [ 'out_trade_no' => $ number ] ) ) ; }
Refund by out trade number .
22,979
protected function query ( string $ number , string $ type ) { $ params = [ 'appid' => $ this -> app [ 'config' ] -> app_id , $ type => $ number , ] ; return $ this -> request ( $ this -> wrap ( 'pay/refundquery' ) , $ params ) ; }
Query refund .
22,980
public function listByPageId ( int $ pageId , int $ begin , int $ count ) { $ params = [ 'type' => 2 , 'page_id' => $ pageId , 'begin' => $ begin , 'count' => $ count , ] ; return $ this -> httpPostJson ( 'shakearound/relation/search' , $ params ) ; }
Get devices by pageId .
22,981
public function officialAccount ( string $ appId , string $ refreshToken = null , AccessToken $ accessToken = null ) : OfficialAccount { $ application = new OfficialAccount ( $ this -> getAuthorizerConfig ( $ appId , $ refreshToken ) , $ this -> getReplaceServices ( $ accessToken ) + [ 'encryptor' => $ this [ 'encrypto...
Creates the officialAccount application .
22,982
public function miniProgram ( string $ appId , string $ refreshToken = null , AccessToken $ accessToken = null ) : MiniProgram { return new MiniProgram ( $ this -> getAuthorizerConfig ( $ appId , $ refreshToken ) , $ this -> getReplaceServices ( $ accessToken ) + [ 'encryptor' => function ( ) { return new Encryptor ( $...
Creates the miniProgram application .
22,983
public function getPreAuthorizationUrl ( string $ callbackUrl , $ optional = [ ] ) : string { if ( \ is_string ( $ optional ) ) { $ optional = [ 'pre_auth_code' => $ optional , ] ; } else { $ optional [ 'pre_auth_code' ] = $ this -> createPreAuthorizationCode ( ) [ 'pre_auth_code' ] ; } $ queries = \ array_merge ( $ op...
Return the pre - authorization login page url .
22,984
public function listItems ( $ context = null ) { if ( $ this -> items === null ) { $ this -> loadItems ( ) ; } if ( $ context !== null ) { return $ this -> filterByContext ( $ this -> groupedItems , $ context ) ; } return $ this -> groupedItems ; }
Returns a collection of all settings by group filtered by context
22,985
protected function filterByContext ( $ items , $ context ) { $ filteredItems = [ ] ; foreach ( $ items as $ categoryName => $ category ) { $ filteredCategory = [ ] ; foreach ( $ category as $ item ) { $ itemContext = is_array ( $ item -> context ) ? $ item -> context : [ $ item -> context ] ; if ( in_array ( $ context ...
Filters a set of items by a given context .
22,986
public function addSettingItems ( $ owner , array $ definitions ) { foreach ( $ definitions as $ code => $ definition ) { $ this -> addSettingItem ( $ owner , $ code , $ definition ) ; } }
Dynamically add an array of setting items
22,987
public function addSettingItem ( $ owner , $ code , array $ definition ) { $ itemKey = $ this -> makeItemKey ( $ owner , $ code ) ; if ( isset ( $ this -> items [ $ itemKey ] ) ) { $ definition = array_merge ( ( array ) $ this -> items [ $ itemKey ] , $ definition ) ; } $ item = array_merge ( self :: $ itemDefaults , a...
Dynamically add a single setting item
22,988
public function removeSettingItem ( $ owner , $ code ) { if ( ! $ this -> items ) { throw new SystemException ( 'Unable to remove settings item before items are loaded.' ) ; } $ itemKey = $ this -> makeItemKey ( $ owner , $ code ) ; unset ( $ this -> items [ $ itemKey ] ) ; if ( $ this -> groupedItems ) { foreach ( $ t...
Removes a single setting item
22,989
public static function setContext ( $ owner , $ code ) { $ instance = self :: instance ( ) ; $ instance -> contextOwner = strtolower ( $ owner ) ; $ instance -> contextItemCode = strtolower ( $ code ) ; }
Sets the navigation context .
22,990
public function findSettingItem ( $ owner , $ code ) { if ( $ this -> items === null ) { $ this -> loadItems ( ) ; } $ owner = strtolower ( $ owner ) ; $ code = strtolower ( $ code ) ; foreach ( $ this -> items as $ item ) { if ( strtolower ( $ item -> owner ) == $ owner && strtolower ( $ item -> code ) == $ code ) { r...
Locates a setting item object by it s owner and code
22,991
public function readRecords ( $ count = 10 ) { $ result = $ this -> getRecords ( $ this -> offset , $ count ) ; $ this -> offset += count ( $ result ) ; return $ result ; }
Returns a set of records from the data source .
22,992
public function download ( $ name , $ outputName = null ) { if ( ! preg_match ( '/^oc[0-9a-z]*$/i' , $ name ) ) { throw new ApplicationException ( Lang :: get ( 'backend::lang.import_export.file_not_found_error' ) ) ; } $ csvPath = temp_path ( ) . '/' . $ name ; if ( ! file_exists ( $ csvPath ) ) { throw new Applicatio...
Download a previously compiled export file .
22,993
protected function processExportData ( $ columns , $ results , $ options ) { if ( ! $ results ) { throw new ApplicationException ( Lang :: get ( 'backend::lang.import_export.empty_error' ) ) ; } $ defaultOptions = [ 'firstRowTitles' => true , 'useOutput' => false , 'fileName' => 'export.csv' , 'delimiter' => null , 'en...
Converts a data collection to a CSV file .
22,994
protected function getColumnHeaders ( $ columns ) { $ headers = [ ] ; foreach ( $ columns as $ column => $ label ) { $ headers [ ] = Lang :: get ( $ label ) ; } return $ headers ; }
Extracts the headers from the column definitions .
22,995
protected function matchDataToColumns ( $ data , $ columns ) { $ results = [ ] ; foreach ( $ columns as $ column => $ label ) { $ results [ ] = array_get ( $ data , $ column ) ; } return $ results ; }
Ensures the correct order of the column data .
22,996
public function afterSave ( ) { Cache :: forget ( implode ( '-' , [ $ this -> table , $ this -> namespace , $ this -> group , $ this -> item ] ) ) ; }
Clear the cache after saving .
22,997
public static function set ( $ key , $ value = null ) { if ( is_array ( $ key ) ) { foreach ( $ key as $ _key => $ _value ) { static :: set ( $ _key , $ _value ) ; } return true ; } $ record = static :: findRecord ( $ key ) ; if ( ! $ record ) { $ record = new static ; list ( $ namespace , $ group , $ item ) = $ record...
Stores a setting value to the database .
22,998
public function reset ( $ key ) { $ record = static :: findRecord ( $ key ) ; if ( ! $ record ) { return false ; } $ record -> delete ( ) ; unset ( static :: $ cache [ $ key ] ) ; return true ; }
Resets a setting value by deleting the record .
22,999
protected function validateSettings ( ) { if ( isset ( $ this -> attributes [ SectionParser :: ERROR_INI ] ) ) { CmsException :: mask ( $ this , 200 ) ; Ini :: parse ( $ this -> attributes [ SectionParser :: ERROR_INI ] ) ; CmsException :: unmask ( ) ; } }
If the model is loaded with an invalid INI section the invalid content will be passed as a special attribute . Look for it then locate the failure reason .