idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
5,400 | protected function makeRule ( $ check , $ rule ) : RuleInterface { $ args = $ this -> parser -> parseArgs ( $ rule ) ; $ message = $ this -> parser -> parseMessage ( $ rule ) ; if ( ! is_array ( $ check ) ) { return new CallableRule ( $ check , $ args , $ message ) ; } if ( is_string ( $ check [ 0 ] ) && $ this -> conf... | Construct rule object . |
5,401 | protected function _getAssetParentId ( JTable $ table = null , $ id = null ) { $ assetId = null ; if ( $ this -> parent_id > 1 ) { $ query = $ this -> _db -> getQuery ( true ) -> select ( $ this -> _db -> quoteName ( 'asset_id' ) ) -> from ( $ this -> _db -> quoteName ( '#__categories' ) ) -> where ( $ this -> _db -> q... | Get the parent asset id for the record |
5,402 | public function check ( ) { if ( trim ( $ this -> title ) == '' ) { $ this -> setError ( JText :: _ ( 'JLIB_DATABASE_ERROR_MUSTCONTAIN_A_TITLE_CATEGORY' ) ) ; return false ; } $ this -> alias = trim ( $ this -> alias ) ; if ( empty ( $ this -> alias ) ) { $ this -> alias = $ this -> title ; } $ this -> alias = JApplica... | Override check function |
5,403 | public function bind ( $ array , $ ignore = '' ) { if ( isset ( $ array [ 'params' ] ) && is_array ( $ array [ 'params' ] ) ) { $ registry = new Registry ; $ registry -> loadArray ( $ array [ 'params' ] ) ; $ array [ 'params' ] = ( string ) $ registry ; } if ( isset ( $ array [ 'metadata' ] ) && is_array ( $ array [ 'm... | Overloaded bind function . |
5,404 | public function extract ( $ object ) { $ data = $ this -> getMapper ( ) -> extract ( $ object ) ; if ( isset ( $ data [ 'properties' ] ) && is_array ( $ data [ 'properties' ] ) ) { foreach ( $ data [ 'properties' ] as $ key => $ value ) { $ newKey = String :: camelize ( $ key ) ; if ( is_array ( $ value ) && array_key_... | Extract values from a structure |
5,405 | public function getPathnameArray ( $ array ) { $ result = [ ] ; foreach ( $ array as $ item ) { $ result [ $ item -> getFile ( ) -> getPathname ( ) ] = $ item ; } return $ result ; } | Can transform a normal array in a pathname array . This means that the key of the array is the path to the class and the value is a PhpClass |
5,406 | public function generateUrl ( $ route_infos , $ base_uri = null , $ hash = null , $ separator = '&' ) { $ url_args = $ this -> getArgumentsMap ( ) -> getCollection ( ) ; $ url = $ base_uri ; if ( is_array ( $ route_infos ) ) { $ final_params = array ( ) ; foreach ( $ route_infos as $ _var => $ _val ) { if ( ! empty... | Build a new route URL |
5,407 | public function matchUrl ( $ pathinfo ) { $ routes = $ this -> getRoutes ( ) ; if ( ! empty ( $ routes ) && isset ( $ routes [ $ pathinfo ] ) ) { return $ routes [ $ pathinfo ] ; } return false ; } | Test if an URL has a corresponding route |
5,408 | public function distribute ( ) { $ route = str_replace ( $ _SERVER [ 'SCRIPT_NAME' ] , '' , $ _SERVER [ 'REQUEST_URI' ] ) ; if ( ! empty ( $ route ) && in_array ( $ route { 0 } , array ( '?' , '/' , '&' ) ) ) { $ route = substr ( $ route , 1 ) ; } if ( ! empty ( $ route ) && $ this -> matchUrl ( $ route ) ) { $ this ->... | Actually dispatch the current route |
5,409 | public static function urlEncode ( $ str = null , $ keep_mask = true ) { if ( ( ! empty ( $ str ) && is_numeric ( $ str ) ) || ( true === $ keep_mask && $ str === '%s' ) ) { return $ str ; } if ( empty ( $ str ) || ! is_string ( $ str ) ) { return '' ; } return urlencode ( $ str ) ; } | Special urlencode function to only encode strings and let any %s mask not encoded |
5,410 | public function save ( $ identifier , $ contents ) { list ( $ language , $ identifier ) = explode ( DS , $ identifier , 2 ) ; $ identifier = basename ( $ identifier , '.db' ) ; $ this -> prep_vars ( $ contents ) ; $ contents = serialize ( $ contents ) ; $ result = \ DB :: update ( $ this -> table ) -> set ( array ( 'la... | Formats the output and saved it to the database . |
5,411 | protected function publishSidebarItems ( ) { $ this -> publishes ( [ $ this -> getSidebarFolder ( ) => config_path ( $ this -> vendor . DS . 'sidebar' . DS . $ this -> package ) ] , 'sidebar' ) ; } | Publish all the sidebar config files . |
5,412 | protected function registerSidebarItems ( ) { foreach ( $ this -> filesystem ( ) -> glob ( $ this -> getSidebarFolder ( ) . DS . '*.php' ) as $ path ) { $ this -> mergeConfigFrom ( $ path , $ this -> getSidebarKey ( ) . '.' . basename ( $ path , '.php' ) ) ; } } | Register all the sidebar config files . |
5,413 | public function implode ( $ separator = ' : ' ) { $ m = array_map ( function ( StringType $ msg ) { return $ msg ( ) ; } , $ this -> messages ) ; return implode ( $ separator , $ m ) ; } | Return string containing imploded message array |
5,414 | public static function cssLinkTag ( $ href , $ media = 'screen' ) { if ( strpos ( $ href , 'http' ) === false and strpos ( $ href , '//' ) === false ) { $ href = Request :: basePath ( $ href ) ; } return '<link rel="stylesheet" href="' . $ href . '" media="' . $ media . '">' . PHP_EOL ; } | Creates a CSS link tag . |
5,415 | public static function jsIncTag ( $ path ) { if ( strpos ( $ path , 'http' ) === false and strpos ( $ path , '//' ) === false ) { $ path = Request :: basePath ( $ path ) ; } return '<script src="' . $ path . '" type="text/javascript"></script>' . PHP_EOL ; } | Returns the code to include a JavaScript file . |
5,416 | public static function link ( $ label , $ url = null , array $ attributes = array ( ) ) { if ( $ label === null ) { $ label = $ url ; } if ( is_object ( $ url ) and method_exists ( $ url , 'href' ) ) { $ url = $ url -> href ( ) ; } $ attributes [ 'href' ] = $ url ; $ attributes = static :: buildAttributes ( $ attribute... | Returns the code for a link . |
5,417 | public static function LinkToUnlessCurrent ( $ label , $ url , array $ attributes = array ( ) ) { if ( Request :: matches ( $ url ) ) { return $ label ; } else { return static :: link ( $ label , $ url , $ attributes ) ; } } | Returns the code for a link unless the current request matches the URL . |
5,418 | public static function buildAttributes ( $ attributes ) { $ options = array ( ) ; foreach ( $ attributes as $ attr => $ val ) { $ options [ ] = "{$attr}=\"{$val}\"" ; } return implode ( ' ' , $ options ) ; } | Builds the attributes for HTML elements . |
5,419 | public function getAdapter ( $ connectionName , array $ options = [ ] ) { if ( ! isset ( $ this -> adapters [ $ connectionName ] ) ) { if ( ! $ this -> connectionExists ( $ connectionName ) ) { throw new Exception \ RuntimeException ( sprintf ( 'Connection doesn\'t exist: %s' , $ connectionName ) ) ; } $ connectionConf... | Get the adapter for a specific connection . If the adapter doesn t exist it is created . If the connection config isn t found an exception is thrown . |
5,420 | public static function applySerializers ( array $ serializers , $ data ) { return array_reduce ( $ serializers , function ( $ serializedData , $ serializer ) { return $ serializer -> apply ( $ serializedData ) ; } , $ data ) ; } | Apply multiple serializers to some data |
5,421 | public function withAddedInvocationRecord ( $ methodName , Dictionary $ newInvocationRecord ) { $ recordedInvocationsOfGivenMethod = isset ( $ this -> methodNameToInvocationRecordsMap [ $ methodName ] ) ? $ this -> methodNameToInvocationRecordsMap [ $ methodName ] : new UnorderedList ( ) ; $ invocationRecordToAdd = $ n... | Mutative update method which returns a new _SpyReflector instance containing this instance s invocation map plus the invocation data given |
5,422 | public function commit_session ( ) { if ( defined ( 'DOING_CRON' ) || $ this -> running_in_cli ( ) ) { return ; } if ( ! empty ( $ _COOKIE [ $ this -> config [ 'cookie_name' ] ] ) ) { $ this -> get_store ( ) -> save ( ) ; } } | Commit session when shutdown fired . |
5,423 | public function register_garbage_collection ( ) { if ( $ this -> config_hits_lottery ( ) ) { $ this -> cleanup_expired_sessions ( ) ; } if ( ! wp_next_scheduled ( $ schedule = $ this -> get_schedule_name ( ) ) ) { wp_schedule_event ( time ( ) , 'hourly' , $ schedule ) ; } } | Register the garbage collector as a hourly event . |
5,424 | public function close ( ) { if ( DEBUG_MODE ) { BLog :: addToLog ( '[Users.Session]: close()' ) ; } setcookie ( 'brillsecret' , '' , time ( ) - 3600 , '/' , BHOSTNAME ) ; if ( DEBUG_MODE ) { BLog :: addToLog ( '[Users.Session] close session' ) ; } if ( ! $ db = BFactory :: getDBO ( ) ) { return false ; } $ bCache = BFa... | Close session . |
5,425 | protected function getTableConfig ( $ table , $ include_options = null ) { if ( $ include_options === null ) { $ include_options = $ this -> include_options ; } $ schema = $ this -> schemaSignature ; if ( $ this -> useLocalCaching && isset ( self :: $ localCache [ $ schema ] [ 'tables' ] [ $ table ] ) ) { return self :... | Get a table configuration . |
5,426 | public function clearCacheInformation ( ) { $ schema = $ this -> schema ; if ( array_key_exists ( $ schema , self :: $ localCache ) ) { unset ( self :: $ localCache [ $ schema ] ) ; if ( ( $ key = array_search ( $ schema , self :: $ fullyCachedSchemas ) ) !== false ) { unset ( self :: $ fullyCachedSchemas [ $ key ] ) ;... | Clear local cache information for the current schema . |
5,427 | public static final function add ( $ array , $ element ) { if ( $ array instanceof \ Traversable ) { $ array = self :: __convert ( $ array ) ; } $ arr = array ( ) ; $ arr = array_values ( $ array ) ; array_push ( $ arr , $ element ) ; return $ arr ; } | Adds an element to an array . When an element is added to an associative array the returned array loses all associative context and instead a non - associative array is returned with numeric indices . |
5,428 | public function getImagePart ( $ x , $ y , $ width , $ height ) { return new ImagePart ( $ x , $ y , $ width , $ height , $ this ) ; } | Retourne une portion d image |
5,429 | protected function applyFilters ( ) { if ( $ this -> emptyRessource ) { $ source = $ this -> emptyRessource ; } else if ( $ this -> extension == self :: IMAGE_TYPE_JPG ) { $ source = imagecreatefromjpeg ( $ this -> path ) ; } else if ( $ this -> extension == self :: IMAGE_TYPE_PNG ) { $ source = imagecreatefrompng ( $ ... | Applique les filtres et retourne un objet ResourceImage GD |
5,430 | public static function run ( $ speech = null ) { if ( ! isset ( $ speech ) ) { $ speech = 'KILL ALL HUMANS!' ; } $ eye = \ Cli :: color ( "*" , 'red' ) ; return \ Cli :: color ( " \"{$speech}\" __ / / __\\" , 'blue' ) . "\n" . \ Cli :: color ( " _[\\" , 'blue' ) . $ eye . \ Cli ::... | This method gets ran when a valid method name is not used in the command . |
5,431 | public static function protect ( ) { $ eye = \ Cli :: color ( "*" , 'green' ) ; return \ Cli :: color ( " \"PROTECT ALL HUMANS\" __ / / __\\" , 'blue' ) . "\n" . \ Cli :: color ( " _[\\" , 'blue' ) . $ eye . \ Cli :: color ( '---' , 'blue' ) . $ eye . \ Cli :: color ( '/] _' , 'bl... | An example method that is here just to show the various uses of tasks . |
5,432 | public function getWeekDayNamesNarrow ( $ day = null ) { $ calendar = $ this -> getName ( ) ; $ data = array ( ) ; $ calendsFallback = array ( $ calendar , 'gregorian' , 'generic' ) ; foreach ( $ calendsFallback as $ calendar ) { $ data = $ this -> getRepoReader ( ) -> getEntityByPath ( 'dates/calendars/calendar[@type=... | Get array of narrow textual representation of a day sorted by first day of week to end . |
5,433 | public function getMonthNamesNarrow ( $ month = null ) { $ calendar = $ this -> getName ( ) ; $ data = array ( ) ; $ calendsFallback = array ( $ calendar , 'gregorian' , 'generic' ) ; foreach ( $ calendsFallback as $ calendar ) { $ data = $ this -> getRepoReader ( ) -> getEntityByPath ( 'dates/calendars/calendar[@type=... | Short textual representation of a month such as January or March |
5,434 | public function getDayPeriodsNarrow ( $ val = null ) { $ calendar = $ this -> getName ( ) ; $ data = array ( ) ; $ calendsFallback = array ( $ calendar , 'gregorian' , 'generic' ) ; foreach ( $ calendsFallback as $ calendar ) { $ data = $ this -> getRepoReader ( ) -> getEntityByPath ( 'dates/calendars/calendar[@type="'... | Get day periods narrow name |
5,435 | protected function init ( ) { if ( isset ( $ this -> theme ) === false ) { throw new \ RuntimeException ( 'Theme property does not exist.' ) ; } if ( empty ( $ this -> theme ) === false and is_string ( $ this -> theme ) ) { $ this -> theme = \ Theme :: instance ( $ this -> theme ) ; } if ( empty ( $ this -> theme_activ... | Loads the theme and sets the template object |
5,436 | public static function load ( $ path , $ assoc = false , $ depth = 512 , $ options = 0 ) { $ json = file_get_contents ( $ path ) ; if ( $ json === false ) { $ error = error_get_last ( ) ; throw new \ Exception ( "Failed reading JSON data from file: " . $ error [ 'message' ] ) ; } return self :: decode ( $ json , $ asso... | Loads and decodes JSON data from a file . |
5,437 | public static function dump ( $ data , $ path , $ options = 0 , $ depth = 512 ) { $ json = self :: encode ( $ data , $ options , $ depth ) ; $ result = file_put_contents ( $ path , $ json ) ; if ( $ result === false ) { $ error = error_get_last ( ) ; throw new \ Exception ( "Failed writing JSON data to file: " . $ erro... | Encodes data to JSON and saves it to a file . |
5,438 | public function questionnaireCheck ( GetResponseEvent $ event ) { if ( HttpKernel :: MASTER_REQUEST != $ event -> getRequestType ( ) || ( $ event -> getRequest ( ) -> request && 'html' !== $ event -> getRequest ( ) -> getRequestFormat ( ) ) || in_array ( $ this -> request -> get ( '_route' ) , array ( 'qcm_public_quest... | Check questionnaire timeout |
5,439 | function bind ( DecorateViewModel $ viewModel , $ priority = 0 ) { $ viewModel -> myRoot = $ this ; $ this -> queue -> insert ( ( object ) $ viewModel , $ priority ) ; return $ this ; } | Bind a ViewModel Into This |
5,440 | function delegateRenderBy ( DecorateViewModel $ parentView , $ rootPassedToNext = null ) { if ( $ rootPassedToNext === null ) $ rootPassedToNext = $ parentView ; $ this -> myRoot = $ rootPassedToNext ; $ this -> nextRoot = $ parentView ; if ( null === $ callback = $ this -> delegateRenderBy ) return ; if ( $ callback i... | Call Before Rendering ViewModel Itself tell viewModel About ParentView that render it . |
5,441 | public function getQueryBuilder ( ColumnCollection $ columns , DataSetRequestInterface $ request ) : QueryBuilder { $ this -> conditions = $ this -> getConditions ( $ request ) ; $ this -> queryBuilder -> select ( $ columns -> getSelectClause ( ) ) ; $ this -> queryBuilder -> addOrderBy ( $ this -> getOrderByExpression... | Prepares and returns Doctrine s QueryBuilder |
5,442 | private function getOrderByExpression ( DataSetRequestInterface $ request , ColumnCollection $ columns ) : Expr \ OrderBy { $ column = $ columns -> get ( $ request -> getOrderBy ( ) ) ; $ orderBy = ( $ column -> isAggregated ( ) ) ? $ column -> getAlias ( ) : $ column -> getSource ( ) ; $ orderDir = $ request -> getOrd... | Prepares an ordering expression |
5,443 | public function find ( $ name , $ default = null , array $ extraDirs = array ( ) ) { if ( ini_get ( 'open_basedir' ) ) { $ searchPath = explode ( PATH_SEPARATOR , ini_get ( 'open_basedir' ) ) ; $ dirs = array ( ) ; foreach ( $ searchPath as $ path ) { if ( @ is_dir ( $ path ) ) { $ dirs [ ] = $ path ; } else { if ( bas... | Finds an executable by name . |
5,444 | public function concat ( ) { $ args = func_get_args ( ) ; $ str = $ this -> str ; foreach ( $ args as $ arg ) { $ str .= ( string ) $ arg ; } return new static ( $ str ) ; } | Function added by Trevor Herselman Concats a string and returns the new one . Actually it is the same as the dot operator . |
5,445 | protected function eregReplace ( $ pattern , $ replacement , $ string , $ option = 'msr' ) { trigger_error ( 'Function ' . __METHOD__ . ' not implemented yet' ) ; static $ functionExists ; if ( $ functionExists === null ) { $ functionExists = function_exists ( '\mb_split' ) ; } if ( $ functionExists ) { return \ mb_ere... | Alias for mb_ereg_replace with a fallback to preg_replace if the mbstring module is not installed . |
5,446 | public function renderWithoutActionButton ( $ template ) { $ custom = $ this -> customise ( [ "Actions" => "" , ] ) ; if ( is_string ( $ template ) ) { $ template = new SSViewer ( $ template ) ; } return $ template -> process ( $ custom ) ; } | Render this form using the given template and return the result as a string . |
5,447 | public function oAuthRequest ( $ url , $ method , $ parameters ) { if ( strrpos ( $ url , 'https://' ) !== 0 && strrpos ( $ url , 'http://' ) !== 0 ) { $ url = self :: API_ENTRY_POINT . $ url ; } $ request = OAuth \ Request :: from_consumer_and_token ( $ this -> getConsumerKey ( ) , $ this -> getCurrentOAuthToken ( ) ,... | Send a signed request using OAuth token |
5,448 | function getOAuthToken ( $ request ) { $ token = OAuth \ Util :: parse_parameters ( $ request ) ; if ( isset ( $ token [ 'oauth_token' ] , $ token [ 'oauth_token_secret' ] ) ) { $ this -> token = new OAuth \ Consumer ( $ token [ 'oauth_token' ] , $ token [ 'oauth_token_secret' ] ) ; } return $ token ; } | Avoid the notices if the token is not set |
5,449 | public function getLastRequestInformation ( ) { return array ( 'http_url' => $ this -> http_url , 'http_request_headers' => $ this -> http_request_headers , 'http_code' => $ this -> http_code , 'http_info' => $ this -> http_info , 'http_header' => $ this -> http_header , 'http_post' => $ this -> http_post , ) ; } | Return the information about the last call |
5,450 | public function get ( $ key , $ params = null ) { $ msg = null ; foreach ( $ this -> messages [ $ this -> currentLang ] as $ messages ) { if ( isset ( $ messages [ $ key ] ) ) { $ msg = $ messages [ $ key ] ; } } if ( $ msg === null ) { throw new Exception ( "Error: don't find message '$key'" ) ; } if ( $ params !== nu... | get the string corresponding to the given key . |
5,451 | public static function getLangFromRequest ( ) { if ( ! isset ( $ _SERVER [ 'HTTP_ACCEPT_LANGUAGE' ] ) ) { return '' ; } $ languages = explode ( ',' , $ _SERVER [ 'HTTP_ACCEPT_LANGUAGE' ] ) ; foreach ( $ languages as $ bl ) { if ( preg_match ( '/^([a-zA-Z]{2,3})(?:[-_]([a-zA-Z]{2,3}))?(;q=[0-9]\\.[0-9])?$/' , $ bl , $ m... | returns the locale corresponding of one of the accepted language indicated by the browser . |
5,452 | private function searchUrl ( NewsItemEntity $ newsItem ) { $ pattern = '/[-a-zA-Z0-9:%_\+.~#?&\/\/=]{2,256}\.[a-z]{2,10}\b(\/[-a-zA-Z0-9:%_\+.~#?&\/\/=]*)?/i' ; if ( ! preg_match ( $ pattern , $ newsItem -> getMessage ( ) , $ matches ) ) { return $ this -> unsetUrl ( $ newsItem ) ; } $ url = $ matches [ 0 ] ; $ result ... | Search for a url in the message if we find one then we fetch it |
5,453 | private function scrapeUrl ( $ url ) { if ( ! parse_url ( $ url , PHP_URL_HOST ) ) { $ url = 'http://' . $ url ; } try { $ client = new Client ( ) ; $ response = $ client -> get ( $ url ) ; } catch ( \ Exception $ e ) { return [ ] ; } $ crawler = new Crawler ( $ response -> getBody ( ) -> getContents ( ) ) ; $ descript... | Extract title and description from the URL |
5,454 | public function afficherFormulaire ( ) { $ html = '' ; $ t = new Template ( 'modules/archi/templates' ) ; $ t -> set_filenames ( array ( 'formulaire' => 'personneFormulaire.tpl' ) ) ; $ modeAffichage = '' ; if ( isset ( $ this -> variablesGet [ 'modeAffichage' ] ) && $ this -> variablesGet [ 'modeAffichage' ] != '' ) {... | Affichage du formulaire d ajout d une personne |
5,455 | public function supprimer ( ) { global $ config ; $ config -> connexionBdd -> requete ( "DELETE FROM `_personneEvenement` WHERE idPersonne='" . mysql_real_escape_string ( $ this -> idPersonne ) . "'" ) ; $ config -> connexionBdd -> requete ( "DELETE FROM `_evenementPersonne` WHERE idPersonne='" . mysql_real_escape_stri... | Supprimer une personne |
5,456 | public function modifier ( $ id , $ firstname , $ name , $ job , $ birth , $ death ) { $ res = $ this -> connexionBdd -> requete ( sprintf ( file_get_contents ( "sql/editPerson.sql" ) , mysql_escape_string ( $ firstname ) , mysql_escape_string ( $ name ) , $ job , $ this -> date -> toBdd ( $ this -> date -> convertYear... | Modifier une personne |
5,457 | public function getPersonneLibelle ( $ idPersonne = 0 ) { $ req = "SELECT nom, prenom FROM personne WHERE idPersonne = '" . $ idPersonne . "'" ; $ res = $ this -> connexionBdd -> requete ( $ req ) ; $ fetch = mysql_fetch_assoc ( $ res ) ; return $ fetch [ 'nom' ] . ' ' . $ fetch [ 'prenom' ] ; } | Renvoie le nom prenom d une personne suivant son ID |
5,458 | public function getInfosPersonne ( $ id = 0 ) { $ req = " SELECT idPersonne, p.nom as nom, p.prenom as prenom, m.nom as nomMetier , p.dateNaissance dateNaissance, p.dateDeces as dateDeces, p.description as description FROM personne p LEFT JOIN metier m ON m.idMetier = p.idMetier ... | Renvoi les infos d une personne |
5,459 | public static function getImage ( $ id , $ size = "moyen" , $ showDefault = true , $ dimension = array ( 'height' => 200 , 'width' => 200 ) ) { global $ config ; $ req = " SELECT idImage FROM _personneImage WHERE idPersonne = '" . mysql_real_escape_string ( $ id ) . "' " ; $ res ... | Obtenir l image principale d une personne |
5,460 | public function updateUser ( UserInterface $ user ) { $ user -> setChangedValue ( ) ; $ this -> em -> persist ( $ user ) ; $ this -> em -> flush ( ) ; return true ; } | update the given user |
5,461 | public function updateUserData ( Data $ data , $ flush = true ) { $ this -> em -> persist ( $ data ) ; if ( $ flush ) { $ this -> em -> flush ( ) ; } return new \ Symfony \ Component \ Validator \ ConstraintViolationList ( ) ; } | update the given user data |
5,462 | protected function getEntityForTagName ( $ entity , $ xmlEntry , $ tagName , $ stackEntity ) { switch ( $ tagName ) { case 'repertoire_extra' : $ association = $ stackEntity -> offsetGet ( $ stackEntity -> count ( ) - 1 ) ; return $ association ; break ; default : return $ entity ; break ; } } | get Entity for TagName |
5,463 | public static function destroy ( $ id ) { $ instance = new static ; $ key = $ instance -> getKeyName ( ) ; $ model = $ instance -> where ( $ key , $ id ) -> first ( ) ; if ( $ model -> delete ( ) ) { return true ; } return false ; } | Destroy the model for the given ID . |
5,464 | public function delete ( ) { if ( is_null ( $ this -> primaryKey ) || is_null ( $ this -> getKey ( ) ) ) { throw new RuntimeException ( "No primary key defined on model." ) ; } if ( $ this -> exists ) { if ( $ this -> fireModelEvent ( 'deleting' ) === false ) { return false ; } if ( ! $ this -> performDeleteOnModel ( )... | Delete the model . |
5,465 | public function newQuery ( ) { $ builder = $ this -> newElicitBuilder ( $ this -> newBaseQueryBuilder ( ) ) ; $ builder -> setModel ( $ this ) ; return $ builder ; } | Get a new query builder for the model s API . |
5,466 | public function hasPath ( $ key ) { $ pathValue = $ this -> getPathValue ( $ key ) ; $ pathMethod = $ this -> getPathMethod ( $ key ) ; return ( ! is_null ( $ pathValue ) && ! is_null ( $ pathMethod ) ) ; } | Check if a path has all the required values . |
5,467 | public function setPath ( $ path , $ value = null , $ method = null ) { $ this -> paths [ $ path ] = [ ] ; if ( ! is_null ( $ value ) ) { $ this -> paths [ $ path ] [ 'path' ] = $ value ; } if ( ! is_null ( $ method ) ) { $ this -> paths [ $ path ] [ 'method' ] = $ method ; } } | Set a path attribute for the model . |
5,468 | public function getMergedPath ( $ key ) { $ mergedPath = [ ] ; $ hasCatchAll = isset ( $ this -> defaults [ '*' ] ) ; $ hasDefault = isset ( $ this -> defaults [ $ key ] ) ; $ hasPath = isset ( $ this -> paths [ $ key ] ) ; if ( $ hasCatchAll && $ hasDefault ) { $ mergedPath = array_merge ( $ this -> defaults [ '*' ] ,... | Get the paths for the model merged with the path defaults . |
5,469 | public function setRawAttributes ( array $ attributes , $ sync = false ) { $ this -> attributes = $ attributes ; if ( $ sync ) { $ this -> syncOriginal ( ) ; } } | Set the array of model attributes . No checking is done . |
5,470 | public static function getIterator ( $ id , $ per_page = 10 , $ start_from_zero = true , $ typ = "old" , $ redir_c = 1 ) { static $ iterators = array ( ) ; if ( ! isset ( $ iterators [ $ id ] ) || ! array_key_exists ( $ id , $ iterators ) || ! $ iterators [ $ id ] ) { $ iterators [ $ id ] = new Iterator ( $ id , $ per_... | Tato funkcia vrati iterator daneho mena . |
5,471 | private function set_object_variables ( $ id , $ per_page , $ zero ) { if ( ! $ per_page || ! is_numeric ( $ per_page ) ) { \ AsyncWeb \ Text \ Messages :: getInstance ( ) -> warning ( \ AsyncWeb \ System \ Language :: get ( "error_iterator_per_page_wrong" ) , false ) ; $ per_page = 10 ; } if ( $ this -> typ == "old" |... | Tato funkcia vytvori premenne objektu pri vzniku tohoto objektu |
5,472 | private function check_update ( ) { if ( $ this -> typ == "old" || $ this -> typ == "jquery" ) { if ( Iterator :: $ use_session ) { if ( isset ( $ _REQUEST [ "ITER_" . $ this -> id . "_PAGE" ] ) ) { \ AsyncWeb \ Storage \ Session :: set ( "ITER_" . $ this -> id . "_PAGE" , $ _REQUEST [ "ITER_" . $ this -> id . "_PAGE" ... | Skontroluje ci bola zmenena strana |
5,473 | public function getTickets ( $ items ) { if ( ! count ( $ items ) ) { return [ ] ; } $ result = [ ] ; foreach ( $ items as $ item ) { $ result [ ] = new Ticket ( $ item ) ; } return $ result ; } | Returns array of tickets . |
5,474 | public function setValue ( $ value ) { if ( $ value instanceof Traversable ) { $ value = ArrayUtils :: iteratorToArray ( $ value ) ; } return parent :: setValue ( ( array ) $ value ) ; } | Set the element value |
5,475 | public function getAtomURL ( ) { $ atomURL = null ; $ searchQuery = $ this -> searchQueryWithEqualsAndWildcard ( ' ' , '*' , true ) ; if ( $ searchQuery ) { $ searchQuery = urlencode ( $ searchQuery ) ; $ atomBaseURL = GeneralUtility :: getIndpEnv ( 'TYPO3_SITE_URL' ) . 'opac.atom?q=' ; $ atomURL = $ atomBaseURL . $ se... | Return URL for the Atom feed of the current query . |
5,476 | public function searchQueryWithEqualsAndWildcard ( $ equals = '=' , $ wildcard = '' , $ ignoreSelectedDate = false ) { $ queryString = null ; $ queries = $ this -> selectedQueriesInFormWithWildcard ( $ wildcard ) ; if ( count ( $ queries ) > 0 ) { $ queryString = $ this -> oredSearchQueries ( $ queries , '' , '' ) ; $ ... | Builds a query string using the queries of the selected checkboxes in the form . The strings used for equals assignment and wildcard can be configured to yield string that can be used for both Pica - and CCL - style queries . Null is returned when no search queries are selected . |
5,477 | private function selectedQueriesInGroupWithWildcard ( $ subjects , $ wildcard ) { $ queries = [ ] ; foreach ( $ subjects as $ subject ) { if ( $ subject [ 'selected' ] && $ subject [ 'queries' ] ) { $ this -> addSearchTermsToList ( $ subject [ 'queries' ] , $ queries , $ wildcard ) ; } elseif ( $ subject [ 'subjects' ]... | Return the array of all queries selected in a subject group taking into account group checkboxes . |
5,478 | private function addSearchTermsToList ( $ searchTerms , & $ list , $ wildcard ) { foreach ( $ searchTerms as $ term ) { if ( $ term != '' ) { if ( $ wildcard && substr ( $ term , - 1 ) === '?' ) { $ term = substr ( $ term , 0 , - 1 ) . $ wildcard ; } $ list [ ] = $ term ; } } } | Helper function adding the elements of an array to a given array potentially appending a wildcard to each of them in the process . |
5,479 | protected function setupSubjects ( ) { $ subjects = $ this -> makeSubjectsArrayForPPN ( $ this -> rootPPN ) ; if ( $ this -> requestArguments [ 'button' ] ) { $ selectedCheckboxes = [ ] ; foreach ( $ this -> requestArguments as $ argumentName => $ argument ) { $ fieldNameStart = 'pz2subject-' ; if ( ( $ argument != '' ... | Get the subjects array add information about the selected ones from our arguments to it and store it . |
5,480 | protected function makeSubjectsArrayForPPN ( $ parentPPN ) { $ rootNodes = $ this -> queryForChildrenOf ( $ parentPPN ) ; $ subjects = [ ] ; while ( $ nodeRecord = $ GLOBALS [ 'TYPO3_DB' ] -> sql_fetch_assoc ( $ rootNodes ) ) { $ subject = [ ] ; $ subject [ 'id' ] = strtolower ( $ nodeRecord [ 'ppn' ] ) ; if ( $ GLOBAL... | Return array of subjects for the parentPPN passed . The data needed are loaded from the tx_nkwgok_data table of the database . They are expected to be imported from CSV - data by the nkwgok extension . See its documentation or code for the fields required in teh CSV - file . |
5,481 | private function oredSearchQueries ( $ queryTerms , $ key , $ equals ) { $ query = '(' . $ key . $ equals . implode ( ' or ' . $ key . $ equals , $ queryTerms ) . ')' ; return $ query ; } | Helper function for preparing search queries . |
5,482 | public function shouldReceive ( $ method ) { $ builder = new MutableExpectationBuilder ( $ method ) ; $ expectation = $ builder -> getExpectation ( ) ; $ builder -> withAnyArgs ( ) -> atLeast ( 1 ) ; $ this -> add ( $ expectation ) ; return $ builder ; } | Create a new expectation for the named method |
5,483 | public function removeAny ( $ method ) { $ keys = [ ] ; foreach ( $ this -> expectations as $ k => $ expectation ) { if ( $ expectation -> getMethod ( ) == $ method ) { $ keys [ ] = $ k ; } } foreach ( $ keys as $ key ) { unset ( $ this -> expectations [ $ key ] ) ; } return $ this ; } | Remove any previously - set expectations for the specified method |
5,484 | public function matches ( $ method , $ arguments ) { foreach ( $ this -> expectations as $ expectation ) { if ( $ expectation -> matches ( $ method , $ arguments ) ) { return true ; } } return false ; } | Determine whether any expectation in the set matches the given method name and argument list |
5,485 | public function add ( Expectation $ e ) { if ( $ this -> mockedMethods !== null && ! in_array ( $ e -> getMethod ( ) , $ this -> mockedMethods ) ) { $ message = "Attempt to mock unknown method \"{$e->getMethod()}\"." ; if ( count ( $ this -> mockedMethods ) > 0 ) { $ message .= " The mocked methods are: " . implode ( "... | Add an expectation to the set |
5,486 | public function receive ( $ method , $ arguments ) { foreach ( $ this -> expectations as $ expectation ) { if ( $ expectation -> matches ( $ method , $ arguments ) ) { return $ expectation -> perform ( $ method , $ arguments ) ; } } $ message = "Unexpected call to method $method" ; if ( count ( $ arguments ) ) { $ mess... | Have the exepectation set receive a method and a set of arguments perfoming the matching expectation or throwing an exception if no matching expectation is found . |
5,487 | public function assertSatisfied ( ) { foreach ( $ this -> expectations as $ expectation ) { if ( ! $ expectation -> isSatisfied ( ) ) { $ comment = $ expectation -> commentOn ( $ expectation -> getMethod ( ) , [ ] ) ; if ( ! $ comment ) { $ comment = "Unsatisfied expectation for method " . $ expectation -> getMethod ( ... | Assert that all mock s expectations are satisfied |
5,488 | protected function configHandle ( ) { $ packageConfigPath = __DIR__ . '/config/config.php' ; $ appConfigPath = config_path ( 'comment.php' ) ; $ this -> mergeConfigFrom ( $ packageConfigPath , 'comment' ) ; $ this -> publishes ( [ $ packageConfigPath => $ appConfigPath , ] , 'config' ) ; } | Loading and publishing package s config |
5,489 | protected function langHandle ( ) { $ packageTranslationsPath = __DIR__ . '/resources/lang' ; $ this -> loadTranslationsFrom ( $ packageTranslationsPath , 'comment' ) ; $ this -> publishes ( [ $ packageTranslationsPath => resource_path ( 'lang/vendor/comment' ) , ] , 'lang' ) ; } | Loading and publishing package s translations |
5,490 | public static function encrypt ( $ string , $ hash = false ) { if ( ! $ string ) { return null ; } if ( ! extension_loaded ( 'mCrypt' ) ) { return static :: altEncrypt ( $ string , $ hash ) ; } ( is_null ( $ hash ) || $ hash === false ) && $ hash = '' ; $ hash = Util :: maybeSerialize ( $ hash ) ; $ key = pack ( 'H*' ,... | Encrypt the string with mCrypt make sure lib mCrypt is active by your php |
5,491 | public static function decrypt ( $ string , $ hash = false ) { if ( ! is_string ( $ string ) || strlen ( trim ( $ string ) ) < 4 || ( strlen ( $ string ) > 10 ? ( substr ( $ string , 10 , 5 ) !== '_mCb=' ) : ( substr ( $ string , 2 , 5 ) !== '_mCb=' ) ) ) { if ( is_string ( $ string ) && strlen ( trim ( $ string ) ) > ... | Decrypt the string encryption with mCrypt make sure lib mCrypt is active by your php |
5,492 | public function add ( $ name , $ type = Type :: TEXT , $ rules = [ ] ) { $ this -> fields [ $ name ] = new Field ( $ name , $ type , $ rules ) ; $ this -> types = [ ] ; return $ this ; } | Add a new field definition . |
5,493 | public function validate ( array $ data ) { $ errors = [ ] ; foreach ( $ this -> fields as $ field ) { $ f = $ field -> name ; $ v = isset ( $ data [ $ f ] ) ? $ data [ $ f ] : null ; list ( $ clean , $ errors [ $ f ] ) = $ field -> validate ( $ v ) ; if ( ! $ errors [ $ f ] ) $ data [ $ f ] = $ clean ; } return [ $ da... | Validate the data in the specified array . |
5,494 | public function getSection ( $ name , $ forceRefresh = false ) { if ( isset ( $ this -> sectionsRendered [ $ name ] ) && $ forceRefresh === false ) { return $ this -> sectionsRendered [ $ name ] ; } $ sections = $ this -> getSections ( ) ; if ( isset ( $ sections [ $ name ] ) === false ) { return false ; } $ name = $ s... | Renders section and returns it content . Also save this content in cache . |
5,495 | protected function resolve ( $ middleware ) : callable { if ( null === $ middleware ) { return function ( RequestInterface $ request , ResponseInterface $ response , callable $ next ) { return $ response ; } ; } return $ this -> resolveMiddleware ( $ middleware ) ; } | Converts a queue middleware to a callable . |
5,496 | public function map ( callable $ function ) { $ output = new Dict ( ) ; foreach ( $ this -> data as $ key => $ value ) { $ output -> offsetSet ( $ key , $ function ( $ key , $ value ) ) ; } return $ output ; } | Map over each item |
5,497 | public function filter ( callable $ function ) : Dict { $ result = new Dict ( ) ; foreach ( $ this -> data as $ key => $ value ) { if ( ! ! $ function ( $ key , $ value ) ) { $ result -> offsetSet ( $ key , $ value ) ; } } return $ result ; } | Filter an Dict using a predicate which receives key and value return a new Dict with elements that doesn t match the predicate |
5,498 | public function foldLeft ( callable $ function , $ initial = null ) { if ( $ this -> isEmpty ( ) ) { return $ initial ; } return array_reduce ( $ this -> data , $ function , $ initial ) ; } | Folds Seq items to the left |
5,499 | public function foldRight ( callable $ function , $ initial = null ) { if ( $ this -> isEmpty ( ) ) { return $ initial ; } return array_reduce ( array_reverse ( $ this -> data , true ) , $ function , $ initial ) ; } | Folds Seq items to the right |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.