idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
8,400 | public function casMember ( $ member , $ oldValue , $ newValue ) { $ set = false ; $ this -> lock ( ) ; if ( $ this [ $ member ] == $ oldValue ) { $ this [ $ member ] = $ newValue ; $ set = true ; } $ this -> unlock ( ) ; return $ set ; } | Performs a compare and swap operation on a class member |
8,401 | public function indexAction ( ) { $ id = $ this -> getUser ( ) -> getId ( ) ; $ oUser = UserQuery :: create ( ) -> findOneById ( $ id ) ; $ form = $ this -> createFormBuilder ( $ oUser ) -> setAction ( $ this -> generateUrl ( "notification_center_update" ) ) -> add ( 'notification_change' , 'checkbox' ) -> add ( 'notif... | Display form for notification settings |
8,402 | public function updateAction ( Request $ request ) { try { $ id = $ this -> getUser ( ) -> getId ( ) ; $ oUser = UserQuery :: create ( ) -> findOneById ( $ id ) ; if ( $ oUser === null ) { throw $ this -> createNotFoundException ( 'Unable to find User entity.' ) ; } $ aPost = $ request -> request -> get ( "form" ) ; $ ... | Update notification settings |
8,403 | public function onControllerSetup ( Event $ event ) { $ controller = $ event -> getSubject ( ) ; $ isAdmin = ( $ controller -> request -> getParam ( 'prefix' ) === 'admin' ) ; $ plugins = Plugin :: loaded ( ) ; foreach ( $ plugins as $ plugin ) { $ path = Plugin :: path ( $ plugin ) ; $ menuFile = ( $ isAdmin ) ? 'admi... | On controller setup . |
8,404 | public function getNewFormRequestMeta ( $ clone = TRUE ) { if ( ! isset ( $ this -> newFormRequestMeta ) ) { $ this -> newFormRequestMeta = new RequestMeta ( \ Psc \ Net \ HTTP \ Request :: GET , $ this -> constructUrl ( array ( $ this -> getEntityNamePlural ( ) , 'form' ) ) ) ; } if ( $ clone ) { return clone $ this -... | Zeigt das Entity erstellen Formular an |
8,405 | public function getSearchRequestMeta ( Array $ query = NULL ) { if ( ! isset ( $ this -> searchRequestMeta ) ) { $ this -> searchRequestMeta = new RequestMeta ( \ Psc \ Net \ HTTP \ Request :: GET , $ this -> constructUrl ( array ( $ this -> getEntityNamePlural ( ) , '%s' ) ) , array ( RequestMeta :: QUERY ) ) ; } if (... | Request zum Suchen von Entities und zur LowLevel Ausgabe |
8,406 | public function initTodo ( ) { $ todo = $ this -> getVar ( array ( 'todo' ) , 'GP' ) ; $ this -> assertTodo ( $ todo ) ; $ this -> setTodo ( $ todo ) ; if ( ! isset ( $ this -> todo ) ) $ this -> todo = $ this -> defaultTodo ; } | Initialisiert das Todo des Controllers |
8,407 | public function entity ( Entity $ entity , Array $ linkRelations = array ( ) ) { if ( ! isset ( $ this -> meta [ 'links' ] ) ) $ this -> meta [ 'links' ] = array ( ) ; foreach ( $ linkRelations as $ linkRelation ) { $ this -> meta [ 'links' ] [ ] = ( object ) array ( 'rel' => $ linkRelation -> getName ( ) , 'href' => $... | Adds metadata for the reponse from an Entity |
8,408 | public function get_accounts ( ) { static $ ga_accounts = null ; if ( ! is_null ( $ ga_accounts ) ) { return $ ga_accounts ; } $ ga_accounts = array ( ) ; if ( $ this -> ga ) { try { $ accounts = $ this -> ga -> management_accounts -> listManagementAccounts ( ) ; if ( count ( $ accounts -> getItems ( ) ) > 0 ) { $ ga_a... | Get account list |
8,409 | public function get_properties ( $ account_id ) { $ result = array ( ) ; try { if ( $ this -> ga ) { $ properties = $ this -> ga -> management_webproperties -> listManagementWebproperties ( $ account_id ) ; $ result = $ properties -> getItems ( ) ; } } catch ( \ Exception $ e ) { error_log ( $ e -> getMessage ( ) , $ e... | Get Web Properties |
8,410 | public function getScopes ( ) { if ( $ this -> scopes === null ) { $ this -> scopes = $ this -> formatScopes ( $ this -> server -> getAccessTokenStorage ( ) -> getScopes ( $ this ) ) ; } return $ this -> scopes ; } | Return all scopes associated with the access token |
8,411 | public function render ( $ key , array $ items = [ ] , array $ options = [ ] , $ level = 1 ) { $ i = 0 ; $ output = [ ] ; $ options = Hash :: merge ( $ this -> _default , $ options ) ; $ sorted = Hash :: sort ( $ items , '{s}.weight' , 'ASC' ) ; $ itemCount = count ( $ sorted ) ; foreach ( $ sorted as $ item ) { $ i ++... | Render menu . |
8,412 | protected function _getCurrentMenuElement ( array $ options = [ ] , $ level = 1 ) { if ( $ level > 1 ) { $ levelElement = $ this -> _getLevelElement ( $ options , $ level ) ; if ( $ this -> _View -> elementExists ( $ levelElement ) ) { return $ levelElement ; } return $ options [ 'childMenuAttr' ] [ 'element' ] ; } ret... | Get current menu element . |
8,413 | protected function _getLevelElement ( array $ options , $ level ) { $ levelElement = 'menu_child_' . $ level ; $ element = $ options [ 'childMenuAttr' ] [ 'element' ] ; list ( $ plugin , $ path ) = $ this -> _View -> pluginSplit ( $ element ) ; $ path = FS :: clean ( $ path , '/' ) ; $ details = explode ( '/' , $ path ... | Get current menu level element . |
8,414 | protected function _setFirstLast ( $ i , $ itemCount , array $ item = [ ] ) { $ item = array_merge ( [ 'last' => false , 'first' => false ] , $ item ) ; if ( $ i == 1 ) { $ item [ 'first' ] = true ; } if ( $ i == $ itemCount ) { $ item [ 'last' ] = true ; } return $ item ; } | Setup first last item params . |
8,415 | public function getLiAttr ( ) { $ params = self :: $ _itemParams ; $ attr = [ 'class' => 'li-item' ] ; if ( isset ( $ params [ 'item' ] [ 'liClass' ] ) ) { $ attr = $ this -> addClass ( $ attr , $ params [ 'item' ] [ 'liClass' ] ) ; } if ( $ params [ 'item' ] [ 'last' ] ) { $ attr = $ this -> addClass ( $ attr , 'last'... | Get default li attributes . |
8,416 | protected function _setActive ( array $ attr = [ ] ) { if ( $ this -> Url -> build ( self :: $ _itemParams [ 'item' ] [ 'url' ] ) == env ( 'REQUEST_URI' ) ) { $ attr = $ this -> addClass ( $ attr , 'active' ) ; } return $ attr ; } | Set active item link . |
8,417 | public function getPolymorphicRelation ( ) { if ( $ this -> _cached !== null ) { return $ this -> _cached ; } $ className = $ this -> owner -> getAttribute ( $ this -> classAttribute ) ; if ( $ className == "" ) { return null ; } if ( ! class_exists ( $ className ) ) { Yii :: error ( "Underlying object class " . $ clas... | Returns the Underlying Object |
8,418 | private function validateUnderlyingObjectType ( $ object ) { if ( count ( $ this -> mustBeInstanceOf ) == 0 ) { return true ; } foreach ( $ this -> mustBeInstanceOf as $ instance ) { if ( $ object instanceof $ instance ) { return true ; } } Yii :: error ( 'Got invalid underlying object type! (' . $ object -> className ... | Validates if given object is of allowed type |
8,419 | public static function ConvertEncoding ( $ value , $ to , $ from ) { if ( self :: getIsMbstringEnabled ( ) ) { $ value = mb_convert_encoding ( $ value , $ to , $ from ) ; return $ value ; } if ( self :: getIsIconvEnabled ( ) ) { $ value = iconv ( $ from , $ to , $ value ) ; return $ value ; } return $ value ; } | Convert string from one encoding to another . First try mbstring then iconv or no convertion |
8,420 | public static function CountCharacters ( $ value , $ enc = 'UTF-8' ) { if ( self :: getIsMbstringEnabled ( ) ) { $ count = mb_strlen ( $ value , $ enc ) ; return $ count ; } if ( self :: getIsIconvEnabled ( ) ) { $ count = iconv_strlen ( $ value , $ enc ) ; return $ count ; } $ count = strlen ( $ value ) ; return $ cou... | Get character count . First try mbstring then iconv finally strlen |
8,421 | public function max ( $ table , $ inc = null ) { return $ this -> select ( $ table , [ 'MAX(id)' ] ) [ 0 ] [ 'MAX(id)' ] + ( isset ( $ inc ) ? $ inc : 0 ) ; } | Get Maximum ID of a table |
8,422 | public function fetch ( $ query ) { $ db = $ this -> connection ( ) ; if ( method_exists ( $ result = $ db -> query ( rtrim ( preg_replace ( '/\s\s/' , ' ' , $ query ) , ' ' ) ) , 'rowCount' ) ) { if ( $ result -> rowCount ( ) && $ result -> setFetchMode ( $ db :: FETCH_ASSOC ) ) { return $ result -> fetchAll ( ) ; } r... | Get Data from the table |
8,423 | public function file ( $ cut = true ) { if ( empty ( $ this -> file ) ) { return null ; } if ( $ cut ) { return str_replace ( CCROOT , '' , $ this -> file ) ; } return $ this -> file ; } | get file path |
8,424 | public function args_string ( ) { if ( ! isset ( $ this -> args ) || ! is_array ( $ this -> args ) ) { return null ; } $ args = $ this -> args ; foreach ( $ args as $ key => $ arg ) { if ( is_array ( $ arg ) ) { $ args [ $ key ] = 'Array' ; } else { $ args [ $ key ] = var_export ( $ arg , true ) ; } } return implode ( ... | create an argument string |
8,425 | private function parse_source ( ) { if ( ! $ this -> file ( ) ) { return null ; } $ lines = file ( $ this -> file ) ; $ size = 10 ; $ start = $ this -> line - ( $ size / 2 ) ; $ end = $ this -> line + ( $ size / 2 ) ; while ( $ start > 0 && substr ( trim ( $ lines [ $ start - 1 ] ) , 0 , 1 ) === '*' ) { $ start -- ; } ... | parse the source file |
8,426 | public function reflection_file ( ) { if ( is_null ( $ this -> reflection_file ) ) { if ( is_null ( $ reflection = $ this -> reflection ( ) ) ) { return null ; } $ this -> reflection_file = file ( $ reflection -> getFileName ( ) ) ; } return $ this -> reflection_file ; } | get the source code of the reflected file |
8,427 | public function reflection_function_info ( $ function = null ) { if ( is_null ( $ lines = $ this -> reflection_file ( ) ) ) { return null ; } if ( is_null ( $ function ) ) { if ( is_null ( $ function = $ this -> function_name ( ) ) ) { return null ; } } $ info = array ( 'message' => '' , ) ; foreach ( $ lines as $ inde... | get the source code where the trace happend |
8,428 | public function setEmail ( $ email ) { require_once 'Zend/Validate/EmailAddress.php' ; $ validate = new Zend_Validate_EmailAddress ( ) ; if ( ! $ validate -> isValid ( $ email ) ) { require_once 'Zend/Feed/Builder/Exception.php' ; throw new Zend_Feed_Builder_Exception ( "you have to set a valid email address into the e... | Sets the author s email |
8,429 | public function setWebmaster ( $ webmaster ) { require_once 'Zend/Validate/EmailAddress.php' ; $ validate = new Zend_Validate_EmailAddress ( ) ; if ( ! $ validate -> isValid ( $ webmaster ) ) { require_once 'Zend/Feed/Builder/Exception.php' ; throw new Zend_Feed_Builder_Exception ( "you have to set a valid email addres... | Email address for person responsible for technical issues Ignored if atom is used |
8,430 | public function setTtl ( $ ttl ) { require_once 'Zend/Validate/Int.php' ; $ validate = new Zend_Validate_Int ( ) ; if ( ! $ validate -> isValid ( $ ttl ) ) { require_once 'Zend/Feed/Builder/Exception.php' ; throw new Zend_Feed_Builder_Exception ( "you have to set an integer value to the ttl property" ) ; } $ this -> of... | How long in minutes a feed can be cached before refreshing Ignored if atom is used |
8,431 | public function setCloud ( $ uri , $ procedure , $ protocol ) { if ( is_string ( $ uri ) && Zend_Uri_Http :: check ( $ uri ) ) { $ uri = Zend_Uri :: factory ( $ uri ) ; } if ( ! $ uri instanceof Zend_Uri_Http ) { require_once 'Zend/Feed/Builder/Exception.php' ; throw new Zend_Feed_Builder_Exception ( 'Passed parameter ... | Cloud to be notified of updates of the feed Ignored if atom is used |
8,432 | public function setTextInput ( $ title , $ description , $ name , $ link ) { $ this -> offsetSet ( 'textInput' , array ( 'title' => $ title , 'description' => $ description , 'name' => $ name , 'link' => $ link ) ) ; return $ this ; } | A text input box that can be displayed with the feed Ignored if atom is used |
8,433 | public function setSkipHours ( array $ hours ) { if ( count ( $ hours ) > 24 ) { require_once 'Zend/Feed/Builder/Exception.php' ; throw new Zend_Feed_Builder_Exception ( "you can not have more than 24 rows in the skipHours property" ) ; } foreach ( $ hours as $ hour ) { if ( $ hour < 0 || $ hour > 23 ) { require_once '... | Hint telling aggregators which hours they can skip Ignored if atom is used |
8,434 | public function setSkipDays ( array $ days ) { if ( count ( $ days ) > 7 ) { require_once 'Zend/Feed/Builder/Exception.php' ; throw new Zend_Feed_Builder_Exception ( "you can not have more than 7 days in the skipDays property" ) ; } $ valid = array ( 'monday' , 'tuesday' , 'wednesday' , 'thursday' , 'friday' , 'saturda... | Hint telling aggregators which days they can skip Ignored if atom is used |
8,435 | public function store ( $ key , $ value , $ expiry = 0 ) { if ( $ expiry == 0 ) { $ expiry = $ this -> expiry ; } $ entry = new CacheItem ( ) ; $ entry -> value = serialize ( $ value ) ; $ entry -> expireAt = time ( ) + $ expiry ; $ data = serialize ( $ entry ) ; $ this -> store -> store ( $ key , $ data ) ; $ this -> ... | Cache an item |
8,436 | public function get ( $ key ) { $ entry = null ; if ( isset ( $ this -> items [ $ key ] ) ) { $ entry = $ this -> items [ $ key ] ; } else { $ data = $ this -> store -> get ( $ key ) ; if ( $ data ) { $ entry = unserialize ( $ data ) ; } } if ( ! $ entry ) { return $ entry ; } if ( $ entry -> expireAt > time ( ) ) { re... | Gets a cached value for a given key |
8,437 | public function buildForm ( FormBuilderInterface $ builder , $ exportAlias , array $ aggregatorAliases ) { $ builder -> add ( 'numerotation' , ChoiceType :: class , array ( 'choices' => array ( 'yes' => true , 'no' => false ) , 'expanded' => true , 'multiple' => false , 'label' => "Add a number on first column" , 'choi... | build a form which will be used to collect data required for the execution of this formatter . |
8,438 | public function getResponse ( $ result , $ formatterData , $ exportAlias , array $ exportData , array $ filtersData , array $ aggregatorsData ) { $ this -> result = $ result ; $ this -> exportAlias = $ exportAlias ; $ this -> exportData = $ exportData ; $ this -> formatterData = $ formatterData ; $ output = fopen ( 'ph... | Generate a response from the data collected on differents ExportElementInterface |
8,439 | protected function prepareHeaders ( $ output ) { $ keys = $ this -> exportManager -> getExport ( $ this -> exportAlias ) -> getQueryKeys ( $ this -> exportData ) ; $ first_row = count ( $ this -> result ) > 0 ? $ this -> result [ 0 ] : array ( ) ; $ header_line = array ( ) ; if ( $ this -> formatterData [ 'numerotation... | add the headers to the csv file |
8,440 | protected function getLabel ( $ key , $ value ) { if ( $ this -> labelsCache === null ) { $ this -> prepareCacheLabels ( ) ; } return $ this -> labelsCache [ $ key ] ( $ value ) ; } | Give the label corresponding to the given key and value . |
8,441 | protected function prepareCacheLabels ( ) { $ export = $ this -> exportManager -> getExport ( $ this -> exportAlias ) ; $ keys = $ export -> getQueryKeys ( $ this -> exportData ) ; foreach ( $ keys as $ key ) { $ values = \ array_map ( function ( $ v ) use ( $ key ) { return $ v [ $ key ] ; } , $ this -> result ) ; $ t... | Prepare the label cache which will be used by getLabel . This function should be called only once in the generation lifecycle . |
8,442 | public function hasFeature ( $ feature ) { $ feature = strtoupper ( $ feature ) ; if ( ! isset ( $ this -> features [ $ feature ] ) ) { return null ; } return $ this -> features [ $ feature ] ; } | Check if feature exists and enabled . |
8,443 | public function setEventEmitter ( $ emitter = null ) { if ( $ emitter === null ) { $ this -> eventEmitter = new Emitter ( ) ; } else { $ this -> eventEmitter = $ emitter ; } } | Set an event emitter |
8,444 | public function addEventListener ( $ eventName , callable $ listener , $ priority = Emitter :: P_NORMAL ) { $ this -> eventEmitter -> addListener ( $ eventName , $ listener , $ priority ) ; } | Add an event listener to the event emitter |
8,445 | public function setClientStorage ( ClientInterface $ storage ) { $ storage -> setServer ( $ this ) ; $ this -> clientStorage = $ storage ; return $ this ; } | Set the client storage |
8,446 | public function setSessionStorage ( SessionInterface $ storage ) { $ storage -> setServer ( $ this ) ; $ this -> sessionStorage = $ storage ; return $ this ; } | Set the session storage |
8,447 | public function setAccessTokenStorage ( AccessTokenInterface $ storage ) { $ storage -> setServer ( $ this ) ; $ this -> accessTokenStorage = $ storage ; return $ this ; } | Set the access token storage |
8,448 | public function setRefreshTokenStorage ( RefreshTokenInterface $ storage ) { $ storage -> setServer ( $ this ) ; $ this -> refreshTokenStorage = $ storage ; return $ this ; } | Set the refresh token storage |
8,449 | public function setAuthCodeStorage ( AuthCodeInterface $ storage ) { $ storage -> setServer ( $ this ) ; $ this -> authCodeStorage = $ storage ; return $ this ; } | Set the auth code storage |
8,450 | public function setScopeStorage ( ScopeInterface $ storage ) { $ storage -> setServer ( $ this ) ; $ this -> scopeStorage = $ storage ; return $ this ; } | Set the scope storage |
8,451 | public function actionDelete ( $ id ) { if ( Admin :: find ( ) -> count ( ) == 1 ) { Yii :: $ app -> getSession ( ) -> setFlash ( 'success' , Yii :: t ( 'yuncms' , 'This is the last administrator, delete can not manage the system, it can not be deleted!' ) ) ; return $ this -> redirect ( [ 'index' ] ) ; } $ this -> fin... | Deletes an existing Admin model . If deletion is successful the browser will be redirected to the index page . |
8,452 | public static function init ( array $ attributes ) { $ obj = new Attributes ; foreach ( $ attributes as $ attribute ) { $ obj -> { $ attribute -> key } = $ attribute ; } return $ obj ; } | Initialize from list of attributes . |
8,453 | protected function sessionUserId ( ) { $ userId = null ; $ request = $ this -> newRequest ( ) ; if ( $ request -> session ( ) -> started ( ) ) { $ userId = $ request -> session ( ) -> read ( $ this -> _config [ 'sessionUserIdKey' ] ) ; } else { $ this -> log ( 'The Session is not started. This typically means a User is... | Return the User . id grabbed from the Session information . |
8,454 | public static function importArray ( array $ data , $ format = 'atom' ) { $ obj = 'Zend_Feed_' . ucfirst ( strtolower ( $ format ) ) ; require_once 'Zend/Loader.php' ; Zend_Loader :: loadClass ( $ obj ) ; require_once 'Zend/Feed/Builder.php' ; return new $ obj ( null , null , new Zend_Feed_Builder ( $ data ) ) ; } | Construct a new Zend_Feed_Abstract object from a custom array |
8,455 | public static function importBuilder ( Zend_Feed_Builder_Interface $ builder , $ format = 'atom' ) { $ obj = 'Zend_Feed_' . ucfirst ( strtolower ( $ format ) ) ; require_once 'Zend/Loader.php' ; Zend_Loader :: loadClass ( $ obj ) ; return new $ obj ( null , null , $ builder ) ; } | Construct a new Zend_Feed_Abstract object from a Zend_Feed_Builder_Interface data source |
8,456 | public function asJsonP ( $ data ) : YiiResponse { $ response = Yii :: $ app -> getResponse ( ) ; $ response -> data = $ data ; $ response -> format = YiiResponse :: FORMAT_JSONP ; return $ response ; } | Sets the response format of the given data as JSONP . |
8,457 | public function asRaw ( $ data ) : YiiResponse { $ response = Yii :: $ app -> getResponse ( ) ; $ response -> data = $ data ; $ response -> format = YiiResponse :: FORMAT_RAW ; return $ response ; } | Sets the response format of the given data as RAW . |
8,458 | protected function setParam ( $ key , $ value ) { if ( ! array_key_exists ( $ key , $ this -> _params ) ) { if ( $ this -> _ignoreExisting || $ this -> arrayGet ( $ this -> _setup , 'suppress_errors' ) === true ) { return ; } throw new UnknownPropertyException ( "Unknown property: '{$key}'" ) ; } switch ( $ this -> _ty... | Set a value in the parameter pool and cast it to the same type as the default value |
8,459 | protected function setDefaultDataTypes ( ) { foreach ( $ this -> _params as $ key => $ value ) { switch ( gettype ( $ value ) ) { case "boolean" : $ this -> _types [ $ key ] = 'boolean' ; break ; case "integer" : $ this -> _types [ $ key ] = 'integer' ; break ; case "double" : $ this -> _types [ $ key ] = 'float' ; bre... | Get the default data types |
8,460 | public function toArray ( $ protect = null ) { $ protect = is_array ( $ protect ) ? $ protect : $ this -> _protect ; if ( $ protect ) { $ new = $ this -> _params ; foreach ( $ protect as $ key ) { unset ( $ new [ $ key ] ) ; } return json_decode ( json_encode ( $ new ) , true , 512 ) ; } return json_decode ( json_encod... | Return the params as array and remove the protected keys |
8,461 | public function date ( $ key , $ format = "F j, Y" ) { if ( is_numeric ( $ this -> _params [ $ key ] ) ) { return date ( $ format , $ this -> _params [ $ key ] ) ; } return date ( $ format , strtotime ( $ this -> _params [ $ key ] ) ) ; } | Return a parameter as a formatted date string |
8,462 | public static function make ( $ data = null , $ index = null , Closure $ modifier = null ) { if ( $ data instanceof Traversable ) { $ data = iterator_to_array ( $ data ) ; } if ( ! is_array ( $ data ) ) { return null ; } if ( count ( $ data ) < 1 ) { return [ ] ; } $ values = array_values ( $ data ) ; $ multi = array_k... | Convert array to entities |
8,463 | protected function arrayGet ( & $ source , $ key , $ default = null ) { if ( ! $ key ) { return $ default ; } if ( array_key_exists ( $ key , $ source ) ) { return $ source [ $ key ] ; } $ current = & $ source ; foreach ( explode ( '.' , $ key ) as $ segment ) { if ( ! array_key_exists ( $ segment , $ current ) ) { ret... | Get a key value using dot notation |
8,464 | protected function arrayHasKey ( & $ source , $ key ) { if ( ! $ key || ! is_array ( $ source ) ) { return false ; } if ( array_key_exists ( $ key , $ source ) ) { return true ; } $ current = & $ source ; foreach ( explode ( '.' , $ key ) as $ segment ) { if ( ! array_key_exists ( $ segment , $ current ) ) { return fal... | Check if a key exists using dot notation |
8,465 | public function join ( $ separator ) { return $ this -> reduce ( function ( $ joined , $ string ) use ( $ separator ) { return ( '' === $ joined ? '' : $ joined . $ separator ) . $ string ; } , '' ) ; } | Join all the strings in this map with the separator between them . |
8,466 | public function letter_frequency ( ) { return $ this -> transform ( function ( $ frequencies , $ word ) { foreach ( count_chars ( $ word , 1 ) as $ byte => $ frequency ) { $ letter = chr ( $ byte ) ; if ( $ frequencies -> has ( $ letter ) ) { $ frequencies -> set ( $ letter , $ frequencies -> get ( $ letter ) + 1 ) ; }... | Calculate frequency of letters in all strings . |
8,467 | private static function buildRegex ( string $ expression , bool $ is_prefix = false ) : string { $ regex = self :: REGEX_DELIMITER . '^' ; $ regex .= preg_replace ( array_keys ( self :: $ datatypes ) , self :: $ datatypes , $ expression ) ; $ regex .= $ is_prefix ? '(.*)' : '' ; $ regex .= '$' . self :: REGEX_DELIMITER... | Build a complete regular expression |
8,468 | private function getParsingMode ( string & $ route ) : int { if ( strpos ( $ route , 'R>' ) === 0 ) { $ route = str_replace ( 'R>' , '' , $ route ) ; return self :: MODE_REGEX ; } if ( strpos ( $ route , 'S>' ) === 0 ) { $ route = str_replace ( 'S>' , '' , $ route ) ; return self :: MODE_STRING ; } return self :: $ mod... | Detect route parsing mode for specific route |
8,469 | private function matchRoute ( string $ route , string $ url , & $ matches , $ value = null ) { switch ( $ this -> getParsingMode ( $ route ) ) { case self :: MODE_REGEX : $ matched = preg_match ( self :: buildRegex ( $ route , ! is_null ( $ value ) ) , $ url , $ matches ) ; array_shift ( $ matches ) ; break ; case self... | Match url against route |
8,470 | private function route ( ) : void { $ parsed = $ this -> parseRoute ( ) ; if ( ! $ parsed && isset ( $ this -> error_controller ) ) { call_user_func ( $ this -> error_controller ) ; } } | Try to parse routes or call the error controller |
8,471 | public static function setDefaultMode ( int $ mode ) : void { if ( in_array ( $ mode , [ self :: MODE_REGEX , self :: MODE_STRING ] ) ) { self :: $ mode = $ mode ; return ; } throw new \ UnexpectedValueException ( 'Invalid route mode' ) ; } | Set the route parsing mode |
8,472 | public function addClassPath ( $ path ) { if ( ! is_array ( $ path ) ) { $ path = array ( $ path ) ; } foreach ( $ path as $ item ) { $ this -> classPaths [ ] = $ item ; } } | Adds a path to search in when looking for a class . |
8,473 | public function loadClass ( $ className ) { $ cache = $ this -> getCache ( ) ; $ entries = $ cache -> load ( $ this -> cacheKey ) ; if ( $ entries == false ) { $ entries = array ( ) ; } $ status = $ this -> tryAndLoadClass ( $ className , $ entries ) ; if ( $ status ) { return true ; } if ( preg_match ( $ this -> ignor... | Returns true if the class file was found and included false if not . |
8,474 | public function buildCreateIndex ( Query $ query ) { return $ this -> renderStatement ( Query :: CREATE_INDEX , [ 'index' => $ this -> formatTable ( $ query -> getAlias ( ) ) , 'table' => $ this -> formatTable ( $ query -> getTable ( ) ) , 'fields' => $ this -> formatFields ( $ query ) ] + $ this -> formatAttributes ( ... | Build the CREATE INDEX query . |
8,475 | public function buildCreateTable ( Query $ query ) { $ schema = $ query -> getSchema ( ) ; if ( ! $ schema ) { throw new InvalidSchemaException ( 'Table creation requires a valid schema object' ) ; } return $ this -> renderStatement ( Query :: CREATE_TABLE , [ 'table' => $ this -> formatTable ( $ schema -> getTable ( )... | Build the CREATE TABLE query . Requires a table schema object . |
8,476 | public function buildDelete ( Query $ query ) { return $ this -> renderStatement ( Query :: DELETE , [ 'table' => $ this -> formatTable ( $ query -> getTable ( ) , $ query -> getAlias ( ) ) , 'joins' => $ this -> formatJoins ( $ query -> getJoins ( ) ) , 'where' => $ this -> formatWhere ( $ query -> getWhere ( ) ) , 'o... | Build the DELETE query . |
8,477 | public function buildDropIndex ( Query $ query ) { return $ this -> renderStatement ( Query :: DROP_INDEX , [ 'index' => $ this -> formatTable ( $ query -> getAlias ( ) ) , 'table' => $ this -> formatTable ( $ query -> getTable ( ) ) ] + $ this -> formatAttributes ( $ query -> getAttributes ( ) ) ) ; } | Build the DROP INDEX query . |
8,478 | public function buildDropTable ( Query $ query ) { return $ this -> renderStatement ( Query :: DROP_TABLE , [ 'table' => $ this -> formatTable ( $ query -> getTable ( ) ) ] + $ this -> formatAttributes ( $ query -> getAttributes ( ) ) ) ; } | Build the DROP TABLE query . |
8,479 | public function buildMultiInsert ( Query $ query ) { return $ this -> renderStatement ( Query :: INSERT , [ 'table' => $ this -> formatTable ( $ query -> getTable ( ) ) , 'fields' => $ this -> formatFields ( $ query ) , 'values' => $ this -> formatValues ( $ query ) ] + $ this -> formatAttributes ( $ query -> getAttrib... | Build the INSERT query with multiple record support . |
8,480 | public function buildSelect ( Query $ query ) { return $ this -> renderStatement ( Query :: SELECT , [ 'fields' => $ this -> formatFields ( $ query ) , 'table' => $ this -> formatTable ( $ query -> getTable ( ) , $ query -> getAlias ( ) ) , 'joins' => $ this -> formatJoins ( $ query -> getJoins ( ) ) , 'where' => $ thi... | Build the SELECT query . |
8,481 | public function buildTruncate ( Query $ query ) { return $ this -> renderStatement ( Query :: TRUNCATE , [ 'table' => $ this -> formatTable ( $ query -> getTable ( ) ) ] + $ this -> formatAttributes ( $ query -> getAttributes ( ) ) ) ; } | Build the TRUNCATE query . |
8,482 | public function buildUpdate ( Query $ query ) { return $ this -> renderStatement ( Query :: UPDATE , [ 'fields' => $ this -> formatFields ( $ query ) , 'table' => $ this -> formatTable ( $ query -> getTable ( ) , $ query -> getAlias ( ) ) , 'joins' => $ this -> formatJoins ( $ query -> getJoins ( ) ) , 'where' => $ thi... | Build the UPDATE query . |
8,483 | public function extend ( $ template , $ data = [ ] , $ paramName = 'body' ) { $ this -> extendedTemplate = $ this -> resolveTemplatePath ( $ template ) ; if ( is_array ( $ data ) ) { $ this -> extendedData = $ data ; } if ( is_string ( $ paramName ) && $ paramName ) { $ this -> extendedParamName = $ paramName ; } } | Set extended template and data . |
8,484 | public function translate ( $ key , $ defaultValue = '' , $ locale = null ) { return $ this -> translation -> translate ( $ key , $ defaultValue , $ locale ) ; } | Helper function for translation . |
8,485 | protected function resolveTemplatePath ( $ path ) { switch ( $ path [ 0 ] ) { case '/' : break ; case '.' : $ path = realpath ( dirname ( $ this -> template ) . '/' . $ path . '.phtml' ) ; break ; default : $ path = realpath ( $ this -> pathService -> getTemplatesPath ( ) . '/' . $ path . '.phtml' ) ; break ; } if ( $ ... | Resolve template path . |
8,486 | protected function renderToHtml ( ) { extract ( $ this -> data , EXTR_SKIP ) ; ob_start ( ) ; set_error_handler ( [ $ this , 'handleError' ] ) ; include $ this -> template ; restore_error_handler ( ) ; $ html = ob_get_clean ( ) ; return $ html ; } | Render this block to HTML string . |
8,487 | protected function normalizeAlias ( $ alias ) { $ normalized = preg_replace ( '/[^a-zA-Z0-9]/' , ' ' , $ alias ) ; $ normalized = 'new' . str_replace ( ' ' , '' , ucwords ( $ normalized ) ) ; return $ normalized ; } | Normalize an alias to a new instance method name |
8,488 | public function addStyleId ( $ styleId ) { $ styleId = ( string ) $ styleId ; if ( ! in_array ( $ styleId , $ this -> styleIds ) ) { array_push ( $ this -> styleIds , $ styleId ) ; } return $ this ; } | Add style Id |
8,489 | public function addStyleClass ( $ styleClass ) { $ styleClass = ( string ) $ styleClass ; if ( ! in_array ( $ styleClass , $ this -> styleClasses ) ) { array_push ( $ this -> styleClasses , $ styleClass ) ; } return $ this ; } | Add style class |
8,490 | public function init ( Entity $ entity , Closure $ adder = NULL , Closure $ remover = NULL ) { parent :: init ( $ entity ) ; list ( $ add , $ remove ) = $ this -> getRelationInterface ( ) ; if ( ! $ adder ) { $ adder = function ( $ entity , $ toEntity , $ repository ) use ( $ add ) { $ repository -> persist ( $ toEntit... | Kompiliert den Synchronizer und initialisiert |
8,491 | function postPublicNotification ( $ message , $ link = null , $ iconStyle = null , $ iconSubstyle = null , $ titleIdString = null , $ mediaURL = null , $ group = null ) { $ n = new Notification ( ) ; $ n -> senderName = ( object ) array ( 'serverLogin' => $ this -> serverLogin ) ; $ n -> message = $ message ; $ n -> li... | Send a public notification to every player that bookmarked your server . |
8,492 | function postPrivateEvent ( $ message , $ eventDate , $ receiverName , $ link = null , $ titleIdString = null , $ mediaURL = null ) { $ e = new Event ( ) ; $ n -> senderName = ( object ) array ( 'serverLogin' => $ this -> serverLogin ) ; $ e -> message = $ message ; $ e -> link = $ link ; $ e -> receiverName = $ receiv... | Create an event visible only by the receivers . To create an event for many players just give an array of login as receiverName . |
8,493 | function postPublicEvent ( $ message , $ eventDate , $ link = null , $ titleIdString = null , $ mediaURL = null ) { $ e = new Event ( ) ; $ n -> senderName = ( object ) array ( 'serverLogin' => $ this -> serverLogin ) ; $ e -> message = $ message ; $ e -> link = $ link ; $ e -> eventDate = $ eventDate ; $ n -> titleId ... | Create an event visible by all players who bookmarked your server |
8,494 | public static function create ( string $ baseUri , array $ query = [ ] ) : string { if ( count ( $ query ) === 0 ) { return $ baseUri ; } return sprintf ( '%s/?%s' , $ baseUri , http_build_query ( $ query ) ) ; } | Create request url based on base uri and request parameters . |
8,495 | public function switcher ( $ fieldName , array $ options = [ ] ) { $ input = parent :: checkbox ( $ fieldName , $ options ) ; if ( $ this -> getConfig ( 'materializeCss' , false ) === false ) { return $ input ; } $ options += [ 'before' => __d ( 'backend' , 'Off' ) , 'after' => __d ( 'backend' , 'On' ) ] ; $ title = ( ... | Form switcher . |
8,496 | public function create ( $ model = null , array $ options = [ ] ) { $ options += [ 'process' => false , 'jsForm' => false ] ; $ options = $ this -> addClass ( $ options , $ this -> _class ( 'form' ) ) ; $ isProcess = $ options [ 'process' ] ; if ( $ isProcess !== false ) { $ _options = [ 'url' => [ 'plugin' => $ this -... | Create html form . |
8,497 | public function end ( array $ secureAttributes = [ ] ) { if ( $ this -> _isJsForm ) { return implode ( '' , [ $ this -> hidden ( 'action' , [ 'value' => '' , 'class' => 'jsFormAction' ] ) , parent :: end ( $ secureAttributes ) ] ) ; } return parent :: end ( $ secureAttributes ) ; } | End html form . |
8,498 | protected function _addDefaultContextProviders ( ) { $ this -> addContextProvider ( 'orm' , function ( $ request , $ data ) { if ( is_array ( $ data [ 'entity' ] ) || $ data [ 'entity' ] instanceof \ Traversable ) { $ pass = ( new Collection ( $ data [ 'entity' ] ) ) -> first ( ) !== null ; if ( $ pass ) { return new E... | Add the default suite of context providers provided . |
8,499 | protected function _addEntityContent ( $ request , $ data ) { if ( $ data [ 'entity' ] instanceof EntityInterface ) { return new EntityContext ( $ request , $ data ) ; } if ( is_array ( $ data [ 'entity' ] ) && empty ( $ data [ 'entity' ] [ 'schema' ] ) ) { return new EntityContext ( $ request , $ data ) ; } } | Add the entity suite of context providers provided . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.