idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
53,500 | public function findAllExcept ( array $ excludedUser ) { $ dql = ' SELECT u FROM Claroline\CoreBundle\Entity\User u WHERE u NOT IN (:userIds) AND u.isRemoved = false ' ; $ query = $ this -> _em -> createQuery ( $ dql ) ; $ query -> setParameter ( 'userIds' , $ excludedUser ) ; re... | Returns all the users except a given one . |
53,501 | public function findByWorkspaceWithUsersFromGroup ( Workspace $ workspace , $ executeQuery = true ) { $ dql = ' SELECT u FROM Claroline\CoreBundle\Entity\User u JOIN u.roles ur LEFT JOIN u.groups g LEFT JOIN g.roles gr LEFT JOIN gr.workspace grws ... | Returns the users who are members of one of the given workspaces . Users s groups ARE taken into account . |
53,502 | public function updateProgressionAction ( Step $ step , User $ user , Request $ request ) { $ node = $ step -> getPath ( ) -> getResourceNode ( ) ; if ( ! $ this -> authorization -> isGranted ( 'OPEN' , new ResourceCollection ( [ $ node ] ) ) ) { throw new AccessDeniedException ( 'Operation "OPEN" cannot be done on obj... | Update step progression for an user . |
53,503 | public function getSelection ( $ uuid ) { foreach ( $ this -> selections as $ selection ) { if ( $ selection -> getUuid ( ) === $ uuid ) { return $ selection ; } } } | Retrieves a selection by its uuid . |
53,504 | public function addSelection ( Selection $ selection ) { if ( ! $ this -> selections -> contains ( $ selection ) ) { $ this -> selections -> add ( $ selection ) ; $ selection -> setInteractionSelection ( $ this ) ; } } | Adds a selection . |
53,505 | public function removeSelection ( Selection $ selection ) { if ( $ this -> selections -> contains ( $ selection ) ) { $ this -> selections -> removeElement ( $ selection ) ; } } | Removes a selection . |
53,506 | public function getColor ( $ uuid ) { foreach ( $ this -> colors as $ color ) { if ( $ color -> getUuid ( ) === $ uuid ) { return $ color ; } } } | Retrieves a color by its uuid . |
53,507 | public function addColor ( Color $ color ) { if ( ! $ this -> colors -> contains ( $ color ) ) { $ this -> colors -> add ( $ color ) ; $ color -> setInteractionSelection ( $ this ) ; } } | Adds a color . |
53,508 | public function removeColor ( Color $ color ) { if ( $ this -> colors -> contains ( $ color ) ) { $ this -> colors -> removeElement ( $ color ) ; } } | Removes a color . |
53,509 | public function findDisplayedByRolesAndWorkspace ( array $ roles , Workspace $ workspace , $ orderedToolType = 0 ) { if ( count ( $ roles ) === 0 ) { return array ( ) ; } else { $ isAdmin = false ; foreach ( $ roles as $ role ) { if ( $ role === 'ROLE_ADMIN' || $ role === 'ROLE_WS_MANAGER_' . $ workspace -> getGuid ( )... | Returns the workspace tools visible by a set of roles . |
53,510 | public function findDisplayedToolsByWorkspace ( Workspace $ workspace , $ orderedToolType = 0 ) { $ dql = ' SELECT tool FROM Claroline\CoreBundle\Entity\Tool\Tool tool LEFT JOIN tool.plugin p JOIN tool.orderedTools ot JOIN ot.workspace ws WHERE ws = :wor... | Returns the visible tools in a workspace . |
53,511 | public function countDisplayedToolsByWorkspace ( Workspace $ workspace , $ orderedToolType = 0 ) { $ dql = " SELECT count(tool) FROM Claroline\CoreBundle\Entity\Tool\Tool tool JOIN tool.orderedTools ot JOIN ot.workspace ws LEFT JOIN tool.plugin p WHERE w... | Returns the number of tools visible in a workspace . |
53,512 | public function setValue ( $ value ) { if ( ! $ this -> isValid ( $ value ) ) { throw new \ UnexpectedValueException ( "Value '$value' is not part of the enum " . get_called_class ( ) ) ; } $ this -> value = $ value ; } | Tries to set the value of this enum . |
53,513 | public function InSection ( $ sectionName ) { $ page = Director :: get_current_page ( ) ; while ( $ page ) { if ( $ sectionName == $ page -> URLSegment ) return true ; $ page = $ page -> Parent ; } return false ; } | Check if this page is in the given current section . |
53,514 | protected function sameFilesystemAction ( $ from , $ to , $ action = 'copy' ) { $ obj = $ this -> path ( $ from ) ; $ res = $ obj -> { $ action } ( $ this -> path ( $ to ) -> getPath ( ) ) ; $ this -> copyError ( $ obj ) ; return $ res ; } | Copy or rename |
53,515 | protected function diffFilesystemCopy ( $ from , $ to ) { $ content = $ this -> get ( $ from ) ; if ( is_null ( $ content ) ) { return false ; } elseif ( is_array ( $ content ) ) { return $ this -> copyDir ( $ content , $ to ) ; } else { if ( $ this -> path ( $ to ) -> isDir ( ) ) { $ to = $ this -> mergePath ( $ to , ... | Copy between different filesystem |
53,516 | protected function isSameFilesystem ( $ path1 , $ path2 ) { return $ this -> path ( $ path1 ) -> getFilesystem ( ) === $ this -> path ( $ path2 ) -> getFilesystem ( ) ; } | Exists on same filesystem ? |
53,517 | protected function copyDir ( array $ paths , $ destination ) { foreach ( $ paths as $ path ) { $ dest = $ this -> mergePath ( $ destination , basename ( $ path ) ) ; if ( ! $ this -> copy ( $ path , $ dest ) ) { return false ; } } return true ; } | Copy an array of paths to destination |
53,518 | protected function prependMountPoint ( array $ paths , $ mountPoint ) { $ res = [ ] ; foreach ( $ paths as $ p ) { $ res [ ] = $ this -> mergePath ( $ mountPoint , $ p ) ; } return $ res ; } | Prepend mount point prefix to the array of paths |
53,519 | public function setFailConnectionFailed ( bool $ fail_connection_failed = true ) : void { $ this -> is_connected = false ; $ this -> fail_connection_failed = $ fail_connection_failed ; } | Testing method - set that the connection failed to test error handling . Set this before attempting the query . |
53,520 | public function setFailQueryFailed ( bool $ fail_query_failed = true ) : void { $ this -> query_succeeded = false ; $ this -> fail_query_failed = $ fail_query_failed ; } | Testing method - set that the query failed to test error handling . Set this before attempting the query . |
53,521 | public function isValid ( ) : bool { if ( false === $ this -> validated ) { $ this -> validate ( ) ; } return ( count ( $ this -> validation_errors ) === 0 ) ; } | This is the opposite of the hasErrors method |
53,522 | public function hasErrors ( ) : bool { if ( false === $ this -> validated ) { $ this -> validate ( ) ; } return ( count ( $ this -> validation_errors ) > 0 ) ; } | This is the opposite of the isValid method |
53,523 | public function getErrorMessages ( ) : array { $ errors = $ this -> getErrors ( true ) ; $ return = array ( ) ; foreach ( $ errors as $ error ) { $ return [ ] = 'Field: ' . $ error -> getFieldName ( ) . '| Message: ' . $ error -> getErrorMessage ( ) ; } return $ return ; } | Returns an array of error messages intended to be displayed in a list . |
53,524 | public function isFieldValid ( string $ field_name ) : bool { if ( false === $ this -> validated ) { $ this -> validate ( ) ; } return ( false === $ this -> getErrorByFieldName ( $ field_name ) ) ; } | Check if a specific field is valid . |
53,525 | public function getFieldValue ( string $ field_name ) { if ( false === $ this -> validated ) { $ this -> validate ( ) ; } foreach ( $ this -> validators as $ validator ) { if ( $ validator -> getFieldName ( ) == $ field_name ) { return $ validator -> getValue ( ) ; } } throw new InvalidInputException ( 'A field called ... | Get the value associated with the field . If the field was not valid returns null . |
53,526 | private function parseRequestValueExpression ( string $ expression , RequestInterface $ request ) : string { $ expression = preg_replace_callback ( '/(\$\w+)/' , function ( $ matches ) use ( $ request ) { $ variable = $ request -> get ( substr ( $ matches [ 1 ] , 1 ) ) ; if ( is_array ( $ variable ) || is_object ( $ va... | Parse request value with expression . |
53,527 | public function add ( $ files , $ string = false ) { if ( true === $ this -> _enabled ) { if ( Arrays :: is ( $ files ) ) { foreach ( $ files as $ file ) { $ this -> _addFile ( ( string ) $ file ) ; } } else { if ( ! empty ( $ string ) && is_string ( $ string ) ) { return $ this -> _zip -> addFromString ( $ files , $ s... | Add file to the archive |
53,528 | public function contents ( ) { if ( true === $ this -> _enabled ) { for ( $ i = 0 ; $ i < $ this -> _zip -> numFiles ; ++ $ i ) { $ this -> _contents [ $ i ] = $ this -> _zip -> statIndex ( $ i ) ; $ comment = $ this -> _zip -> getCommentIndex ( $ i ) ; if ( $ comment ) { $ this -> _contents [ $ i ] [ 'comment' ] = $ c... | Get archive contents |
53,529 | public function delete ( $ filename ) { if ( true === $ this -> _enabled && ! empty ( $ filename ) ) { $ index = $ this -> _zip -> locateName ( $ filename , \ ZipArchive :: FL_NODIR ) ; if ( $ index ) { return $ this -> deleteIndex ( ( int ) $ index ) ; } } return false ; } | Delete file from archive |
53,530 | protected function saveRules ( ) { $ rules = [ ] ; foreach ( $ this -> rules as $ name => $ rule ) { $ rules [ $ name ] = serialize ( $ rule ) ; } DiscHelper :: saveToFile ( $ rules , $ this -> ruleFile ) ; $ this -> domain -> const -> generateAll ( ) ; } | Saves rules data into persistent storage . |
53,531 | public function onAfterWrite ( ) { parent :: onAfterWrite ( ) ; if ( ! $ this -> getOwner ( ) -> Contact ( ) -> exists ( ) ) { $ sync = Config :: inst ( ) -> get ( Contact :: class , 'sync_fields' ) ; $ contact = Contact :: create ( ) ; foreach ( $ sync as $ field ) { $ contact -> $ field = $ this -> getOwner ( ) -> $ ... | If no contact exists for this account then create one |
53,532 | public function getLog ( $ index = null ) { if ( is_null ( $ index ) ) { return $ this -> log ; } return $ this -> log [ $ index ] ; } | Return the log array . |
53,533 | public function client ( $ alias ) { if ( is_int ( $ alias ) && isset ( $ this -> clients [ $ alias ] ) ) { return $ this -> clients [ $ alias ] ; } elseif ( isset ( $ this -> aliases [ $ alias ] ) ) { return $ this -> aliases [ $ alias ] ; } throw new Exception ( "Client $alias does not exist." ) ; } | Get a client by index or alias . |
53,534 | public function all ( ) { $ args = func_get_args ( ) ; $ name = array_shift ( $ args ) ; $ results = array ( ) ; foreach ( $ this -> clients as $ client ) { $ results [ ] = call_user_func_array ( [ $ client , $ name ] , $ args ) ; } return $ results ; } | Execute a command on all clients |
53,535 | public function hash ( $ key ) { $ needle = hexdec ( substr ( md5 ( $ key ) , 0 , 7 ) ) ; $ server = $ min = 0 ; $ max = count ( $ this -> nodes ) - 1 ; while ( $ max >= $ min ) { $ position = ( int ) ( ( $ min + $ max ) / 2 ) ; $ server = $ this -> nodes [ $ position ] ; if ( $ needle < $ server ) { $ max = $ position... | Get client index for a key by searching ring with binary search |
53,536 | public static function instance ( ) : StringSyntax { if ( self :: $ instance === null ) self :: $ instance = new StringSyntax ; return self :: $ instance ; } | Returns the StringSyntax instance . |
53,537 | public static function prepare ( ) { $ orgArgs = func_get_args ( ) ; if ( count ( $ orgArgs ) < 2 ) { throw new \ BadMethodCallException ( 'Func::prepare requires at least two arguments. First should be the function to prepare followed by arguments for that function' ) ; } $ func = array_shift ( $ orgArgs ) ; return fu... | Initializes method of Func passed as first argument with provided arguments . Pass null for arguments that you wanna skip even when you wanna skip the last argument! |
53,538 | public static function call ( $ func , array $ args ) { switch ( $ func ) { case 'map' : if ( count ( $ args ) != 2 ) throw new \ BadMethodCallException ( "Wrong parameter count for method Func::map" ) ; return self :: map ( $ args [ 0 ] , $ args [ 1 ] ) ; case 'premap' : if ( count ( $ args ) != 2 ) throw new \ BadMet... | Calls a method of Func with arguments provided as array |
53,539 | public static function manipulate ( Payload $ payload , $ callback ) { self :: assert_callable ( $ callback ) ; $ payload -> replaceData ( $ callback ( $ payload -> extractTypeData ( ) ) ) ; return $ payload ; } | Extracts data from payload passes it to callback and overrides payload data with result |
53,540 | public static function isKeyWithElements ( $ array , $ key ) { if ( false === is_array ( $ array ) || false === isset ( $ array [ $ key ] ) ) { return false ; } if ( false === is_array ( $ array [ $ key ] ) ) { return false ; } if ( 0 === count ( $ array [ $ key ] ) ) { return false ; } return true ; } | Does given array has array with elements for key? |
53,541 | public static function getFlat ( $ input , $ glue = ',' ) { if ( false === is_array ( $ input ) ) { return $ input ; } $ result = [ ] ; foreach ( $ input as $ inputKey => $ inputText ) { if ( true === is_numeric ( $ inputKey ) ) { $ result [ ] = self :: getFlat ( $ inputText , $ glue ) ; } $ result [ ] = sprintf ( '%s:... | Get Multidimensional - Array as string |
53,542 | protected function getLogAsObject ( $ level , $ message ) { $ log = new Entity ; $ log -> level = $ level ; $ log -> datetime = date ( 'Y-m-d H:i:s' ) ; if ( preg_match ( '/^(\[([^\]]+)\]\s)?(.+)/' , $ message , $ matches ) ) { if ( ! empty ( $ matches [ 2 ] ) ) { $ log -> exception = $ matches [ 2 ] ; } $ log -> messa... | Gets the log as an object . It splits the log information from the message using regex |
53,543 | protected function checkPermissionMask ( $ selfError , $ exists , $ pathname , $ mask ) { return ! ( ! $ selfError && ! $ exists && ! chmod ( $ pathname , ( int ) $ mask ) ) ; } | Internal method to check the permission mask . Useful only for obtaining a stub method |
53,544 | public function is_valid ( ) { $ ret = false ; if ( is_null ( $ this -> maxRecipients ) === false && is_null ( $ this -> priority ) === false && is_null ( $ this -> compileBeforeDeliveryStart ) === false && is_null ( $ this -> allowMultipleDeliveries ) === false && is_null ( $ this -> deliverImmediately ) === false && ... | Validates a scheduling |
53,545 | protected function dnsResolutionIsOk ( $ domain = null , $ ip = null ) { if ( $ this -> dnsAlreadyResolved ) { return true ; } $ domain = $ domain ? $ domain : $ this -> obtainDomain ( ) ; $ ip = $ ip ? $ ip : $ this -> obtainIp ( ) ; if ( $ domain != null && $ ip != null ) { $ resolved_ip = gethostbyname ( $ domain ) ... | Check if DNS is already configured . |
53,546 | public static function toBytes ( String $ data ) : Float { $ number = substr ( $ data , 0 , - 2 ) ; switch ( strtoupper ( substr ( $ data , - 2 ) ) ) { case 'KB' : return $ number * 1024 ; case 'MB' : return $ number * pow ( 1024 , 2 ) ; case 'GB' : return $ number * pow ( 1024 , 3 ) ; case 'TB' : return $ number * pow... | Convert string to bytes . |
53,547 | public static function highLight ( String $ str , Array $ settings = [ ] ) : String { return Helper :: highLight ( $ str , $ settings ) ; } | Convert high lightin |
53,548 | public static function accent ( String $ str ) : String { $ accent = array_merge ( Config :: get ( 'Expressions' , 'accentChars' ) ? : [ ] , self :: $ accentChars ) ; $ accent = Datatype :: multikey ( $ accent ) ; return str_replace ( array_keys ( $ accent ) , array_values ( $ accent ) , $ str ) ; } | Converter Accent Char |
53,549 | public static function toConstant ( String $ var , String $ prefix = NULL , String $ suffix = NULL ) { return Helper :: toConstant ( $ var , $ prefix , $ suffix ) ; } | Convert to constant |
53,550 | protected static function objectRecursive ( Array $ array , stdClass & $ std ) : stdClass { foreach ( $ array as $ key => $ value ) { if ( is_array ( $ value ) ) { $ std -> $ key = new stdClass ; self :: objectRecursive ( $ value , $ std -> $ key ) ; } else { $ std -> $ key = $ value ; } } return $ std ; } | Protected Object Recursive |
53,551 | public function doViewContent ( ) { $ this -> setDefaultResponseGroups ( array ( self :: VIEWCONTENT_RESPONSEGROUP_METADATA ) ) ; $ isNodeRequested = false ; if ( isset ( $ this -> nodeId ) ) { $ content = ezpContent :: fromNodeId ( $ this -> nodeId ) ; $ isNodeRequested = true ; } else if ( isset ( $ this -> objectId ... | Handles content requests per node or object ID |
53,552 | public function loadProperty ( $ prop ) { if ( $ prop -> isPrimaryKey ( ) ) { $ this -> setPrimaryKey ( $ prop ) ; } else if ( $ prop -> isProperty ( ) ) { $ this -> properties [ ] = $ prop ; if ( $ prop -> isIndexed ( ) ) { $ this -> indexedProperties [ ] = $ prop ; } } } | Loads a property into this graph element . |
53,553 | function findProperty ( $ name ) { $ property = Reflection :: getProperty ( $ name ) ; foreach ( $ this -> properties as $ p ) { if ( $ p -> matches ( $ property ) ) { return $ p ; } } return null ; } | Finds property by method name . |
53,554 | public function provides ( $ consumer ) { $ file = $ this -> getConfigFilePath ( ) ; $ routes = $ this -> config -> get ( 'routes' ) ; if ( is_null ( $ routes ) ) { return ; } foreach ( $ routes as $ name => $ route ) { if ( ! isset ( $ route [ 'path' ] ) ) { throw new RuntimeException ( 'no "path" in route "' . $ name... | Configure the http dispatcher with routes defined in a config file . |
53,555 | function getCounterKey ( $ username ) { $ k = $ this -> app [ 'config' ] -> get ( 'cache.namespace' ) ; $ k .= ':failed_login_counter.' ; $ k .= $ username ; return $ k ; } | Gets the key of the failed login counter in Redis for a given username . |
53,556 | protected function bootstrapColumn ( $ content , $ match ) { $ parts = $ this -> getGridsystemColumMethodParts ( $ match ) ; $ this -> bootstrapGridsystemCol .= $ this -> class ( $ this -> getGridsytemColumnClass ( $ parts ) ) -> div ( $ content ) ; $ this -> bootstrapGridsystemColumnCount += ( int ) $ parts [ 'number'... | Protected bootstrap column |
53,557 | public function getRemoteAddr ( $ ipToLong = false ) { if ( is_null ( $ this -> _remoteAddr ) ) { $ headers = $ this -> getRemoteAddrHeaders ( ) ; foreach ( $ headers as $ var ) { if ( $ this -> _getRequest ( ) -> getServer ( $ var , false ) ) { $ ip_array = explode ( ',' , $ this -> _getRequest ( ) -> getServer ( $ va... | Retrieve Client Remote Address |
53,558 | private function ip_is_private ( $ ip ) { $ privateAddresses = [ '10.0.0.0|10.255.255.255' , '172.16.0.0|172.31.255.255' , '192.168.0.0|192.168.255.255' , '169.254.0.0|169.254.255.255' , '127.0.0.0|127.255.255.255' ] ; $ long_ip = ip2long ( $ ip ) ; if ( $ long_ip != - 1 ) { foreach ( $ privateAddresses as $ pri_addr )... | Determine if IP Address is of a private subnet |
53,559 | public function attributes ( array $ attr ) { $ attr_string = '' ; foreach ( $ attr as $ name => $ value ) { if ( is_array ( $ value ) ) { $ attr_string .= ' ' . $ name . '="' . implode ( ' ' , $ value ) . '"' ; } else { $ attr_string .= ' ' . $ name . '="' . $ value . '"' ; } } return $ attr_string ; } | This function builds attributes for html elements ex . id = name . |
53,560 | public function getInputType ( $ input , $ old_input = null , $ edit = false ) { $ input = ! empty ( $ old_input ) ? $ old_input : $ input ; if ( ( stripos ( $ input , 'id' ) !== false | stripos ( $ input , '_id' ) !== false ) & stripos ( $ input , 'uuid' ) === false ) { return 'relationship' ; } elseif ( ( stripos ( $... | This function uses naming conventions to determine what a fillable attribute might be . |
53,561 | public function getRelationalDataAndModels ( $ model , $ desired_relation ) { $ relation = $ this -> trimCommonRelationEndings ( $ desired_relation ) ; if ( method_exists ( $ model , $ relation ) ) { return $ this -> getResolvedRelationship ( $ model , $ relation ) ; } elseif ( method_exists ( $ model , $ relation . 's... | This should get the realtions of the given model and . |
53,562 | protected function getResolvedRelationship ( $ model , $ desired_relation , $ singleRelations = [ BelongsTo :: class , HasOne :: class , MorphTo :: class , MorphOne :: class , ] , $ multiRelations = [ HasMany :: class , BelongsToMany :: class , MorphMany :: class , MorphToMany :: class , ] ) { $ relation_class = get_cl... | This will see if the desired relation is a relation . |
53,563 | protected function in_array ( $ needle , $ haystack ) { return count ( array_filter ( $ haystack , function ( $ hay ) use ( $ needle ) { return $ hay === $ needle ; } ) ) > 0 ; } | Check if an item is actually in an array . |
53,564 | public function spitOutHtmlForModelInputToConsume ( $ type , $ input ) { if ( $ type === 'select' ) { return $ this -> select ( [ 'default_text' => 'Please select a ' . trim ( $ input , '_id' ) , 'type' => $ type , 'name' => $ input , ] , [ false => 'No' , true => 'Yes' , ] ) ; } elseif ( in_array ( $ type , [ 'text' ,... | This should ... |
53,565 | public function setName ( $ sName ) { if ( ! empty ( $ sName ) ) { if ( ! is_numeric ( $ sName ) ) { @ session_name ( $ sName ) ; } else { throw new Exception ( 'The session name can\'t consist only of digits, ' . 'at least one letter must be presented.' ) ; } } else { throw new Exception ( 'Empty session name value wa... | The method sets the name of current session . |
53,566 | public function start ( $ sSessName = null , $ iSess = null ) { if ( ! $ this -> isStarted ( ) ) { if ( ! is_null ( $ sSessName ) ) { $ this -> setName ( $ sSessName ) ; } @ session_start ( $ iSess ) ; } ; return $ this -> getId ( ) ; } | It inits the data of new session or continues the current session . |
53,567 | public function getAll ( ) { $ aRes = array ( ) ; foreach ( $ this -> getKeys ( ) as $ sKey ) { $ aRes [ $ sKey ] = $ this -> get ( $ sKey ) ; } return $ aRes ; } | It returns all session variables as associative array . |
53,568 | public function remove ( $ sKey ) { if ( $ this -> contains ( $ sKey ) ) { $ mRes = $ _SESSION [ $ sKey ] ; unset ( $ _SESSION [ $ sKey ] ) ; return $ mRes ; } else { return null ; } } | It removes the variable of session by passed key . |
53,569 | public function removeAll ( ) { $ aRes = array ( ) ; foreach ( $ this -> getKeys ( ) as $ sKey ) { $ aRes [ $ sKey ] = $ this -> remove ( $ sKey ) ; } return $ aRes ; } | It clears the session by removing all stored variables . |
53,570 | public function getStorePath ( ) { if ( is_null ( $ this -> _storePath ) ) { $ this -> _storePath = $ this -> _organizer -> getUploadStorePath ( ) ; } return $ this -> _storePath ; } | generate file path in time |
53,571 | public function getExtensions ( $ key ) { if ( $ this -> extensions -> has ( $ key ) ) { return $ this -> extensions -> get ( $ key ) ; } return [ ] ; } | Returns the extension for the given key |
53,572 | public function getExtensionsByPackage ( $ key , $ packageName ) { if ( $ this -> packages -> has ( $ packageName ) ) { $ pkg = $ this -> packages -> get ( $ packageName ) ; if ( $ pkg -> has ( $ key ) ) { return $ pkg -> get ( $ key ) ; } } return [ ] ; } | Returns the extension for the given key by a given packageName |
53,573 | public function optionExpectsValue ( $ key ) { $ spec_data = $ this -> getOptionDataByOptionKey ( ) ; if ( ! isset ( $ spec_data [ $ key ] ) ) { return false ; } return strlen ( $ spec_data [ $ key ] [ 'value_name' ] ) ? true : false ; } | returns true if the option expects a value |
53,574 | public function normalizeOptionName ( $ key ) { if ( $ key === null ) { return null ; } $ map = $ this -> getNormAlizedOptiOnnameMap ( ) ; return isset ( $ map [ $ key ] ) ? $ map [ $ key ] : null ; } | returns the normalized option name |
53,575 | protected function getOptionDataByOptionKey ( ) { if ( ! isset ( $ this -> option_data_by_name ) ) { $ this -> option_data_by_name = array ( ) ; foreach ( $ this -> argument_spec_data [ 'options' ] as $ argument_spec ) { if ( strlen ( $ argument_spec [ 'short' ] ) ) { $ this -> option_data_by_name [ $ argument_spec [ '... | returns options data mapped to both the long and short option name |
53,576 | protected function getNormalizedOptionNameMap ( ) { if ( ! isset ( $ this -> normalized_option_name_map ) ) { $ this -> normalized_option_name_map = array ( ) ; foreach ( $ this -> argument_spec_data [ 'options' ] as $ argument_spec ) { $ long_name = $ argument_spec [ 'long' ] ; if ( strlen ( $ long_name ) ) { $ this -... | builds option names mapped to their normalized name |
53,577 | protected function maybeRender ( $ content ) { if ( $ content instanceof ViewModel ) { $ content = $ this -> getView ( ) -> render ( $ content ) ; } return ( string ) $ content ; } | Renders a given ViewModel or passes the argument verbatim |
53,578 | protected function getDataAttributes ( ) { $ ret = array ( ) ; $ properties = array ( 'backdrop' , 'keyboard' , 'show' , 'remote' , ) ; foreach ( $ properties as $ property ) { $ value = $ this -> { 'get' . $ property } ( ) ; if ( $ value ) { $ ret [ 'data-' . $ property ] = $ value ; } } return $ ret ; } | Returns data attributes from options |
53,579 | public function getPaginatedRoutes ( $ sort = 'name' , $ perPage = null ) { return $ this -> paginate ( $ this -> getAllRoutes ( $ sort ) , $ perPage ) ; } | Get paginated Routes . |
53,580 | public function paginate ( $ items , $ perPage = null , $ pageName = 'page' , $ page = null ) { if ( is_array ( $ items ) ) { $ items = collect ( $ items ) ; } $ page = $ page ? : Paginator :: resolveCurrentPage ( $ pageName ) ; $ perPage = $ perPage ? : $ items [ 0 ] -> getPerPage ( ) ; $ results = $ items -> forPage ... | Paginate a laravel colletion or array of items . |
53,581 | public function addOption ( string $ value , string $ text ) : FormElement { $ this -> options [ $ value ] = $ text ; return $ this ; } | Add a single value to the list . |
53,582 | public function addBlankOption ( bool $ disabled = false ) : Select { $ this -> addBlank = true ; if ( $ disabled ) $ this -> disabled [ ] = '' ; return $ this ; } | Force a blank option to be added at the top of the pulldown . Optionally pass true to cause that option to not be selectable . |
53,583 | public function validate ( ) : void { if ( null === $ this -> is_valid ) { if ( null === $ this -> user_value && null !== $ this -> default_value ) { $ this -> is_valid = true ; } elseif ( in_array ( $ this -> user_value , array_keys ( $ this -> options ) ) && ! in_array ( $ this -> user_value , $ this -> disabled ) ) ... | Overrides the normal validation to instead make sure the value passed is a value that has been set and the value is not disabled . |
53,584 | public function outputValue ( ) : string { if ( isset ( $ this -> options [ $ this -> getValue ( ) ] ) ) { return '<span class="uneditable-field">' . $ this -> options [ $ this -> getValue ( ) ] . '</span>' ; } else { return '<span class="uneditable-field">' . $ this -> getValue ( ) . '</span>' ; } } | If the field is set to not be editable this will output the value of the form element instead of a form field . |
53,585 | public static function toCamelCase ( $ str , $ firstInLowerCase = false ) { $ str = str_replace ( " " , "" , ucwords ( str_replace ( "_" , " " , $ str ) ) ) ; return $ firstInLowerCase ? lcfirst ( $ str ) : $ str ; } | Converts a underscored string to CamelCase |
53,586 | public function addRouteProvider ( RouteProvider $ provider ) { foreach ( $ provider -> routes ( ) as $ route ) { $ this -> add ( $ route ) ; } } | Registers a new route provider to feed new routes |
53,587 | public function addPattern ( string $ name , string $ regexp ) { $ this -> regexp_map = [ '/\{(\w+):' . $ name . '\}/' => '(?<$1>' . $ regexp . ')' ] + $ this -> regexp_map ; } | Registers a matching pattern for URI parameters . |
53,588 | public function findURI ( string $ name , array $ parameters = [ ] ) { if ( array_key_exists ( $ name , $ this -> route_names ) ) { $ foundUri = $ this -> route_names [ $ name ] ; foreach ( $ parameters as $ parameter => $ value ) { $ foundUri = preg_replace ( "/\{(" . $ parameter . ")(\:\w+)?\}/i" , $ value , $ foundU... | Finds the uri associated with a given name . |
53,589 | public function parse ( string $ method , string $ uri , string $ prefix = "" ) : ParsedRoute { $ uri = trim ( explode ( "?" , $ uri ) [ 0 ] ) ; if ( $ prefix !== "" && substr ( $ prefix , 0 , 1 ) !== "/" ) { $ prefix = "/" . $ prefix ; } try { return $ this -> findMatches ( $ method , $ uri , $ prefix ) ; } catch ( Ro... | Parses an incoming method and URI and returns a matching route . |
53,590 | private function findMatches ( string $ method , string $ uri , string $ prefix = "" ) : ParsedRoute { if ( isset ( $ this -> routes [ strtoupper ( $ method ) ] ) ) { foreach ( array_keys ( $ this -> routes [ strtoupper ( $ method ) ] ) as $ route ) { $ parsed_regexp = $ this -> prepareRouteRegexp ( $ prefix . $ route ... | Finds the first matching route for a given method and URI . |
53,591 | private function prepareRouteRegexp ( string $ route ) : string { if ( ! array_key_exists ( $ route , self :: $ parsed_regexp ) ) { self :: $ parsed_regexp [ $ route ] = preg_replace ( array_keys ( $ this -> regexp_map ) , array_values ( $ this -> regexp_map ) , $ route ) ; } return self :: $ parsed_regexp [ $ route ] ... | Applies standard regexp patterns to an incoming URI route . |
53,592 | public static function clean ( $ filename = null ) { static :: filename ( $ filename ) ; static :: $ description = static :: $ keywords = static :: $ title = static :: $ jsTextOnReady = '' ; static :: $ css = static :: $ js = static :: $ jsText = static :: $ jsMgr = [ ] ; } | Cleans up all layout variables & resets filename if specified . |
53,593 | public static function og ( string $ property , string $ value = null ) { return $ value !== null ? static :: $ openGraph [ $ property ] = $ value : ( static :: $ openGraph [ $ property ] ?? null ) ; } | Sets or gets layout OpenGraph property . |
53,594 | protected static function assembleTemplateVars ( $ content ) { $ layoutTplVars = [ 'content' => $ content , 'keywords' => static :: eWrap ( static :: $ keywords , "<meta name='keywords' content='%s' />\n" ) , 'title' => static :: eWrap ( static :: $ title , "<title>%s</title>\n" ) , 'description' => static :: eWrap ( s... | Prepare and assemble all variables for Layout PhpTemplate . |
53,595 | protected static function assembleOpenGraph ( ) { $ meta = [ ] ; foreach ( static :: $ openGraph as $ key => $ value ) { $ meta [ ] = "<meta property='og:$key' content='" . Html :: e ( $ value ) . "' />" ; } return implode ( "\n\t" , $ meta ) . "\n" ; } | Assemble OpenGraph properties into html meta tags . |
53,596 | protected static function compileWith ( array $ layoutTplVars ) { if ( static :: $ filename === null ) { throw new \ Exception ( 'Layout template file name does not set: use Layout::setFilename().' ) ; } $ tpl = new PhpTemplate ( VIEWS . static :: $ filename ) ; $ tpl -> vars = $ layoutTplVars ; $ compiledHtml = $ tpl ... | Compiles layout template with given variables . |
53,597 | public function Connect ( ) { if ( $ this -> dev ) { $ this -> log [ ] = 'Connection Attempt' ; } if ( $ this -> _stream === FALSE ) { $ this -> _stream = stream_socket_client ( $ this -> url . ':' . $ this -> port , $ this -> errorCode , $ this -> errorMessage , $ this -> timeout ) ; if ( $ this -> _stream === FALSE )... | Connect to a stream |
53,598 | public function Send ( $ data , $ reply = FALSE ) { if ( $ this -> _stream === FALSE ) { $ this -> Error ( 'Cannot send data, the stream is not connected!' ) ; return FALSE ; } if ( is_array ( $ data ) ) { if ( $ this -> dev ) { $ this -> log [ ] = 'Send data array:' ; } foreach ( $ data as $ val ) { if ( $ this -> dev... | Send data through a stream |
53,599 | public function Receive ( $ reply = FALSE ) { if ( $ this -> _stream === FALSE ) { $ this -> Error ( 'Cannot receive data, the stream is not connected!' ) ; return FALSE ; } $ recv = NULL ; while ( TRUE ) { $ recv .= stream_socket_recvfrom ( $ this -> _stream , 4096 ) ; if ( strstr ( $ recv , "\r\n" ) ) { break ; } } i... | Receive data through a stream |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.