idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
233,500 | public function addInstance ( Curl $ curlInstance , $ name = null ) { if ( $ name ) { $ this -> curlInstances [ $ name ] = $ curlInstance ; } else { $ this -> curlInstances [ ] = $ curlInstance ; } end ( $ this -> curlInstances ) ; return key ( $ this -> curlInstances ) ; } | Add a Curl instance to this Curl Multi instance |
233,501 | public function setOpt ( $ option , $ value ) { foreach ( $ this -> curlInstances as $ instance ) { $ instance -> setOpt ( $ option , $ value ) ; } } | Set the given cURL option for all previously added cURL instances . |
233,502 | private function subExec ( $ instances , $ retryCount = 0 , $ retryWait = 0 ) { $ curlMultiInstance = curl_multi_init ( ) ; foreach ( $ instances as $ name => $ curlInstance ) { curl_multi_add_handle ( $ curlMultiInstance , $ curlInstance -> getHandle ( ) ) ; } do { curl_multi_exec ( $ curlMultiInstance , $ stillRunnin... | Execute the requests of all given Curl instances |
233,503 | public function exec ( $ maxRequests = null , $ retryCount = 0 , $ retryWait = 0 , $ waitBetweenChunks = 0 ) { if ( $ maxRequests == null or $ maxRequests <= 0 ) { $ this -> subExec ( $ this -> curlInstances , $ retryCount , $ retryWait ) ; return ; } $ instanceChunks = array_chunk ( $ this -> curlInstances , $ maxRequ... | Execute the requests of all added Curl instances |
233,504 | public function removeInstance ( $ instanceName ) { $ curlInstance = $ this -> curlInstances [ $ instanceName ] ; unset ( $ this -> curlInstances [ $ instanceName ] ) ; return $ curlInstance ; } | Remove the specified instance given by the name |
233,505 | public function retryFailed ( $ curlInstances ) { $ failed = 0 ; $ curlMultiInstance = new CurlMulti ( ) ; foreach ( $ curlInstances as $ curlInstance ) { if ( $ curlInstance -> isSuccessful ( ) ) { continue ; } $ curlInstance -> setRetryCount ( $ curlInstance -> getRetryCount ( ) + 1 ) ; $ curlMultiInstance -> addInst... | Retry all failed requests of the given array of Curl instances . |
233,506 | public function getDecode ( Comm $ item , $ lead = null ) { $ comt = json_decode ( $ item -> comment ) ; if ( $ comt -> frontmatter -> title ) { $ til = $ comt -> frontmatter -> title ; } else { $ til = $ item -> title ; } $ comt = $ comt -> text ; if ( $ lead ) { return '<h3>' . $ til . '</h3><p>' . $ comt . '</p>' ; ... | Returns json_decoded title and text If lead text headline is larger font |
233,507 | public function getEdit ( $ isadmin , $ userid , $ commid , $ htmlcomment ) { $ update = $ this -> setUrlCreator ( "comm/update" ) ; if ( $ isadmin || $ userid == $ this -> sess [ 'id' ] ) { $ edit = '<p><a href="' . $ update . '/' . $ commid . '">Redigera</a> | ' ; $ edit .= $ htmlcomment ; } else { $ edit = "<p>" . $... | If loggedin allowed to edit |
233,508 | public function writeXML ( \ XMLWriter $ w , string $ elementName = 'ImageSizeReducers' ) { if ( ! empty ( $ elementName ) ) { $ w -> startElement ( $ elementName ) ; } foreach ( $ this as $ reducer ) { if ( \ is_null ( $ reducer ) || ! ( $ reducer instanceof ImageSizeReducer ) ) { continue ; } $ reducer -> writeXML ( ... | Writes the current instance data to defined XMLWriter . |
233,509 | public function dispatch ( ) { if ( $ this -> isDispatchable ( ) ) { $ sorted = [ ] ; foreach ( $ this -> attachedToEvents as $ eventName ) { $ sorted [ $ eventName ] = $ this -> dispatchedEvents [ $ eventName ] ; } call_user_func ( $ this -> listener , $ sorted ) ; if ( $ this -> purge ) { $ this -> dispatchedEvents =... | Try to dispatch the event and clear the event cache |
233,510 | protected function _normalizePath ( $ path , $ separator ) { try { return $ this -> _normalizeIterable ( $ path ) ; } catch ( InvalidArgumentException $ e ) { return $ this -> _stringableSplit ( $ path , $ separator ) ; } } | Normalizes a path . |
233,511 | public function askForArray ( OutputInterface $ output , $ question , $ default ) { $ result = $ this -> ask ( $ output , $ question , $ default ) ; if ( is_string ( $ result ) ) { $ result = explode ( ',' , $ result ) ; } if ( ! is_array ( $ result ) ) { $ result = array ( ) ; } $ result = array_map ( 'trim' , $ resul... | Asks for a list of values the response is split to return an array |
233,512 | public function amountOfDays ( ) : int { return $ this -> end -> handle ( ) -> diff ( $ this -> start -> handle ( ) ) -> days + 1 ; } | returns amount of days in this datespan |
233,513 | public function isInFuture ( ) : bool { $ today = mktime ( 23 , 59 , 59 , ( int ) date ( 'm' ) , ( int ) date ( 'd' ) , ( int ) date ( 'Y' ) ) ; if ( $ this -> start -> timestamp ( ) > $ today ) { return true ; } return false ; } | checks whether the DateSpan is in the future compared to current date |
233,514 | public function containsDate ( $ date ) : bool { $ date = Date :: castFrom ( $ date ) ; if ( ! $ this -> start -> isBefore ( $ date ) && ! $ this -> start -> equals ( $ date ) ) { return false ; } if ( ! $ this -> end -> isAfter ( $ date ) && ! $ this -> end -> equals ( $ date ) ) { return false ; } return true ; } | checks whether the span contains the given date |
233,515 | final public function handle ( CommandInterface $ command ) { $ this -> validateCommand ( $ command ) ; try { $ this -> _handle ( $ command ) ; } catch ( \ Exception $ exception ) { $ commandClass = get_class ( $ command ) ; $ this -> logError ( "Exception throw while handling {$commandClass} command... {$exception->ge... | Processes the associated command |
233,516 | function logError ( $ errorMessage , \ Exception $ exception ) { if ( $ this -> logger instanceof LoggerInterface ) { $ this -> logger -> error ( $ errorMessage . "\n" . $ exception -> getTraceAsString ( ) ) ; } } | Logs an error if the error logger is available |
233,517 | public function Link ( $ action = null ) { if ( $ this -> currentRecord ) { return Controller :: join_links ( $ this -> parentController -> Link ( ) , "/{$this->currentRecord->ID}/{$action}" ) ; } else { return $ this -> parentController -> Link ( ) ; } } | Link fragment - appends the current record ID to the URL . |
233,518 | public function view ( $ request ) { if ( ! $ this -> currentRecord ) { return $ this -> httpError ( 404 , "{$this->recordType} not found" ) ; } if ( ! $ this -> currentRecord -> canView ( ) ) { return $ this -> httpError ( 403 , "You do not have permission to view this {$this->recordType}" ) ; } $ form = $ this -> For... | Returns the view of the record |
233,519 | public function edit ( $ request ) { if ( ! $ this -> currentRecord ) { return $ this -> httpError ( 404 , "{$this->recordType} not found" ) ; } if ( ! $ this -> currentRecord -> canEdit ( ) ) { return $ this -> httpError ( 403 , "You do not have permission to edit this {$this->recordType}" ) ; } $ this -> addCrumb ( '... | Returns a form for editing the record |
233,520 | function getViewer ( $ action ) { if ( $ this -> parentController ) { if ( is_numeric ( $ action ) ) { $ action = 'view' ; } $ viewer = $ this -> parentController -> getViewer ( $ action ) ; $ layoutTemplate = null ; $ layoutTemplate = SSViewer :: getTemplateFileByType ( "{$this->recordType}_$action" , 'Layout' ) ; if ... | If a parentcontroller exists use its main template and mix in specific collectioncontroller subtemplates . |
233,521 | public function Form ( ) { if ( $ this -> currentRecord ) { $ fields = $ this -> currentRecord -> getFrontEndFields ( ) ; $ required = $ this -> currentRecord -> getRequiredFields ( ) ; } else { $ fields = singleton ( $ this -> recordType ) -> getFrontEndFields ( ) ; $ required = singleton ( $ this -> recordType ) -> g... | Scaffolds the fields required for editing the record |
233,522 | public function doSave ( $ data , $ form ) { if ( ! $ this -> currentRecord ) { $ this -> currentRecord = new $ this -> recordType ( ) ; } $ form -> saveInto ( $ this -> currentRecord ) ; $ this -> currentRecord -> write ( ) ; $ this -> redirect ( $ this -> Link ( ) ) ; } | Save the record |
233,523 | public function httpError ( $ code , $ message = null ) { if ( $ this -> request -> isMedia ( ) || ! $ response = ErrorPage :: response_for ( $ code ) ) { parent :: httpError ( $ code , $ message ) ; } else { throw new HTTPResponse_Exception ( $ response ) ; } } | Show a pretty error if possible |
233,524 | public function addCrumb ( $ title , $ link = null ) { $ this -> Title = $ title ; if ( $ link ) { array_push ( $ this -> crumbs , "<a href=\"$link\">$title</a>" ) ; } else { array_push ( $ this -> crumbs , $ title ) ; } } | Adds a breadcrumb action |
233,525 | public function Breadcrumbs ( ) { $ parts = explode ( self :: $ breadcrumbs_delimiter , $ this -> parentController -> Breadcrumbs ( ) ) ; array_pop ( $ parts ) ; array_push ( $ parts , '<a href="' . $ this -> parentController -> Link ( ) . '">' . $ this -> parentController -> Title . '</a>' ) ; array_pop ( $ this -> cr... | Build on the breadcrumbs to show the nested actions |
233,526 | public function addReplacer ( array $ replacer ) { foreach ( $ replacer as $ key => $ value ) { Unicode :: $ char [ $ key ] = $ value ; } } | Add array list for replacer |
233,527 | public function replaceText ( string $ str ) : string { foreach ( Unicode :: $ char as $ key => $ value ) { if ( $ key === $ str ) { $ result = ( ( count ( $ value ) > 1 ) ? Unicode :: $ char [ $ key ] [ random_int ( 0 , count ( $ value ) - 1 ) ] : Unicode :: $ char [ $ key ] [ 0 ] ) ; } } return $ result ?? $ str ; } | Replace text with unicode character |
233,528 | public function encode ( ) { foreach ( $ this -> body as $ key => $ value ) { $ result [ ] = $ this -> replaceText ( $ value ) ; } return implode ( '' , $ result ) ; } | Replace character with new unicode character |
233,529 | public function build ( $ sql = '' ) { $ sql .= "\n" ; if ( ! empty ( $ this -> selectParams [ self :: SELECT ] ) ) { $ sql = "SELECT " . implode ( ",\n" , $ this -> selectParams [ self :: SELECT ] ) ; } if ( ! empty ( $ this -> selectParams [ self :: FROM ] ) ) { $ sql .= "\nFROM " . implode ( ",\n" , $ this -> select... | Creates the SQL query |
233,530 | public function limit ( $ limit ) { if ( ! empty ( $ limit ) ) $ this -> selectParams [ self :: LIMIT ] = $ limit ; else unset ( $ this -> selectParams [ self :: LIMIT ] ) ; return $ this ; } | Sets the LIMIT clause for the query . |
233,531 | public function offset ( $ offset ) { if ( ! empty ( $ offset ) ) $ this -> selectParams [ self :: OFFSET ] = $ offset ; return $ this ; } | Sets or clears the offset for the query . If null is specified the offset is cleared . |
233,532 | protected function setClause ( $ section , $ clause ) { if ( ! isset ( $ this -> selectParams [ $ section ] ) ) $ this -> selectParams [ $ section ] = array ( ) ; if ( empty ( $ clause ) ) unset ( $ this -> selectParams [ $ section ] ) ; else if ( is_array ( $ clause ) ) $ this -> selectParams [ $ section ] = array_mer... | The setter used internally in this function to build each clause . |
233,533 | public function validatePasswordNotUseWordPassword ( $ password ) { $ washedPassword = trim ( $ password ) ; $ washedPassword = strtolower ( $ password ) ; if ( strpos ( $ washedPassword , "password" ) !== false ) { return false ; } return true ; } | Password should not use the word password |
233,534 | public function validatePasswordNotUseUsername ( $ username , $ password ) { $ washedPassword = trim ( $ password ) ; $ washedPassword = strtolower ( $ password ) ; $ washedUsername = trim ( $ username ) ; $ washedUsername = strtolower ( $ username ) ; if ( $ washedPassword == $ washedUsername ) { return false ; } $ wa... | Password should not be the username |
233,535 | public function getPeopleIdForIndexListing ( $ id ) { if ( Schema :: hasTable ( 'peoples' ) ) { $ person = DB :: table ( 'peoples' ) -> where ( 'user_id' , '=' , $ id ) -> first ( ) ; if ( ! $ person ) return "Not in LaSalleCRM" ; $ full_url = route ( 'admin.crmpeoples.edit' , $ person -> id ) ; $ html = '<a href="' ; ... | Get the ID from the PEOPLES table |
233,536 | public function on ( $ event , $ handler , $ prepend = false ) { if ( ! is_string ( $ event ) ) { throw new InvalidArgumentException ( "invalid value provided for 'event'; " . "expecting an event name as string" ) ; } $ handler = new Handler ( $ event , $ handler ) ; if ( $ prepend === false ) { $ this -> eventHandlers... | Add an event handler |
233,537 | public function off ( $ event ) { list ( $ type , $ namespace ) = Event :: split ( $ event ) ; for ( $ i = count ( $ this -> eventHandlers ) - 1 ; $ i > - 1 ; $ i -- ) { $ h = $ this -> eventHandlers [ $ i ] ; if ( $ type !== null && $ h -> getType ( ) !== $ type ) { continue ; } else if ( $ namespace !== null && $ h -... | Remove one or more event handlers |
233,538 | public function fire ( $ event , array $ data = [ ] ) { if ( is_string ( $ event ) ) { $ event = new Event ( $ event ) ; $ event -> setData ( $ data ) ; } else if ( $ event instanceof Event ) { if ( $ data ) { $ event -> addData ( $ data ) ; } } else { throw new InvalidArgumentException ( "invalid value provided for 'e... | Call all handlers for a given event |
233,539 | protected function BeforeInit ( ) { if ( $ this -> RemoveTemplate ( ) ) { Response :: Redirect ( Request :: Uri ( ) ) ; return true ; } parent :: BeforeInit ( ) ; } | Removes the template if necessary |
233,540 | protected function InitBundles ( ) { $ bundles = PathUtil :: Bundles ( ) ; $ this -> bundles = array ( ) ; foreach ( $ bundles as $ bundle ) { if ( count ( $ this -> BundleModules ( $ bundle ) ) > 0 ) { $ this -> bundles [ ] = $ bundle ; } } } | Initializes the bundle names by fetching those containing modules with adjustable templates |
233,541 | protected function ModuleTemplates ( $ module ) { $ folder = PathUtil :: ModuleCustomTemplatesFolder ( $ module ) ; if ( ! Folder :: Exists ( $ folder ) ) { return array ( ) ; } $ templates = Folder :: GetFiles ( $ folder ) ; $ result = array ( ) ; foreach ( $ templates as $ template ) { if ( Path :: Extension ( $ temp... | Gets the module templates |
233,542 | protected function RemovalTemplateModule ( array $ idParts ) { if ( count ( $ idParts ) != 2 ) { return null ; } $ module = ClassFinder :: CreateFrontendModule ( $ idParts [ 0 ] ) ; return ( $ module instanceof FrontendModule && $ module -> AllowCustomTemplates ( ) ) ? $ module : null ; } | The removel template module |
233,543 | public function setValue ( $ value = null ) { if ( isset ( $ value ) ) { $ this -> value = array_map ( 'htmlspecialchars' , ( array ) $ value ) ; } foreach ( $ this -> options as $ o ) { $ v = $ this -> getValue ( ) ; if ( is_array ( $ v ) && in_array ( $ o -> getValue ( ) , $ v ) ) { $ o -> select ( ) ; } else { $ o -... | set value of select element value can be either a primitive or an array |
233,544 | public function init ( $ options = [ ] ) { $ auth = new Authentication ( ) ; if ( ! $ auth -> check ( ) ) { $ url = ( isset ( $ options [ 'auth_login_url' ] ) ) ? $ options [ 'auth_login_url' ] : '/auth/login' ; $ this -> redirect = $ url ; } } | Group init function . |
233,545 | public function getData ( ) { if ( $ this -> options [ 'paginate' ] ) { $ currentPage = \ Paginator :: getCurrentPage ( ) ; $ total = ( int ) $ this -> getQuery ( ) -> count ( ) ; $ slice = $ this -> getQuery ( ) -> forPage ( $ currentPage , $ this -> perPage ) -> get ( ) ; $ models = \ Paginator :: make ( $ slice -> a... | Return the data filter by the options |
233,546 | public function sameValueAs ( ValueObjectInterface $ integer ) { if ( false === Util :: classEquals ( $ this , $ integer ) ) { return false ; } return $ this -> toNative ( ) === $ integer -> toNative ( ) ; } | Tells whether two Integer are equal by comparing their values |
233,547 | public function stringValue ( string $ allowedNext = ',;)' ) : string { $ value = '' ; if ( $ this -> isEnd ( ) ) { throw $ this -> createSyntaxException ( 'StringValue' ) ; } if ( '"' === $ this -> data [ $ this -> cursor ] ) { $ this -> moveCursor ( '"' ) ; while ( "\n" !== $ c = mb_substr ( $ this -> data , $ this -... | Expect a StringValue . |
233,548 | protected function stripHtmlTags ( $ string ) { $ string = preg_replace ( '@<(embed|head|noembed|noscript|object|script|style)[^>]*?>.*?</\\1>@siu' , '' , $ string ) ; $ string = preg_replace ( '@</(div|h[1-9]|p|pre|tr)@iu' , "\r\n\$0" , $ string ) ; $ string = preg_replace ( '@</(td|th)@iu' , " \$0" , $ string ) ; $ s... | - remove invisible elements - replace certain elements with a line - break - replace certain table elements with a space - add a placeholder for plain - text bullets to list elements - strip all remaining HTML tags |
233,549 | public static function installFromFile ( $ path , $ deleteFile = false ) { $ spa = new Tenant_SPA ( ) ; $ spa -> path = 'not/set' ; $ spa -> name = 'spa-' . rand ( ) ; $ spa -> create ( ) ; try { return self :: updateFromFile ( $ spa , $ path , $ deleteFile ) ; } catch ( Exception $ ex ) { $ spa -> delete ( ) ; throw $... | Install spa from file into the tenant . |
233,550 | public function getAddressInfo ( $ ipAddress ) { $ long = ip2long ( $ ipAddress ) ; if ( $ long == - 1 || $ long === false ) { return null ; } $ result = $ this -> gateway -> get ( 'ipv4address' , [ 'ip_address' => $ ipAddress , '_max_results' => 1 ] ) ; return ( isset ( $ result [ 0 ] ) ) ? $ result [ 0 ] : null ; } | Looks up an IP Address and returns whatever Infoblox knows about it . |
233,551 | public function getMacFilterInfo ( $ macAddress ) { $ result = $ this -> gateway -> get ( 'macfilteraddress' , [ 'filter' => $ this -> filter , 'mac' => $ macAddress , '_max_results' => 1 ] ) ; return ( isset ( $ result [ 0 ] ) ) ? $ result [ 0 ] : null ; } | Returns whatever Infoblox knows about a MAC address filter address . |
233,552 | public function getRegistrations ( $ username ) { $ params = [ ] ; $ params [ 'filter' ] = $ this -> filter ; $ params [ 'username' ] = $ username ; $ params [ '_return_fields+' ] = 'fingerprint,extattrs' ; return $ this -> gateway -> get ( 'macfilteraddress' , $ params ) ; } | Returns MAC address filter registrations for a given user . |
233,553 | public static function formatMacAddress ( $ validAddress ) { if ( strlen ( $ validAddress ) == 12 ) { $ formattedAddress = substr ( $ validAddress , 0 , 2 ) ; for ( $ i = 2 ; $ i < 12 ; $ i += 2 ) { $ formattedAddress .= ':' . substr ( $ validAddress , $ i , 2 ) ; } return $ formattedAddress ; } if ( strlen ( $ validAd... | Formats a MAC Address . |
233,554 | public static function i ( ) { $ class = get_called_class ( ) ; $ initArgs = func_get_args ( ) ; if ( count ( $ initArgs ) === 1 ) { $ initArgs = $ initArgs [ 0 ] ; } if ( ! empty ( self :: $ _baseInstances [ $ class ] ) ) { $ inst = self :: $ _baseInstances [ $ class ] ; if ( ! empty ( $ initArgs ) ) { $ inst -> initC... | Direct static constructor and singleton getter . |
233,555 | public function initConfig ( $ config ) { if ( is_string ( $ config ) ) { if ( file_exists ( ( $ configFile = $ config ) ) || file_exists ( ( $ configFile = dirname ( dirname ( __FILE__ ) ) . self :: DS . $ config ) ) ) { $ config = $ this -> loadConfig ( $ configFile ) ; } } elseif ( ! is_array ( $ config ) && ! is_ob... | Initiate class configuration |
233,556 | public function mergeConfig ( $ new = array ( ) ) { $ config = ( object ) array_merge ( ( array ) $ this -> _defaultConfiguration , ( array ) $ this -> _configuration , ( array ) $ new ) ; foreach ( $ config as $ key => $ value ) { $ this -> setConfig ( $ key , $ value ) ; } return $ this ; } | Merge new data into the current defaults and configuration |
233,557 | public function loadConfig ( $ file ) { $ config ; switch ( pathinfo ( $ file , PATHINFO_EXTENSION ) ) { case 'json' : $ config = json_decode ( file_get_contents ( $ file ) ) ; break ; case 'php' : $ config = include $ file ; break ; default : return $ this ; } $ this -> doCallback ( 'configurationLoaded' , array ( $ c... | Loads the configuration from a json or php file |
233,558 | public function getCallbackKey ( $ callback ) { if ( is_array ( $ callback ) ) { if ( is_object ( $ callback [ 0 ] ) ) { $ callback [ 0 ] = spl_object_hash ( $ callback [ 0 ] ) ; } } elseif ( ( function ( ) { } instanceof $ callback ) ) { $ callback = spl_object_hash ( $ callback ) ; } return md5 ( serialize ( $ callba... | Generates unique hashes for callback functions |
233,559 | public function doCallback ( $ name , array $ values = array ( ) , $ getResult = false ) { $ values = array_merge ( $ values , array ( $ name , $ this ) ) ; if ( $ getResult ) { $ result = $ values [ 0 ] ; } if ( $ this -> getConfig ( 'hookIntoWordpress' ) && class_exists ( '\WP' ) ) { $ result = call_user_func_array (... | Executes callbacks for a hook |
233,560 | public function addCallback ( $ name , $ callback , $ prio = 10 ) { if ( ! is_callable ( $ callback ) ) { throw new \ Exception ( "Callback not callable." , 3 ) ; return false ; } $ key = $ this -> getCallbackKey ( $ callback ) ; if ( ! isset ( self :: $ _baseRealCallbacks [ $ key ] ) ) { self :: $ _baseRealCallbacks [... | Adds a callback listener |
233,561 | public function removeCallback ( $ name , $ callback , $ prio = 10 ) { $ key = $ this -> getCallbackKey ( $ callback ) ; if ( in_array ( $ key , $ this -> _callbacks [ $ name ] [ $ prio ] ) ) { while ( false !== $ k = array_search ( $ key , $ this -> _callbacks [ $ name ] [ $ prio ] ) ) { unset ( $ this -> _callbacks [... | Removes the callback from the specific hook at the specific priority |
233,562 | public function killCallback ( $ callback ) { $ key = $ this -> getCallbackKey ( $ callback ) ; self :: $ _baseRealCallbacks [ $ key ] = false ; return $ this ; } | Globally disables the passed function from being called by any hook . |
233,563 | public function reanimateCallback ( $ callback ) { $ key = $ this -> getCallbackKey ( $ callback ) ; self :: $ _baseRealCallbacks [ $ key ] = $ callback ; return $ this ; } | Globally enables the passed function to receive callback calls . |
233,564 | public function _exit ( $ status = null , $ msg = null , $ errorCode = null ) { foreach ( array ( 'status' , 'msg' , 'errorCode' ) as $ k ) { if ( $ $ k !== null ) { self :: $ _baseR [ $ k ] = $ $ k ; } } echo serialize ( self :: $ _baseR ) ; exit ; } | Killer function stops the script and echoes the serialized response |
233,565 | public function search ( $ expression ) { return \ Aws \ flatmap ( $ this , function ( \ Aws \ ResultInterface $ result ) use ( $ expression ) { return ( array ) $ result -> search ( $ expression ) ; } ) ; } | Returns an iterator that iterates over the values of applying a JMESPath search to each wrapped \ Aws \ ResultInterface as a flat sequence . |
233,566 | public static function register ( $ debug = TRUE , $ charset = 'UTF-8' ) { if ( self :: $ handler ) { throw new \ RuntimeException ( 'Exception handler already registered.' ) ; } self :: $ handler = new static ( $ debug , $ charset ) ; set_exception_handler ( array ( self :: $ handler , 'handle' ) ) ; return self :: $ ... | register custom exception handler |
233,567 | protected function decorateException ( \ Exception $ e , $ status ) { $ headerTpl = ' <!DOCTYPE html> <html> <head> <title>Error %d</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body> <table> <tr> <th colspan="4">%s</th> </tr> <tr> <th></th> ... | generate simple formatted output of exception |
233,568 | public function createParamTag ( $ type , $ name , $ description = null ) { return $ this -> createVariableTag ( 'param' , $ type , $ name , $ description ) ; } | Create a param tag for describing method arguments |
233,569 | public function createPropertyTag ( $ type , $ name , $ description = null ) { return $ this -> createVariableTag ( 'property' , $ type , $ name , $ description ) ; } | Create a property tag for describing class properties |
233,570 | public function createReturnTag ( $ type , $ description = null ) { return $ this -> internalCreateTag ( true , 'return' , $ this -> classFile -> getType ( $ type ) , $ description ) ; } | Define the return type of a method |
233,571 | public function createThrowsTag ( $ exceptionClass , $ description = null ) { return $ this -> internalCreateTag ( false , 'throws' , $ this -> classFile -> getType ( $ exceptionClass ) , $ description ) ; } | Indicates if the element throws partical exceptions |
233,572 | public function createVarTag ( $ type , $ name , $ description = null ) { return $ this -> createVariableTag ( 'var' , $ type , $ name , $ description ) ; } | Create a var tag for describing class properties |
233,573 | protected function internalCreateTag ( $ single = true , $ name , $ column1 = null , $ column2 = null , $ _ = null ) { $ arguments = func_get_args ( ) ; $ single = array_shift ( $ arguments ) ; array_unshift ( $ arguments , $ this -> maxColumnLengths ) ; foreach ( $ arguments as $ index => $ argument ) { if ( $ argumen... | Create tag with the given values |
233,574 | public function addSubscriber ( EventSubscriber $ eventSubscriber ) { $ listeners = $ eventSubscriber -> getEvents ( ) ; foreach ( $ listeners as $ listener => $ data ) { if ( is_array ( $ data ) ) { $ data = new SubscriberConfiguration ( $ data [ 0 ] , $ data [ 1 ] ?? self :: USE_ALL , $ data [ 2 ] ?? 100 ) ; } if ( !... | Adds an event subscriber that listens on the specified events . Internally this will convert all handlers to listeners . |
233,575 | public function getListeners ( string ... $ eventNames ) : array { if ( empty ( $ eventNames ) ) return [ ] ; $ key = implode ( '|' , $ eventNames ) ; return $ this -> combinationListeners [ $ key ] ?? [ ] ; } | Gets the listeners of a specific event |
233,576 | public function clean ( ) { $ fileSystem = new Filesystem ( ) ; if ( $ fileSystem -> exists ( $ this -> getCacheDir ( ) ) ) { $ fileSystem -> remove ( $ this -> getCacheDir ( ) ) ; } } | Remove the assets cache directory . |
233,577 | public function getCacheDir ( ) { $ fileSystem = new Filesystem ( ) ; $ path = 'var/cache/assets/' . $ this -> name . '/' ; if ( ! $ fileSystem -> exists ( $ path ) ) { $ fileSystem -> mkdir ( $ path ) ; } return $ path ; } | Return the assets cache dir . |
233,578 | protected function addNotification ( $ message ) { $ event = new NotificationEvent ( ) ; $ event -> setMessage ( $ message ) ; $ this -> eventDispatcher -> dispatch ( NotificationEvent :: NAME , $ event ) ; } | Add a notification to the subscriber . |
233,579 | public function convert ( $ jsonString , $ mapToClass = null ) { $ converted = json_decode ( $ jsonString , true ) ; if ( $ mapToClass ) { $ converted = SerialisableArrayUtils :: convertArrayToSerialisableObjects ( $ converted , $ mapToClass ) ; } return $ converted ; } | Convert a json string into objects . If the mapToClass member is passed the converter will attempt to map the result to an instance of that class type or array . |
233,580 | protected function getToken ( $ src ) { $ full_path = \ Yii :: getAlias ( '@webroot' ) . "/$src" ; try { $ token = hash ( 'crc32b' , '$full_path ' . filemtime ( $ full_path ) ) ; } catch ( \ Exception $ ex ) { \ Yii :: error ( $ ex ) ; return null ; } catch ( \ Throwable $ ex ) { \ Yii :: error ( $ ex ) ; return null ;... | Get a file token based on pipe configuration and source path . |
233,581 | public function url ( $ pipeline , $ src , $ scheme = false ) { $ src = ltrim ( is_array ( $ src ) ? $ src [ 0 ] : $ src , '/' ) ; $ version = $ this -> getPipelineVersion ( $ pipeline ) ; return Url :: to ( "@web/$this->path/$pipeline/$version/$src" , $ scheme ) . '?' . $ this -> getToken ( $ src ) ; } | Return a URL to render a filtered version of an image . |
233,582 | public function img ( $ pipeline , $ src , array $ options = [ ] ) { return \ yii \ helpers \ Html :: img ( $ this -> url ( $ pipeline , $ src ) , $ options ) ; } | Return an HTML IMG tag . |
233,583 | public static function ip ( ) { $ whip = new Whip ( Whip :: CLOUDFLARE_HEADERS | Whip :: REMOTE_ADDR , [ Whip :: CLOUDFLARE_HEADERS => self :: CLOUDFLARE_IP , ] ) ; return $ whip -> getValidIpAddress ( ) ; } | Get real ip address . |
233,584 | public static function contains ( $ cidr , $ ip ) { $ cidr = Range :: parse ( $ cidr ) ; $ ip = new IP ( $ ip ) ; if ( $ cidr -> getFirstIP ( ) -> getVersion ( ) !== $ ip -> getVersion ( ) ) { return false ; } return $ cidr -> contains ( $ ip ) ; } | Check if ip is within range . |
233,585 | public function getSlaveConnection ( ) { if ( null === $ this -> slaveConnection ) { $ this -> slaveConnection = new \ Redis ( ) ; $ this -> slaveConnection -> pconnect ( $ this -> config [ 'slave' ] [ 'HOST' ] , $ this -> config [ 'slave' ] [ 'PORT' ] ) ; } return $ this -> slaveConnection ; } | Get slave connection If connection is not initialized we create a new one |
233,586 | public function getIndent ( ) { $ leadingWhitespace = array ( ) ; $ n = 0 ; foreach ( $ this -> lines as $ line ) { if ( ! empty ( $ line ) ) { $ leadingWhitespace [ $ n ] = strlen ( $ line ) - strlen ( ltrim ( $ line ) ) ; } $ n ++ ; } return min ( $ leadingWhitespace ) ; } | Get the number of chars |
233,587 | public function deIndent ( ) { $ ltrim = $ this -> getIndent ( ) ; if ( $ ltrim > 0 ) { foreach ( $ this -> lines as & $ line ) { $ line = substr ( $ line , $ ltrim ) ; } } return $ this ; } | Completely deindent a string |
233,588 | public function indent ( $ indent = 4 ) { $ indent = $ this -> generateIndent ( $ indent ) ; foreach ( $ this -> lines as & $ line ) { $ line = $ indent . $ line ; } return $ this ; } | Indent a string |
233,589 | public function comment ( $ comment = '#' ) { foreach ( $ this -> lines as & $ line ) { $ line = $ comment . $ line ; } return $ this ; } | Comment out a string |
233,590 | public function docblockify ( ) { foreach ( $ this -> lines as & $ line ) { $ line = ' * ' . $ line ; } array_unshift ( $ this -> lines , '/**' ) ; array_push ( $ this -> lines , ' */' ) ; return $ this ; } | Make docblock this string |
233,591 | public function removeDuplicateEmptyLines ( ) { $ output = [ ] ; $ c = 0 ; foreach ( $ this -> lines as $ key => $ line ) { if ( strlen ( rtrim ( $ line ) ) === 0 ) { $ c ++ ; if ( $ c === 1 ) { $ output [ ] = $ line ; } } else { $ c = 0 ; $ output [ ] = $ line ; } } $ this -> lines = $ output ; return $ this ; } | Duplicate empty lines remove |
233,592 | public function addLineNumbers ( ) { $ lengthToPad = strlen ( count ( $ this -> lines ) ) ; $ c = 0 ; foreach ( $ this -> lines as & $ line ) { $ c ++ ; $ line = sprintf ( "%s %s" , str_pad ( ( string ) $ c , $ lengthToPad , ' ' , STR_PAD_LEFT ) , $ line ) ; } return $ this ; } | Add line numbers to output . Useful for debugging output . This is obviously destructive |
233,593 | private function generateIndent ( $ indent ) { if ( is_integer ( $ indent ) ) { $ indent = str_repeat ( $ this -> indentChar , $ indent ) ; } elseif ( ! is_string ( $ indent ) ) { throw new BadTypeException ( $ indent , 'int|string' ) ; } return $ indent ; } | Generate indention string from length . |
233,594 | public function filterByCategoryId ( $ categoryId = null , $ comparison = null ) { if ( is_array ( $ categoryId ) ) { $ useMinMax = false ; if ( isset ( $ categoryId [ 'min' ] ) ) { $ this -> addUsingAlias ( C2MTableMap :: COL_CATEGORY_ID , $ categoryId [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } i... | Filter the query on the category_id column |
233,595 | public function filterByMediaId ( $ mediaId = null , $ comparison = null ) { if ( is_array ( $ mediaId ) ) { $ useMinMax = false ; if ( isset ( $ mediaId [ 'min' ] ) ) { $ this -> addUsingAlias ( C2MTableMap :: COL_MEDIA_ID , $ mediaId [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ medi... | Filter the query on the media_id column |
233,596 | public function useCategoryQuery ( $ relationAlias = null , $ joinType = Criteria :: INNER_JOIN ) { return $ this -> joinCategory ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'Category' , '\Attogram\SharedMedia\Orm\CategoryQuery' ) ; } | Use the Category relation Category object |
233,597 | public function useMediaQuery ( $ relationAlias = null , $ joinType = Criteria :: INNER_JOIN ) { return $ this -> joinMedia ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'Media' , '\Attogram\SharedMedia\Orm\MediaQuery' ) ; } | Use the Media relation Media object |
233,598 | protected function _createInvalidArgumentException ( $ message = '' , $ code = 0 , RootException $ previous = null , $ argument = null ) { return new RootInvalidArgumentException ( $ message , $ code , $ previous ) ; } | Creates a new invalid argument exception . |
233,599 | private static function getVarName ( $ sFunction , $ sFile , $ iLine ) { $ sContent = file ( $ sFile ) ; $ sLine = $ sContent [ $ iLine - 1 ] ; preg_match ( "#$sFunction\s*\((.+)\)#" , $ sLine , $ aMatches ) ; $ iMax = strlen ( $ aMatches [ 1 ] ) ; $ sVarname = '' ; $ iNb = 0 ; for ( $ i = 0 ; $ i < $ iMax ; $ i ++ ) {... | Return the name of the first parameter of the penultimate function call . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.