idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
225,900
public static function fromWif ( string $ wif , AbstractNetwork $ network = null ) : EcPrivateKey { return ( new PrivateKeyFactory ( ) ) -> fromWif ( $ wif , $ network ) ; }
Derive the private key for the given WIF .
225,901
public static function sign ( string $ message , string $ passphrase ) : self { $ keys = PrivateKey :: fromPassphrase ( $ passphrase ) ; return static :: new ( [ 'publickey' => $ keys -> getPublicKey ( ) -> getHex ( ) , 'signature' => $ keys -> sign ( Hash :: sha256 ( new Buffer ( $ message ) ) ) -> getBuffer ( ) -> ge...
Sign a message using the given passphrase .
225,902
public function verify ( ) : bool { $ factory = new PublicKeyFactory ; return $ factory -> fromHex ( $ this -> publicKey ) -> verify ( new Buffer ( hash ( 'sha256' , $ this -> message , true ) ) , SignatureFactory :: fromHex ( $ this -> signature ) ) ; }
Verify the message contents .
225,903
protected function getSearchQuery ( $ keywords , $ classes ) { $ query = new SearchQuery ( ) ; $ query -> classes = $ classes ; $ query -> addSearchTerm ( $ keywords ) ; $ query -> addExclude ( SiteTree :: class . '_ShowInSearch' , 0 ) ; $ query -> setLimit ( 100 ) ; $ this -> extend ( 'updateSearchQuery' , $ query ) ;...
Build a SearchQuery for a new search
225,904
protected function getSearchOptions ( $ spellcheck ) { $ options = $ this -> config ( ) -> get ( 'search_options' ) ; if ( $ spellcheck ) { $ options = array_merge ( $ options , $ this -> config ( ) -> get ( 'spellcheck_options' ) ) ; } return $ options ; }
Get solr search options for this query
225,905
protected function getResult ( $ keywords , $ classes , $ searchIndex , $ limit = - 1 , $ start = 0 , $ spellcheck = false ) { $ query = $ this -> getSearchQuery ( $ keywords , $ classes ) ; $ options = $ this -> getSearchOptions ( $ spellcheck ) ; $ solrResult = $ searchIndex -> search ( $ query , $ start , $ limit , ...
Get results for a search term
225,906
public function search ( $ keywords , $ classes , $ searchIndex , $ limit = - 1 , $ start = 0 , $ followSuggestions = false ) { if ( empty ( $ keywords ) ) { return null ; } try { $ result = $ this -> getResult ( $ keywords , $ classes , $ searchIndex , $ limit , $ start , true ) ; if ( ! $ followSuggestions || $ resul...
Get a CwpSearchResult for a given criterea
225,907
protected function unwrapEnvelope ( array $ body ) { if ( isset ( $ body [ 'data' ] ) ) { return $ body [ 'data' ] ; } else if ( isset ( $ body [ 'items' ] ) ) { $ items = array ( ) ; foreach ( $ body [ 'items' ] as $ item ) { $ items [ ] = $ item ; } return $ items ; } return $ body ; }
Perform envelope unwrapping
225,908
protected function encodePayload ( array $ params ) { $ encoded = [ ] ; foreach ( $ params as $ key => $ value ) { if ( is_array ( $ value ) ) $ encoded [ $ key ] = $ this -> encodePayload ( $ value ) ; else if ( $ value instanceof \ DateTime ) $ encoded [ $ key ] = $ value -> format ( \ DateTime :: ISO8601 ) ; else $ ...
Ensure consistency in encoding between native PHP types and Base API expected types .
225,909
protected function encodeQueryParams ( array $ params ) { $ encoded = [ ] ; foreach ( $ params as $ key => $ value ) { if ( is_array ( $ value ) ) $ encoded [ $ key ] = $ this -> encodeQueryParams ( $ value ) ; else if ( is_bool ( $ value ) ) $ encoded [ $ key ] = $ value ? 'true' : 'false' ; else if ( $ value instance...
Ensure consistency in encoding between native PHP types and Base API expected query type format .
225,910
public function all ( $ params = [ ] , array $ options = array ( ) ) { list ( $ code , $ tasks ) = $ this -> httpClient -> get ( "/tasks" , $ params , $ options ) ; return $ tasks ; }
Retrieve all tasks
225,911
public function create ( array $ task , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ task , array_flip ( self :: $ keysToPersist ) ) ; list ( $ code , $ createdTask ) = $ this -> httpClient -> post ( "/tasks" , $ attributes , $ options ) ; return $ createdTask ; }
Create a task
225,912
protected function getLink ( $ terms , $ format = null ) { if ( ! $ terms ) { return null ; } $ link = 'search/SearchForm?Search=' . rawurlencode ( $ terms ) ; if ( $ format ) { $ link .= '&format=' . rawurlencode ( $ format ) ; } return $ link ; }
Get a search link for given terms
225,913
public function setting ( $ setting , $ default = null ) { $ value = parent :: setting ( $ setting ) ; if ( null === $ value ) { $ value = isset ( static :: $ globalSettings [ $ setting ] ) ? static :: $ globalSettings [ $ setting ] : $ default ; } return $ value ; }
Get setting .
225,914
protected function getResultsTemplate ( $ request ) { $ templates = [ Page :: class . '_results' , Page :: class ] ; if ( $ request -> getVar ( 'format' ) == 'rss' ) { array_unshift ( $ templates , Page :: class . '_results_rss' ) ; } if ( $ request -> getVar ( 'format' ) == 'atom' ) { array_unshift ( $ templates , Pag...
Select the template to render search results with
225,915
protected function decode ( $ var ) { $ decoded = file_exists ( $ this -> filename ) ? @ parse_ini_file ( $ this -> filename ) : [ ] ; if ( $ decoded === false ) { throw new \ RuntimeException ( "Decoding file '{$this->filename}' failed'" ) ; } return $ decoded ; }
Decode INI file into contents .
225,916
public function start ( $ deviceUUID , array $ options = array ( ) ) { $ this -> checkArgument ( $ deviceUUID , 'deviceUUID' ) ; list ( $ code , $ session ) = $ this -> httpClient -> post ( '/sync/start' , null , array_merge ( $ options , [ 'headers' => $ this -> buildHeaders ( $ deviceUUID ) ] ) ) ; if ( $ code == 204...
Start synchronization flow
225,917
public function fetch ( $ deviceUUID , $ sessionId , $ queue = 'main' , array $ options = array ( ) ) { $ this -> checkArgument ( $ deviceUUID , 'deviceUUID' ) ; $ this -> checkArgument ( $ sessionId , 'sessionId' ) ; $ this -> checkArgument ( $ queue , 'queue' ) ; $ options = array_merge ( $ options , [ 'headers' => $...
Get data from queue
225,918
public function ack ( $ deviceUUID , array $ ackKeys , array $ options = array ( ) ) { $ this -> checkArgument ( $ deviceUUID , 'deviceUUID' ) ; if ( ! $ ackKeys ) return true ; $ attributes = [ 'ack_keys' => $ ackKeys ] ; list ( $ code , ) = $ this -> httpClient -> post ( '/sync/ack' , $ attributes , array_merge ( $ o...
Acknowledge received data
225,919
public function create ( array $ source , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ source , array_flip ( self :: $ keysToPersist ) ) ; list ( $ code , $ createdSource ) = $ this -> httpClient -> post ( "/sources" , $ attributes , $ options ) ; return $ createdSource ; }
Create a source
225,920
public function update ( $ id , array $ order , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ order , array_flip ( self :: $ keysToPersist ) ) ; list ( $ code , $ updatedOrder ) = $ this -> httpClient -> put ( "/orders/{$id}" , $ attributes , $ options ) ; return $ updatedOrder ; }
Update an order
225,921
public function create ( array $ lead , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ lead , array_flip ( self :: $ keysToPersist ) ) ; if ( isset ( $ attributes [ 'custom_fields' ] ) && empty ( $ attributes [ 'custom_fields' ] ) ) unset ( $ attributes [ 'custom_fields' ] ) ; list ( $ code , $ ...
Create a lead
225,922
public function update ( $ id , array $ lead , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ lead , array_flip ( self :: $ keysToPersist ) ) ; if ( isset ( $ attributes [ 'custom_fields' ] ) && empty ( $ attributes [ 'custom_fields' ] ) ) unset ( $ attributes [ 'custom_fields' ] ) ; list ( $ co...
Update a lead
225,923
public function start ( ) { if ( isset ( $ _COOKIE [ session_name ( ) ] ) && ! preg_match ( '/^[-,a-zA-Z0-9]{1,128}$/' , $ _COOKIE [ session_name ( ) ] ) ) { unset ( $ _COOKIE [ session_name ( ) ] ) ; } if ( ! session_start ( ) ) { throw new \ RuntimeException ( 'Failed to start session.' , 500 ) ; } $ this -> started ...
Starts the session storage
225,924
public function invalidate ( ) { $ params = session_get_cookie_params ( ) ; setcookie ( session_name ( ) , '' , time ( ) - 42000 , $ params [ 'path' ] , $ params [ 'domain' ] , $ params [ 'secure' ] , $ params [ 'httponly' ] ) ; session_unset ( ) ; session_destroy ( ) ; $ this -> started = false ; return $ this ; }
Invalidates the current session .
225,925
public function updateCMSFields ( FieldList $ fields ) { $ pageInfoTitle = _t ( __CLASS__ . '.PAGEINFO' , 'Page info and SEO' ) ; $ boostTitle = _t ( __CLASS__ . '.SearchBoost' , 'Boost Keywords' ) ; $ boostNote = _t ( __CLASS__ . '.SearchBoostNote' , '(Only applies to the search results on this site e.g. not on Google...
Adds boost fields to this page
225,926
public function create ( array $ lossReason , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ lossReason , array_flip ( self :: $ keysToPersist ) ) ; list ( $ code , $ createdLossReason ) = $ this -> httpClient -> post ( "/loss_reasons" , $ attributes , $ options ) ; return $ createdLossReason ; ...
Create a loss reason
225,927
public function get ( $ id , array $ options = array ( ) ) { list ( $ code , $ loss_reason ) = $ this -> httpClient -> get ( "/loss_reasons/{$id}" , null , $ options ) ; return $ loss_reason ; }
Retrieve a single reason
225,928
public function update ( $ id , array $ lossReason , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ lossReason , array_flip ( self :: $ keysToPersist ) ) ; list ( $ code , $ updatedLossReason ) = $ this -> httpClient -> put ( "/loss_reasons/{$id}" , $ attributes , $ options ) ; return $ updatedL...
Update a loss reason
225,929
public function all ( $ deal_id , $ params = [ ] , array $ options = array ( ) ) { list ( $ code , $ associated_contacts ) = $ this -> httpClient -> get ( "/deals/{$deal_id}/associated_contacts" , $ params , $ options ) ; return $ associated_contacts ; }
Retrieve deal s associated contacts
225,930
public function create ( $ deal_id , array $ associatedContact , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ associatedContact , array_flip ( self :: $ keysToPersist ) ) ; list ( $ code , $ createdAssociatedContact ) = $ this -> httpClient -> post ( "/deals/{$deal_id}/associated_contacts" , $...
Create an associated contact
225,931
public function destroy ( $ deal_id , $ contact_id , array $ options = array ( ) ) { list ( $ code , $ payload ) = $ this -> httpClient -> delete ( "/deals/{$deal_id}/associated_contacts/{$contact_id}" , null , $ options ) ; return $ code == 204 ; }
Remove an associated contact
225,932
public function update ( $ id , array $ tag , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ tag , array_flip ( self :: $ keysToPersist ) ) ; list ( $ code , $ updatedTag ) = $ this -> httpClient -> put ( "/tags/{$id}" , $ attributes , $ options ) ; return $ updatedTag ; }
Update a tag
225,933
public function create ( array $ dealUnqualifiedReason , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ dealUnqualifiedReason , array_flip ( self :: $ keysToPersist ) ) ; list ( $ code , $ createdDealUnqualifiedReason ) = $ this -> httpClient -> post ( "/deal_unqualified_reasons" , $ attributes ...
Create a deal unqualified reason
225,934
public function update ( $ id , array $ dealUnqualifiedReason , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ dealUnqualifiedReason , array_flip ( self :: $ keysToPersist ) ) ; list ( $ code , $ updatedDealUnqualifiedReason ) = $ this -> httpClient -> put ( "/deal_unqualified_reasons/{$id}" , $...
Update a deal unqualified reason
225,935
private function cleanup ( $ value ) { $ value = str_replace ( array ( "\r\n" , "\r" ) , "\n" , $ value ) ; $ count = 0 ; $ value = preg_replace ( '#^\%YAML[: ][\d\.]+.*\n#u' , '' , $ value , - 1 , $ count ) ; $ this -> offset += $ count ; $ trimmedValue = preg_replace ( '#^(\#.*?\n)+#s' , '' , $ value , - 1 , $ count ...
Cleanups a YAML string to be parsed .
225,936
public function save ( $ data = null ) { parent :: save ( $ data ) ; if ( \ function_exists ( 'opcache_invalidate' ) ) { @ opcache_invalidate ( $ this -> filename , true ) ; } elseif ( \ function_exists ( 'apc_invalidate' ) ) { @ apc_invalidate ( $ this -> filename ) ; } }
Saves PHP file and invalidates opcache .
225,937
public static function instance ( $ filename ) { if ( ! \ is_string ( $ filename ) && $ filename ) { throw new \ InvalidArgumentException ( 'Filename should be non-empty string' ) ; } if ( ! isset ( static :: $ instances [ $ filename ] ) ) { static :: $ instances [ $ filename ] = new static ; static :: $ instances [ $ ...
Get file instance .
225,938
public function free ( ) { if ( $ this -> locked ) { $ this -> unlock ( ) ; } $ this -> content = null ; $ this -> raw = null ; unset ( static :: $ instances [ $ this -> filename ] ) ; }
Free the file instance .
225,939
public function writable ( ) { return file_exists ( $ this -> filename ) ? is_writable ( $ this -> filename ) && is_file ( $ this -> filename ) : $ this -> writableDir ( \ dirname ( $ this -> filename ) ) ; }
Check if file can be written .
225,940
public function rename ( $ filename ) { if ( $ this -> exists ( ) && ! @ rename ( $ this -> filename , $ filename ) ) { return false ; } unset ( static :: $ instances [ $ this -> filename ] ) ; static :: $ instances [ $ filename ] = $ this ; $ this -> filename = $ filename ; return true ; }
Rename file in the filesystem if it exists .
225,941
public function self ( array $ options = array ( ) ) { list ( $ code , $ resource ) = $ this -> httpClient -> get ( "/users/self" , null , $ options ) ; return $ resource ; }
Retrieve an authenticating user
225,942
public function add ( $ message , $ scope = 'default' ) { $ key = md5 ( $ scope . '~' . $ message ) ; $ item = [ 'message' => $ message , 'scope' => $ scope ] ; if ( ! array_key_exists ( $ key , $ this -> messages ) ) { $ this -> messages [ $ key ] = $ item ; } return $ this ; }
Add message to the queue .
225,943
public function clear ( $ scope = null ) { if ( $ scope === null ) { $ this -> messages = array ( ) ; } else { foreach ( $ this -> messages as $ key => $ message ) { if ( $ message [ 'scope' ] === $ scope ) { unset ( $ this -> messages [ $ key ] ) ; } } } return $ this ; }
Clear message queue .
225,944
public function all ( $ scope = null ) { if ( $ scope === null ) { return array_values ( $ this -> messages ) ; } $ messages = array ( ) ; foreach ( $ this -> messages as $ message ) { if ( $ message [ 'scope' ] === $ scope ) { $ messages [ ] = $ message ; } } return $ messages ; }
Fetch all messages .
225,945
public function fetch ( $ scope = null ) { $ messages = $ this -> all ( $ scope ) ; $ this -> clear ( $ scope ) ; return $ messages ; }
Fetch and clear message queue .
225,946
public function all ( $ params = [ ] , array $ options = array ( ) ) { list ( $ code , $ deals ) = $ this -> httpClient -> get ( "/deals" , $ params , $ options ) ; if ( isset ( $ options [ 'raw' ] ) && $ options [ 'raw' ] ) { return $ deals ; } $ dealsData = array_map ( array ( $ this , 'coerceNestedDealData' ) , $ de...
Retrieve all deals
225,947
public function create ( array $ deal , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ deal , array_flip ( self :: $ keysToPersist ) ) ; if ( isset ( $ attributes [ 'custom_fields' ] ) && empty ( $ attributes [ 'custom_fields' ] ) ) unset ( $ attributes [ 'custom_fields' ] ) ; if ( isset ( $ att...
Create a deal
225,948
public function get ( $ id , array $ options = array ( ) ) { list ( $ code , $ deal ) = $ this -> httpClient -> get ( "/deals/{$id}" , null , $ options ) ; if ( isset ( $ options [ 'raw' ] ) && $ options [ 'raw' ] ) { return $ deal ; } $ deal = $ this -> coerceDealData ( $ deal ) ; return $ deal ; }
Retrieve a single deal
225,949
public function update ( $ id , array $ deal , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ deal , array_flip ( self :: $ keysToPersist ) ) ; if ( isset ( $ attributes [ 'custom_fields' ] ) && empty ( $ attributes [ 'custom_fields' ] ) ) unset ( $ attributes [ 'custom_fields' ] ) ; if ( isset ...
Update a deal
225,950
public function update ( $ id , array $ product , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ product , array_flip ( self :: $ keysToPersist ) ) ; list ( $ code , $ updatedProduct ) = $ this -> httpClient -> put ( "/products/{$id}" , $ attributes , $ options ) ; return $ updatedProduct ; }
Update a product
225,951
public function destroy ( $ id , array $ options = array ( ) ) { list ( $ code , $ payload ) = $ this -> httpClient -> delete ( "/products/{$id}" , null , $ options ) ; return $ code == 204 ; }
Delete a product
225,952
public function load ( $ extends = null ) { if ( empty ( $ this -> items ) && $ this -> filename ) { $ files = $ this -> getFiles ( $ this -> filename ) ; $ data = $ this -> doLoad ( $ files , $ extends ) ; $ this -> items = ( array ) array_shift ( $ data ) ; foreach ( $ data as $ content ) { $ this -> extend ( $ conte...
Load blueprint .
225,953
public function fields ( ) { $ fields = $ this -> get ( 'form/fields' ) ; if ( $ fields === null ) { $ field = $ this -> get ( 'form/field' ) ; $ fields = $ field !== null ? [ '' => ( array ) $ field ] : $ fields ; } return ( array ) $ fields ; }
Get form fields .
225,954
public function extend ( $ extends , $ append = false ) { if ( $ extends instanceof self ) { $ extends = $ extends -> toArray ( ) ; } if ( $ append ) { $ a = $ this -> items ; $ b = $ extends ; } else { $ a = $ extends ; $ b = $ this -> items ; } $ this -> items = $ this -> deepMerge ( $ a , $ b ) ; return $ this ; }
Extend blueprint with another blueprint .
225,955
protected function deepMerge ( array $ a , array $ b ) { $ bref_stack = [ & $ a ] ; $ head_stack = [ $ b ] ; do { end ( $ bref_stack ) ; $ bref = & $ bref_stack [ key ( $ bref_stack ) ] ; $ head = array_pop ( $ head_stack ) ; unset ( $ bref_stack [ key ( $ bref_stack ) ] ) ; foreach ( $ head as $ key => $ value ) { if ...
Deep merge two arrays together .
225,956
protected function doLoad ( array $ files , $ extends = null ) { $ filename = array_shift ( $ files ) ; $ content = $ this -> loadFile ( $ filename ) ; $ key = '' ; if ( isset ( $ content [ 'extends@' ] ) ) { $ key = 'extends@' ; } elseif ( isset ( $ content [ '@extends' ] ) ) { $ key = '@extends' ; } elseif ( isset ( ...
Internal function that handles loading extended blueprints .
225,957
protected function doExtend ( $ filename , array $ parents , array $ extends , $ override = false ) { if ( \ is_string ( key ( $ extends ) ) ) { $ extends = [ $ extends ] ; } $ data = [ [ ] ] ; foreach ( $ extends as $ value ) { $ type = ! \ is_string ( $ value ) ? ( ! isset ( $ value [ 'type' ] ) ? null : $ value [ 't...
Internal function to recursively load extended blueprints .
225,958
protected function doReorder ( array $ items , array $ keys ) { $ reordered = array_keys ( $ items ) ; foreach ( $ keys as $ item => $ ordering ) { if ( ( string ) ( int ) $ ordering === ( string ) $ ordering ) { $ location = array_search ( $ item , $ reordered , true ) ; $ rel = array_splice ( $ reordered , $ location...
Internal function to reorder items .
225,959
protected function generateSearchRecord ( ) { $ searchPage = CwpSearchPage :: create ( ) ; $ searchPage -> URLSegment = 'search' ; $ searchPage -> Title = _t ( 'SilverStripe\\CMS\\Search\\SearchForm.SearchResults' , 'Search Results' ) ; $ searchPage -> ID = - 1 ; return $ searchPage ; }
Create the dummy search record for this page
225,960
public function init ( ) { parent :: init ( ) ; $ routes = $ this -> findAvailableRoutes ( ) ; $ route = $ this -> getRequest ( ) -> getVar ( 'endpoint' ) ? : $ this -> config ( ) -> default_route ; if ( ! $ route && ! empty ( $ routes ) ) { $ route = $ routes [ 0 ] ; } if ( ! $ route ) { throw new \ RuntimeException (...
Initialise the controller sanity check load javascript . Note that permission checks are handled by DevelopmentAdmin .
225,961
protected function findAvailableRoutes ( ) { $ routes = [ ] ; $ rules = Director :: config ( ) -> get ( 'rules' ) ; foreach ( $ rules as $ pattern => $ controllerInfo ) { $ routeClass = ( is_string ( $ controllerInfo ) ) ? $ controllerInfo : $ controllerInfo [ 'Controller' ] ; try { $ routeController = Injector :: inst...
Find all available graphql routes
225,962
public function all ( $ order_id , $ params = [ ] , array $ options = array ( ) ) { list ( $ code , $ line_items ) = $ this -> httpClient -> get ( "/orders/{$order_id}/line_items" , $ params , $ options ) ; return $ line_items ; }
Retrieve order s line items
225,963
public function create ( $ order_id , array $ lineItem , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ lineItem , array_flip ( self :: $ keysToPersist ) ) ; list ( $ code , $ createdLineItem ) = $ this -> httpClient -> post ( "/orders/{$order_id}/line_items" , $ attributes , $ options ) ; retur...
Create a line item
225,964
public function get ( $ order_id , $ id , array $ options = array ( ) ) { list ( $ code , $ line_item ) = $ this -> httpClient -> get ( "/orders/{$order_id}/line_items/{$id}" , null , $ options ) ; return $ line_item ; }
Retrieve a single line item
225,965
public function create ( array $ contact , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ contact , array_flip ( self :: $ keysToPersist ) ) ; if ( isset ( $ attributes [ 'custom_fields' ] ) && empty ( $ attributes [ 'custom_fields' ] ) ) unset ( $ attributes [ 'custom_fields' ] ) ; list ( $ cod...
Create a contact
225,966
public function update ( $ id , array $ contact , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ contact , array_flip ( self :: $ keysToPersist ) ) ; if ( isset ( $ attributes [ 'custom_fields' ] ) && empty ( $ attributes [ 'custom_fields' ] ) ) unset ( $ attributes [ 'custom_fields' ] ) ; list ...
Update a contact
225,967
public function getState ( ) { return [ 'items' => $ this -> items , 'rules' => $ this -> rules , 'nested' => $ this -> nested , 'dynamic' => $ this -> dynamic , 'filter' => $ this -> filter ] ; }
Convert object into an array .
225,968
public function embed ( $ name , array $ value , $ separator = '.' , $ merge = false ) { if ( isset ( $ value [ 'rules' ] ) ) { $ this -> rules = array_merge ( $ this -> rules , $ value [ 'rules' ] ) ; } $ name = $ separator !== '.' ? str_replace ( $ separator , '.' , $ name ) : $ name ; if ( isset ( $ value [ 'form' ]...
Embed an array to the blueprint .
225,969
public function getPropertyName ( $ path = null , $ separator = '.' ) { $ parts = explode ( $ separator , $ path ) ; $ nested = $ this -> nested ; $ result = [ ] ; while ( ( $ part = array_shift ( $ parts ) ) !== null ) { if ( ! isset ( $ nested [ $ part ] ) ) { if ( isset ( $ nested [ '*' ] ) ) { $ part = '*' ; } else...
Returns name of the property with given path .
225,970
protected function getNested ( $ path = null , $ separator = '.' ) { if ( ! $ path ) { return $ this -> nested ; } $ parts = explode ( $ separator , $ path ) ; $ item = array_pop ( $ parts ) ; $ nested = $ this -> nested ; foreach ( $ parts as $ part ) { if ( ! isset ( $ nested [ $ part ] ) ) { $ part = '*' ; if ( ! is...
Get property from the definition .
225,971
protected function parseFormFields ( array $ fields , array $ params , $ prefix = '' , $ parent = '' , $ merge = false , array $ formPath = [ ] ) { if ( isset ( $ fields [ 'type' ] ) && ! \ is_array ( $ fields [ 'type' ] ) ) { return ; } foreach ( $ fields as $ key => $ field ) { $ this -> parseFormField ( $ key , $ fi...
Gets all field definitions from the blueprints .
225,972
protected function addProperty ( $ path ) { $ parts = explode ( '.' , $ path ) ; $ item = array_pop ( $ parts ) ; $ nested = & $ this -> nested ; foreach ( $ parts as $ part ) { if ( ! isset ( $ nested [ $ part ] ) || ! \ is_array ( $ nested [ $ part ] ) ) { $ nested [ $ part ] = [ ] ; } $ nested = & $ nested [ $ part ...
Add property to the definition .
225,973
protected function validateField ( $ fieldName , $ value ) { if ( ! $ this -> validateValue ( $ value ) ) { $ this -> validationError ( $ fieldName , _t ( __CLASS__ . '.InvalidValue' , 'Synonyms cannot contain words separated by spaces' ) ) ; } }
Validate field values raising errors if the values are invalid .
225,974
protected function validateValue ( $ value ) { $ lines = array_filter ( explode ( "\n" , $ value ) ) ; $ lines = array_filter ( $ lines , function ( $ line ) { $ line = trim ( $ line ) ; return ! empty ( $ line ) && $ line [ 0 ] !== '#' ; } ) ; foreach ( $ lines as $ line ) { if ( ! $ this -> validateLine ( $ line ) ) ...
Check field values to see that they doesn t contain spaces between words .
225,975
protected function validateLine ( $ line ) { $ line = trim ( $ line ) ; $ parts = explode ( ',' , $ line ) ; $ parts = array_filter ( $ parts ) ; foreach ( $ parts as $ part ) { if ( ! $ this -> validatePart ( $ part ) ) { return false ; } } return true ; }
Check each line to see that it doesn t contain spaces between words .
225,976
protected function validatePart ( $ part ) { if ( strpos ( $ part , '=>' ) !== false ) { $ subs = explode ( '=>' , $ part ) ; $ subs = array_filter ( $ subs ) ; foreach ( $ subs as $ sub ) { if ( ! $ this -> validateNoSpaces ( $ sub ) ) { return false ; } } return true ; } return $ this -> validateNoSpaces ( $ part ) ;...
Check each part of the line doesn t contain spaces between words .
225,977
private static function parseQuotedScalar ( $ scalar , & $ i ) { if ( ! Parser :: preg_match ( '/' . self :: REGEX_QUOTED_STRING . '/Au' , substr ( $ scalar , $ i ) , $ match ) ) { throw new ParseException ( sprintf ( 'Malformed inline YAML string: %s.' , substr ( $ scalar , $ i ) ) ) ; } $ output = substr ( $ match [ ...
Parses a YAML quoted scalar .
225,978
public function create ( array $ note , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ note , array_flip ( self :: $ keysToPersist ) ) ; list ( $ code , $ createdNote ) = $ this -> httpClient -> post ( "/notes" , $ attributes , $ options ) ; return $ createdNote ; }
Create a note
225,979
public function update ( $ id , array $ note , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ note , array_flip ( self :: $ keysToPersist ) ) ; list ( $ code , $ updatedNote ) = $ this -> httpClient -> put ( "/notes/{$id}" , $ attributes , $ options ) ; return $ updatedNote ; }
Update a note
225,980
public function isValid ( ) { if ( ! is_string ( $ this -> accessToken ) ) { $ msg = 'Provided access token is invalid as it is not a string' ; throw new Errors \ ConfigurationError ( $ msg ) ; } if ( preg_match ( '/\s/' , $ this -> accessToken ) ) { $ msg = 'Provided access token is invalid ' . 'as it contains disallo...
Checks if provided configuration is valid .
225,981
public static function configure ( ) { if ( ! class_exists ( Solr :: class ) ) { return ; } $ options = static :: config ( ) -> get ( 'options' ) ; switch ( $ options [ 'version' ] ) { case 'cwp-4' : $ solrOptions = self :: options_for_cwp ( $ options ) ; break ; case 'local-4' : $ solrOptions = self :: options_for_loc...
Configure Solr .
225,982
public function addPath ( $ scheme , $ prefix , $ paths , $ override = false , $ force = false ) { $ list = [ ] ; foreach ( ( array ) $ paths as $ path ) { if ( \ is_array ( $ path ) ) { if ( \ count ( $ path ) !== 2 || ! \ is_string ( $ path [ 0 ] ) || ! \ is_string ( $ path [ 1 ] ) ) { throw new \ BadMethodCallExcept...
Add new paths to the scheme .
225,983
public function getPaths ( $ scheme = null ) { return ! $ scheme ? $ this -> schemes : ( isset ( $ this -> schemes [ $ scheme ] ) ? $ this -> schemes [ $ scheme ] : [ ] ) ; }
Return all scheme lookup paths .
225,984
public function isStream ( $ uri ) { try { list ( $ scheme , ) = $ this -> normalize ( $ uri , true , true ) ; } catch ( \ Exception $ e ) { return false ; } return $ this -> schemeExists ( $ scheme ) ; }
Returns true if uri is resolvable by using locator .
225,985
public function findResource ( $ uri , $ absolute = true , $ first = false ) { if ( ! \ is_string ( $ uri ) ) { throw new \ BadMethodCallException ( 'Invalid parameter $uri.' ) ; } return $ this -> findCached ( $ uri , false , $ absolute , $ first ) ; }
Find highest priority instance from a resource .
225,986
public function findResources ( $ uri , $ absolute = true , $ all = false ) { if ( ! \ is_string ( $ uri ) ) { throw new \ BadMethodCallException ( 'Invalid parameter $uri.' ) ; } return $ this -> findCached ( $ uri , true , $ absolute , $ all ) ; }
Find all instances from a resource .
225,987
public function mergeResources ( array $ uris , $ absolute = true , $ all = false ) { $ uris = array_unique ( $ uris ) ; $ lists = [ [ ] ] ; foreach ( $ uris as $ uri ) { $ lists [ ] = $ this -> findResources ( $ uri , $ absolute , $ all ) ; } return call_user_func_array ( 'array_merge' , $ lists ) ; }
Find all instances from a list of resources .
225,988
public function fillCache ( $ uri ) { $ cacheKey = $ uri . '@cache' ; if ( ! isset ( $ this -> cache [ $ cacheKey ] ) ) { $ this -> cache [ $ cacheKey ] = true ; $ iterator = new \ RecursiveIteratorIterator ( $ this -> getRecursiveIterator ( $ uri ) , \ RecursiveIteratorIterator :: SELF_FIRST ) ; foreach ( $ iterator a...
Pre - fill cache by a stream .
225,989
public function clearCache ( $ uri = null ) { if ( $ uri ) { $ this -> clearCached ( $ uri , true , true , true ) ; $ this -> clearCached ( $ uri , true , true , false ) ; $ this -> clearCached ( $ uri , true , false , true ) ; $ this -> clearCached ( $ uri , true , false , false ) ; $ this -> clearCached ( $ uri , fal...
Reset locator cache .
225,990
public function moveUpAction ( $ id ) { $ repo = $ this -> getDoctrine ( ) -> getManager ( ) -> getRepository ( $ this -> admin -> getClass ( ) ) ; $ result = $ repo -> find ( $ id ) ; $ repo -> moveUp ( $ result ) ; if ( $ referer = $ this -> getRequest ( ) -> headers -> get ( 'referer' ) ) { return $ this -> redirect...
Move the item up . Used for Tree admins
225,991
protected function bindAndRender ( $ action ) { $ templateKey = 'edit' ; if ( $ action == 'edit' ) { $ id = $ this -> getRequest ( ) -> get ( $ this -> admin -> getIdParameter ( ) ) ; $ object = $ this -> admin -> getObject ( $ id ) ; if ( ! $ object ) { throw new NotFoundHttpException ( sprintf ( 'unable to find the o...
Binds the request to the form and only renders the resulting form .
225,992
public function createQuery ( $ context = 'list' ) { if ( $ context === 'list' ) { $ em = $ this -> getModelManager ( ) -> getEntityManager ( $ this -> getClass ( ) ) ; $ cmd = $ em -> getMetadataFactory ( ) -> getMetadataFor ( $ this -> getClass ( ) ) ; $ queryBuilder = $ em -> createQueryBuilder ( ) ; $ queryBuilder ...
Override the default query builder to utilize correct sorting
225,993
public function filterWithChildren ( $ qb , $ alias , $ field , $ value ) { if ( ! ( $ value [ 'value' ] && is_numeric ( $ value [ 'value' ] ) ) ) { return null ; } $ parentQb = clone $ qb ; $ parentQb -> where ( $ parentQb -> expr ( ) -> eq ( sprintf ( '%s.id' , $ alias ) , ':id' ) ) ; $ parentQb -> setParameter ( 'id...
Get item plus children
225,994
protected function mapAttributesToRoles ( $ class , $ attributes ) { $ mappedAttributes = array ( ) ; foreach ( $ this -> pool -> getAdminClasses ( ) as $ adminClass => $ adminCodes ) { if ( $ class === $ adminClass || $ class instanceof $ adminClass ) { foreach ( $ adminCodes as $ adminCode ) { $ admin = $ this -> poo...
Maps regular attributes such as VIEW EDIT etc to their respective SONATA role name such as ROLE_FOO_BAR_BAZ_EDIT
225,995
public function adminUrl ( $ subject , $ action , $ parameters = array ( ) ) { if ( is_object ( $ subject ) ) { $ className = get_class ( $ subject ) ; } elseif ( is_string ( $ subject ) ) { $ className = $ subject ; if ( strpos ( $ className , ':' ) !== false ) { list ( $ namespace , $ entity ) = explode ( ':' , $ cla...
Render an url to a sonata admin
225,996
public function onKernelResponse ( KernelEvent $ event ) { if ( $ event -> getRequestType ( ) === HttpKernelInterface :: MASTER_REQUEST && $ this -> wasTxStarted && $ this -> doctrine -> getConnection ( ) -> getTransactionIsolation ( ) > 0 ) { if ( $ this -> doctrine -> getConnection ( ) -> isRollbackOnly ( ) ) { $ thi...
Commits the transaction if started
225,997
public function quicklistAction ( Request $ request ) { $ quicklist = $ this -> get ( 'zicht_admin.quicklist' ) ; if ( $ request -> get ( 'repo' ) && $ request -> get ( 'pattern' ) ) { if ( $ request -> get ( 'language' ) ) { $ language = $ request -> get ( 'language' ) ; } else { $ language = null ; } return new JsonR...
Displays a quick list control for jumping to entries registered in the quick list service
225,998
public function onEvent ( Event $ anyEvent , $ eventName , EventDispatcherInterface $ dispatcher ) { if ( isset ( $ this -> propagations [ $ eventName ] ) ) { foreach ( $ this -> propagations [ $ eventName ] as $ builder ) { $ builder -> buildAndForwardEvent ( $ anyEvent ) ; } } }
Builds and forwards the event for all progragations registered for the specified event type .
225,999
public function getRepositoryConfigs ( $ exposedOnly = true ) { if ( $ exposedOnly ) { return array_filter ( $ this -> repos , function ( $ item ) { return isset ( $ item [ 'exposed' ] ) && $ item [ 'exposed' ] === true ; } ) ; } return $ this -> repos ; }
Returns all configurations