idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
58,400 | public function setTooltip ( $ txt , $ placement = null , $ html = null , $ container = null , $ delay = null ) { if ( Container :: getDevice ( ) -> isMobileOrTablet ( ) ) { return $ this ; } if ( $ txt === null || $ txt === '' ) { $ this -> tooltip = null ; $ this -> tooltipOptions = [ ] ; } $ this -> tooltip = ( stri... | Set the tooltip |
58,401 | public function getTooltipAttributes ( ) : array { if ( $ this -> tooltip !== null ) { $ attrs = $ this -> tooltipOptions ; $ attrs [ 'data-toggle' ] = 'tooltip' ; $ attrs [ 'title' ] = $ this -> tooltip ; return $ attrs ; } return [ ] ; } | Attributes to add to an element |
58,402 | protected function addThemes ( Theme $ theme , $ config ) { if ( ! is_array ( $ config ) && ! ( $ config instanceof \ Traversable ) ) { return $ this ; } foreach ( $ config as $ name => $ conf ) { if ( ! isset ( $ conf [ 'path' ] ) ) { continue ; } $ theme -> addLocation ( $ name , $ conf [ 'path' ] ) ; } return $ this... | Add config themes |
58,403 | public function verifyRegistration ( TokenEntity $ token ) { if ( $ token -> isNew ( ) ) { throw new OutOfBoundsException ( 'NOT_FOUND' , self :: TOKEN_NOT_FOUND ) ; } if ( ( int ) $ token -> getTokenTypeId ( ) !== TokenEntity :: TYPE_VERIFY_REGISTRATION ) { throw new OutOfBoundsException ( 'NOT_FOUND' , self :: INCORR... | Verify the user given a verify registration token |
58,404 | public function createUserToken ( array $ data ) { $ userToken = new TokenEntity ; $ expires = Arr :: get ( $ data , 'expires' ) ? : strtotime ( '+1 day' , time ( ) ) ; $ defaults = [ 'created' => time ( ) , 'expires' => $ expires , 'token' => $ userToken -> generateToken ( ) , ] ; $ userToken = $ userToken -> exchange... | Create a user token and persist it in the database |
58,405 | public function registerClientScript ( ) { $ js = [ ] ; $ view = $ this -> getView ( ) ; DateTimePickerAsset :: register ( $ view ) ; $ id = $ this -> options [ 'id' ] ; $ selector = ";jQuery('#$id')" ; if ( strpos ( $ this -> template , '{button}' ) !== false || $ this -> inline ) { $ selector .= ".parent()" ; } $ opt... | Registers required script for the plugin to work as a DateTimePicker |
58,406 | public static function getValue ( $ data , $ key , $ defaultvalue = false ) { if ( is_array ( $ data ) ) { return ( array_key_exists ( $ key , $ data ) ) ? $ data [ $ key ] : $ defaultvalue ; } else { return $ defaultvalue ; } } | Return value of array |
58,407 | public static function assocSort ( & $ arr , $ key , $ type = SORT_STRING ) { $ ret = usort ( $ arr , function ( $ a , $ b ) use ( $ key , $ type ) { switch ( $ type ) { case SORT_STRING : return strcasecmp ( $ a [ $ key ] , $ b [ $ key ] ) ; break ; case SORT_NUMERIC : return $ a [ $ key ] > $ b [ $ key ] ; break ; de... | Tri d un tableau associatif |
58,408 | public function hasExceededRetries ( $ retries ) { $ delay = $ this -> getDelay ( $ retries , false ) ; return ( ( ! $ this -> max_retries && ( $ delay >= $ this -> max_backoff ) ) || ( $ this -> max_retries && ( $ retries > $ this -> max_retries ) ) ) ; } | Returns bool to indicate whether the processes has exceeded the maximum number of retries |
58,409 | public static function Merge ( array $ array1 = null , array $ array2 = null ) { self :: setImplmentationClass ( ) ; try { $ array1 = ( ! is_null ( $ array1 ) ) ? $ array1 : self :: $ ArrayHelperClassInstance -> getOutputElement ( ) ; $ array2 = ( ! is_null ( $ array2 ) ) ? $ array2 : self :: $ ArrayHelperClassInstance... | This method merges the elements of an array |
58,410 | public function onBeforeSend ( Event $ event ) { $ request = $ event [ 'request' ] ; $ id = $ this -> signatureCredentials -> getMacId ( ) ; $ ts = $ this -> timeProvider -> getCurrentTime ( ) -> getTimestamp ( ) ; $ nonce = $ this -> randomProvider -> generateStringForRanges ( $ this -> nonceLength , self :: $ charact... | Adds MAC Authorization header to request before sending |
58,411 | public function validate ( $ subject ) : bool { if ( \ is_bool ( $ this -> schema [ 'uniqueItems' ] ) && ( $ this -> schema [ 'uniqueItems' ] === true ) ) { if ( \ count ( $ subject ) !== \ count ( \ array_unique ( $ subject ) ) ) { return false ; } } return true ; } | Validates subject against uniqueItems |
58,412 | public function loadRouteCollection ( $ source = null ) { $ collection = new RouteCollection ( ) ; $ routes = $ this -> loadResource ( $ source ) ; foreach ( $ routes as $ name => $ route ) { $ collection -> add ( $ name , $ this -> parseRoute ( $ route ) ) ; } return $ collection ; } | Loads RouteCollection from source |
58,413 | public function resolveResorceSource ( $ source = null ) { $ basePath = '../' ; if ( $ source == null ) { $ source = "app/config/routing.yml" ; } $ extension = Path :: getExtension ( $ source ) ; if ( ! in_array ( $ extension , self :: $ knownSourceTypes ) && empty ( $ extension ) ) { $ source = $ source . '/routing.ym... | Resolves name of the file to get resource from |
58,414 | public function loadResource ( $ source = null ) { $ routes = array ( ) ; $ source = $ this -> resolveResorceSource ( $ source ) ; $ extension = Path :: getExtension ( $ source ) ; if ( file_exists ( $ source ) ) { $ content = File :: load ( $ source ) ; if ( $ extension == 'yml' ) { $ array = Yaml :: parse ( $ content... | Loads array of routes from resource |
58,415 | public function parseRoute ( $ routeSpec ) { $ path = isset ( $ routeSpec [ 'path' ] ) ? $ routeSpec [ 'path' ] : null ; $ methods = isset ( $ routeSpec [ 'methods' ] ) ? $ routeSpec [ 'methods' ] : array ( ) ; $ controller = isset ( $ routeSpec [ 'controller' ] ) ? $ routeSpec [ 'controller' ] : null ; $ calls = isset... | Parses array of spec into Route object |
58,416 | public function __init ( $ method , $ params ) { $ this -> SKY = ( object ) [ 'method' => $ method , 'params' => $ params ] ; if ( ! method_exists ( $ this , $ method ) ) { Loader :: getClass ( 'Sky.core.Log' ) -> write ( 300 , $ method . ' Page Not Found' ) ; Exceptions :: show404 ( ) ; } if ( method_exists ( $ this ,... | Start initialize controller |
58,417 | public function getDeviceValidationToken ( ) { $ username = $ this -> httpRequest ( ) -> post ( 'username' ) ; $ token = $ this -> getLoginInstance ( ) -> generateDeviceValidationToken ( $ username ) ; return [ 'deviceValidationToken' => $ token ] ; } | For the provided username returns deviceValidationToken . |
58,418 | public function validateDeviceValidationToken ( ) { $ username = $ this -> httpRequest ( ) -> post ( 'username' ) ; $ deviceValidationToken = $ this -> httpRequest ( ) -> post ( 'deviceValidationToken' ) ; $ result = $ this -> getLoginInstance ( ) -> validateDeviceConfirmationToken ( $ username , $ deviceValidationToke... | Validates if the provided deviceValidationToken for the given username . Returns deviceToken if validation is successful otherwise false . |
58,419 | public function getAccountActivationToken ( ) { $ username = $ this -> httpRequest ( ) -> post ( 'username' ) ; $ token = $ this -> getLoginInstance ( ) -> getAccountConfirmationToken ( $ username ) ; return [ 'accountActivationToken' => $ token ] ; } | Returns accountActivationToken for the provided username . |
58,420 | public function validateAccountActivationToken ( ) { $ username = $ this -> httpRequest ( ) -> post ( 'username' ) ; $ accountActivationToken = $ this -> httpRequest ( ) -> post ( 'accountActivationToken' ) ; $ result = $ this -> getLoginInstance ( ) -> validateAccountConfirmationToken ( $ username , $ accountActivatio... | Sets the activated flag to true if the accountActivationToken is valid for the provided username . |
58,421 | public function logout ( ) { $ username = $ this -> httpRequest ( ) -> post ( 'username' ) ; $ session = $ this -> httpRequest ( ) -> post ( 'authToken' ) ; $ this -> getLoginInstance ( ) -> revokeSessions ( $ username , $ session ) ; return [ 'result' => 'success' ] ; } | Revokes the given session for the provided username . |
58,422 | public function generateForgotPasswordResetToken ( ) { $ username = $ this -> httpRequest ( ) -> post ( 'username' ) ; $ token = $ this -> getLoginInstance ( ) -> generateDeviceValidationToken ( $ username ) ; return [ 'passwordResetToken' => $ token ] ; } | Generates a password reset token for the provided username . |
58,423 | private function getCommandNamespace ( array $ composer ) { if ( ! $ this -> isset ( 'autoload.psr-4' , $ composer ) ) { return null ; } foreach ( $ composer [ 'autoload' ] [ 'psr-4' ] as $ namespace => $ folder ) { if ( $ folder === 'src/' ) return $ namespace . 'Commands\\' ; } return null ; } | Only supports psr4 for now . |
58,424 | public function add_emoticon ( $ key , $ url , $ replace = true ) { if ( isset ( $ this -> emoticons [ $ key ] ) && ! $ replace ) return false ; $ this -> emoticons [ $ key ] = $ url ; return true ; } | Adds an emoticon to the parser . |
58,425 | public function add_emoticons ( Array $ emoticons , $ replace = true ) { foreach ( $ emoticons as $ key => $ url ) $ this -> add_emoticon ( $ key , $ url , $ replace ) ; } | Adds multipule emoticons to the parser . Should be in emoticon_key = > image_url format . |
58,426 | public function remove_emoticon ( $ key , $ url ) { if ( ! isset ( $ this -> emoticons [ $ key ] ) ) return false ; unset ( $ this -> emoticons [ $ key ] ) ; return true ; } | Removes an emoticon from the parser . |
58,427 | public function add_bbcode ( BBCode $ bbcode , $ replace = true ) { if ( ! $ replace && isset ( $ this -> bbcodes [ $ bbcode -> tag ( ) ] ) ) return false ; $ this -> bbcodes [ $ bbcode -> tag ( ) ] = $ bbcode ; return true ; } | Adds a bbcode to the parser |
58,428 | public function add_bbcodes ( Array $ bbcodes , $ replace = true ) { foreach ( $ bbcodes as $ bbcode ) $ this -> add_bbcode ( $ bbcode , $ replace ) ; } | Adds an array of BBCode s to the document |
58,429 | public function remove_bbcode ( $ bbcode ) { if ( $ bbcode instanceof BBCode ) $ bbcode = $ bbcode -> tag ( ) ; unset ( $ this -> bbcodes [ $ bbcode ] ) ; } | Removes a BBCode from the document |
58,430 | public function get_bbcode ( $ tag ) { if ( ! isset ( $ this -> bbcodes [ $ tag ] ) ) return null ; return $ this -> bbcodes [ $ tag ] ; } | Returns the BBCode object for the passed tag . |
58,431 | public function get_base_uri ( ) { if ( $ this -> base_uri != null ) return $ this -> base_uri ; return htmlentities ( dirname ( $ _SERVER [ 'PHP_SELF' ] ) , ENT_QUOTES | ENT_IGNORE , "UTF-8" ) . '/' ; } | Gets the base URI to be used in links images ect . |
58,432 | public function parse ( $ str ) { $ str = str_replace ( "\r" , "" , $ str ) ; $ len = strlen ( $ str ) ; $ tag_open = false ; $ tag_text = '' ; $ tag = '' ; $ this -> current_tag = $ this ; for ( $ i = 0 ; $ i < $ len ; ++ $ i ) { if ( $ str [ $ i ] === '[' ) { if ( $ tag_open ) $ tag_text .= '[' . $ tag ; $ tag_open =... | Parses a BBCode string into the current document |
58,433 | private function tag_open ( $ tag , $ attrs ) { if ( $ this -> current_tag instanceof Node_Container_Tag ) { $ closing_tags = $ this -> bbcodes [ $ this -> current_tag -> tag ( ) ] -> closing_tags ( ) ; if ( in_array ( $ tag , $ closing_tags ) ) $ this -> tag_close ( $ this -> current_tag -> tag ( ) ) ; } if ( $ this -... | Handles a BBCode opening tag |
58,434 | private function tag_text ( $ text ) { if ( $ this -> current_tag instanceof Node_Container_Tag ) { $ accepted_children = $ this -> bbcodes [ $ this -> current_tag -> tag ( ) ] -> accepted_children ( ) ; if ( ! empty ( $ accepted_children ) && ! in_array ( 'text_node' , $ accepted_children ) ) return ; } $ this -> curr... | Handles tag text |
58,435 | private function tag_close ( $ tag ) { if ( ! $ this -> current_tag instanceof Node_Container_Document && $ tag !== $ this -> current_tag -> tag ( ) ) { $ closing_tags = $ this -> bbcodes [ $ this -> current_tag -> tag ( ) ] -> closing_tags ( ) ; if ( in_array ( $ tag , $ closing_tags ) || in_array ( '/' . $ tag , $ cl... | Handles BBCode closing tag |
58,436 | private function parse_attribs ( $ attribs ) { $ ret = array ( 'default' => null ) ; $ attribs = trim ( $ attribs ) ; if ( $ attribs == '' ) return $ ret ; if ( $ attribs [ 0 ] == '=' && strrpos ( $ attribs , '=' ) === 0 ) $ ret [ 'default' ] = htmlentities ( substr ( $ attribs , 1 ) , ENT_QUOTES | ENT_IGNORE , "UTF-8"... | Parses a bbcode attribute string into an array |
58,437 | public function detect_links ( ) { $ this -> loop_text_nodes ( function ( $ child ) { preg_match_all ( "/(?:(?:https?|ftp):\/\/|(?:www|ftp)\.)(?:[a-zA-Z0-9\-\.]{1,255}\.[a-zA-Z]{1,20})(?::[0-9]{1,5})?(?:\/[^\s'\"]*)?(?:(?<![,\)\.])|[\S])/" , $ child -> get_text ( ) , $ matches , PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE... | Detects any none clickable links and makes them clickable |
58,438 | public function detect_emails ( ) { $ this -> loop_text_nodes ( function ( $ child ) { preg_match_all ( "/(?:[a-zA-Z0-9\-\._]){1,}@(?:[a-zA-Z0-9\-\.]{1,255}\.[a-zA-Z]{1,20})/" , $ child -> get_text ( ) , $ matches , PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE ) ; if ( count ( $ matches [ 0 ] ) == 0 ) return ; $ replacment... | Detects any none clickable emails and makes them clickable |
58,439 | public function detect_emoticons ( ) { $ pattern = '' ; foreach ( $ this -> emoticons as $ key => $ url ) $ pattern .= ( $ pattern === '' ? '/(?:' : '|' ) . preg_quote ( $ key , '/' ) ; $ pattern .= ')/' ; $ emoticons = $ this -> emoticons ; $ this -> loop_text_nodes ( function ( $ child ) use ( $ pattern , $ emoticons... | Detects any emoticons and replaces them with their images |
58,440 | private function get_excluded_tags ( $ exclude ) { $ ret = array ( ) ; foreach ( $ this -> bbcodes as $ bbcode ) if ( $ bbcode -> auto_detect_exclude ( ) & $ exclude ) $ ret [ ] = $ bbcode -> tag ( ) ; return $ ret ; } | Gets an array of tages to be excluded from the elcude param |
58,441 | public static function add ( $ hook , $ plugin ) { if ( ! isset ( static :: $ plugins [ $ hook ] ) ) { static :: $ plugins [ $ hook ] = array ( ) ; } static :: $ plugins [ $ hook ] [ ] = $ plugin ; } | Adds a plugin to the library |
58,442 | public static function run ( $ hook , array $ params = array ( ) ) { if ( ! isset ( static :: $ plugins [ $ hook ] ) ) { return false ; } foreach ( static :: $ plugins [ $ hook ] as $ plugin ) { call_user_func_array ( $ plugin , $ params ) ; } } | Executes a hook |
58,443 | public function getStats ( ) { echo sprintf ( "Total %d Matched %d (%s%%)" , $ this -> total , $ this -> matched , number_format ( $ this -> matched * 100.0 / $ this -> total , 1 ) ) ; } | Returns the stats collected |
58,444 | protected function loadCarouselItemsForBlock ( BlockInterface $ block ) { $ settings = $ block -> getSettings ( ) ; return $ this -> container -> get ( 'doctrine' ) -> getRepository ( 'Presta\CMSMediaBundle\Doctrine\Orm\Carousel' ) -> findLimited ( ) ; } | Load carousel items to display |
58,445 | public function addLogLinkVisitAction ( \ BlackForest \ PiwikBundle \ Entity \ PiwikLogLinkVisitAction $ logLinkVisitAction ) { $ this -> logLinkVisitAction [ ] = $ logLinkVisitAction ; return $ this ; } | Add logLinkVisitAction . |
58,446 | public function removeLogLinkVisitAction ( \ BlackForest \ PiwikBundle \ Entity \ PiwikLogLinkVisitAction $ logLinkVisitAction ) { return $ this -> logLinkVisitAction -> removeElement ( $ logLinkVisitAction ) ; } | Remove logLinkVisitAction . |
58,447 | public function check ( string $ sentence ) : bool { $ this -> validateSentence ( $ sentence ) ; return $ this -> isCorrect ( $ sentence ) ; } | Check brackets in sentence |
58,448 | protected function isCorrect ( string $ sentence ) : bool { $ bracketsStack = [ ] ; $ sentenceChars = str_split ( $ sentence ) ; $ openBrackets = array_keys ( $ this -> brackets ) ; foreach ( $ sentenceChars as $ char ) { if ( in_array ( $ char , $ openBrackets ) ) { $ bracketsStack [ ] = $ this -> brackets [ $ char ] ... | Parse and check the correctness of the sentence |
58,449 | protected function validateSentence ( string $ sentence ) : void { if ( empty ( $ sentence ) ) { throw new EmptySentenceException ( "Sentence can not be empty" ) ; } $ sentenceChars = str_split ( $ sentence ) ; if ( count ( array_diff ( $ sentenceChars , $ this -> availableChars ) ) ) { throw new InvalidCharactersExcep... | Validate sentence string |
58,450 | private function register ( Entity $ meta ) : self { $ this -> mapping = $ this -> mapping -> put ( ( string ) $ meta -> class ( ) , $ meta ) ; return $ this ; } | Register a new entity metadata |
58,451 | protected function createEntityForm ( Request $ request = NULL ) { $ form = $ this -> createForm ( $ this -> type , $ this -> entity ) ; return $ request ? $ form -> handleRequest ( $ request ) : $ form ; } | Build a create form to create an entity . |
58,452 | protected function editEntityForm ( $ id , Request $ request = NULL ) { $ attributes [ 'method' ] = 'PUT' ; $ form = $ this -> createForm ( $ this -> type , $ this -> repository -> find ( $ id ) , $ attributes ) ; return $ request ? $ form -> handleRequest ( $ request ) : $ form ; } | Build an edit form to edit an entity . |
58,453 | protected function deleteEntityLink ( $ id ) { $ post = $ this -> repository -> find ( $ id ) ; $ this -> manager -> remove ( $ post ) ; $ this -> manager -> flush ( ) ; } | Delete an entity from the database . |
58,454 | public function getReturnUri ( ) { if ( null === $ this -> returnUri ) { $ request = $ this -> getRequest ( ) ; $ session = $ this -> getSessionContainer ( ) ; $ returnUri = $ request -> getQuery ( 'requestUri' ) ; if ( empty ( $ returnUri ) ) { $ returnUri = $ request -> getPost ( 'requestUri' ) ; } if ( empty ( $ ret... | Get return - uri |
58,455 | protected function getValidReturnUri ( $ returnUri ) { $ match = array ( ) ; $ returnUri = ltrim ( str_replace ( '\\' , '/' , $ returnUri ) , "\n\r\t\v\e\f" ) ; if ( ! preg_match ( '#^/([^/].*)?$#' , $ returnUri , $ match ) ) { $ returnUri = static :: DEFAULT_RETURN_URI ; } return $ returnUri ; } | Get valid return - uri |
58,456 | public function getDefaultPathGenerator ( ) { if ( null === $ this -> defaultPathGenerator ) { $ this -> setDefaultPathGenerator ( $ this -> getOptions ( ) -> getDefaultUploadPathGenerator ( ) ) ; } return $ this -> defaultPathGenerator ; } | Returns path generator |
58,457 | public function getDefaultPath ( ) { if ( null === $ this -> defaultPath ) { $ this -> setDefaultPath ( $ this -> getOptions ( ) -> getDefaultUploadPath ( ) ) ; } return $ this -> defaultPath ; } | Returns default path |
58,458 | public function warning ( $ mes , $ alert = true ) { \ AsyncWeb \ Storage \ Log :: log ( "MessagesWarning" , "Bola zobrazena varovacia hlaska: " . addslashes ( $ mes ) , ML__LOW_PRIORITY ) ; $ this -> warn .= '<div class="error alert alert-warning">' . $ mes . '</div>' . "\n" ; \ AsyncWeb \ Storage \ Session :: set ( $... | Tu je zatial class = error |
58,459 | public function addEventListener ( $ function , $ event = null , $ node = null , $ wrap = false , $ position = 1000 ) { $ event = $ event ? : 'DOMContentLoaded' ; $ node = $ node ? : 'document' ; $ function = ( $ wrap ? "function(event) { {$function} }" : $ function ) ; $ this -> addInline ( "{$node}.addEventListener(\... | add an event listner |
58,460 | public function eventCaptureStart ( $ event = null , $ node = null , $ wrap = false , $ position = 1000 ) { $ this -> capture [ ] = [ 'func' => 'addEventListener' , 'args' => [ $ event , $ node , $ wrap , $ position ] ] ; ob_start ( ) ; return $ this ; } | start capturing an event to bind |
58,461 | public function actionGenerate ( ) { $ tableName = Enter :: display ( 'Enter table name' ) ; $ className = MigrationHelper :: generateByTableName ( $ tableName ) ; Output :: block ( $ className , 'Migration created!' ) ; } | Generate migration with columns and foreign keys |
58,462 | protected function cleanZendType ( ? string $ type ) : ? string { if ( ! $ type || strtolower ( $ type ) == 'null' ) { return null ; } if ( strtolower ( $ type ) == 'array' ) { return 'array' ; } if ( strpos ( '\\' , $ type ) ) { return '\\' . $ type ; } return $ type ; } | Clean data types for zend generator |
58,463 | public function created ( $ item = null , $ transformer , $ status = 201 ) { if ( ! $ item || $ transformer ) return $ this -> respond ( null , $ status ) ; return $ this -> item ( $ item , $ transformer , $ status ) ; } | Respond without a comment or respond with data |
58,464 | public function add ( $ key , $ value , $ override = false ) { if ( $ override || ! isset ( $ this -> _data [ $ key ] ) ) { $ this -> _data [ $ key ] = $ value ; } } | Adds data to the response . |
58,465 | public function addArray ( $ array , $ override ) { foreach ( $ array as $ key => $ value ) { $ this -> add ( $ key , $ value , $ override ) ; } } | Adds an array of data to the response . |
58,466 | public function success ( $ message = null , $ data = array ( ) , $ return = false ) { if ( ! empty ( $ data ) ) { foreach ( $ data as $ key => $ value ) { $ this -> add ( $ key , $ value ) ; } } $ json = $ this -> jsonEncode ( array ( 'success' => true , 'message' => $ message , 'data' => $ this -> _data , ) ) ; if ( ... | Outputs the JSON for AJAX success . |
58,467 | public function error ( $ message , $ return = false ) { $ json = $ this -> jsonEncode ( array ( 'error' => true , 'message' => $ message , ) ) ; if ( ! $ return ) { echo $ json ; Yii :: app ( ) -> end ( ) ; } else { return $ json ; } } | Outputs the JSON for AJAX error . |
58,468 | private function getAttr ( \ DOMNode $ node , $ attr , $ default = null ) { $ attr = $ node -> attributes -> getNamedItem ( $ attr ) ; return isset ( $ attr ) ? $ attr -> nodeValue : $ default ; } | Safely get an attribute value . |
58,469 | protected function getValue ( $ key ) { if ( isset ( $ key [ 0 ] ) && $ key [ 0 ] === self :: CONST_PREFIX ) { return substr ( $ key , 1 ) ; } $ data = $ this -> object ; foreach ( explode ( '.' , $ key ) as $ step ) { if ( is_array ( $ data ) ) { $ data = $ data [ $ step ] ; } else { $ data = $ data -> $ step ; } } re... | Get value for node or attribute . |
58,470 | public function getTemplateNamesForFilename ( $ filename ) { $ map = $ this -> getMap ( ) ; $ matching = array_filter ( array_keys ( $ map ) , function ( $ path ) use ( $ filename ) { return $ filename [ 0 ] === $ path [ 0 ] && 0 === strpos ( $ filename , $ path ) ; } ) ; $ templateNames = [ ] ; foreach ( $ matching as... | Lookup the possible twig names that correspond with a given filename . |
58,471 | public function build ( ) { $ this -> debug -> groupCollapsed ( __METHOD__ ) ; $ str = '' ; $ strFunctions = '' ; $ strListen = '' ; $ strOnload = '' ; $ trigs = $ this -> getTriggers ( ) ; $ this -> debug -> log ( 'trigs' , $ trigs ) ; foreach ( $ trigs as $ trigName => $ trig ) { $ strFunc = $ this -> buildOnChangeFu... | Build form form - specific javascript Script updates require attribute if req is dependant on other fields |
58,472 | private function buildIsReq ( $ strJs , $ trigField ) { $ trigName = $ trigField -> attribs [ 'name' ] ; $ strJs = \ str_replace ( '{{' . $ trigName . '}}' , 'val' , $ strJs ) ; $ strJs = \ preg_replace_callback ( $ this -> regExOther , array ( $ this , 'replaceOther' ) , $ strJs ) ; $ strJs = \ preg_replace_callback (... | Buiild isRequired script for given trigger field |
58,473 | private function getFieldsWithName ( $ name ) { $ trigFields = array ( ) ; $ fields = & $ this -> form -> currentFields ; if ( isset ( $ fields [ $ name ] ) ) { $ trigFields [ ] = $ fields [ $ name ] ; } else { foreach ( $ fields as $ f ) { if ( $ f -> attribs [ 'name' ] == $ name ) { $ trigFields [ ] = $ f ; } } } ret... | Get all form fields having given name |
58,474 | public function resolveQuery ( array $ toResolve , QueryService $ query ) { foreach ( $ toResolve as $ field => $ valueExpression ) { if ( ! is_a ( $ valueExpression , ValueExpression :: class ) ) { throw QueryException :: queryParseErrorException ( ) ; } $ method = sprintf ( "query%s" , ucfirst ( camel_case ( $ field ... | Resolve unfinished queries |
58,475 | protected function getAllowedQueryParameters ( ) { $ queryParameters = QueryService :: getDefaultQueryParameters ( ) ; $ customParameters = $ this -> getCustomQueryParameters ( ) ; if ( is_array ( $ customParameters ) && count ( $ customParameters ) > 0 ) { $ queryParameters = array_merge ( $ queryParameters , $ custom... | Get the query parameters for the current controller |
58,476 | public function context ( string $ prefix , $ invoker ) { if ( ! $ invoker instanceof \ Closure ) { throw new \ InvalidArgumentException ( 'Context invoker must be instance of Closure.' ) ; } $ this -> currentContext -> addSubContext ( $ prefix , $ invoker ) ; return $ this ; } | Adds a new routing context |
58,477 | public function get ( string $ path , $ handler ) { return $ this -> request ( $ path , Request :: HTTP_GET | Request :: HTTP_HEAD , $ handler ) ; } | Adds a new route with given path to the current context that accepts GET and HEAD requests . |
58,478 | public function post ( string $ path , $ handler ) { return $ this -> request ( $ path , Request :: HTTP_POST , $ handler ) ; } | Adds a new route with given path to the current context that accepts POST requests . |
58,479 | public function put ( string $ path , $ handler ) { return $ this -> request ( $ path , Request :: HTTP_PUT , $ handler ) ; } | Adds a new route with given path to the current context that accepts PUT requests . |
58,480 | public function patch ( string $ path , $ handler ) { return $ this -> request ( $ path , Request :: HTTP_PATCH , $ handler ) ; } | Adds a new route with given path to the current context that accepts PATCH requests . |
58,481 | public function delete ( string $ path , $ handler ) { return $ this -> request ( $ path , Request :: HTTP_DELETE , $ handler ) ; } | Adds a new route with given path to the current context that accepts DELETE requests . |
58,482 | public function any ( string $ path , $ handler ) { return $ this -> request ( $ path , Request :: HTTP_ALL , $ handler ) ; } | Adds a new route with given path to the current context that accepts all requests . |
58,483 | public function validate ( string $ name , string $ pattern ) { $ this -> currentContext -> addPattern ( $ name , $ pattern ) ; return $ this ; } | Sets a global variable pattern for the given name . |
58,484 | private function resultToResponse ( $ result ) : Response { switch ( true ) { case $ result instanceof Response : return $ result ; case is_string ( $ result ) || is_numeric ( $ result ) : return new Response ( $ result ) ; case $ result instanceof Uri : return new RedirectResponse ( $ uri ) ; case is_array ( $ result ... | Transforms any skalar handler result to a Everest \ Http \ Response object |
58,485 | public function execute ( ) { $ query = $ this -> factory -> builder ( $ this -> update ) -> process ( ) ; $ result = $ this -> pdo -> query ( $ query ) ; if ( ! $ result ) { throw new \ Exception ( 'An error while updating is occurred' ) ; } } | Execute the query and update the expected entries in the database . |
58,486 | protected function parseData ( $ data ) { if ( is_scalar ( $ data ) ) { return $ data ; } if ( $ data instanceof Serializable ) { $ data = $ data -> ayeAyeSerialize ( ) ; } elseif ( $ data instanceof \ JsonSerializable ) { $ data = $ data -> jsonSerialize ( ) ; } elseif ( ! is_array ( $ data ) ) { $ data = ( array ) $ ... | Recursively turn data into arrays for output . This method is used to make sure only desired data is output from objects . AyeAye \ Formatters \ Serializable takes precedence over JsonSerializable everything else is cast straight to array |
58,487 | public function content ( ) { $ out = [ 'content' => [ ] ] ; foreach ( $ this -> _contentAreas as $ contentArea ) { $ out [ 'content' ] [ ] = $ contentArea -> toArray ( ) ; } return $ out ; } | Construct the default content for this layout consisting of the defined content areas . By default these content areas hold no other content and are used by the page builder . |
58,488 | protected function _extractId ( ) { list ( , $ className ) = namespaceSplit ( get_class ( $ this ) ) ; $ id = explode ( 'Layout' , $ className ) [ 0 ] ; if ( ! $ className || ! $ id ) { user_error ( __d ( 'wasabi_cms' , 'The layout Class {0} has an invalid name. The name has to end with "Layout".' , $ className ) ) ; }... | Extract the lower cased id from the layout class name . |
58,489 | public static function makeComplexSortFunction ( $ sortFnArr , $ index = 0 ) { if ( isset ( $ sortFnArr [ $ index ] ) ) { $ fn1 = $ sortFnArr [ $ index ] ; } else { throw new InvalidArgumentException ( 'First argument must be an array conatining at least one callable' ) ; } $ fn2 = null ; if ( isset ( $ sortFnArr [ $ i... | Given an ordered array of comparison functions return one function that starts with the first and uses the subsequent functions in order in the event of equal items . |
58,490 | private static function makeChainedSortFunction ( $ fn1 , $ fn2 ) { if ( ! is_callable ( $ fn2 ) ) { return $ fn1 ; } return function ( $ a , $ b ) use ( $ fn1 , $ fn2 ) { $ comp = $ fn1 ( $ a , $ b ) ; if ( $ comp !== 0 ) { return $ comp ; } return $ fn2 ( $ a , $ b ) ; } ; } | Given two comparison functions return a comparison function that uses the first unless it evaluates as equal then uses the second . |
58,491 | private function expandPath ( $ path ) { if ( 0 === strspn ( $ path , '\\/' , 0 , 1 ) || null === parse_url ( $ path , PHP_URL_PATH ) ) { $ path = $ this -> cwd . DIRECTORY_SEPARATOR . $ path ; } return realpath ( $ path ) ; } | Expands a path to full path . |
58,492 | public static function dispatch ( ) { if ( is_null ( self :: $ route ) ) die ( Utils :: colorize ( "No console route found" , 'FAILURE' ) ) ; $ segments = explode ( '@' , self :: $ route ) ; $ controller = $ segments [ 0 ] ; $ action = $ segments [ 1 ] . 'Action' ; $ object = new $ controller ( ) ; if ( ! method_exists... | Console route dispatcher |
58,493 | public function scopeKey ( Illuminate \ Database \ Query \ Builder $ query , $ key ) { return $ query -> whereKey ( $ key ) ; } | Look up by key |
58,494 | public function setIndent ( $ spacesNum ) { if ( $ spacesNum ) { $ this -> writer -> setIndent ( true ) ; $ this -> writer -> setIndentString ( str_repeat ( ' ' , ( int ) $ spacesNum ) ) ; } else { $ this -> writer -> setIndent ( false ) ; } return $ this ; } | Sets number of spaces uses for indentation . Set 0 to disable indentation . |
58,495 | public function get ( $ name ) { if ( ! isset ( $ this -> permissions [ $ name ] ) ) { throw new InvalidArgumentException ( "Permissions $name for type $objectType not found." ) ; } return $ this -> permissions [ $ name ] ; } | Return permissions . |
58,496 | public function getSynthesize ( ) { if ( ! $ this -> _objSynthesize instanceof Synthesize ) { $ this -> _objSynthesize = $ this -> _createSynthesize ( ) ; } return $ this -> _objSynthesize ; } | Get Synthesize Method |
58,497 | private function _createSynthesize ( $ mixSynthesize = null ) { if ( $ mixSynthesize ) { $ this -> _mixSynthesizeOptions = $ mixSynthesize ; } else { if ( ! empty ( $ this -> arrSynthesize ) ) { $ this -> _mixSynthesizeOptions = $ this -> arrSynthesize ; } else if ( isset ( $ this -> mixSynthesize ) ) { $ this -> _mixS... | Create Synthesize Method |
58,498 | private function _loadOptionsFromFile ( $ strFileName ) { $ objReflector = new \ ReflectionClass ( $ this ) ; $ strFileName = dirname ( $ objReflector -> getFileName ( ) ) . '/' . $ strFileName . '.json' ; if ( file_exists ( $ strFileName ) ) { return file_get_contents ( $ strFileName ) ; } throw new MissingOptionsFile... | Load Options From File Method |
58,499 | public function createRequest ( $ method , $ uri ) { if ( is_string ( $ uri ) ) { $ uri = ( new UriFactory ( ) ) -> createUri ( $ uri ) ; } return new Request ( $ method , $ uri ) ; } | Create a new request |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.