idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
55,500 | public function save ( ) { $ bucket = $ this -> _post ( 'servers/' . $ this -> server_id . '/software_bucket/' . $ this -> key , $ this -> dirty_values ) ; $ this -> mergeValues ( $ bucket ) ; } | Saves a bucket if the bucket does not exist a new bucket will be created |
55,501 | public function name ( ) { if ( null === $ this -> sessionName ) { $ characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' ; $ this -> sessionName = '' ; for ( $ i = 0 ; $ i < 32 ; $ i ++ ) { $ this -> sessionName .= $ characters [ rand ( 0 , strlen ( $ characters ) - 1 ) ] ; } } return $ this -... | returns session name |
55,502 | public static function doInsert ( $ criteria , ConnectionInterface $ con = null ) { if ( null === $ con ) { $ con = Propel :: getServiceContainer ( ) -> getWriteConnection ( C2PTableMap :: DATABASE_NAME ) ; } if ( $ criteria instanceof Criteria ) { $ criteria = clone $ criteria ; } else { $ criteria = $ criteria -> bui... | Performs an INSERT on the database given a C2P or Criteria object . |
55,503 | public static function convertVariableTo ( \ PHY \ Variable \ AVar $ variable , $ convertTo = 'Obj' ) { $ method = 'to' . $ convertTo ; if ( ! is_callable ( [ $ variable , $ method ] ) ) { throw new \ PHY \ Variable \ Exception ( 'Could not convert "' . $ variable -> getType ( ) . '" to "' . $ convertTo . '"' ) ; } $ v... | Convert a variable to a different type . |
55,504 | protected function registerRoutes ( ) { $ http = Arr :: get ( $ this -> triggers , 'http' ) ; if ( is_null ( $ http ) ) { return ; } try { Validator :: validate ( $ http , [ 'route' => 'required' , 'methods' => 'required' , 'function' => 'required' ] ) ; } catch ( ExceptionAttrs $ e ) { throw new \ Exception ( $ e -> t... | Registrar rotas . |
55,505 | protected function _createRuntimeException ( $ message = null , $ code = null , $ previous = null ) { return new RuntimeException ( $ message , $ code , $ previous ) ; } | Creates a new Runtime exception . |
55,506 | public function init ( $ baseStorageDefaultPath , $ baseStorageSqlPath ) { $ storageDefaultPath = realpath ( $ baseStorageDefaultPath ) ; $ contentSqlPath = realpath ( $ baseStorageSqlPath ) ; $ this -> initConfigStorage ( $ storageDefaultPath ) ; $ this -> initContentDb ( $ contentSqlPath ) ; $ this -> save ( ) ; } | Initiates default storage |
55,507 | public function save ( ) { $ host = $ this ; array_map ( function ( $ value ) use ( $ host ) { $ host -> saveSubset ( $ value ) ; } , $ this -> fileBasedSubsets ) ; } | Persist all subsets |
55,508 | public function saveSubset ( $ subset ) { $ changes = $ subset . 'Changes' ; if ( $ this -> $ changes === true ) { if ( ! defined ( 'JSON_PRETTY_PRINT' ) ) { $ json = json_encode ( $ this -> $ subset ) ; } else { $ json = json_encode ( $ this -> $ subset , JSON_PRETTY_PRINT ) ; } $ subsetStoragePath = $ this -> storage... | Persist subset to disk |
55,509 | protected function loadSubset ( $ subset ) { $ subsetStoragePath = $ this -> storagePath . DIRECTORY_SEPARATOR . $ subset . '.json' ; $ json = file_get_contents ( $ subsetStoragePath ) ; $ json = json_decode ( $ json ) ; $ this -> $ subset = $ json ; return $ json ; } | Load subset from disk |
55,510 | public function addRoles ( Collection $ roles ) { foreach ( $ roles as $ role ) { $ this -> roles -> add ( $ role ) ; } } | Add a role to the user . |
55,511 | private function registerTwigExtensions ( ) { foreach ( $ this -> app -> getSetting ( 'twig_extensions' , [ ] ) as $ extension ) { $ this -> twig -> addExtension ( new $ extension ( $ this ) ) ; } } | Register custom twig extensions . |
55,512 | public function getUrl ( $ url ) { if ( ! $ url || starts_with ( $ url , [ '#' , '//' , 'mailto:' , 'tel:' , 'http' ] ) ) { return $ url ; } $ root = $ this -> app -> getSetting ( 'url' ) ; $ url = trim ( $ root , '/' ) . '/' . trim ( $ url , '/' ) ; if ( $ this -> app -> getSetting ( 'url_trailing_slash' , false ) && ... | Get the URL for the given page . |
55,513 | public function getAsset ( $ path ) { if ( $ path [ 0 ] === '/' ) { return $ this -> getUrl ( $ path ) ; } $ asset = $ this -> manifest -> get ( $ path ) ; return $ this -> getUrl ( '/assets/' . trim ( $ asset , '/' ) ) ; } | Check asset manifest for a file |
55,514 | public function build ( ) { $ this -> app -> writeln ( "\n<comment>Adding root pages</comment>" ) ; $ this -> addPages ( '\\Skosh\\Content\\Page' ) ; $ this -> app -> writeln ( "\n<comment>Adding posts</comment>" ) ; $ this -> addPages ( '\\Skosh\\Content\\Post' , 'path' , '_posts' ) ; $ this -> app -> writeln ( "\n<co... | Renders the site |
55,515 | public function savePage ( $ target , $ html ) { $ fs = new Filesystem ( ) ; $ fs -> dumpFile ( $ this -> target . DIRECTORY_SEPARATOR . $ target , $ html ) ; } | Save page to target file . |
55,516 | public function getParent ( $ parentId ) { if ( $ parentId && isset ( $ this -> site -> pages [ $ parentId ] ) ) { return $ this -> site -> pages [ $ parentId ] ; } return [ ] ; } | Get parent content . |
55,517 | public function getPosts ( Content $ content ) { if ( isset ( $ this -> site -> categories [ $ content -> id ] ) ) { return $ this -> site -> categories [ $ content -> id ] ; } else { if ( isset ( $ content -> category ) && isset ( $ this -> site -> categories [ $ content -> category ] ) ) { return $ this -> site -> ca... | Get posts for given content . |
55,518 | public function createServerConfig ( ) { $ config = new Config ( $ this -> app -> getEnvironment ( ) , '.env' ) ; $ config -> export ( $ this -> target . DIRECTORY_SEPARATOR . '.env.php' ) ; } | Create a server config file |
55,519 | public function copyStaticFiles ( ) { $ exclude = [ 'js' , 'javascripts' , 'stylesheets' , 'less' , 'sass' ] ; $ exclude = array_merge ( $ exclude , ( array ) $ this -> app -> getSetting ( 'exclude' , [ ] ) ) ; $ pattern = '/\\.(' . implode ( "|" , $ exclude ) . ')$/' ; $ to_copy = ( array ) $ this -> app -> getSetting... | Copy static files to target Ignoring JS CSS & LESS - Gulp handles that |
55,520 | public function cleanTarget ( ) { $ filesystem = new Filesystem ( ) ; $ files = array_diff ( scandir ( $ this -> target ) , [ '.' , '..' ] ) ; $ files = preg_grep ( '/[^.gitignore]/i' , $ files ) ; foreach ( $ files as $ file ) { $ filesystem -> remove ( "$this->target/$file" ) ; } Event :: fire ( 'target.cleaned' , [ ... | Clean target directory |
55,521 | private function addPages ( $ class , $ path = 'notPath' , $ filter = '_' ) { $ finder = new Finder ( ) ; $ finder -> files ( ) -> in ( $ this -> source ) -> $ path ( $ filter ) -> name ( '/\\.(md|textile|xml|twig)$/' ) ; foreach ( $ finder as $ file ) { $ page = new $ class ( $ file , $ this ) ; if ( $ this -> app -> ... | Add pages for rendering |
55,522 | public function cmdGetFile ( ) { $ result = $ this -> getListFile ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableFile ( $ result ) ; $ this -> output ( ) ; } | Callback for file - get command |
55,523 | public function cmdDeleteFile ( ) { $ id = $ this -> getParam ( 0 ) ; $ all = $ this -> getParam ( 'all' ) ; if ( empty ( $ id ) && empty ( $ all ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } $ options = null ; if ( isset ( $ id ) ) { if ( $ this -> getParam ( 'type' ) ) { $ options = array ... | Callback for file - delete command |
55,524 | public function cmdUpdateFile ( ) { $ params = $ this -> getParam ( ) ; if ( empty ( $ params [ 0 ] ) || count ( $ params ) < 2 ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } if ( ! is_numeric ( $ params [ 0 ] ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ this -> ... | Callback for file - update command |
55,525 | protected function addFile ( ) { if ( ! $ this -> isError ( ) ) { $ id = $ this -> file -> add ( $ this -> getSubmitted ( ) ) ; if ( empty ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } $ this -> line ( $ id ) ; } } | Add a new file record |
55,526 | protected function updateFile ( $ file_id ) { if ( ! $ this -> isError ( ) && ! $ this -> file -> update ( $ file_id , $ this -> getSubmitted ( ) ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } } | Updates a file record |
55,527 | protected function submitAddFile ( ) { $ this -> setSubmitted ( null , $ this -> getParam ( ) ) ; $ this -> validateComponent ( 'file' ) ; $ this -> addFile ( ) ; } | Add a new file record at once |
55,528 | protected function wizardAddFile ( ) { $ this -> validatePrompt ( 'path' , $ this -> text ( 'Path' ) , 'file' ) ; $ this -> validatePrompt ( 'entity' , $ this -> text ( 'Entity' ) , 'file' ) ; $ this -> validatePrompt ( 'entity_id' , $ this -> text ( 'Entity ID' ) , 'file' , 0 ) ; $ this -> validatePrompt ( 'title' , $... | Add a new file record step by step |
55,529 | private function SaveGroups ( ) { $ assignedIDs = $ this -> AssignedGroupIDs ( ) ; $ selectedIDs = Request :: PostArray ( 'Group' ) ; $ this -> ClearMembergroups ( $ selectedIDs ) ; foreach ( $ selectedIDs as $ selectedID ) { if ( ! in_array ( $ selectedID , $ assignedIDs ) ) { $ confirmGroup = new RegisterConfirmMembe... | Saves the groups |
55,530 | public function configParam ( $ parameter ) { $ value = $ this -> container -> getParameter ( $ parameter ) ; return is_array ( $ value ) ? json_encode ( $ value ) : $ value ; } | Returns the specified container s parameter |
55,531 | protected function _getException ( \ Throwable $ e , $ h1 ) { try { return $ this -> _getFormatterStrategy ( ) -> format ( $ e , $ h1 ) ; } catch ( \ Throwable $ e2 ) { return "Error '" . get_class ( $ e2 ) . "' during processing of exception '" . get_class ( $ e ) . "' with message '{$e2->getMessage()}'." ; } } | Get exception stack trace as a string |
55,532 | protected function _handleXMLHTTPCommandException ( \ Throwable $ e ) { header ( "Content-Type: application/json; charset=utf-8" ) ; header ( "Expires: Sat, 1 Jan 2005 00:00:00 GMT" ) ; header ( "Last-Modified: " . gmdate ( "D, d M Y H:i:s" ) . " GMT" ) ; header ( "Cache-Control: no-cache, must-revalidate" ) ; header (... | Handle an exception during an XMLHTTP request . |
55,533 | public function end ( ) { $ calc = $ this -> start ( ) + $ this -> max ; $ r = ( $ calc > $ this -> total ) ? $ this -> total : $ calc ; return $ r ; } | This calculates the end of our result set based on our current page |
55,534 | public function info ( $ html ) { $ tags = array ( '{total}' , '{start}' , '{end}' , '{page}' , '{pages}' ) ; $ code = array ( $ this -> total , $ this -> start ( ) + 1 , $ this -> end ( ) , $ this -> get , $ this -> pages ( ) ) ; return str_replace ( $ tags , $ code , $ html ) ; } | Based on which page you are this returns informations like start result end result total results current page total pages |
55,535 | public function first ( $ html , $ html2 = '' ) { $ r = ( $ this -> get != 1 ) ? str_replace ( '{nr}' , 1 , $ html ) : str_replace ( '{nr}' , 1 , $ html2 ) ; return $ r ; } | This shows the first link with custom html |
55,536 | public function previous ( $ html , $ html2 = '' ) { $ r = ( $ this -> get != 1 ) ? str_replace ( '{nr}' , $ this -> get - 1 , $ html ) : str_replace ( '{nr}' , $ this -> get - 1 , $ html2 ) ; return $ r ; } | This shows the previous link with custom html |
55,537 | public function next ( $ html , $ html2 = '' ) { $ r = ( $ this -> get < $ this -> pages ( ) ) ? str_replace ( '{nr}' , $ this -> get + 1 , $ html ) : str_replace ( '{nr}' , $ this -> get + 1 , $ html2 ) ; return $ r ; } | This shows the next link with custom html |
55,538 | public function last ( $ html , $ html2 = '' ) { $ r = ( $ this -> get < $ this -> pages ( ) ) ? str_replace ( '{nr}' , $ this -> pages ( ) , $ html ) : str_replace ( '{nr}' , $ this -> pages ( ) , $ html2 ) ; return $ r ; } | This shows the last link with custom html |
55,539 | public function numbers ( $ link , $ current , $ reversed = false ) { $ r = '' ; $ range = floor ( ( $ this -> max_items - 1 ) / 2 ) ; if ( ! $ this -> max_items ) { $ page_nums = range ( 1 , $ this -> pages ( ) ) ; } else { $ lower_limit = max ( $ this -> get - $ range , 1 ) ; $ upper_limit = min ( $ this -> pages ( )... | This shows an loop of numbers with their appropriate link in custom html |
55,540 | public function saveI18N ( ) { if ( empty ( $ this -> i18n_data ) ) return ; $ this -> i18n_relation ( ) -> getQuery ( ) -> whereIn ( $ this -> getI18NCodeField ( ) , array_keys ( $ this -> i18n_data ) ) -> delete ( ) ; foreach ( $ this -> i18n_data as $ locale => $ data ) { $ obj = new $ this -> i18n_class ( ) ; $ dat... | Store I18N to database |
55,541 | public function filterI18NColumn ( ) { $ overrideData = array_only ( $ this -> attributes , $ this -> i18n_fillable ) ; if ( ! empty ( $ overrideData ) ) { $ this -> i18n_data [ $ this -> i18n_default_locale ] = $ overrideData ; foreach ( $ this -> i18n_fillable as $ key ) { unset ( $ this -> $ key ) ; } } if ( isset (... | Filter & remove i18n column from attributes . Mean is not save to model self . |
55,542 | public function scopeI18N ( $ query , $ locale = null ) { $ i18nTranAlias = "i18n_translation" ; $ i18nAlias = "i18n" ; $ primary = $ this -> primaryKey ; $ i18nPrimary = $ this -> i18n_primary ; $ table = $ this -> table ; $ i18n_table = ( new $ this -> i18n_class ( ) ) -> getTable ( ) ; if ( $ locale ) { $ query -> l... | Join I18N data to this |
55,543 | public function seed ( array $ seeds ) { foreach ( $ seeds as $ seed ) { $ group = PermissionsGroup :: create ( $ seed [ 'group' ] ) ; $ permissions = array_map ( function ( $ permission ) { return new Permission ( $ permission ) ; } , $ seed [ 'permissions' ] ) ; $ group -> permissions ( ) -> saveMany ( $ permissions ... | Seed permissions . |
55,544 | public function get ( string $ settingsField = null , $ default = null ) { if ( is_null ( $ settingsField ) ) { return $ this -> settings ; } $ setting = $ this -> settings ; foreach ( explode ( '.' , $ settingsField ) as $ field ) { if ( is_array ( $ setting ) && array_key_exists ( $ field , $ setting ) ) { $ setting ... | Returns the given settings field if set or the default value |
55,545 | public function merge ( array $ settings , string $ field = null , bool $ mergeArrays = false ) { $ merged = self :: mergeSettings ( $ this -> get ( $ field ) , $ settings , $ mergeArrays ) ; if ( ! is_null ( $ field ) ) { $ this -> put ( $ field , $ merged ) ; } else { $ this -> set ( $ merged ) ; } } | Merges the given settings into the given field |
55,546 | private static function mergeSettings ( array $ a , array $ b , $ mergeArrays = false ) : array { foreach ( $ b as $ key => $ value ) { if ( array_key_exists ( $ key , $ a ) ) { if ( self :: isAssoc ( $ a [ $ key ] ) && self :: isAssoc ( $ b [ $ key ] ) ) { $ a [ $ key ] = self :: mergeSettings ( $ a [ $ key ] , $ b [ ... | Recursively merges the two given arrays giving priority to the second |
55,547 | public function load ( DOMDocument $ domDocument , $ cachePath , $ xmlSchemaFile = null ) { $ this -> domDocument = $ domDocument ; $ this -> cachePath = $ cachePath ; if ( isset ( $ xmlSchemaFile ) ) { $ this -> xmlSchemaFile = $ xmlSchemaFile ; } $ this -> loadConfiguration ( ) ; } | Loads the XML configuration . |
55,548 | public function reload ( ) { $ this -> configuration = null ; $ this -> load ( $ this -> domDocument , $ this -> cachePath , $ this -> xmlSchemaFile ) ; } | Reloads the configuration . |
55,549 | public function hasField ( $ objectName , $ fieldName ) { $ field = $ this -> getField ( $ objectName , $ fieldName ) ; return is_array ( $ field ) ; } | Returns true when the configuration of an object contains the specified field name . |
55,550 | public function getObjectNames ( ) { $ objectNames = array ( ) ; if ( is_array ( $ this -> configuration ) ) { $ objectNames = array_keys ( $ this -> configuration ) ; } return $ objectNames ; } | Returns all configured object names . |
55,551 | public function getModelConfiguration ( $ objectName ) { if ( isset ( $ this -> configuration [ $ objectName ] ) ) { $ modelConfiguration = $ this -> configuration [ $ objectName ] ; $ modelConfiguration [ '__object_name' ] = $ objectName ; if ( isset ( $ modelConfiguration [ 'fields' ] ) === false ) { $ modelConfigura... | Returns the model for the specified object . |
55,552 | public function getFormConfiguration ( $ objectName , $ formName ) { $ modelConfiguration = $ this -> getModelConfiguration ( $ objectName ) ; if ( isset ( $ modelConfiguration [ 'forms' ] [ $ formName ] ) ) { $ formConfiguration = $ modelConfiguration [ 'forms' ] [ $ formName ] ; foreach ( $ formConfiguration [ 'field... | Returns field configuration of the specified form in the object . |
55,553 | public function getViewConfiguration ( $ objectName , $ viewName ) { $ modelConfiguration = $ this -> getModelConfiguration ( $ objectName ) ; if ( isset ( $ modelConfiguration [ 'views' ] [ $ viewName ] ) ) { $ viewConfiguration = $ modelConfiguration [ 'views' ] [ $ viewName ] ; if ( isset ( $ viewConfiguration [ 'fi... | Returns field configuration of the specified view in the object . |
55,554 | public function getViewConfigurationsByViewgroupOfView ( $ objectName , $ viewName ) { $ viewConfigurations = array ( ) ; $ modelConfiguration = $ this -> getModelConfiguration ( $ objectName ) ; $ viewConfiguration = $ this -> getViewConfiguration ( $ objectName , $ viewName ) ; if ( isset ( $ viewConfiguration [ 'vie... | Returns all the field configurations of views in the viewgroup of the specified view name . |
55,555 | public function getFieldNames ( $ objectName ) { $ fieldNames = array ( ) ; $ modelConfiguration = $ this -> getModelConfiguration ( $ objectName ) ; if ( isset ( $ modelConfiguration [ '__field_index' ] ) ) { $ fieldNames = array_keys ( $ modelConfiguration [ '__field_index' ] ) ; } return $ fieldNames ; } | Returns the field names of the specified object . |
55,556 | public function getFieldNamesByView ( $ objectName , $ viewName ) { $ fieldNames = array ( ) ; $ fieldConfigurations = $ this -> getFieldsByView ( $ objectName , $ viewName ) ; foreach ( $ fieldConfigurations as $ fieldConfiguration ) { array_push ( $ fieldNames , $ fieldConfiguration [ 'name' ] ) ; } return $ fieldNam... | Returns the field names of the specified view in the object . |
55,557 | public function getFields ( $ objectName ) { $ fieldConfigurations = array ( ) ; $ modelConfiguration = $ this -> getModelConfiguration ( $ objectName ) ; if ( is_array ( $ modelConfiguration ) ) { $ fieldConfigurations = $ modelConfiguration [ 'fields' ] ; } return $ fieldConfigurations ; } | Returns all fields for the object . |
55,558 | public function getFieldsByDatatype ( $ objectName , $ datatype ) { $ datatypeFieldConfigurations = array ( ) ; $ fieldConfigurations = $ this -> getFields ( $ objectName ) ; foreach ( $ fieldConfigurations as $ fieldConfiguration ) { if ( $ fieldConfiguration [ 'datatype' ] == $ datatype ) { $ datatypeFieldConfigurati... | Returns all fields with the specified datatype for an object . |
55,559 | public function getFieldsByView ( $ objectName , $ viewName ) { $ fieldConfigurations = array ( ) ; $ viewConfiguration = $ this -> getViewConfiguration ( $ objectName , $ viewName ) ; if ( is_array ( $ viewConfiguration ) ) { $ fieldConfigurations = $ viewConfiguration [ "fields" ] ; foreach ( $ fieldConfigurations as... | Returns the fields in the object view . |
55,560 | public function getField ( $ objectName , $ fieldName , $ excludeFormDefaults = true ) { $ modelConfiguration = $ this -> getModelConfiguration ( $ objectName ) ; if ( isset ( $ modelConfiguration [ '__field_index' ] [ $ fieldName ] ) ) { $ fieldConfiguration = array_replace_recursive ( $ this -> defaultFieldConfigurat... | Returns the configuration of a field in the specified object . |
55,561 | public function getReferencedField ( $ objectName , $ fieldName , array & $ excludedFieldNameParts = array ( ) , $ objectReferencesOnly = true ) { $ foundFieldName = null ; $ fieldNameParts = explode ( '_' , $ fieldName ) ; $ excludedFieldNameParts = array ( ) ; $ initial = false ; while ( count ( $ fieldNameParts ) > ... | Returns the field reference of the specified object . The returned excluded field name parts can be used to retrieve the field for the referenced object . |
55,562 | private function generateCacheFile ( ) { $ previousErrorSetting = libxml_use_internal_errors ( true ) ; libxml_clear_errors ( ) ; if ( @ $ this -> domDocument -> schemaValidate ( $ this -> xmlSchemaFile ) ) { $ this -> domDocument -> preserveWhiteSpace = false ; $ this -> domDocument -> loadXML ( $ this -> domDocument ... | Generates the cache file . |
55,563 | public function configurationObjectAfter ( GetConfigurationObjectDTO $ serviceDataTransferObject ) { $ this -> delay ( self :: PRIORITY_SAVE_OBJECT_IN_CACHE , function ( GetConfigurationObjectDTO $ serviceDataTransferObject ) { $ cacheHash = $ this -> getConfigurationObjectCacheHash ( $ serviceDataTransferObject ) ; if... | After a configuration object has been built it is stored in the cache . |
55,564 | public function add ( \ Caridea \ Validate \ Rule ... $ rules ) : self { $ this -> rules = array_merge ( $ this -> rules , $ rules ) ; return $ this ; } | Adds one or more Rule s into this Set . |
55,565 | public function addAll ( array $ rules ) : self { try { return $ this -> add ( ... $ rules ) ; } catch ( \ TypeError $ e ) { throw new \ InvalidArgumentException ( 'Only Rule objects are allowed' , 0 , $ e ) ; } } | Adds several Rule s into this Set . |
55,566 | public function merge ( Set $ rules ) : self { $ this -> rules = array_merge ( $ this -> rules , $ rules -> rules ) ; return $ this ; } | Adds the entries from another Set into this one . |
55,567 | protected function initializeDaemon ( ) { declare ( ticks = 100 ) ; pcntl_signal ( SIGHUP , [ $ this , 'handleSignal' ] ) ; pcntl_signal ( SIGINT , [ $ this , 'handleSignal' ] ) ; pcntl_signal ( SIGTERM , [ $ this , 'handleSignal' ] ) ; pcntl_signal ( SIGCHLD , [ $ this , 'handleSignal' ] ) ; pcntl_signal ( SIGUSR1 , [... | Post - daemonize initialization |
55,568 | protected function getPayloadInstance ( ) : AppInterface { if ( ! ( $ this -> instance instanceof AppInterface ) ) { $ appName = $ this -> get ( 'appname' , null ) ; $ appNamespace = $ this -> get ( 'appnamespace' , null ) ; $ appClassName = ucfirst ( $ appName ) ; if ( ! is_null ( $ appNamespace ) ) { $ appClassName =... | Get an instance of the app |
55,569 | protected function payloadExec ( $ method , $ args = [ ] ) { $ this -> getPayloadInstance ( ) ; if ( method_exists ( $ this -> instance , $ method ) ) { return $ this -> di -> call ( [ $ this -> instance , $ method ] , $ args ) ; } return null ; } | Execute callback on payload |
55,570 | protected function attachPayloadErrorHandler ( ) { $ this -> getPayloadInstance ( ) ; if ( method_exists ( $ this -> instance , 'errorHandler' ) ) { $ this -> di -> get ( ErrorHandler :: class ) -> addHandler ( [ $ this -> instance , 'errorHandler' ] ) ; } } | Attach payload error handler |
55,571 | protected function launchWorker ( ) : bool { $ this -> log ( LogLevel :: DEBUG , "[{pid}] launching fleet worker" ) ; $ workerConfig = $ this -> payloadExec ( 'getWorkerConfig' ) ; if ( $ workerConfig === false ) { $ this -> log ( LogLevel :: DEBUG , "[{pid}] launch cancelled by payload" ) ; return false ; } $ thi... | Launch a fleet worker |
55,572 | protected function runPayloadApplication ( $ workerConfig = null ) : int { $ this -> getPayloadInstance ( ) ; try { $ runSuccess = $ this -> instance -> run ( $ workerConfig ) ; unset ( $ this -> instance ) ; } catch ( Exception $ ex ) { $ exitMessage = $ ex -> getMessage ( ) ; $ exitFile = $ ex -> getFile ( ) . ':' . ... | Run application worker |
55,573 | public function sendSignal ( int $ signal ) { $ runningPid = $ this -> lock -> getRunningPID ( ) ; if ( ! $ runningPid ) { return false ; } return posix_kill ( $ runningPid , $ signal ) ; } | Send a signal to the running daemon |
55,574 | public function workerSignal ( int $ signal ) { $ this -> log ( LogLevel :: DEBUG , "[{pid}] Caught signal '{$signal}' (SIGHUP) at worker - handing off to payload handler" ) ; switch ( $ signal ) { case SIGHUP : $ this -> payloadExec ( 'signal' , [ $ signal ] ) ; break ; case SIGUSR1 : $ this -> payloadExec ( 'signal' ... | Worker signal handler |
55,575 | protected function reapChild ( int $ pid , int $ status = null ) { if ( array_key_exists ( $ pid , $ this -> children ) ) { $ exited = pcntl_wexitstatus ( $ status ) ; if ( $ this -> exitMode == 'worst-case' ) { if ( abs ( $ exited ) > abs ( $ this -> exit ) ) { $ this -> exit = $ exited ; } } $ workerType = val ( $ pi... | Reap a fleet worker |
55,576 | public function reapZombies ( ) { $ reaped = 0 ; do { $ status = null ; $ pid = pcntl_wait ( $ status , WNOHANG ) ; if ( $ pid > 0 ) { $ this -> reapChild ( $ pid , $ status ) ; $ reaped ++ ; } } while ( $ pid > 0 ) ; return $ reaped ; } | Reap any available exited children |
55,577 | protected function reapAllChildren ( ) : bool { static $ killing = false ; if ( ! $ killing ) { $ this -> log ( LogLevel :: DEBUG , "[{pid}] Shutting down fleet operations..." ) ; $ killing = true ; foreach ( $ this -> children as $ childpid => $ childtype ) { posix_kill ( $ childpid , SIGKILL ) ; } pcntl_signal_dispat... | Force - reap all children and return |
55,578 | public static function time ( string $ time = 'now' , string $ format = null ) : \ DateTimeInterface { $ timezone = new \ DateTimeZone ( 'utc' ) ; if ( is_null ( $ format ) ) { $ date = new \ DateTime ( $ time , $ timezone ) ; } else { $ date = \ DateTime :: createFromFormat ( $ format , $ time , $ timezone ) ; } retur... | Get the time |
55,579 | public function levelPriority ( string $ level ) : int { static $ priorities = [ LogLevel :: DEBUG => LOG_DEBUG , LogLevel :: INFO => LOG_INFO , LogLevel :: NOTICE => LOG_NOTICE , LogLevel :: WARNING => LOG_WARNING , LogLevel :: ERROR => LOG_ERR , LogLevel :: CRITICAL => LOG_CRIT , LogLevel :: ALERT => LOG_ALERT , LogL... | Get the numeric priority for a log level . |
55,580 | protected function interpolateContext ( string $ format , array $ context = [ ] ) : string { $ final = preg_replace_callback ( '/{([^\s][^}]+[^\s]?)}/' , function ( $ matches ) use ( $ context ) { $ field = trim ( $ matches [ 1 ] , '{}' ) ; if ( array_key_exists ( $ field , $ context ) ) { return $ context [ $ field ] ... | Interpolate contexts into messages containing bracket - wrapped format strings . |
55,581 | public function setCategory ( ChildCategory $ v = null ) { if ( $ v === null ) { $ this -> setCategoryId ( NULL ) ; } else { $ this -> setCategoryId ( $ v -> getId ( ) ) ; } $ this -> aCategory = $ v ; if ( $ v !== null ) { $ v -> addC2M ( $ this ) ; } return $ this ; } | Declares an association between this object and a ChildCategory object . |
55,582 | public function getCategory ( ConnectionInterface $ con = null ) { if ( $ this -> aCategory === null && ( $ this -> category_id != 0 ) ) { $ this -> aCategory = ChildCategoryQuery :: create ( ) -> findPk ( $ this -> category_id , $ con ) ; } return $ this -> aCategory ; } | Get the associated ChildCategory object |
55,583 | public function createJob ( $ jobName , $ data = null , $ notBefore = null , $ reference = null ) { $ data = [ 'type' => $ jobName , 'data' => $ data , 'reference' => $ reference , ] ; if ( $ notBefore !== null ) { $ data [ 'notbefore' ] = new Time ( $ notBefore ) ; } $ queue = $ this -> newEntity ( $ data ) ; if ( $ q... | Add a new Job to the Queue . |
55,584 | public function requestJob ( ) { $ findCond = [ 'conditions' => [ 'completed' => 0 ] , 'order' => [ 'created ASC' , 'id ASC' , ] , 'limit' => 3 , ] ; $ jobs = $ this -> find ( 'all' , $ findCond ) -> all ( ) -> toArray ( ) ; for ( $ i = 0 ; $ i < count ( $ jobs ) ; $ i ++ ) { if ( $ jobs [ $ i ] [ 'stats' ] [ 'tries' ]... | Find a job to do . |
55,585 | public function markJobDone ( $ id ) { $ entity = $ this -> get ( $ id ) ; $ data = [ 'completed' => true , 'stats' => [ 'tries' => ( $ entity -> stats [ 'tries' ] + 1 ) , 'message' => $ entity -> stats [ 'message' ] . ( $ entity -> stats [ 'tries' ] + 1 ) . '. ' . 'Success!' . PHP_EOL ] ] ; $ this -> patchEntity ( $ e... | Mark job done and add some stats |
55,586 | public function markJobFailed ( $ id , $ message = null ) { $ entity = $ this -> get ( $ id ) ; $ data = [ 'completed' => false , 'stats' => [ 'tries' => ( $ entity -> stats [ 'tries' ] + 1 ) , 'message' => $ entity -> stats [ 'message' ] . ( $ entity -> stats [ 'tries' ] + 1 ) . '. ' . $ message . PHP_EOL ] ] ; $ this... | Job did not complete save a few stats so we can see what went wrong . |
55,587 | private function cleanBatches ( $ userId ) { $ where = EBatch :: A_USER_REF . '=' . ( int ) $ userId ; $ result = $ this -> daoBatch -> delete ( $ where ) ; return $ result ; } | Remove all existing batches for currently logged in admin user . |
55,588 | private function createBatch ( $ userId ) { $ entity = new EBatch ( ) ; $ entity -> setUserRef ( $ userId ) ; $ result = $ this -> daoBatch -> create ( $ entity ) ; return $ result ; } | Register new batch for currently logged in admin user . |
55,589 | public function quarterback ( $ createCommand ) { $ data = ( array ) $ createCommand ; $ data = $ this -> sanitize ( $ data , $ this -> type ) ; if ( $ this -> validate ( $ data , $ this -> type ) != "passed" ) { return $ this -> prepareResponseArray ( 'validation_failed' , 500 , $ data , $ this -> validate ( $ data , ... | The form processing steps . |
55,590 | public function processTasks ( ) { foreach ( $ this -> tasks as $ task ) { $ callable = new $ task ( ) ; $ result = call_user_func ( $ callable , $ this -> route , $ this -> console , $ this -> params ) ; if ( 1 === $ result ) { return false ; } } return true ; } | Process command tasks |
55,591 | public function build ( array $ taskConfigurations ) { $ resolver = new OptionsResolver ( ) ; $ tasks = [ ] ; foreach ( $ taskConfigurations as $ taskName => $ taskConfiguration ) { $ resolver -> clear ( ) ; if ( $ this -> debug === true ) { $ taskConfiguration [ 'debug' ] = $ this -> debug ; } if ( ! $ this -> hasCopy... | Build and return an array of Task . |
55,592 | public function removeByIds ( array $ in = [ ] , array $ notIn = [ ] ) { if ( ! count ( $ in ) && ! count ( $ notIn ) ) { return ; } $ qb = $ this -> createQueryBuilder ( 'e' ) ; if ( $ this -> getClassMetadata ( ) -> hasField ( 'deletedAt' ) ) { $ qb -> update ( ) -> set ( 'e.deletedAt' , ':date' ) -> setParameter ( '... | Will remove entities based on the ids you input . |
55,593 | public function typeroomAction ( Request $ request ) { $ roomType = new RoomType ( ) ; $ form = $ this -> createForm ( "room_types" , $ roomType ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> persist ( $ roomType ) ; $ em -> flush ... | Homepage for type room listing and editing types |
55,594 | public function login ( & $ subject , $ token ) { global $ logger ; global $ app ; try { if ( $ app -> getConfiguration ( ) -> isPreventMultipleLogins ( ) ) { list ( $ authInfo , $ roles , $ tokens , $ hashedSessionId ) = $ this -> authenticate ( $ token , true ) ; $ app -> getSessionManager ( ) -> getActiveSession ( )... | login Logs in the subject . |
55,595 | private function _generateCSRFToken ( $ length = 32 ) { $ randUtils = new RandomUtils ( ) ; $ randToken = $ randUtils -> getBytes ( $ length , true ) ; return base64_encode ( $ randToken ) ; } | Generate CSRF Token of given length . |
55,596 | private function _logAnalytics ( $ app , $ subject ) { if ( $ app -> getConfiguration ( ) -> logAnalytics ( ) == true ) { $ clientIP = ( isset ( $ _SERVER [ 'HTTP_X_FORWARDED_FOR' ] ) && ! empty ( $ _SERVER [ 'HTTP_X_FORWARDED_FOR' ] ) ) ? $ _SERVER [ 'HTTP_X_FORWARDED_FOR' ] : $ _SERVER [ 'REMOTE_ADDR' ] ; $ analytics... | Log Analytics using the route logger |
55,597 | public function createSubject ( $ context ) { global $ logger ; $ subject = $ this -> doCreateSubject ( $ context ) ; $ this -> _save ( $ subject ) ; return $ subject ; } | createSubject Creating the subject using the given context . |
55,598 | public function onUserActivationPost ( UserActivationEvent $ e ) { $ password = $ e -> getParam ( 'password' ) ; $ email = $ e -> getParam ( 'to' ) ; $ siteUrl = $ e -> getParam ( 'siteurl' ) ; $ loginUri = $ this -> getModuleOptions ( ) -> getLoginUri ( ) ; if ( null === $ email || null === $ password ) { return ; } $... | User Activation mail |
55,599 | public function setDefaultValue ( $ value ) { if ( ! is_array ( $ value ) ) { throw new \ InvalidArgumentException ( $ this -> getPath ( ) . ': the default value of an array node has to be an array.' ) ; } $ this -> defaultValue = $ value ; } | Sets the default value of this node . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.