idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
2,600 | public function isDelimiter ( ) { for ( $ i = count ( $ this -> tokens ) - 1 ; $ i >= 0 ; $ i -- ) { $ t = $ this -> tokens [ $ i ] ; if ( $ t [ 0 ] === null || $ t [ 0 ] === 'COMMENT' ) { continue ; } elseif ( $ t [ 0 ] === 'OPENER' || $ t [ 0 ] === 'OPERATOR' ) { return true ; } elseif ( $ t [ 0 ] === 'IDENT' ) { swi... | by looking behind in the token stream . |
2,601 | public function heredocRealOverride ( $ matches ) { $ this -> record ( $ matches [ 0 ] , null ) ; $ this -> posShift ( strlen ( $ matches [ 0 ] ) ) ; $ this -> removePattern ( 'HEREDOC_NL' ) ; assert ( $ this -> heredoc !== null ) ; $ delim = preg_quote ( $ this -> heredoc ) ; $ substr = $ this -> scanUntil ( '/^' . $ ... | this override handles the actual heredoc text |
2,602 | public function podCutOverride ( $ matches ) { $ line = $ this -> scan ( '/^=.*/m' ) ; assert ( $ line !== null ) ; $ term = '/^=cut$|\\z/m' ; $ substr = $ this -> scanUntil ( $ term ) ; assert ( $ substr !== null ) ; $ end = $ this -> scan ( $ term ) ; assert ( $ end !== null ) ; $ this -> record ( $ line . $ substr .... | we do it the old fashioned way |
2,603 | protected function generateI18n ( $ name , $ locale , $ parameters , $ referenceType = self :: ABSOLUTE_PATH ) { try { return $ this -> generator -> generate ( $ this -> routeNameInflector -> inflect ( $ name , $ locale ) , $ parameters , $ referenceType ) ; } catch ( RouteNotFoundException $ e ) { throw new RouteNotFo... | Generates a I18N URL from the given parameter |
2,604 | protected function getLocale ( $ parameters ) { if ( isset ( $ parameters [ 'locale' ] ) ) { return $ parameters [ 'locale' ] ; } if ( $ this -> getContext ( ) -> hasParameter ( '_locale' ) ) { return $ this -> getContext ( ) -> getParameter ( '_locale' ) ; } return $ this -> defaultLocale ; } | Determine the locale to be used with this request |
2,605 | public function parseJson ( $ json ) { $ this -> id = $ json [ 'id' ] ; $ this -> name = $ json [ 'name' ] ; $ this -> links = $ json [ 'links' ] ; if ( isset ( $ json [ 'xmpp_jid' ] ) ) { $ this -> xmppJid = $ json [ 'xmpp_jid' ] ; $ this -> created = new \ DateTime ( $ json [ 'created' ] ) ; $ this -> archived = $ js... | Parses response given by the API and maps the fields to Room object |
2,606 | public function toJson ( ) { $ json = array ( ) ; $ json [ 'name' ] = $ this -> getName ( ) ; $ json [ 'privacy' ] = $ this -> getPrivacy ( ) ; if ( $ this -> getId ( ) ) { $ json [ 'is_archived' ] = $ this -> isArchived ( ) ; $ json [ 'is_guest_accessible' ] = $ this -> isGuestAccessible ( ) ; $ json [ 'topic' ] = $ t... | Serializes Room object |
2,607 | public function run ( ) { try { $ vulnerabilities = $ this -> checker -> check_site ( $ this -> options -> ignored_packages ) ; do_action ( 'soter_site_check_complete' , $ vulnerabilities ) ; $ this -> options -> get_store ( ) -> set ( 'last_scan_hash' , $ vulnerabilities -> hash ( ) ) ; } catch ( \ RuntimeException $ ... | Run the site check . |
2,608 | public function render_html_error_email ( $ exception , CssToInlineStyles $ inliner = null ) { $ plates = _soter_instance ( 'plates' ) ; $ html = $ plates -> render ( 'emails/html/error.php' , [ 'message' => $ exception -> getMessage ( ) , ] ) ; $ css = $ plates -> render ( 'emails/style.css' ) ; $ inliner = $ inliner ... | Render the contents of the HTML error notification . |
2,609 | protected function rebuildFiles ( Array $ files ) { DependencyInjector :: getInstance ( ) -> generateDependenciesDeclaration ( ) ; $ this -> setLayout ( 'manager/templates.tpl' ) ; $ output = array ( ) ; $ instance_inheritance = array_unique ( \ Sifo \ Domains :: getInstance ( ) -> getInstanceInheritance ( ) ) ; $ inst... | Writes all the configurattion files to disk . |
2,610 | public function setArguments ( $ name , $ required = false , $ description = 'Argument description' ) { $ required ? $ required = InputArgument :: REQUIRED : $ required = InputArgument :: OPTIONAL ; $ this -> addArgument ( $ name , $ required , $ description ) ; } | Add argument to a command . |
2,611 | public function setOption ( $ name , $ shortcut = null , $ inputRequired = false , $ description = 'option does what?' ) { $ inputRequired ? $ inputRequired = InputOption :: VALUE_REQUIRED : $ inputRequired = InputOption :: VALUE_OPTIONAL ; $ this -> addOption ( $ name , $ shortcut , $ inputRequired , $ description ) ;... | Add options to command . |
2,612 | public function offsetSet ( $ name , $ value ) { $ cookie = $ this -> _classes [ 'cookie' ] ; $ value = $ this -> _autobox ( $ name , $ value ) ; if ( ! $ value instanceof $ cookie ) { throw new RuntimeException ( "Error, only `{$cookie}` instances are allowed in this collection." ) ; } $ hash = $ name . ';' . $ value ... | Adds a cookie to the collection . |
2,613 | public function offsetGet ( $ name ) { $ data = [ ] ; if ( ! isset ( $ this -> _hashes [ $ name ] ) ) { throw new RuntimeException ( "Unexisting Set-Cookie `'{$name}'`." ) ; } foreach ( $ this -> _hashes [ $ name ] as $ key => $ hash ) { $ data [ ] = $ this -> _data [ $ hash ] ; } return $ data ; } | Gets a set - cookie . |
2,614 | public function offsetUnset ( $ name ) { if ( ! isset ( $ this -> _hashes [ $ name ] ) ) { return ; } foreach ( $ this -> _hashes [ $ name ] as $ hash ) { unset ( $ this -> _data [ $ hash ] ) ; unset ( $ this -> _names [ $ hash ] ) ; } unset ( $ this -> _hashes [ $ name ] ) ; } | Removes all set - cookies of a specific name . |
2,615 | protected function _autobox ( $ name , $ value ) { if ( is_object ( $ value ) ) { return $ value ; } $ cookie = $ this -> _classes [ 'cookie' ] ; if ( ! is_array ( $ value ) ) { $ value = [ 'value' => $ value ] ; } $ value [ 'name' ] = $ name ; return new $ cookie ( $ value ) ; } | Autoboxes a cookie value . |
2,616 | public function flushExpired ( ) { foreach ( $ this -> _hashes as $ name => $ hashes ) { foreach ( $ hashes as $ key => $ hash ) { $ cookie = $ this -> _data [ $ hash ] ; if ( $ cookie -> expired ( ) ) { unset ( $ this -> _data [ $ hash ] ) ; unset ( $ this -> _names [ $ hash ] ) ; unset ( $ this -> _hashes [ $ name ] ... | Removes expired cookies . |
2,617 | public function clear ( $ domain = null , $ path = null , $ name = null ) { if ( ! $ domain ) { $ this -> _data = [ ] ; return ; } elseif ( ! $ path ) { $ this -> _data = array_filter ( $ this -> _data , function ( $ cookie ) use ( $ path , $ domain ) { return ! $ cookie -> matchesDomain ( $ domain ) ; } ) ; } elseif (... | Remove some cookies from the Jar . |
2,618 | public function clearSessionCookies ( ) { $ this -> _data = array_filter ( $ this -> _data , function ( $ cookie ) { return ! $ cookie -> discard ( ) && $ cookie -> expires ( ) ; } ) ; return $ this ; } | Clear session based cookies . |
2,619 | public function fetchCookies ( $ request , $ response ) { foreach ( $ response -> cookies ( $ request ) as $ cookie ) { $ this -> add ( $ cookie ) ; } return $ this ; } | Collect the Set - Cookie header from a response . |
2,620 | public static function toArray ( $ cookies , $ options = [ ] ) { $ data = [ ] ; foreach ( $ cookies as $ name => $ cookie ) { $ data [ $ name ] [ ] = $ cookie -> data ( ) ; } return $ data ; } | Exports set - cookies . |
2,621 | public static function toResource ( $ obj , $ transformer ) : ResourceAbstract { if ( ! $ obj ) return new NullResource ( ) ; $ resource = null ; try { if ( is_array ( $ obj ) ) { $ resource = new Collection ( $ obj , new $ transformer ( ) , get_class ( $ obj [ 0 ] ) ) ; } else { $ resource = new Item ( $ obj , new $ t... | Transform the given object or array with the given transformer to a Resource . |
2,622 | protected function setNextNumPage ( ) { $ this -> next_num_page = 0 ; if ( $ this -> current_page_number < $ this -> num_pages ) { $ this -> next_num_page = ( $ this -> current_page_number + 1 ) ; } } | Set next page number . |
2,623 | public function setItemsPerPage ( $ items_per_page ) { if ( ! is_int ( $ items_per_page ) ) { trigger_error ( 'Pagination setItemsPerPage: Items per page must be an integer.' ) ; return false ; } if ( $ items_per_page <= 0 ) { trigger_error ( 'Pagination setItemsPerPage: Items per page must be a positive integer.' ) ; ... | Set number of items per page . |
2,624 | public function setMaxPages ( $ max_num_pages ) { if ( ! is_int ( $ max_num_pages ) ) { trigger_error ( 'Pagination setMaxPages: Maxim number of pages must be an integer.' ) ; return false ; } if ( $ max_num_pages <= 0 ) { trigger_error ( 'Pagination setMaxPages: Maxim number of pages must be a positive integer.' ) ;... | Set maxim number of pages to show . |
2,625 | public function setNumTotalResults ( $ total ) { $ total = ( int ) $ total ; if ( $ total < 0 ) { trigger_error ( 'Pagination setNumTotalResults: Total must be positive.' ) ; return false ; } $ this -> items_total = $ total ; } | Set the total number of items . |
2,626 | public function setTemplateParam ( $ param , $ value ) { if ( ! isset ( $ param ) || empty ( $ param ) || ! isset ( $ value ) ) { trigger_error ( "The parameter \$param or \$value can't be empty." ) ; return false ; } $ this -> params_template [ $ param ] = $ value ; } | Set a parameter assigned to the pagination template . |
2,627 | public function setTemplate ( $ layout_template ) { $ tpl_config = $ this -> config -> getConfig ( 'templates' ) ; if ( ! isset ( $ tpl_config [ $ layout_template ] ) ) { trigger_error ( "Template file '$layout_template' not found." ) ; return false ; } $ this -> layout_template = ROOT_PATH . '/' . $ tpl_config [ $ lay... | Set the pagination template . |
2,628 | public function setDisplayItemsPerPage ( $ values_to_show ) { $ this -> display_items_per_page [ 'display' ] = false ; if ( ! empty ( $ values_to_show ) && is_array ( $ values_to_show ) ) { $ result = array_filter ( $ values_to_show , "is_integer" ) ; $ this -> display_items_per_page [ 'display' ] = true ; $ this -> di... | Set display items per page . |
2,629 | public function sign ( string $ data , string $ secret ) : string { return base64_encode ( hash_hmac ( 'md5' , $ data , $ secret , true ) ) ; } | Sign current datas |
2,630 | protected function getFinalSchemas ( KernelInterface $ kernel , BundleInterface $ bundle = null ) { if ( null !== $ bundle ) { return $ this -> getSchemasFromBundle ( $ bundle ) ; } $ finalSchemas = array ( ) ; foreach ( $ kernel -> getBundles ( ) as $ bundle ) { $ finalSchemas = array_merge ( $ finalSchemas , $ this -... | Return a list of final schema files that will be processed . |
2,631 | public function logIn ( array $ user_infos ) : void { $ _SESSION [ 'phunder' ] [ 'user' ] [ 'logged_in' ] = true ; $ this -> infos = array_merge ( $ this -> infos , $ user_infos ) ; $ this -> save ( ) ; } | Declare the current user as logged in |
2,632 | public function setModule ( $ namespace ) { $ nsParts = explode ( '\\' , $ namespace ) ; $ moduleClass = $ nsParts [ 0 ] . '\Module' ; if ( ! class_exists ( $ moduleClass , true ) ) { throw new InvalidArgumentException ( sprintf ( "The Module class was not found in the '%s' namespace." , $ namespace ) ) ; } $ module = ... | Allows you to change the module . The root directory of the module is calculated as the directory that contains the file of the Module class . |
2,633 | public function module ( $ path = '' , $ checkIfExists = false ) { $ moduleDir = $ this -> moduleDir ; if ( $ checkIfExists ) { return realpath ( $ moduleDir . DS . $ path ) ; } if ( empty ( $ path ) ) { return $ moduleDir ; } return $ moduleDir . DS . $ this -> normalizePath ( $ path ) ; } | Returns the path to the root directory of the module or any child path . |
2,634 | public function app ( $ path = '' , $ checkIfExists = false ) { $ appDir = getcwd ( ) ; if ( $ checkIfExists ) { return realpath ( $ appDir . DS . $ path ) ; } if ( empty ( $ path ) ) { return $ appDir ; } return $ appDir . DS . $ this -> normalizePath ( $ path ) ; } | Returns the path to the root directory of the appliacation or any child path . |
2,635 | public function appAutoload ( $ path = '' , $ checkIfExists = false ) { $ appAutoloadDir = getcwd ( ) . $ this -> getRelativeAppAutoloadDir ( ) ; if ( $ checkIfExists ) { return realpath ( $ appAutoloadDir . DS . $ path ) ; } if ( empty ( $ path ) ) { return $ appAutoloadDir ; } return $ appAutoloadDir . DS . $ this ->... | Returns the path to the application autoload directory or any child path . |
2,636 | public function appPublic ( $ path = '' , $ checkIfExists = false ) { $ appPublicDir = getcwd ( ) . $ this -> getRelativeAppPublicDir ( ) ; if ( $ checkIfExists ) { return realpath ( $ appPublicDir . DS . $ path ) ; } if ( empty ( $ path ) ) { return $ appPublicDir ; } return $ appPublicDir . DS . $ this -> normalizePa... | Returns the path to the application public directory or any child path . |
2,637 | public function appUploads ( $ path = '' , $ checkIfExists = false ) { $ appUploadsDir = getcwd ( ) . $ this -> getRelativeAppUploadsDir ( ) ; if ( $ checkIfExists ) { return realpath ( $ appUploadsDir . DS . $ path ) ; } if ( empty ( $ path ) ) { return $ appUploadsDir ; } return $ appUploadsDir . DS . $ this -> norma... | Returns the path to the upload directory or any child path . |
2,638 | public static function fromFilename ( $ filename ) { $ contents = file_get_contents ( $ filename ) ; $ jsonData = json_decode ( $ contents , true ) ; $ instance = new self ( $ jsonData ) ; return $ instance ; } | Construct from filename |
2,639 | public static function fromUrl ( $ url ) { $ client = new GuzzleHttp \ Client ( ) ; $ response = $ client -> get ( $ url ) ; $ jsonData = json_decode ( $ response -> getBody ( ) , true ) ; $ instance = new self ( $ jsonData ) ; return $ instance ; } | Construct from URL |
2,640 | public function register ( \ Closure $ runner , $ options = array ( ) ) { $ this -> runner = $ runner ; $ this -> options = $ options ; return $ this ; } | Register the runner and options for delay run |
2,641 | public function send ( $ msg ) { if ( $ this -> queue && is_resource ( $ this -> queue ) && msg_stat_queue ( $ this -> queue ) ) { return msg_send ( $ this -> queue , 1 , array ( 'from' => $ this -> isMaster ( ) ? $ this -> ppid : $ this -> pid , 'to' => $ this -> isMaster ( ) ? $ this -> pid : $ this -> ppid , 'body' ... | Send msg to child process |
2,642 | private function getStartingRow ( $ sheet ) : int { $ row = null ; for ( $ i = 1 ; $ i <= 4 && ! $ row ; $ i ++ ) { if ( $ sheet -> getCellByColumnAndRow ( 1 , $ i ) == "Cod." ) { $ row = $ i + 1 ; } } return $ row ; } | Returns the spreadsheet row number for which the extractor should start extracting row data . |
2,643 | protected function getNodeString ( Filter $ node , Compiler $ compiler = null ) { return array_reduce ( $ node -> block -> nodes , function ( & $ result , $ line ) use ( $ compiler ) { $ val = $ compiler ? $ compiler -> interpolate ( $ line -> value ) : $ line -> value ; return $ result .= $ val . "\n" ; } ) ; } | Returns the node string value line by line . If the compiler is present that means we need to interpolate line contents |
2,644 | public function createSend ( $ sender = '' , $ messages = array ( ) , $ scheduledate = '' ) { $ message_sender = array ( ) ; $ index = 0 ; $ url = $ this -> _setEnvironment . 'wcf/Service.svc/rest/CreateSend' ; if ( is_array ( $ messages ) ) { foreach ( $ messages as $ mobile => $ message ) { $ message_sender [ $ index... | This operation allows you to send 1 or more messages in a single call . |
2,645 | public function createMessage ( $ sender = '' , $ mobile = '' , $ message = '' , $ scheduledate = '' ) { $ url = $ this -> _setEnvironment . 'wcf/Service.svc/rest/CreateMessage' ; $ json = array ( 'UserName' => $ this -> user , 'Password' => $ this -> password , 'Sender' => $ sender , 'Mobile' => $ mobile , 'Text' => $... | This operation allows you to send 1 message on a single call . |
2,646 | protected function statusCodeHandling ( $ e ) { $ response = ( object ) array ( "Status" => $ e -> getResponse ( ) -> getStatusCode ( ) , "Error" => json_decode ( $ e -> getResponse ( ) -> getBody ( true ) -> getContents ( ) ) ) ; return $ response ; } | Return message error |
2,647 | public function queue ( ) { $ log = $ this -> getLogger ( ) ; $ log -> info ( 'Queueing operation started' , array ( 'collections' => count ( $ this ) ) ) ; $ event = new CollectorEvent ( $ this ) ; $ this -> dispatchEvent ( SearchEvents :: COLLECTOR_PRE_QUEUE , $ event ) ; $ num_queued = 0 ; foreach ( $ this -> _colle... | Queues the items scheduled for indexing for all collections attached to the collector . |
2,648 | public function queueCollection ( CollectionAbstract $ collection ) { $ log = $ this -> getLogger ( ) ; $ context = array ( 'collection' => $ collection -> getId ( ) ) ; $ log -> info ( 'Begin fetching items that are scheduled for indexing' , $ context ) ; $ event = new CollectionEvent ( $ this , $ collection ) ; $ thi... | Queues the items scheduled for indexing for the collection . |
2,649 | public static function getConstructArguments ( $ objectClasses , $ annotationReader ) { $ constructArguments = null ; array_reverse ( $ objectClasses ) ; foreach ( $ objectClasses as $ class ) { $ annotation = $ annotationReader -> getClassAnnotation ( $ class , self :: $ constructAnnotationClass ) ; if ( $ annotation ... | Get the list of needed arguments for given object s constructor . |
2,650 | public static function getPropertiesToInitialize ( $ properties , $ annotationReader ) { $ propertiesValues = array ( ) ; foreach ( $ properties as $ propertyName => $ property ) { $ initializeAnnotation = $ annotationReader -> getPropertyAnnotation ( $ property , self :: $ initializeAnnotationClass ) ; $ initializeObj... | Get the list of properties that have to be initialized automatically during the object construction plus their value . |
2,651 | public function addSinglePattern ( $ pattern , $ ruleName , $ childRuleName ) { return $ this -> addPattern ( $ pattern , $ ruleName , self :: SINGLE_RULE_PREFIX . $ childRuleName ) ; } | Add single pattern . If pattern match change to provided rule and immediately back |
2,652 | protected function addPattern ( $ pattern , $ ruleName , $ childRuleName = null ) { if ( ! isset ( $ this -> patterns [ $ ruleName ] ) ) { $ this -> patterns [ $ ruleName ] = new LexerPattern ( $ ruleName ) ; } $ this -> patterns [ $ ruleName ] -> addPattern ( $ pattern , $ childRuleName ) ; return $ this ; } | Add pattern to rule patterns |
2,653 | protected function reduce ( & $ text ) { if ( ! array_key_exists ( $ this -> stack -> top ( ) , $ this -> patterns ) ) { return false ; } if ( $ text !== '' && ( $ data = $ this -> patterns [ $ this -> stack -> top ( ) ] -> split ( $ text ) ) !== false ) { list ( $ unmatched , $ matched , $ text , $ childRuleName ) = $... | Reduce input text length by patterns match |
2,654 | public static function getAccessProperties ( $ properties , $ annotationReader ) { $ objectAccessProperties = array ( ) ; foreach ( $ properties as $ propertyName => $ property ) { if ( empty ( $ objectAccessProperties [ $ propertyName ] ) ) { $ objectAccessProperties [ $ propertyName ] = array ( ) ; } $ propertyAccess... | Get a list of properties and the access that are given to them for given object . |
2,655 | public static function get ( ) { $ widgets = [ ] ; foreach ( Packages :: all ( ) as $ package ) { $ dir = __DIR__ . '/../../' . $ package . '/src' ; $ files = is_dir ( $ dir ) ? scandir ( $ dir ) : [ ] ; foreach ( $ files as $ file ) { if ( $ file == 'Widgets.json' ) { $ file_r = file_get_contents ( $ dir . '/' . $ fil... | Returns all the widgets . |
2,656 | public static function orderByPreference ( $ widgets ) { $ preference = collect ( [ 'laralum' , 'dashboard' , 'users' , 'roles' , 'permissions' ] ) ; $ ordered_widgets = [ ] ; $ final_ordered_widgets = [ ] ; $ widgets = collect ( $ widgets ) -> groupBy ( 'package' ) -> toArray ( ) ; foreach ( Packages :: all ( ) as $ p... | Order the widgets by preference . |
2,657 | private function getQualityFactor ( ) { $ qFactor = 0.0 ; if ( 2 === count ( explode ( '/' , $ this -> variant ) ) ) { $ qFactor = $ this -> qFactor ; } return $ qFactor ; } | Get the variants s quality factor defaulting to 0 on absent variant . |
2,658 | public function setLabelAttributes ( array $ attribs ) { foreach ( $ attribs as $ a => $ v ) { $ this -> setLabelAttribute ( $ a , $ v ) ; } return $ this ; } | Set the attributes of the label of the form element object |
2,659 | public function setHintAttributes ( array $ attribs ) { foreach ( $ attribs as $ a => $ v ) { $ this -> setHintAttribute ( $ a , $ v ) ; } return $ this ; } | Set the attributes of the hint of the form element object |
2,660 | public function addValidator ( $ validator ) { if ( ! ( $ validator instanceof \ Pop \ Validator \ AbstractValidator ) && ! is_callable ( $ validator ) ) { throw new Exception ( 'Error: The validator must be an instance of Pop\Validator\AbstractValidator or a callable object.' ) ; } $ this -> validators [ ] = $ validat... | Add a validator the form element |
2,661 | public static function fromJson ( string $ name , bool $ endsWithSession , DateTimeImmutable $ issuedAt , string $ json ) : self { $ cookie = new self ( $ name , $ endsWithSession , $ issuedAt ) ; $ cookie -> data = json_decode ( $ json , true ) ; if ( ! is_array ( $ cookie -> data ) ) { throw JsonException :: fromJson... | Creates a new cookie instance from JSON encoded data . |
2,662 | public function toJson ( ) : string { $ json = json_encode ( $ this -> data ) ; if ( false === $ json ) { throw JsonException :: fromJsonEncodeError ( json_last_error_msg ( ) ) ; } return $ json ; } | Serializes the cookie data as JSON . |
2,663 | public function boot ( Container $ container ) { add_action ( 'admin_init' , [ $ this -> proxy ( $ container , 'options_page' ) , 'admin_init' ] ) ; add_action ( 'admin_menu' , [ $ this -> proxy ( $ container , 'options_page' ) , 'admin_menu' ] ) ; add_action ( 'admin_notices' , [ $ this -> proxy ( $ container , 'optio... | Provider - specific boot logic . |
2,664 | public function register ( Container $ container ) { $ container [ 'check_site_job' ] = function ( Container $ c ) { return new Check_Site_Job ( $ c [ 'checker' ] , $ c [ 'options_manager' ] ) ; } ; $ container [ 'checker' ] = function ( Container $ c ) { $ checker = new Checker ( new Api_Client ( $ c [ 'http' ] ) , ne... | Provider - specific registration logic . |
2,665 | protected function boot_upgrader ( Container $ container ) { if ( ! $ this -> doing_cron ( ) && ! is_admin ( ) ) { return ; } $ upgrader = new Upgrader ( $ container [ 'options_manager' ] ) ; add_action ( 'init' , [ $ upgrader , 'perform_upgrade' ] ) ; } | Boots the upgrader object on cron or admin requests . |
2,666 | public function push ( $ headers , $ value = '' ) { if ( is_string ( $ headers ) && func_num_args ( ) === 2 ) { $ headers = [ $ headers => $ value ] ; } return $ this -> _set ( $ headers ) ; } | Sets some headers . |
2,667 | public function prepend ( $ headers , $ value = '' ) { if ( is_string ( $ headers ) && func_num_args ( ) === 2 ) { $ headers = [ $ headers => $ value ] ; } return $ this -> _set ( $ headers , true ) ; } | Prepends some headers . |
2,668 | public function offsetExists ( $ name ) { $ name = strtolower ( $ name ) ; if ( ! array_key_exists ( $ name , $ this -> _data ) ) { return false ; } return ! empty ( $ this -> _data [ $ name ] -> value ( ) ) ; } | Checks whether or not an header exists . |
2,669 | public function offsetGet ( $ name ) { if ( ! isset ( $ this -> _data [ strtolower ( $ name ) ] ) ) { $ header = $ this -> _classes [ 'header' ] ; return $ this -> _data [ strtolower ( $ name ) ] = new $ header ( $ name , '' ) ; } return $ this -> _data [ strtolower ( $ name ) ] ; } | Returns the value of a specific header . |
2,670 | protected function _set ( $ values , $ prepend = false ) { $ header = $ this -> _classes [ 'header' ] ; $ headers = is_string ( $ values ) ? explode ( "\n" , $ values ) : $ values ; $ headers = $ headers ? $ headers : [ ] ; foreach ( $ headers as $ key => $ value ) { if ( ! is_numeric ( $ key ) ) { if ( $ value instanc... | Sets one or some plain string headers . |
2,671 | public function valid ( ) { if ( key ( $ this -> _data ) === null ) { return false ; } $ current = current ( $ this -> _data ) ; while ( ! $ current -> value ( ) ) { $ current = $ this -> next ( ) ; if ( key ( $ this -> _data ) === null ) { return false ; } } return true ; } | Returns the current item . |
2,672 | public static function toArray ( $ headers , $ options = [ ] ) { $ data = [ ] ; foreach ( $ headers as $ name => $ header ) { if ( strtolower ( $ name ) === 'set-cookie' ) { foreach ( $ header -> data ( ) as $ value ) { $ data [ ] = $ name . ': ' . $ value ; } } else { $ data [ ] = $ name . ': ' . $ header -> value ( )... | Gets the headers as an array . |
2,673 | public function handle ( ) : array { $ this -> firstRun = true ; $ this -> output -> writeln ( '<info>' . $ this -> question -> getMessage ( ) . '</info> [<comment>SPACE=select</>, <comment>ENTER=submit</>]' ) ; $ this -> repaint ( ) ; $ sttyMode = shell_exec ( 'stty -g' ) ; shell_exec ( 'stty -icanon -echo' ) ; while ... | Navigates through option items . |
2,674 | public static function get_microtime ( ) { list ( $ tps_usec , $ tps_sec ) = explode ( ' ' , microtime ( ) ) ; return ( float ) $ tps_usec + ( float ) $ tps_sec ; } | Return current microtime . |
2,675 | public static function isFrenchHoliday ( $ unixTimeStamp = null ) { $ date = strtotime ( date ( 'm/d/Y' , $ unixTimeStamp == null ? time ( ) : $ unixTimeStamp ) ) ; $ year = date ( 'Y' , $ date ) ; $ holidays = Cache :: getHandler ( 'quick' ) -> get ( 'holiday' . $ year ) ; if ( $ holidays == null ) { $ easterDate = ea... | Return french holiday |
2,676 | public function getHTMLFormatted ( $ config , $ errors = null ) { $ ret = array ( ) ; $ this -> generator = new HTMLPurifier_Generator ( $ config , $ this -> context ) ; if ( $ errors === null ) $ errors = $ this -> errors ; foreach ( $ this -> lines as $ line => $ col_array ) { if ( $ line == - 1 ) continue ; foreach ... | Default HTML formatting implementation for error messages |
2,677 | public static function load ( $ id , $ subId = null ) : CacheEntryInterface { $ storageId = $ id ; if ( $ subId ) { $ storageId .= '[' . $ subId . ']' ; } if ( ! isset ( self :: $ files [ $ storageId ] ) ) { $ filename = static :: CACHE_DIR . ( $ subId ? $ subId . '/' : null ) . urlencode ( $ id ) . '.' . static :: CAC... | Gets the cache file from the filesystem |
2,678 | public function build ( array $ options ) { if ( isset ( $ options [ 'fields' ] ) ) { if ( ! is_array ( $ options [ 'fields' ] ) ) { $ message = 'Argument 1 passed to ' . __METHOD__ . ' must be an array.' ; throw new \ InvalidArgumentException ( $ message ) ; } foreach ( $ options [ 'fields' ] as $ id => $ field_option... | Builds the schema from an array of options . |
2,679 | public function attachField ( SchemaField $ field ) { $ id = $ field -> getId ( ) ; $ name = $ field -> getName ( ) ; $ this -> _fields [ $ id ] = $ field ; $ this -> _fieldNameMap [ $ name ] = $ id ; return $ this ; } | Associates a field with this schema . |
2,680 | public function getField ( $ id ) { if ( ! isset ( $ this -> _fields [ $ id ] ) ) { $ message = 'Field "' . $ id . '" not associated with this schema.' ; throw new \ InvalidArgumentException ( $ message ) ; } return $ this -> _fields [ $ id ] ; } | Returns a field by its unique identifier . |
2,681 | public function getFieldByName ( $ name ) { if ( ! isset ( $ this -> _fieldNameMap [ $ name ] ) ) { $ message = 'Field name "' . $ name . '" not associated to this schema.' ; throw new \ InvalidArgumentException ( $ message ) ; } return $ this -> getField ( $ this -> _fieldNameMap [ $ name ] ) ; } | Returns a field by its name as stored in the index . |
2,682 | public function removeField ( $ id ) { if ( isset ( $ this -> _fields [ $ id ] ) ) { $ name = $ this -> _fields [ $ id ] -> getName ( ) ; unset ( $ this -> _fields [ $ id ] , $ this -> _fieldNameMap [ $ name ] ) ; } return $ this ; } | De - references a field from the schema . |
2,683 | public function toArray ( ) { $ schema_options = array ( 'unique_field' => $ this -> _uniqueField , 'fields' => array ( ) , ) ; foreach ( $ this -> _fields as $ id => $ field ) { $ schema_options [ 'fields' ] [ $ id ] = $ field -> toArray ( ) ; } return $ schema_options ; } | Returns the array of schema options . |
2,684 | private function getMethodCallInfo ( $ name ) { $ extractedMethod = preg_match ( "/^(set|get|is|add|remove)([A-Z].*)/" , $ name , $ pregMatches ) ; if ( $ extractedMethod ) { $ method = $ pregMatches [ 1 ] ; $ property = lcfirst ( $ pregMatches [ 2 ] ) ; } else { $ method = 'call' ; $ property = $ name ; } $ collection... | Extract the info about the method called . |
2,685 | public function getPath ( string ... $ dirs ) : string { if ( empty ( $ dirs ) ) { return $ this -> path ; } return self :: canonicalize ( $ this -> path , ... $ dirs ) ; } | Returns the absolute path of the app . |
2,686 | public function getAuth ( $ oauth_token ) { try { $ this -> setToken ( $ oauth_token ) ; $ token = $ this -> getAccessToken ( ) ; $ this -> setToken ( $ token -> oauth_token , $ token -> oauth_token_secret ) ; return array ( 'oauth_token' => $ token -> oauth_token , 'oauth_token_secret' => $ token -> oauth_token_secret... | Returns the authentication token and secret . |
2,687 | public function upload ( $ context , $ file , $ extension , FilesystemAdapter $ filesystemAdapter , $ fileName ) { $ fileName = $ this -> fileManager -> setFileSystemAdapter ( $ filesystemAdapter ) -> uploadFile ( $ file , $ extension , $ context , null , $ fileName ) ; $ this -> processSizes ( $ file , $ fileName , $ ... | Handles image upload |
2,688 | public function rebuild ( $ fileName , $ context , FilesystemAdapter $ filesystemAdapter ) { $ originalImage = $ filesystemAdapter -> get ( '/' . $ context . '/' . $ fileName ) ; $ originalImage = $ this -> openImageHandler -> loadImage ( $ originalImage ) ; $ extension = $ this -> findExtension ( $ fileName ) ; $ this... | Rebuilds image sizes |
2,689 | public function rename ( $ oldFileName , $ newFileName , $ context , FilesystemAdapter $ filesystemAdapter ) { if ( $ filesystemAdapter -> exists ( $ context . '/' . $ newFileName ) ) { throw new IcrRuntimeException ( "File with name {$newFileName} already exists!" ) ; } $ image = $ filesystemAdapter -> get ( $ context... | Renames existing file |
2,690 | public function node_load ( $ nid = null , $ vid = null , $ reset = false ) { return node_load ( $ nid , $ vid , $ reset ) ; } | Load a node object from the database . |
2,691 | public function node_save ( & $ node ) { try { node_save ( $ node ) ; } catch ( \ Exception $ e ) { throw new NodeException ( sprintf ( NodeException :: FailedToSaveNodeText , $ node -> nid ) , NodeException :: FailedToSaveNode , $ e -> getCode ( ) , $ e ) ; } } | Save changes to a node or add a new node . |
2,692 | function size ( $ min = null , $ max = null ) { $ size = [ ] ; if ( $ min ) $ size [ 'min' ] = $ min ; if ( $ max ) $ size [ 'max' ] = $ max ; if ( count ( $ size ) ) $ this -> data [ 'size' ] = $ size ; return $ this ; } | Validates that the size of a text object or array is within a range . |
2,693 | function regexp ( $ pattern , $ flags = null ) { $ regexp [ 'pattern' ] = $ pattern ; if ( $ flags ) $ regexp [ 'flags' ] = $ flags ; $ this -> data [ 'regexp' ] = $ regexp ; return $ this ; } | Validates that the value of a field matches a Regular Expression . |
2,694 | function dateRange ( $ min = null , $ max = null ) { $ range = [ ] ; if ( $ min ) $ range [ 'min' ] = $ min ; if ( $ max ) $ range [ 'max' ] = $ max ; if ( count ( $ range ) ) $ this -> data [ 'dateRange' ] = $ range ; return $ this ; } | Validates that the value of a field is within a date range . It s defined specifying the min and max values of that range . |
2,695 | function assetFileSize ( $ min = null , $ max = null ) { $ range = [ ] ; if ( $ min ) $ range [ 'min' ] = $ min ; if ( $ max ) $ range [ 'max' ] = $ max ; if ( count ( $ range ) ) $ this -> data [ 'assetFileSize' ] = $ range ; return $ this ; } | Validates that the size of an asset is within a range . It s defined specifying the min and max values of that range . min and max are inclusive . |
2,696 | function assetImageDimensions ( $ height = null , $ width = null ) { $ imageDimensions = [ ] ; if ( $ height ) $ imageDimensions [ 'height' ] = $ height ; if ( $ width ) $ imageDimensions [ 'width' ] = $ width ; if ( count ( $ imageDimensions ) ) $ this -> data [ 'assetImageDimensions' ] = $ imageDimensions ; return $ ... | Validates that the dimensions of an image are within a range . |
2,697 | public function getGroup ( Communicator $ communicator ) : ProcessedGroup { $ groupJSON = $ communicator -> get ( 'api/groups/' . $ this -> groupID ) ; $ group = RecipientFactory :: createProcessedGroupFromJSON ( $ groupJSON ) ; return $ group ; } | Returns the Group this membership is referenced to . |
2,698 | public function getContact ( Communicator $ communicator ) : ProcessedContact { $ contactJSON = $ communicator -> get ( 'api/groups/' . $ this -> contactID ) ; $ contact = RecipientFactory :: createProcessedGroupFromJSON ( $ contactJSON ) ; return $ contact ; } | Returns the Contact this membership is referenced to . |
2,699 | public function getGroups ( Communicator $ communicator = null ) : ClassValidationArray { if ( $ communicator !== null ) { $ groupsJSON = $ communicator -> get ( 'api/contacts/' . $ this -> contactID . '/groups' ) ; $ groupStd = json_decode ( $ groupsJSON ) ; $ groups = RecipientFactory :: createProcessedGroupsFromStdC... | Returns an array of all the Groups the group is referenced in . If a communicator is not provided it will not fetch memberships from the API but return those that has been fetched if any . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.