idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
16,000
public function onSubscribe ( ConnectionInterface $ conn , $ topic ) { $ this -> console -> info ( "onSubscribe: {$conn->WAMP->sessionId} topic: $topic {$topic->count()}" ) ; if ( ! array_key_exists ( $ topic -> getId ( ) , $ this -> subscribedTopics ) ) { $ this -> subscribedTopics [ $ topic -> getId ( ) ] = $ topic ;...
A request to subscribe to a topic has been made .
16,001
public function onCall ( ConnectionInterface $ conn , $ id , $ topic , array $ params ) { $ this -> console -> info ( 'onCall' ) ; $ conn -> callError ( $ id , $ topic , 'You are not allowed to make calls' ) -> close ( ) ; }
An RPC call has been received .
16,002
public function onPublish ( ConnectionInterface $ conn , $ topic , $ event , array $ exclude , array $ eligible ) { $ this -> console -> info ( 'onPublish' ) ; }
A client is attempting to publish content to a subscribed connections on a URI .
16,003
public function onError ( ConnectionInterface $ conn , \ Exception $ e ) { $ this -> console -> info ( 'onError' . $ e -> getMessage ( ) ) ; }
If there is an error with one of the sockets or somewhere in the application where an Exception is thrown the Exception is sent back down the stack handled by the Server and bubbled back up the application through this method .
16,004
protected function registerAssetsManagerInstance ( $ name , array $ config ) { $ this -> app -> singleton ( "stolz.assets.group.$name" , function ( $ app ) use ( $ config ) { if ( ! isset ( $ config [ 'public_dir' ] ) ) $ config [ 'public_dir' ] = public_path ( ) ; return new Assets ( $ config ) ; } ) ; }
Register an instance of the assets manager library in the IoC container .
16,005
protected function getPipelineDirectories ( ) { $ config = $ this -> config -> get ( 'assets' , [ ] ) ; $ groups = ( isset ( $ config [ 'default' ] ) ) ? $ config : [ 'default' => $ config ] ; if ( ! is_null ( $ group = $ this -> option ( 'group' ) ) ) $ groups = array_only ( $ groups , $ group ) ; $ directories = [ ] ...
Get the pipeline directories of the groups .
16,006
protected function purgeDir ( $ directory ) { if ( ! $ this -> filesystem -> isDirectory ( $ directory ) ) return true ; if ( $ this -> filesystem -> isWritable ( $ directory ) ) return $ this -> filesystem -> cleanDirectory ( $ directory ) ; $ this -> error ( $ directory . ' is not writable' ) ; return false ; }
Remove the contents of a given directory .
16,007
public function prepend ( $ asset ) { if ( is_array ( $ asset ) ) { foreach ( array_reverse ( $ asset ) as $ a ) $ this -> prepend ( $ a ) ; } elseif ( isset ( $ this -> collections [ $ asset ] ) ) $ this -> prepend ( $ this -> collections [ $ asset ] ) ; elseif ( preg_match ( $ this -> js_regex , $ asset ) ) $ this ->...
Add an asset or a collection of assets to the beginning of the queue .
16,008
public function addCss ( $ asset ) { if ( is_array ( $ asset ) ) { foreach ( $ asset as $ a ) $ this -> addCss ( $ a ) ; return $ this ; } if ( ! $ this -> isRemoteLink ( $ asset ) ) $ asset = $ this -> buildLocalLink ( $ asset , $ this -> css_dir ) ; if ( ! in_array ( $ asset , $ this -> css ) ) $ this -> css [ ] = $ ...
Add a CSS asset .
16,009
public function prependCss ( $ asset ) { if ( is_array ( $ asset ) ) { foreach ( array_reverse ( $ asset ) as $ a ) $ this -> prependCss ( $ a ) ; return $ this ; } if ( ! $ this -> isRemoteLink ( $ asset ) ) $ asset = $ this -> buildLocalLink ( $ asset , $ this -> css_dir ) ; if ( ! in_array ( $ asset , $ this -> css ...
Add a CSS asset to the beginning of the queue .
16,010
public function addJs ( $ asset ) { if ( is_array ( $ asset ) ) { foreach ( $ asset as $ a ) $ this -> addJs ( $ a ) ; return $ this ; } if ( ! $ this -> isRemoteLink ( $ asset ) ) $ asset = $ this -> buildLocalLink ( $ asset , $ this -> js_dir ) ; if ( ! in_array ( $ asset , $ this -> js ) ) $ this -> js [ ] = $ asset...
Add a JavaScript asset .
16,011
public function prependJs ( $ asset ) { if ( is_array ( $ asset ) ) { foreach ( array_reverse ( $ asset ) as $ a ) $ this -> prependJs ( $ a ) ; return $ this ; } if ( ! $ this -> isRemoteLink ( $ asset ) ) $ asset = $ this -> buildLocalLink ( $ asset , $ this -> js_dir ) ; if ( ! in_array ( $ asset , $ this -> js ) ) ...
Add a JavaScript asset to the beginning of the queue .
16,012
protected function cssPipeline ( ) { $ minifier = ( isset ( $ this -> css_minifier ) ) ? $ this -> css_minifier : function ( $ buffer ) { $ min = new \ CSSmin ( ) ; return $ min -> run ( $ buffer ) ; } ; return $ this -> pipeline ( $ this -> css , '.css' , $ this -> css_dir , $ minifier ) ; }
Minifiy and concatenate CSS files .
16,013
protected function jsPipeline ( ) { $ minifier = ( isset ( $ this -> js_minifier ) ) ? $ this -> js_minifier : function ( $ buffer ) { return \ JSMin :: minify ( $ buffer ) ; } ; return $ this -> pipeline ( $ this -> js , '.js' , $ this -> js_dir , $ minifier ) ; }
Minifiy and concatenate JavaScript files .
16,014
protected function pipeline ( array $ assets , $ extension , $ subdirectory , Closure $ minifier ) { $ pipeline_dir = $ this -> public_dir . DIRECTORY_SEPARATOR . $ subdirectory . DIRECTORY_SEPARATOR . $ this -> pipeline_dir ; if ( ! is_dir ( $ pipeline_dir ) ) mkdir ( $ pipeline_dir , 0777 , true ) ; $ filename = $ th...
Minifiy and concatenate files .
16,015
protected function calculatePipelineHash ( array $ assets ) { $ salt = $ this -> pipeline ; if ( ! $ salt ) return md5 ( implode ( $ assets ) ) ; if ( $ salt !== 'auto' ) return md5 ( implode ( $ assets ) . $ salt ) ; $ timestamps = array ( ) ; foreach ( $ assets as $ asset ) { if ( $ this -> isRemoteLink ( $ asset ) )...
Calculate the pipeline hash .
16,016
protected function packLinks ( array $ links , Closure $ minifier ) { $ buffer = '' ; foreach ( $ links as $ link ) { $ originalLink = $ link ; if ( $ this -> isRemoteLink ( $ link ) ) { if ( '//' === substr ( $ link , 0 , 2 ) ) { $ protocol = ( isset ( $ _SERVER [ 'HTTPS' ] ) and ! empty ( $ _SERVER [ 'HTTPS' ] ) and ...
Download concatenate and minifiy the content of several links .
16,017
protected function purgeDir ( $ directory ) { if ( ! File :: isDirectory ( $ directory ) ) return true ; if ( File :: isWritable ( $ directory ) ) return File :: cleanDirectory ( $ directory ) ; $ this -> error ( $ directory . ' is not writable' ) ; return false ; }
Purge directory .
16,018
public function getRoot ( $ conn = null ) { $ command = $ this -> invoke ( 'simple_command' , $ conn ) ; $ httpResponse = $ command -> execute ( ) ; return $ this -> handleHttpResponse ( $ httpResponse ) ; }
Convenience method that returns the root of the Neo4j Api .
16,019
public function getNeo4jVersion ( $ conn = null ) { $ command = $ this -> invoke ( 'neo.get_neo4j_version' , $ conn ) ; $ httpResponse = $ command -> execute ( ) ; $ response = $ this -> handleHttpResponse ( $ httpResponse ) ; return $ response -> getBody ( ) [ 'neo4j_version' ] ; }
Convenience method that invoke the GetVersionCommand .
16,020
public function sendCypherQuery ( $ query , array $ parameters = array ( ) , $ conn = null , $ queryMode = null ) { $ command = $ this -> invoke ( 'neo.send_cypher_query' , $ conn ) ; if ( ! is_string ( $ query ) ) { throw new CypherException ( 'You need to send a Cypher query as a string. Usage: "$neoclient->sendCyphe...
Convenience method that invoke the sendCypherQueryCommand and passes given query and parameters arguments .
16,021
public function createSchemaIndex ( $ label , $ property , $ conn = null ) { $ statement = 'CREATE INDEX ON :' . $ label . '(' . $ property . ')' ; $ this -> sendCypherQuery ( $ statement , array ( ) , $ conn = null , self :: WRITE_QUERY ) ; return new Index ( $ label , $ property ) ; }
Creates a Schema Index based on label and property .
16,022
public function dropSchemaIndex ( Index $ index , $ conn = null ) { $ statement = 'DROP INDEX ON :' . $ index -> getLabel ( ) . '(' . $ index -> getProperty ( ) . ')' ; $ this -> sendCypherQuery ( $ statement , array ( ) , $ conn , self :: WRITE_QUERY ) ; }
Removes a Schema Index .
16,023
public function createIndex ( $ label , $ property ) { $ statements = [ ] ; if ( is_array ( $ property ) ) { foreach ( $ property as $ prop ) { $ statements [ ] = 'CREATE INDEX ON :' . $ label . '(' . $ prop . ')' ; } } else { $ statements [ ] = 'CREATE INDEX ON :' . $ label . '(' . $ property . ')' ; } foreach ( $ sta...
Creates an index on a label .
16,024
public function listIndex ( $ label , $ conn = null ) { $ command = $ this -> invoke ( 'neo.list_index_command' , $ conn ) ; $ command -> setArguments ( $ label ) ; $ httpResponse = $ command -> execute ( ) ; $ response = $ this -> handleHttpResponse ( $ httpResponse ) ; $ propertiesIndexed = [ ] ; foreach ( $ response...
Returns the list of indexed properties for a given Label .
16,025
public function getSchemaIndexes ( $ conn = null ) { $ indx = [ ] ; $ labels = $ this -> getLabels ( $ conn ) -> getBody ( ) ; foreach ( $ labels as $ label ) { $ indexes = $ this -> listIndex ( $ label , $ conn ) -> getBody ( ) ; foreach ( $ indexes as $ property ) { $ indx [ ] = new Index ( $ label , $ property ) ; }...
Returns the schema indexes live in the database .
16,026
public function isIndexed ( $ label , $ propertyKey , $ conn = null ) { $ indexes = $ this -> listIndex ( $ label , $ conn ) -> getBody ( ) ; if ( in_array ( $ propertyKey , $ indexes ) ) { return true ; } return false ; }
Checks if a property is indexed for a given label .
16,027
public function getUniqueConstraints ( $ conn = null ) { $ command = $ this -> invoke ( 'neo.get_constraints_command' , $ conn ) ; $ httpResponse = $ command -> execute ( ) ; $ responseO = $ this -> handleHttpResponse ( $ httpResponse ) ; $ response = $ responseO -> getBody ( ) ; $ constraints = [ ] ; foreach ( $ respo...
Returns the registered constraints .
16,028
public function createUniqueConstraint ( $ label , $ property , $ removeIndexIfExist = false ) { $ statements = [ ] ; $ identifier = strtolower ( $ label ) ; if ( is_array ( $ property ) ) { foreach ( $ property as $ prop ) { $ statements [ ] = 'CREATE CONSTRAINT ON (' . $ identifier . ':' . $ label . ') ASSERT ' . $ i...
Create a unique constraint on a label .
16,029
public function dropSchemaUniqueConstraint ( UniqueConstraint $ constraint , $ conn = null ) { $ q = 'DROP CONSTRAINT ON (n:' . $ constraint -> getLabel ( ) . ') ASSERT n.' . $ constraint -> getProperty ( ) . ' IS UNIQUE' ; $ this -> sendCypherQuery ( $ q ) ; }
Drops a Uniqueness constraint from the Schema .
16,030
public function getSchemaUniqueConstraints ( $ conn = null ) { $ command = $ this -> invoke ( 'neo.get_constraints_command' , $ conn ) ; $ httpResponse = $ command -> execute ( ) ; $ responseO = $ this -> handleHttpResponse ( $ httpResponse ) ; $ response = $ responseO -> getBody ( ) ; $ constraints = [ ] ; foreach ( $...
Returns a collection of Uniqueness constraints live in the schema .
16,031
public function dropUniqueConstraint ( $ label , $ property ) { $ statements = [ ] ; $ identifier = strtolower ( $ label ) ; if ( is_array ( $ property ) ) { foreach ( $ property as $ prop ) { $ statements [ ] = 'DROP CONSTRAINT ON (' . $ identifier . ':' . $ label . ') ASSERT ' . $ identifier . '.' . $ prop . ' IS UNI...
Drops a unique constraint on a label .
16,032
public function createTransaction ( $ conn = null , $ queryMode = Client :: NEOCLIENT_QUERY_MODE_WRITE ) { $ transaction = new Transaction ( $ conn , $ this , $ queryMode ) ; return $ transaction ; }
Creates a new Transaction Handler .
16,033
public function openTransaction ( $ conn = null , $ queryMode = self :: WRITE_QUERY ) { $ command = $ this -> invoke ( 'neo.open_transaction' , $ conn ) ; $ command -> setArguments ( $ queryMode ) ; $ httpResponse = $ command -> execute ( ) ; return $ this -> handleHttpResponse ( $ httpResponse ) ; }
Convenience method that invoke the OpenTransactionCommand .
16,034
public function rollBackTransaction ( $ id , $ conn = null ) { $ response = $ this -> invoke ( 'neo.rollback_transaction' , $ conn ) -> setTransactionId ( $ id ) -> execute ( ) ; return $ this -> handleHttpResponse ( $ response ) ; }
Convenience method that invoke the RollBackTransactionCommand .
16,035
public function pushToTransaction ( $ transactionId , $ query , array $ parameters = array ( ) , $ conn = null , $ queryMode = Client :: NEOCLIENT_QUERY_MODE_WRITE ) { $ httpResponse = $ this -> invoke ( 'neo.push_to_transaction' , $ conn ) -> setArguments ( $ transactionId , $ query , $ parameters , $ this -> resultDa...
Convenience method that invoke the PushToTransactionCommand and passes the query and parameters as arguments .
16,036
public function commitTransaction ( $ transactionId , $ query = null , array $ parameters = array ( ) , $ conn = null , $ queryMode = self :: WRITE_QUERY ) { $ response = $ this -> invoke ( 'neo.commit_transaction' , $ conn ) -> setArguments ( $ transactionId , $ query , $ parameters , $ this -> resultDataContent , $ q...
Convenience method that commit the transaction and passes the optional query and parameters as arguments .
16,037
public function sendReadQuery ( $ query , array $ parameters = array ( ) ) { return $ this -> sendCypherQuery ( $ query , $ parameters , $ this -> getReadConnection ( ) -> getAlias ( ) , self :: READ_QUERY ) ; }
Convenience method for working with replication Sends a read only query .
16,038
public function sendWriteQuery ( $ query , array $ parameters = array ( ) ) { return $ this -> sendCypherQuery ( $ query , $ parameters , $ this -> getWriteConnection ( ) -> getAlias ( ) , self :: WRITE_QUERY ) ; }
Convenience method for working with replication .
16,039
public function commit ( ) { if ( $ this -> committed ) { throw new CommandException ( 'The prepared transaction has already been commited' ) ; } $ response = Client :: commitPreparedTransaction ( $ this ) ; $ this -> committed = true ; return $ response ; }
Commit the prepared transaction .
16,040
public function loadConfigurationFile ( $ file ) { if ( ! file_exists ( $ file ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Configuration file "%s" not found' , $ file ) ) ; } $ this -> loadedConfig = Yaml :: parse ( file_get_contents ( $ file ) ) ; return $ this ; }
Load a configuration from an external YAML file .
16,041
public function getLogger ( $ name = null ) { if ( null === $ name && ! isset ( $ this -> loggers [ 'nullLogger' ] ) ) { $ this -> createNullLogger ( ) ; $ name = 'nullLogger' ; } return $ this -> loggers [ $ name ] ; }
Returns a registered Logger .
16,042
public function log ( $ level = 'debug' , $ message , array $ context = array ( ) ) { foreach ( $ this -> getLoggers ( ) as $ key => $ logger ) { $ logger -> log ( $ level , $ message , $ context ) ; } }
Logs a record to the registered loggers .
16,043
public function createDefaultStreamLogger ( $ name , $ path , $ level = Logger :: DEBUG ) { $ logger = new Logger ( $ name ) ; $ handler = new \ Monolog \ Handler \ StreamHandler ( $ path , $ level ) ; $ logger -> pushHandler ( $ handler ) ; $ this -> loggers [ $ name ] = $ logger ; return $ this ; }
Creates an internal stream logger .
16,044
public function createDefaultChromePHPLogger ( $ name , $ level = Logger :: DEBUG ) { $ logger = new Logger ( $ name ) ; $ handler = new \ Monolog \ Handler \ ChromePHPHandler ( $ level ) ; $ logger -> pushHandler ( $ handler ) ; $ this -> loggers [ $ name ] = $ logger ; return $ this ; }
Creates an internal chrome php logger .
16,045
public function build ( ) { if ( $ this -> isCacheEnabled ( ) ) { $ file = $ this -> getCachePath ( ) . self :: CACHE_FILENAME ; if ( file_exists ( $ file ) ) { include_once $ file ; $ this -> serviceContainer = new \ ProjectServiceContainer ( ) ; return new Client ( $ this -> serviceContainer ) ; } } $ extension = new...
Builds the service definitions and processes the configuration .
16,046
public function onPreSendHAHeaders ( HttpClientPreSendRequestEvent $ event ) { if ( $ event -> getRequest ( ) -> getQueryMode ( ) == 'WRITE' ) { $ event -> getRequest ( ) -> setHeader ( $ this -> queryModeHeaderName , $ this -> queryModeWriteQueryHeaderValue ) ; } elseif ( $ event -> getRequest ( ) -> getQueryMode ( ) ...
Add specific headers to the Request object for helping HA proxies to determine if it is a read or write query .
16,047
public function format ( $ response ) { $ this -> isNew = false ; $ responseObject = new Response ( ) ; $ responseObject -> setRawResponse ( $ response ) ; if ( $ responseObject -> containsResults ( ) ) { $ this -> extractResults ( $ response ) ; $ this -> prepareResultSet ( ) ; $ this -> prepareNodesByLabels ( ) ; $ t...
Formats the Neo4j Response .
16,048
private function extractResults ( $ resultSet ) { foreach ( $ resultSet [ 'results' ] as $ result ) { foreach ( $ result [ 'data' ] as $ data ) { if ( isset ( $ data [ 'graph' ] ) ) { foreach ( $ data [ 'graph' ] [ 'nodes' ] as $ node ) { $ this -> nodesMap [ $ node [ 'id' ] ] = $ node ; } foreach ( $ data [ 'graph' ] ...
Extracts the results from the Neo4j Response .
16,049
public function reset ( ) { $ this -> isNew = true ; $ this -> nodesMap = array ( ) ; $ this -> relationshipsMap = array ( ) ; $ this -> nodesByLabel = array ( ) ; $ this -> result = new Result ( ) ; }
Resets the results collections for next Result process .
16,050
public function getLabel ( ) { if ( empty ( $ this -> labels ) ) { return ; } reset ( $ this -> labels ) ; return current ( $ this -> labels ) ; }
Used when only one label is expected .
16,051
public function getSingleNode ( $ label = null ) { $ nodes = ( null === $ label ) ? $ this -> getNodes ( ) : $ this -> getNodesByLabel ( $ label ) ; $ single = current ( $ nodes ) ; return $ single ; }
Returns a single node from the nodes collection Use when you do cypher queries returning only one node .
16,052
public function getSingleNodeByLabel ( $ label ) { foreach ( $ this -> nodes as $ node ) { if ( $ node -> hasLabel ( $ label ) ) { return $ node ; } } return ; }
Returns a single node for a given label .
16,053
public function getNodesByLabel ( $ name , $ labelizedKeys = false ) { $ collection = array ( ) ; foreach ( $ this -> getNodes ( ) as $ node ) { if ( $ node -> hasLabel ( $ name ) ) { if ( $ labelizedKeys ) { $ collection [ $ name ] = $ node ; } else { $ collection [ ] = $ node ; } } } return $ collection ; }
Returns all nodes with the given label .
16,054
public function getNodesByLabels ( array $ labels = array ( ) , $ labelizedKeys = false ) { $ nodes = [ ] ; foreach ( $ labels as $ label ) { $ lnodes = $ this -> getNodesByLabel ( $ label ) ; foreach ( $ lnodes as $ node ) { if ( $ labelizedKeys ) { $ nodes [ $ label ] = $ node ; } else { $ nodes [ ] = $ node ; } } } ...
Returns all nodes with the given labels .
16,055
public function getSingle ( $ identifier , $ default = null ) { $ get = $ this -> get ( $ identifier , $ default ) ; if ( is_array ( $ get ) ) { return array_values ( $ this -> identifiers [ $ identifier ] ) [ 0 ] ; } return $ get ; }
Returns a single item bound to the given identifier or the default if the identifier is not bound .
16,056
public function onOutputFrontendTemplate ( $ buffer ) { if ( null !== ( $ rootPage = PageModel :: findByPk ( $ GLOBALS [ 'objPage' ] -> rootId ) ) && $ rootPage -> cookiebar_enable ) { $ generator = new CookiebarGenerator ( ) ; $ cookiebar = $ generator -> createTemplate ( $ rootPage -> row ( ) ) -> parse ( ) ; if ( 'b...
On output the frontend template .
16,057
public function createTemplate ( array $ data , $ name = 'cookiebar' ) { $ template = new FrontendTemplate ( $ name ) ; $ this -> setBasicData ( $ template , $ data ) ; $ this -> setMoreLinkData ( $ template , $ data ) ; $ this -> setAnalyticsCheckboxData ( $ template , $ data ) ; $ template -> cookie = sprintf ( 'COOK...
Create the cookie bar template .
16,058
private function setBasicData ( FrontendTemplate $ template , array $ data ) { foreach ( $ data as $ k => $ v ) { if ( 0 === strpos ( $ k , 'cookiebar_' ) ) { $ template -> { substr ( $ k , 10 ) } = $ v ; } } $ template -> raw = $ data ; }
Automatically set all variables with cookiebar_ prefix .
16,059
private function setMoreLinkData ( FrontendTemplate $ template , array $ data ) { $ template -> more = null ; if ( $ data [ 'cookiebar_url' ] ) { $ template -> more = [ 'label' => $ data [ 'cookiebar_link' ] ? : $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'cookiebar.more' ] , 'url' => $ data [ 'cookiebar_url' ] , ] ; } }
Set the more link data .
16,060
private function setAnalyticsCheckboxData ( FrontendTemplate $ template , array $ data ) { $ template -> analyticsCheckbox = null ; if ( $ data [ 'cookiebar_analyticsCheckbox' ] ) { $ template -> analyticsCheckbox = [ 'label' => $ data [ 'cookiebar_analyticsLabel' ] ? : $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'cookiebar.an...
Set the analytics checkbox data .
16,061
public function lPush ( $ key , $ value ) { try { $ this -> _redis -> lPush ( $ key , $ value ) ; } catch ( Predis \ Response \ ServerException $ e ) { throw new CM_Exception_Invalid ( 'Cannot push key to list.' , null , [ 'key' => $ key ] ) ; } }
Prepend a value to a list
16,062
public function lRange ( $ key , $ start = null , $ stop = null ) { if ( null === $ start ) { $ start = 0 ; } if ( null === $ stop ) { $ stop = - 1 ; } return $ this -> _redis -> lRange ( $ key , $ start , $ stop ) ; }
Return values from list
16,063
public function sFlush ( $ key ) { $ this -> _redis -> multi ( ) ; $ this -> _redis -> sMembers ( $ key ) ; $ this -> _redis -> del ( $ key ) ; return $ this -> _redis -> exec ( ) [ 0 ] ; }
Remove and return all members of a set
16,064
public function getItemsRaw ( ) { $ itemsRaw = $ this -> _getItemsRaw ( ) ; if ( null !== $ this -> _pageSize && count ( $ itemsRaw ) > $ this -> _pageSize ) { $ itemsRaw = array_slice ( $ itemsRaw , 0 , $ this -> _pageSize ) ; } return $ itemsRaw ; }
Return Un - processed un - filtered items
16,065
public function _change ( ) { if ( ! $ this -> _source ) { throw new CM_Exception ( 'Cannot change paging without source' ) ; } $ this -> _source -> clearCache ( ) ; $ this -> _clearItems ( ) ; $ this -> _clearCount ( ) ; }
Items in the underlying source have changed
16,066
final public function isOwner ( CM_Model_User $ user = null ) { try { return $ this -> getUser ( ) -> equals ( $ user ) ; } catch ( CM_Exception_Nonexistent $ ex ) { return false ; } }
Checks if a given user is the entity owner
16,067
public function setTtl ( $ key , $ ttl ) { $ redis = $ this -> _getRedisClient ( ) ; $ redis -> expire ( $ this -> _getInternalKey ( $ key ) , $ ttl ) ; }
Updates the time to live of the whole queue not of single entries
16,068
public function findSiteByType ( $ type ) { $ type = ( int ) $ type ; return \ Functional \ first ( $ this -> _getSiteList ( ) , function ( CM_Site_Abstract $ site ) use ( $ type ) { return $ site -> getType ( ) === $ type ; } ) ; }
These 2 method were temporary added till we resolve ambiguity related to splitting siteId and type especially for models where type is currently stored .
16,069
public function lookup ( ) { $ r = mt_rand ( ) / mt_getrandmax ( ) * $ this -> _weightTotal ; return $ this -> _values [ $ this -> _binarySearch ( $ r , $ this -> _lookup ) ] ; }
Randomly select one of the elements based on their weights .
16,070
public function updateDocuments ( $ ids = null , $ useMaintenance = null , $ limit = null , $ maxDocsPerRequest = self :: MAX_DOCS_PER_REQUEST ) { $ this -> _updateDocuments ( $ this -> getIndexName ( ) , $ ids , $ useMaintenance , $ limit , $ maxDocsPerRequest ) ; }
Update the complete index
16,071
public static function var_line ( $ expression ) { $ line = print_r ( $ expression , true ) ; $ line = str_replace ( PHP_EOL , ' ' , $ line ) ; $ line = trim ( $ line ) ; return $ line ; }
Return human - readable information on one line about a variable
16,072
protected function createChildren ( ) { $ this -> children = [ ] ; $ this -> determineChoiceField ( ) ; $ fieldType = $ this -> formHelper -> getFieldType ( $ this -> choiceType ) ; switch ( $ this -> choiceType ) { case 'radio' : case 'checkbox' : $ this -> buildCheckableChildren ( $ fieldType ) ; break ; default : $ ...
Create children depending on choice type
16,073
protected function buildCheckableChildren ( $ fieldType ) { $ multiple = $ this -> getOption ( 'multiple' ) ? '[]' : '' ; foreach ( ( array ) $ this -> options [ 'choices' ] as $ key => $ choice ) { $ id = str_replace ( '.' , '_' , $ this -> getNameKey ( ) ) . '_' . $ key ; $ options = $ this -> formHelper -> mergeOpti...
Build checkable children fields from choice type
16,074
protected function getModelValueAttribute ( $ model , $ name ) { $ transformedName = $ this -> transformKey ( $ name ) ; if ( is_string ( $ model ) ) { return $ model ; } elseif ( is_object ( $ model ) ) { return object_get ( $ model , $ transformedName ) ; } elseif ( is_array ( $ model ) ) { return array_get ( $ model...
Get the attribute value from the model by name
16,075
protected function prepareOptions ( array $ options = [ ] ) { $ helper = $ this -> formHelper ; if ( array_get ( $ this -> options , 'template' ) !== null ) { $ this -> template = array_pull ( $ this -> options , 'template' ) ; } $ options = $ helper -> mergeOptions ( $ this -> options , $ options ) ; if ( $ this -> pa...
Prepare options for rendering
16,076
private function allDefaults ( ) { return [ 'wrapper' => [ 'class' => $ this -> formHelper -> getConfig ( 'defaults.wrapper_class' ) ] , 'attr' => [ 'class' => $ this -> formHelper -> getConfig ( 'defaults.field_class' ) ] , 'help_block' => [ 'text' => null , 'tag' => 'p' , 'attr' => [ 'class' => $ this -> formHelper -...
Defaults used across all fields
16,077
private function setTemplate ( ) { $ this -> template = $ this -> formHelper -> getConfig ( $ this -> getTemplate ( ) , $ this -> getTemplate ( ) ) ; }
Set the template property on the object
16,078
protected function addErrorClass ( & $ options ) { $ errors = $ this -> formHelper -> getRequest ( ) -> getSession ( ) -> get ( 'errors' ) ; if ( $ errors && $ errors -> has ( $ this -> getNameKey ( ) ) ) { $ errorClass = $ this -> formHelper -> getConfig ( 'defaults.wrapper_error_class' ) ; if ( $ options [ 'wrapper' ...
Add error class to wrapper if validation errors exist
16,079
protected function setDefaultOptions ( array $ options = [ ] ) { $ this -> options = $ this -> formHelper -> mergeOptions ( $ this -> allDefaults ( ) , $ this -> getDefaults ( ) ) ; $ this -> options = $ this -> prepareOptions ( $ options ) ; }
Merge all defaults with field specific defaults and set template if passed
16,080
protected function needsLabel ( array $ options = [ ] ) { $ isChildSelect = $ this -> type == 'select' && array_get ( $ options , 'is_child' ) === true ; if ( $ this -> type == 'hidden' || $ isChildSelect ) { return false ; } return true ; }
Check if fields needs label
16,081
private function setupStaticOptions ( & $ options ) { $ options [ 'elemAttrs' ] = $ this -> formHelper -> prepareAttributes ( $ this -> getOption ( 'attr' ) ) ; $ options [ 'labelAttrs' ] = $ this -> formHelper -> prepareAttributes ( $ this -> getOption ( 'label_attr' ) ) ; }
Setup static field options
16,082
public function plain ( array $ options = [ ] , array $ data = [ ] ) { return $ this -> container -> make ( 'Kris\LaravelFormBuilder\Form' ) -> setFormHelper ( $ this -> formHelper ) -> setFormBuilder ( $ this ) -> setFormOptions ( $ options ) -> addData ( $ data ) ; }
Get instance of the empty form which can be modified
16,083
public function getFieldType ( $ type ) { $ types = array_keys ( static :: $ availableFieldTypes ) ; if ( ! $ type || trim ( $ type ) == '' ) { throw new \ InvalidArgumentException ( 'Field type must be provided.' ) ; } if ( array_key_exists ( $ type , $ this -> customTypes ) ) { return $ this -> customTypes [ $ type ]...
Get proper class for field type
16,084
public function addCustomField ( $ name , $ class ) { if ( ! array_key_exists ( $ name , $ this -> customTypes ) ) { return $ this -> customTypes [ $ name ] = $ class ; } throw new \ InvalidArgumentException ( 'Custom field [' . $ name . '] already exists on this form object.' ) ; }
Add custom field
16,085
protected function makeField ( $ name , $ type = 'text' , array $ options = [ ] ) { $ this -> setupFieldOptions ( $ name , $ options ) ; $ fieldName = $ this -> getFieldName ( $ name ) ; $ fieldType = $ this -> getFieldType ( $ type ) ; return new $ fieldType ( $ fieldName , $ type , $ this , $ options ) ; }
Create the FormField object
16,086
public function add ( $ name , $ type = 'text' , array $ options = [ ] , $ modify = false ) { if ( ! $ name || trim ( $ name ) == '' ) { throw new \ InvalidArgumentException ( 'Please provide valid field name for class [' . get_class ( $ this ) . ']' ) ; } if ( $ this -> rebuilding && ! $ this -> has ( $ name ) ) { ret...
Create a new field and add it to the form
16,087
protected function addField ( FormField $ field , $ modify = false ) { if ( ! $ modify && ! $ this -> rebuilding ) { $ this -> preventDuplicate ( $ field -> getRealName ( ) ) ; } $ this -> fields [ $ field -> getRealName ( ) ] = $ field ; return $ this ; }
Add a FormField to the form s fields
16,088
public function compose ( $ class , array $ options = [ ] , $ modify = false ) { $ options [ 'class' ] = $ class ; if ( $ class instanceof Form ) { $ fields = $ class -> getFields ( ) ; } elseif ( $ class instanceof Fields \ ChildFormType ) { $ fields = $ class -> getForm ( ) -> getFields ( ) ; } elseif ( is_string ( $...
Take another form and add it s fields directly to this form
16,089
public function remove ( $ name ) { if ( $ this -> has ( $ name ) ) { unset ( $ this -> fields [ $ name ] ) ; return $ this ; } throw new \ InvalidArgumentException ( 'Field [' . $ name . '] does not exist in ' . get_class ( $ this ) ) ; }
Remove field with specified name from the form
16,090
public function renderUntil ( $ field_name , $ showFormEnd = true , $ showFields = true ) { $ fields = $ this -> getUnrenderedFields ( ) ; $ i = 1 ; foreach ( $ fields as $ key => $ value ) { if ( $ value -> getRealName ( ) == $ field_name ) { break ; } $ i ++ ; } $ fields = array_slice ( $ fields , 0 , $ i , true ) ; ...
Renders the rest of the form up until the specified field name
16,091
public function getField ( $ name ) { if ( $ this -> has ( $ name ) ) { return $ this -> fields [ $ name ] ; } throw new \ InvalidArgumentException ( 'Field with name [' . $ name . '] does not exist in class ' . get_class ( $ this ) ) ; }
Get single field instance from form object
16,092
public function setFormOptions ( $ formOptions ) { $ this -> formOptions = $ this -> formHelper -> mergeOptions ( $ this -> formOptions , $ formOptions ) ; $ this -> getModelFromOptions ( ) ; $ this -> getDataFromOptions ( ) ; $ this -> checkIfNamedForm ( ) ; return $ this ; }
Set form options
16,093
public function getData ( $ name = null , $ default = null ) { if ( is_null ( $ name ) ) { return $ this -> data ; } return array_get ( $ this -> data , $ name , $ default ) ; }
Get single additional data
16,094
protected function checkIfNamedForm ( ) { if ( $ this -> getFormOption ( 'name' ) ) { $ this -> name = array_pull ( $ this -> formOptions , 'name' , $ this -> name ) ; } }
Check if form is named form
16,095
protected function setupFieldOptions ( $ name , & $ options ) { if ( ! $ this -> getName ( ) ) { return ; } $ options [ 'real_name' ] = $ name ; if ( ! isset ( $ options [ 'label' ] ) ) { $ options [ 'label' ] = $ this -> formHelper -> formatLabel ( $ name ) ; } }
Set up options on single field depending on form options
16,096
protected function setupNamedModel ( ) { if ( ! $ this -> getModel ( ) || ! $ this -> getName ( ) ) { return ; } $ model = $ this -> formHelper -> convertModelToArray ( $ this -> getModel ( ) ) ; if ( ! array_get ( $ model , $ this -> getName ( ) ) ) { $ this -> model = [ $ this -> getName ( ) => $ model ] ; } }
Set namespace to model if form is named so the data is bound properly
16,097
public function text ( $ text ) { if ( mb_strlen ( $ text ) > 320 ) { throw CouldNotCreateMessage :: textTooLong ( ) ; } $ this -> text = $ text ; $ this -> hasText = true ; return $ this ; }
Notification text .
16,098
public function attach ( $ attachmentType , $ url ) { $ attachmentTypes = [ AttachmentType :: FILE , AttachmentType :: IMAGE , AttachmentType :: VIDEO , AttachmentType :: AUDIO , ] ; if ( ! in_array ( $ attachmentType , $ attachmentTypes ) ) { throw CouldNotCreateMessage :: invalidAttachmentType ( ) ; } if ( ! isset ( ...
Add Attachment .
16,099
public function cards ( array $ cards = [ ] ) { if ( count ( $ cards ) > 10 ) { throw CouldNotCreateMessage :: messageCardsLimitExceeded ( ) ; } $ this -> cards = $ cards ; return $ this ; }
Add up to 10 cards to be displayed in a carousel .