idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
11,200
public function col_full_name ( string $ col , $ table = '' , $ escaped = false ) : ? string { return $ this -> language -> col_full_name ( $ col , $ table , $ escaped ) ; }
Return column s full name .
11,201
public function col_simple_name ( string $ col , bool $ escaped = false ) : ? string { return $ this -> language -> col_simple_name ( $ col , $ escaped ) ; }
Return the column s simple name .
11,202
public function get_tables ( string $ database = '' ) : ? array { if ( empty ( $ database ) ) { $ database = $ this -> current ; } return $ this -> _get_cache ( $ database , 'tables' ) ; }
Return tables names of a database as an array .
11,203
public function get_keys ( string $ table ) : ? array { if ( $ tmp = $ this -> _get_cache ( $ table ) ) { return [ 'keys' => $ tmp [ 'keys' ] , 'cols' => $ tmp [ 'cols' ] ] ; } return null ; }
Return the table s keys as an array indexed with the fields names .
11,204
public function get_insert ( array $ cfg ) : string { $ cfg [ 'kind' ] = 'INSERT' ; return $ this -> language -> get_insert ( $ this -> process_cfg ( $ cfg ) ) ; }
Returns the SQL code for an INSERT statement .
11,205
public function get_update ( array $ cfg ) : string { $ cfg [ 'kind' ] = 'UPDATE' ; return $ this -> language -> get_update ( $ this -> process_cfg ( $ cfg ) ) ; }
Returns the SQL code for an UPDATE statement .
11,206
public function get_delete ( array $ cfg ) : string { $ cfg [ 'kind' ] = 'DELETE' ; return $ this -> language -> get_delete ( $ this -> process_cfg ( $ cfg ) ) ; }
Returns the SQL code for a DELETE statement .
11,207
public function delete_index ( string $ table , string $ key ) : bool { return $ this -> language -> delete_index ( $ table , $ key ) ; }
Deletes index on a column of the table .
11,208
public function setLimits ( $ offset , $ limit , $ max = 0 , $ cutoff = 0 ) { $ this -> sphinx -> setLimits ( $ offset , $ limit , $ max , $ cutoff ) ; }
Set limits on the range and number of results returned .
11,209
public function setFilter ( $ attribute , $ values , $ exclude = false ) { $ this -> sphinx -> setFilter ( $ attribute , $ values , $ exclude ) ; }
Set the desired search filter .
11,210
public function search ( $ query , array $ indexes , array $ options = array ( ) , $ escapeQuery = true ) { if ( $ escapeQuery ) { $ query = $ this -> sphinx -> escapeString ( $ query ) ; } $ indexNames = '' ; foreach ( $ indexes as & $ label ) { if ( isset ( $ this -> indexes [ $ label ] ) ) { $ indexNames .= $ this -...
Search for the specified query string .
11,211
public function addQuery ( $ query , array $ indexes ) { $ indexNames = '' ; foreach ( $ indexes as & $ label ) { if ( isset ( $ this -> indexes [ $ label ] ) ) { $ indexNames .= $ this -> indexes [ $ label ] . ' ' ; } } if ( ! empty ( $ indexNames ) ) { $ this -> sphinx -> addQuery ( $ query , $ indexNames ) ; } }
Adds a query to a multi - query batch using current settings .
11,212
public function getSnippet ( $ text , $ index , $ terms , $ options = array ( ) ) { $ results = $ this -> getSnippets ( array ( $ text ) , $ index , $ terms , $ options ) ; if ( $ results ) { return $ results [ 0 ] ; } return false ; }
Get snippet for text
11,213
public function getSnippets ( $ text , $ index , $ terms , $ options = array ( ) ) { return $ this -> sphinx -> BuildExcerpts ( $ text , $ index , $ terms , $ options ) ; }
Get snippets for array of text
11,214
public function resetAll ( ) { $ this -> sphinx -> ResetFilters ( ) ; $ this -> sphinx -> ResetGroupBy ( ) ; $ this -> sphinx -> ResetOverrides ( ) ; $ this -> sphinx -> SetSortMode ( SPH_SORT_RELEVANCE ) ; $ this -> resetLimits ( ) ; }
Reset filters group by overrides limits
11,215
public function setFilterFloatRange ( $ attribute , $ min , $ max , $ exclude = false ) { $ this -> sphinx -> SetFilterFloatRange ( $ attribute , $ min , $ max , $ exclude ) ; }
Set float range filter
11,216
public function setFilterRange ( $ attribute , $ min , $ max , $ exclude = false ) { $ this -> sphinx -> SetFilterRange ( $ attribute , $ min , $ max , $ exclude ) ; }
Set range filter
11,217
public function rotateAll ( ) { $ pb = $ this -> prepareProcessBuilder ( ) ; $ pb -> add ( '--all' ) ; $ indexer = $ pb -> getProcess ( ) ; $ indexer -> run ( ) ; if ( strstr ( $ indexer -> getOutput ( ) , 'FATAL:' ) || strstr ( $ indexer -> getOutput ( ) , 'ERROR:' ) ) { throw new \ RuntimeException ( sprintf ( 'Error...
Rebuild and rotate all indexes .
11,218
protected function prepareProcessBuilder ( ) { $ pb = new ProcessBuilder ( ) ; $ pb -> inheritEnvironmentVariables ( ) ; if ( $ this -> sudo ) { $ pb -> add ( 'sudo' ) ; } $ pb -> add ( $ this -> bin ) ; if ( $ this -> config ) { $ pb -> add ( '--config' ) -> add ( $ this -> config ) ; } $ pb -> add ( '--rotate' ) ; re...
Prepare process builder
11,219
public static function createAbsolute ( $ url , array $ params = array ( ) ) { $ url = self :: addParams ( $ url , $ params ) ; $ url = ltrim ( $ url , '/' ) ; $ baseUrl = app ( ) -> request -> getBaseUrl ( ) ; return $ baseUrl . '/' . $ url ; }
Creates absolute url .
11,220
private static function addParams ( $ url , array $ params = array ( ) ) { $ cParams = count ( $ params ) ; if ( $ cParams > 0 ) { $ url .= '?' ; $ idx = 1 ; foreach ( $ params as $ key => $ value ) { $ url .= $ key . '=' . $ value ; if ( $ idx < $ cParams ) { $ url .= '&' ; } ++ $ idx ; } } return $ url ; }
Appends GET parameters to url .
11,221
private function writeAttributes ( $ file , $ fields ) { foreach ( $ fields as $ fieldName => $ field ) { fwrite ( $ file , " /**\n" ) ; fwrite ( $ file , " * $fieldName\n" ) ; fwrite ( $ file , " *\n" ) ; fwrite ( $ file , " * @var {$this->translateType($field->type)}\n" ) ; fwrite ( $ file , " */\n...
Writes the list of attributes .
11,222
private function writeClass ( $ dir , $ tableName , ezcDbSchemaTable $ table ) { $ file = $ this -> openFile ( $ dir , $ tableName ) ; fwrite ( $ file , "/**\n" ) ; fwrite ( $ file , " * Data class $tableName.\n" ) ; fwrite ( $ file , " * Class to be used with eZ Components PersistentObject.\n" ) ; fwrite ( $ file , " ...
Writes a PHP class . This method writes a PHP class from a table definition .
11,223
private function openFile ( $ dir , $ name ) { $ filename = $ dir . DIRECTORY_SEPARATOR . strtolower ( $ this -> prefix ) . strtolower ( $ name ) . '.php' ; if ( file_exists ( $ filename ) && ( $ this -> overwrite === false || is_writable ( $ filename ) === false ) ) { throw new ezcBaseFileIoException ( $ filename , ez...
Open a file for writing a PersistentObject definition to . This method opens a file for writing a PersistentObject definition to and writes the basic PHP open tag to it .
11,224
public static function check ( $ permissions ) { if ( Schema :: hasTable ( 'laralum_permissions' ) ) { foreach ( $ permissions as $ permission ) { if ( ! self :: allCached ( ) -> contains ( 'slug' , $ permission [ 'slug' ] ) ) { Cache :: forget ( 'laralum_permissions' ) ; if ( ! self :: allCached ( ) -> contains ( 'slu...
Checks if the permisions exists and if they dont they will be added .
11,225
public function process ( ServerRequestInterface $ request , RequestHandlerInterface $ handler ) : ResponseInterface { $ this -> failWhenDisabled ( ) ; $ this -> failWhenStarted ( ) ; $ cookies = $ request -> getCookieParams ( ) ; $ session_id = $ cookies [ $ this -> name ] ?? '' ; if ( $ session_id != '' ) session_id ...
Start the session handle the request and add the session cookie to the response .
11,226
private function withSessionCookie ( ResponseInterface $ response , string $ session_id ) : ResponseInterface { $ default = session_get_cookie_params ( ) ; $ default = array_change_key_case ( $ default , CASE_LOWER ) ; $ options = array_change_key_case ( $ this -> options , CASE_LOWER ) ; $ options = array_merge ( $ de...
Attach a session cookie with the given sesison id to the given response .
11,227
protected function createResponse ( PHPExcel $ excel , $ fileName ) { $ writer = new PHPExcel_Writer_Excel2007 ( $ excel ) ; ob_start ( ) ; $ writer -> save ( 'php://output' ) ; $ content = ob_get_clean ( ) ; $ response = new Response ( ) ; $ response -> headers -> set ( 'Content-Type' , 'application/vnd.openxmlformats...
Generates a response object for a PHPExcel object .
11,228
public static function haveSameKeys ( array $ array1 , array $ array2 ) { return self :: hasAllKeys ( $ array1 , array_keys ( $ array2 ) ) && self :: hasAllKeys ( $ array2 , array_keys ( $ array1 ) ) ? true : false ; }
Checks if two arrays have all equal keys
11,229
public static function haveSameValues ( $ array1 , $ array2 ) { return self :: hasAllValues ( $ array1 , $ array2 ) && self :: hasAllValues ( $ array2 , $ array1 ) ? true : false ; }
Check if two arrays have all equal values
11,230
public static function gen ( $ password ) { return crypt ( $ password , self :: $ algo . self :: $ cost . '$' . self :: uniqueSalt ( ) ) ; }
this will be used to generate a hash
11,231
public static function getComposerMap ( ) { $ composerMap = array ( ) ; foreach ( self :: getComposers ( ) as $ composer ) $ composerMap [ call_user_func ( array ( $ composer , "getKind" ) ) ] = $ composer ; return $ composerMap ; }
Returns a map from all composer kinds to class names .
11,232
public static function fromKind ( $ kind ) { $ composerMap = self :: getComposerMap ( ) ; if ( ! array_key_exists ( $ kind , $ composerMap ) ) throw new ComposerException ( "no composer found for \"$kind\"" ) ; $ class = $ composerMap [ $ kind ] ; return new $ class ( ) ; }
Creates a composer from a kind .
11,233
public function routes ( ) { Route :: get ( 'countries/{id}' , function ( $ id ) { $ request = request ( ) ; return CountryStore :: country ( $ id , $ request ) ; } ) -> name ( 'country' ) ; Route :: get ( 'countries' , function ( ) { $ request = request ( ) ; return CountryStore :: countries ( $ request ) ; } ) -> nam...
Set routes for country API
11,234
public function country ( $ country_id , Request $ request = null ) { $ country = Country :: with ( 'zone' ) -> find ( $ country_id ) ; if ( $ request ) { $ included = [ ] ; $ query = $ country -> getInlcudeResources ( $ request -> include ) ; if ( $ query ) { $ collection = new Collection ( $ query , str_singular ( $ ...
Get Country item . Optional include administrative areas
11,235
public function countries ( Request $ request = null ) { $ query = Country :: with ( 'zone' ) ; if ( $ request ) { $ resource = new Collection ( $ query , 'country' , $ request ) ; return $ this -> respondWithCollection ( $ resource ) ; } return $ query -> get ( ) ; }
Get Country list
11,236
public function administrativeArea ( $ admin_area_id , Request $ request = null ) { $ admin_area = AdministrativeArea :: find ( $ admin_area_id ) ; if ( $ request ) { $ included = [ ] ; if ( $ request -> has ( 'include' ) && AdministrativeArea :: isIncludable ( $ request -> include ) ) { $ cities = $ admin_area -> citi...
Get Administrative area item optional include cities
11,237
public function administrativeAreas ( $ country_id , Request $ request = null ) { $ query = AdministrativeArea :: where ( 'country_id' , $ country_id ) -> with ( 'country' ) ; if ( $ request ) { $ resource = new Collection ( $ query , 'administrative_area' , $ request ) ; return $ this -> respondWithCollection ( $ reso...
Get Administrative areas collection of a country given
11,238
public function city ( $ city_id , Request $ request = null ) { $ city = City :: find ( $ city_id ) ; if ( $ request ) { $ included = [ ] ; $ query = $ city -> getInlcudeResources ( $ request -> include ) ; if ( $ query ) { $ collection = new Collection ( $ query , $ request -> include ) ; $ included = $ collection -> ...
Get city item optional include administrative division .
11,239
public function cities ( $ country_id , Request $ request = null ) { $ query = City :: with ( [ 'administrativeArea' => function ( $ q ) use ( $ country_id ) { $ q -> where ( 'country_id' , $ country_id ) ; } ] ) -> with ( 'administrativeArea.country' ) ; if ( $ request ) { $ resource = new Collection ( $ query , 'city...
Get country cities
11,240
protected function checkArgumentInDocBlock ( ) { $ validator = new IsArgumentInDocBlockValidator ( ) ; $ validator -> initialize ( $ this -> context ) ; return $ validator -> validate ( $ this -> validationValue , new IsArgumentInDocBlock ) ; }
Check if argument is inside docblock .
11,241
protected function checkArgumentNameMatchParam ( ) { $ validator = new DoesArgumentNameMatchParamValidator ; $ validator -> initialize ( $ this -> context ) ; return $ validator -> validate ( $ this -> validationValue , new DoesArgumentNameMatchParam ) ; }
Check if argument matches parameter .
11,242
protected function checkArgumentTypehintMatchParam ( ) { $ validator = new DoesArgumentTypehintMatchParamValidator ; $ validator -> initialize ( $ this -> context ) ; return $ validator -> validate ( $ this -> validationValue , new DoesArgumentTypehintMatchParam ) ; }
Check if argument typehint matches parameter .
11,243
protected function checkParamsExists ( ) { $ validator = new DoesParamsExistsValidator ( ) ; $ validator -> initialize ( $ this -> context ) ; return $ validator -> validate ( $ this -> validationValue , new DoesParamsExists ) ; }
Check if parameter exists for argument .
11,244
public static function getEnvNameByHost ( string $ defaultEnv = null , string $ hostname = null ) : string { $ hostname = $ hostname ? : gethostname ( ) ; if ( ! $ hostname ) { return $ defaultEnv ; } foreach ( self :: $ host2env as $ kw => $ env ) { if ( false !== strpos ( $ hostname , $ kw ) ) { return $ env ; } } re...
get Env Name By Host
11,245
public static function getEnvNameByDomain ( string $ defaultEnv = null , string $ domain = null ) : string { $ domain = $ domain ? : PhpHelper :: serverParam ( 'HTTP_HOST' ) ; if ( ! $ domain ) { return $ defaultEnv ; } foreach ( self :: $ domain2env as $ kw => $ env ) { if ( false !== strpos ( $ domain , $ kw ) ) { re...
get Env Name By Domain
11,246
public function delete ( ) { try { if ( is_null ( $ id = Input :: get ( 'id' ) ) ) { throw new Exception ( 'Invalid notification id provided' ) ; } $ this -> stack -> deleteById ( $ id ) ; } catch ( Exception $ ex ) { Log :: alert ( $ ex ) ; return new JsonResponse ( [ 'message' => trans ( 'antares/notifications::messa...
Deletes item from sidebar
11,247
public function read ( ) { try { $ this -> stack -> markAsRead ( from_route ( 'type' , 'notifications' ) ) ; return new JsonResponse ( '' , 200 ) ; } catch ( Exception $ ex ) { Log :: alert ( $ ex ) ; return new JsonResponse ( [ 'message' => trans ( 'antares/notifications::messages.sidebar.unable_to_mark_notifications_...
Marks notification item as read
11,248
public function init ( $ file ) { try { $ this -> load ( $ file ) ; } catch ( Exceptions \ FileNotExists $ e ) { $ this -> create ( $ file ) ; } }
Attempts loading a file if its not there it create its .
11,249
public function load ( $ file ) { if ( ! $ this -> fs -> exists ( $ file ) ) { throw new Exceptions \ FileNotExists ( $ file ) ; } $ this -> file = $ file ; $ this -> info -> load ( $ file ) ; $ this -> extension = $ this -> info -> extension ; $ this -> directory = $ this -> info -> directory ; $ this -> filename = $ ...
Loads the file and its details
11,250
public function saveAs ( $ extension = NULL ) { $ extension = ( ! is_null ( $ extension ) ? $ extension : $ this -> extension ) ; $ converter = $ this -> extracter -> converter ( ) ; $ converter -> setExtension ( $ extension ) ; $ data = $ converter -> toNative ( $ this -> params ) ; $ this -> rename ( NULL , $ extensi...
Save as a different extension
11,251
public function rename ( $ file = NULL , $ extension = NULL ) { $ target = ( ! is_null ( $ file ) ? $ this -> filename : $ this -> extension ) ; $ replacement = ( ! is_null ( $ file ) ? $ file . '.' . $ this -> extension : $ extension ) ; $ this -> file = str_replace ( $ target , $ replacement , $ this -> file ) ; }
Renames a file or changes files extension
11,252
public function save ( ) { $ converter = $ this -> extracter -> converter ( ) ; $ data = $ converter -> toNative ( $ this -> params ) ; $ this -> fs -> dumpFile ( $ this -> file , $ data ) ; }
Saves the current params to the file
11,253
public function wp_title ( $ title , $ sep , $ location ) { if ( ! empty ( $ this -> title ) ) { $ array = [ $ this -> title ] ; $ sep = ' ' . trim ( $ sep ) . ' ' ; if ( 'right' == $ location ) { $ array [ ] = $ sep ; } else { array_unshift ( $ array , $ sep ) ; } $ title = implode ( '' , $ array ) ; } return $ title ...
Filter wp title
11,254
public function notify ( NotificationInterface $ notification , $ level = self :: INFO ) { if ( ! $ this -> handlers ) { $ this -> addHandler ( new NullHandler ( ) ) ; } foreach ( $ this -> getHandlers ( ) as $ handler ) { if ( $ handler -> shouldHandle ( $ notification , $ level ) ) { if ( false === $ handler -> handl...
Handles notification for every handler
11,255
public function log ( $ level , $ message , array $ context = [ ] ) { return $ this -> notify ( new DetailedNotification ( $ message , '' , $ context ) , $ level ) ; }
Adds a new notification message to the queue as an attribute aware notification
11,256
protected function _generateFiles ( ) { if ( $ this -> feature && ! $ this -> isSelectedFeature ( $ this -> feature ) ) { $ this -> logFile -> log ( null , "did not add runtime information because \"$this->feature\" is not selected" ) ; return ; } $ this -> files [ ] = fphp \ File \ TemplateFile :: fromSpecification ( ...
Generates the runtime file . Internally this uses a template file and assigns the given variables . You can override this to add runtime information for other languages . If a feature was supplied only generates if that feature is selected .
11,257
public function traceRuntimeCalls ( $ files , $ productLine ) { $ runtimeCalls = array ( ) ; foreach ( $ files as $ file ) { $ content = $ file -> getContent ( ) ; if ( $ content instanceof fphp \ File \ StoredFileContent ) { $ fileSource = $ content -> getFileSource ( ) ; $ content = file_get_contents ( $ fileSource )...
Returns tracing links for all calls of the runtime class .
11,258
public function generateXml ( ) { $ xml = $ this -> getUpdate ( ) -> asSimplexml ( ) ; $ removeInstructions = $ xml -> xpath ( "//remove" ) ; if ( is_array ( $ removeInstructions ) ) { foreach ( $ removeInstructions as $ infoNode ) { if ( ! $ this -> checkConditionals ( $ infoNode , false ) ) { continue ; } $ blockName...
Layout XML generation
11,259
public function generateBlocks ( $ parent = null ) { if ( $ parent instanceof Mage_Core_Model_Layout_Element ) { if ( ! $ this -> checkConditionals ( $ parent ) ) { return ; } $ this -> processOutputAttribute ( $ parent ) ; } parent :: generateBlocks ( $ parent ) ; }
Create layout blocks hierarchy from layout xml configuration
11,260
protected function _generateBlock ( $ node , $ parent ) { if ( $ node instanceof Mage_Core_Model_Layout_Element ) { if ( ! $ this -> checkConditionals ( $ node ) ) { return $ this ; } } return parent :: _generateBlock ( $ node , $ parent ) ; }
Add block object to layout based on xml node data
11,261
protected function _generateAction ( $ node , $ parent ) { if ( $ node instanceof Mage_Core_Model_Layout_Element ) { if ( ! $ this -> checkConditionals ( $ node ) ) { return $ this ; } } $ method = ( string ) $ node [ 'method' ] ; if ( ! empty ( $ node [ 'block' ] ) ) { $ parentName = ( string ) $ node [ 'block' ] ; } ...
Convert an action node into a method call on the parent block
11,262
protected function getHelperMethodValue ( $ helperMethodString , $ args = null ) { $ helperName = explode ( '/' , ( string ) $ helperMethodString ) ; $ helperMethod = array_pop ( $ helperName ) ; $ helperName = implode ( '/' , $ helperName ) ; $ helperArgs = [ ] ; if ( ! is_array ( $ args ) ) { $ helperArgs [ ] = $ arg...
Gets the value of a helper method from the helper method string
11,263
protected function processOutputAttribute ( Mage_Core_Model_Layout_Element $ node ) { if ( isset ( $ node [ 'output' ] ) ) { $ blockName = ( string ) $ node [ 'name' ] ; if ( empty ( $ blockName ) ) { return ; } $ method = trim ( ( string ) $ node [ 'output' ] ) ; if ( empty ( $ method ) ) { $ this -> removeOutputBlock...
Process the output attribute of a node
11,264
protected function checkConditionals ( Mage_Core_Model_Layout_Element $ node , $ aclDefault = true ) { return $ this -> checkConfigConditional ( $ node ) && ( $ aclDefault ? $ this -> checkAclConditional ( $ node , $ aclDefault ) : ! $ this -> checkAclConditional ( $ node , $ aclDefault ) ) && $ this -> checkHelperCond...
Checks all conditionals for a given layout node
11,265
public function getDup ( $ contador ) { $ dup = $ this -> getElementsByTagName ( 'dup' ) -> item ( $ contador ) ; return self :: createByXml ( $ dup -> C14N ( ) ) ; }
Pega a propriedade do Dup .
11,266
public function onFormSuccess ( FormEvent $ event ) { $ form = $ event -> getForm ( ) ; $ result = $ this -> createResult ( $ form ) ; if ( $ form -> getStoreResults ( ) ) { $ this -> storeResult ( $ form , $ result ) ; } if ( $ form -> getSendMail ( ) ) { $ this -> sendMail ( $ form , $ result ) ; } $ successUrl = $ f...
Default handling for the form success event . This includes storage of the result sending a confirmation mail and redirecting to the success URL while respecting the form settings .
11,267
public function createResult ( Form $ form ) { $ result = new Result ( ) ; $ result -> setDatetimeAdded ( new \ DateTime ( ) ) ; $ viewData = $ form -> getSf2Form ( ) -> getViewData ( ) ; foreach ( $ form -> getFields ( ) as $ field ) { $ entry = new Entry ( ) ; $ entry -> setField ( $ field ) ; $ entry -> setValue ( $...
Creates the result object from the user s input .
11,268
public function storeResult ( Form $ form , Result $ result ) { $ entityManager = $ this -> container -> get ( 'doctrine' ) -> getManager ( ) ; $ form -> addResult ( $ result ) ; $ entityManager -> persist ( $ form ) ; $ entityManager -> flush ( ) ; }
Stores the user input as a result object .
11,269
public function sendMail ( Form $ form , Result $ result ) { $ message = \ Swift_Message :: newInstance ( ) -> setSubject ( $ form -> getMailSubject ( ) ) -> setTo ( array ( $ form -> getMailRecipientEmail ( ) => $ form -> getMailRecipientName ( ) ) ) -> setBody ( $ this -> container -> get ( 'templating' ) -> render (...
Sends a mail containing the form values to the contact e - mail address specified .
11,270
public function createService ( ServiceLocatorInterface $ serviceLocator ) { $ appConfig = $ serviceLocator -> get ( 'config' ) ; $ config = array_key_exists ( 'log' , $ appConfig ) ? $ appConfig [ 'log' ] : array ( ) ; $ class = array_key_exists ( 'class' , $ config ) ? $ config [ 'class' ] : 'Zend\Log\Logger' ; $ log...
Creates a Logger service
11,271
private function processModules ( DependencyInjectionContainer $ dic , array $ modules , array & $ config ) { $ dependencyGraph = new ModuleDependencyGraph ( ) ; $ dependencyGraph -> addModules ( $ modules ) ; $ modules = $ dependencyGraph -> getSortedModuleList ( ) ; foreach ( $ modules as $ module ) { $ this -> loadM...
Process modules after initial loading .
11,272
private function loadModule ( $ moduleClass , array & $ modules , array $ moduleList , DependencyInjectionContainer $ dic ) { $ module = $ dic -> make ( $ moduleClass ) ; if ( ! $ module instanceof Module ) { throw new ConfigurationException ( get_class ( $ module ) . ' was configured as a module, but doesn\'t implemen...
Load a module by class name .
11,273
private function loadRequiredModules ( Module $ module , & $ modules , array $ moduleList , DependencyInjectionContainer $ dic ) { foreach ( $ module -> getRequiredModules ( ) as $ requiredModule ) { if ( ! \ in_array ( $ requiredModule , $ moduleList ) ) { $ this -> loadModule ( $ requiredModule , $ modules , $ module...
Load the modules a certain module requires .
11,274
private function loadModuleConfiguration ( Module $ module , array & $ config ) { $ key = $ module -> getModuleKey ( ) ; if ( ! isset ( $ config [ $ key ] ) ) { $ config [ $ key ] = array ( ) ; } $ module -> loadConfiguration ( $ config [ $ key ] , $ config ) ; }
Load the configuration for a specific module .
11,275
public function addRule ( Rule $ rule ) { $ this -> addReason ( $ rule -> getId ( ) , array ( 'rule' => $ rule , 'job' => $ rule -> getJob ( ) , ) ) ; }
Add a rule as a reason
11,276
protected function jobToText ( $ job ) { switch ( $ job [ 'cmd' ] ) { case 'install' : $ packages = $ this -> pool -> whatProvides ( $ job [ 'packageName' ] , $ job [ 'constraint' ] ) ; if ( ! $ packages ) { return 'No package found to satisfy install request for ' . $ job [ 'packageName' ] . $ this -> constraintToText...
Turns a job into a human readable description
11,277
public function getTemplateHtmlAndScript ( ) { $ html = '' ; $ scripts = [ ] ; foreach ( $ this -> fields ( ) as $ field ) { $ html .= $ field -> render ( ) ; if ( $ field -> getScript ( ) ) { $ scripts [ ] = array_pop ( Merchant :: $ script ) ; } } return [ $ html , implode ( "\r\n" , $ scripts ) ] ; }
Get the html and script of template .
11,278
protected function formatField ( Field $ field ) { $ column = $ field -> column ( ) ; $ elementName = $ elementClass = $ errorKey = [ ] ; $ key = $ this -> key ? : 'new_' . static :: DEFAULT_KEY_NAME ; if ( is_array ( $ column ) ) { foreach ( $ column as $ k => $ name ) { $ errorKey [ $ k ] = sprintf ( '%s.%s.%s' , $ t...
Set errorKey elementName elementClass for fields inside hasmany fields .
11,279
public static function encryptOpenssl ( $ textToEncrypt , string $ secretHash = null , string $ password = '' ) : ? string { if ( ! $ secretHash ) { $ secretHash = self :: $ salt ; } if ( $ length = openssl_cipher_iv_length ( self :: $ method ) ) { $ iv = substr ( md5 ( self :: $ prefix . $ password ) , 0 , $ length ) ...
Encrypt string using openSSL module
11,280
public static function decryptOpenssl ( $ textToDecrypt , string $ secretHash = null , string $ password = '' ) : ? string { if ( ! $ secretHash ) { $ secretHash = self :: $ salt ; } if ( $ length = openssl_cipher_iv_length ( self :: $ method ) ) { $ iv = substr ( md5 ( self :: $ prefix . $ password ) , 0 , $ length ) ...
Decrypt string using openSSL module
11,281
public function upload ( string $ projectKey , string $ ext , string $ filename , array $ params ) { if ( ! file_exists ( $ filename ) ) { throw new Exception \ InvalidArgumentException ( 'file ' . $ filename . ' not found' ) ; } if ( ! isset ( $ params [ 'locale_id' ] ) ) { throw new Exception \ InvalidArgumentExcepti...
Upload a locale .
11,282
public function request ( $ method , $ absUrl , $ params , $ headers ) { $ curl = curl_init ( ) ; $ method = strtolower ( $ method ) ; $ opts = array ( ) ; if ( $ method == 'get' ) { $ opts [ CURLOPT_HTTPGET ] = 1 ; if ( count ( $ params ) > 0 ) { $ encoded = self :: urlEncode ( $ params ) ; $ absUrl = "$absUrl?$encode...
Make the request
11,283
private function handleCurlError ( $ errno , $ message ) { switch ( $ errno ) { case CURLE_COULDNT_CONNECT : case CURLE_COULDNT_RESOLVE_HOST : case CURLE_OPERATION_TIMEOUTED : $ msg = "Could not connect" ; break ; case CURLE_SSL_CACERT : case CURLE_SSL_PEER_CERTIFICATE : $ msg = "Could not verify SSL certificate." ; br...
Throw an exception with message indicating type of http error
11,284
public function pop ( ) { $ keys = array_keys ( $ this -> queues ) ; for ( $ this -> queueCounter ; isset ( $ keys [ $ this -> queueCounter ] ) ; $ this -> queueCounter ++ ) { $ queue = $ this -> queues [ $ keys [ $ this -> queueCounter ] ] ; $ message = $ queue -> pop ( ) ; if ( $ message !== null ) { $ this -> queueC...
Returns the next message from each queue until all are empty
11,285
public function loadCustomerGroupConfigFile ( ModuleToggleActivationEvent $ event ) { $ event -> setModule ( ModuleQuery :: create ( ) -> findPk ( $ event -> getModuleId ( ) ) ) ; if ( $ event -> getModule ( ) -> getActivate ( ) === BaseModule :: IS_NOT_ACTIVATED ) { $ this -> configurationFileHandler -> loadConfigurat...
Load customer group definitions
11,286
protected function getFileDescriptor ( $ element ) { $ fileDescriptor = $ element instanceof FileDescriptor ? $ element : $ element -> getFile ( ) ; if ( ! $ fileDescriptor instanceof FileDescriptor ) { throw new \ UnexpectedValueException ( 'An element should always have a file associated with it' ) ; } return $ fileD...
Retrieves the File Descriptor from the given element .
11,287
function reindex ( $ mode , $ post_id , $ message , $ subject , $ poster_id , $ forum_id ) { global $ config , $ phpbb_root_path , $ phpEx ; $ search_type = basename ( $ config [ 'search_type' ] ) ; if ( ! file_exists ( $ phpbb_root_path . 'phpbb/search/' . $ search_type . '.' . $ phpEx ) ) { trigger_error ( 'NO_SUCH_S...
Reindex post in search
11,288
private function from_notes ( array $ messages , $ simple = true ) { if ( ! empty ( $ messages ) ) { foreach ( $ messages as $ idx => $ mess ) { if ( empty ( $ mess [ 'id_note' ] ) ) { unset ( $ messages [ $ idx ] ) ; continue ; } $ note = $ this -> notes -> get ( $ mess [ 'id_note' ] ) ; $ note = [ 'id' => $ mess [ 'i...
Gets internal messages info from notes archive
11,289
public function insert ( $ imess ) { $ cfg = & $ this -> class_cfg ; if ( empty ( $ imess [ 'id_option' ] ) ) { $ perm = new \ bbn \ user \ permissions ( ) ; $ imess [ 'id_option' ] = $ perm -> is ( self :: BBN_DEFAULT_PERM ) ; } if ( ! empty ( $ imess [ 'id_option' ] ) && ! empty ( $ imess [ 'title' ] ) && ! empty ( $...
Inserts a new page s internal message
11,290
public function get ( string $ id_option , string $ id_user , $ simple = true ) { $ cfg = & $ this -> class_cfg ; $ now = date ( 'Y-m-d H:i:s' ) ; $ id_group = $ this -> db -> select_one ( 'bbn_users' , 'id_group' , [ 'id' => $ id_user ] ) ; $ messages = $ this -> db -> get_rows ( " SELECT {$cfg['table']}.* F...
Gets the page s internal messages of an user
11,291
public function set_hidden ( string $ id_imess , string $ id_user ) { $ cfg = & $ this -> class_cfg ; if ( ! empty ( $ id_imess ) && ! empty ( $ id_user ) ) { return ! ! $ this -> db -> insert_update ( $ cfg [ 'tables' ] [ 'users' ] , [ $ cfg [ 'arch' ] [ 'users' ] [ 'id_imessage' ] => $ id_imess , $ cfg [ 'arch' ] [ '...
Sets an user s internal message as visible
11,292
public function unset_hidden ( string $ id_imess , string $ id_user ) { $ cfg = & $ this -> class_cfg ; if ( ! empty ( $ id_imess ) && ! empty ( $ id_user ) ) { return ! ! $ this -> db -> update_ignore ( $ cfg [ 'tables' ] [ 'users' ] , [ $ cfg [ 'arch' ] [ 'users' ] [ 'id_imessage' ] => $ id_imess , $ cfg [ 'arch' ] [...
Sets an user s internal message as not visible
11,293
public function get_by_user ( string $ id_user ) { $ cfg = & $ this -> class_cfg ; $ now = date ( 'Y-m-d H:i:s' ) ; $ id_group = $ this -> db -> select_one ( 'bbn_users' , 'id_group' , [ 'id' => $ id_user ] ) ; $ messages = $ this -> db -> get_rows ( " SELECT {$cfg['table']}.* FROM {$cfg['tables']['users']} ...
Gets all user s internal messages
11,294
public function check ( array $ insert , bool $ throw = true ) : bool { foreach ( $ this -> schema as $ key => $ rules ) { $ result = $ this -> processRules ( $ key , explode ( '|' , $ rules ) , $ insert ) ; if ( ! $ result [ 'status' ] && $ throw ) { throw new InvalidArgumentException ( sprintf ( $ result [ 'message' ...
Check if given array is matching the schema .
11,295
public static function createFromFile ( string $ path , bool $ json = false ) : Schema { static :: fileExists ( $ path ) ; $ schema = $ json ? json_decode ( file_get_contents ( $ path ) , true ) : include $ path ; if ( ! is_array ( $ schema ) ) { throw new InvalidArgumentException ( '[createFromFile] method requires fi...
Create new Schema instance based on file .
11,296
private function processRules ( string $ key , array $ rules , array $ insert ) : array { $ status = true ; if ( ! isset ( $ insert [ $ key ] ) ) { $ status = false ; $ message = 'Schema key [%s] not present on insert.' ; } do { $ r = array_shift ( $ rules ) ; $ method = 'checkRule' . ucfirst ( $ r ) ; if ( ! in_array ...
Parse each rules for given key of insert .
11,297
public function value ( ) { if ( is_null ( $ this -> value ) ) { if ( is_null ( $ this -> elem ) ) { $ this -> value = '' ; } else { $ this -> value = $ this -> elem -> textContent ; } } return $ this -> value ; }
Retorna o valor .
11,298
public function pad ( $ num , $ char = '0' , $ dir = STR_PAD_LEFT ) { $ this -> value = str_pad ( $ this -> value ( ) , $ num , $ char , $ dir ) ; return $ this ; }
Aplicar PAD .
11,299
private function inspectElementForVersioned ( \ SimpleXMLElement $ element , array & $ config , $ meta ) { foreach ( $ element as $ mapping ) { $ mappingDoctrine = $ mapping ; $ mapping = $ mapping -> children ( self :: GEDMO_NAMESPACE_URI ) ; $ isAssoc = $ this -> _isAttributeSet ( $ mappingDoctrine , 'field' ) ; $ fi...
Searches mappings on element for versioned fields .