idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
229,300 | public function onKernelException ( GetResponseForExceptionEvent $ event ) { $ request = $ event -> getRequest ( ) ; $ exception = $ event -> getException ( ) ; if ( ! $ this -> supports ( $ request ) ) { return ; } $ statusCode = $ exception instanceof HttpException ? $ exception -> getStatusCode ( ) : 500 ; $ errors ... | Exception event handler |
229,301 | protected function transformWords ( array $ words ) { $ text = implode ( " {$this->determine} " , $ words ) ; $ text = $ this -> pinyin -> sentence ( $ text ) ; return explode ( " {$this->determine} " , $ text ) ; } | Transform words to pinyin . |
229,302 | protected function prepareRatios ( Collection $ tags ) { $ ratios = $ tags -> filter ( function ( Tag $ tag ) { return $ tag -> hasPosts ( ) ; } ) -> transform ( function ( Tag $ tag ) { return [ 'label' => $ tag -> name , 'posts' => $ tag -> posts -> count ( ) , ] ; } ) -> sortByDesc ( 'posts' ) ; $ chunk = $ ratios -... | Prepare the tags ratios . |
229,303 | private function colorizeRatios ( Collection $ ratios ) { $ colors = [ '#F56954' , '#00A65A' , '#F39C12' , '#00C0EF' , '#3C8DBC' ] ; return $ ratios -> values ( ) -> transform ( function ( array $ values , $ key ) use ( $ colors ) { return $ values + [ 'color' => $ colors [ $ key ] ] ; } ) ; } | Colorize the ratios . |
229,304 | public function searchTable ( string $ databaseName , string $ tableName , string $ searchTerm ) : \ Generator { return $ this -> search -> searchTable ( $ this -> connection , $ databaseName , $ tableName , $ searchTerm ) ; } | Performs search on the specified database and table . |
229,305 | public function searchDatabase ( string $ databaseName , string $ searchTerm ) : \ Generator { return $ this -> search -> searchDatabase ( $ this -> connection , $ databaseName , $ searchTerm ) ; } | Performs search on all tables in the specified database . |
229,306 | public function searchServer ( string $ searchTerm ) : \ Generator { return $ this -> search -> searchServer ( $ this -> connection , $ searchTerm ) ; } | Performs search on all available databases . |
229,307 | public function replaceTable ( string $ databaseName , string $ tableName , string $ searchTerm , string $ replaceTerm ) : \ Generator { return $ this -> replace -> replaceTable ( $ this -> connection , $ databaseName , $ tableName , $ searchTerm , $ replaceTerm ) ; } | Performs search and replacement on the specified database and table . |
229,308 | public function replaceDatabase ( string $ databaseName , string $ searchTerm , string $ replaceTerm ) : \ Generator { return $ this -> replace -> replaceDatabase ( $ this -> connection , $ databaseName , $ searchTerm , $ replaceTerm ) ; } | Performs search and replacement on all tables in the specified database . |
229,309 | public function getCacheService ( ) { $ memcached = $ this -> memcached ; if ( empty ( $ memcached ) ) { $ memcached = $ this -> getServiceLocator ( ) -> get ( 'memcached' ) ; } return $ memcached ; } | Get memcached service |
229,310 | static function NextStep ( $ step ) { $ keys = array_keys ( self :: Steps ( ) ) ; $ index = array_search ( $ step , $ keys ) ; if ( $ index !== false && $ index < count ( $ keys ) - 1 ) { return $ keys [ $ index + 1 ] ; } return null ; } | Gets the next step name |
229,311 | public static function fixUTF8 ( $ text , $ option = self :: WITHOUT_ICONV ) { if ( is_array ( $ text ) ) { foreach ( $ text as $ k => $ v ) $ text [ $ k ] = self :: fixUTF8 ( $ v , $ option ) ; return $ text ; } $ last = "" ; while ( $ last <> $ text ) { $ last = $ text ; $ text = self :: toUTF8 ( static :: utf8_decod... | Fix broken UTF - 8 text . |
229,312 | public static function encode ( $ encodingLabel , $ text ) { $ encodingLabel = self :: normalizeEncoding ( $ encodingLabel ) ; if ( $ encodingLabel == 'ISO-8859-1' ) return self :: toWin1252 ( $ text ) ; return self :: toUTF8 ( $ text ) ; } | Convert the text to either UTF - 8 or ISO - 85591 - 1 . |
229,313 | public static function getBOM ( string $ which ) { $ cname = self :: class . '::' . strtoupper ( $ which ) . '_BOM' ; if ( ! defined ( $ cname ) ) return null ; $ bytes = constant ( $ cname ) ; $ bom = '' ; foreach ( $ bytes as $ ord ) $ bom .= chr ( $ ord ) ; return $ bom ; } | Get a BOM for a supported encoding |
229,314 | public function orderBy ( $ column , string $ direction = 'asc' ) : self { $ column = $ this -> checkStringValue ( 'Argument $column' , $ column ) ; $ this -> order [ ] = new Order ( $ column , strtolower ( $ direction ) === 'desc' ) ; return $ this ; } | Adds a simple order to the orders list . |
229,315 | public function orderByNullLast ( $ column , bool $ doReverse = false ) : self { $ column = $ this -> checkStringValue ( 'Argument $column' , $ column ) ; $ this -> order [ ] = new OrderByIsNull ( $ column , $ doReverse ) ; return $ this ; } | Adds such order that the null column values go last . |
229,316 | public function inExplicitOrder ( $ column , array $ order , bool $ areOtherFirst = false ) : self { $ column = $ this -> checkStringValue ( 'Argument $column' , $ column ) ; foreach ( $ order as $ index => & $ value ) { $ value = $ this -> checkScalarOrNullValue ( 'Argument $order[' . $ index . ']' , $ value ) ; } $ t... | Adds such order that makes a column values follow the explicitly given order . |
229,317 | public function delete ( ) { if ( ! $ this -> isNewRecord ) { $ item = Yii :: $ app -> authManager -> getRole ( $ this -> name ) ; if ( $ item ) { Yii :: $ app -> authManager -> remove ( $ item ) ; } } } | Delete current item |
229,318 | static public function getRolesList ( $ except = null ) { $ res = ArrayHelper :: map ( Yii :: $ app -> authManager -> getRoles ( ) , 'name' , 'description' ) ; if ( $ except !== null ) { unset ( $ res [ $ except ] ) ; } asort ( $ res ) ; return $ res ; } | Returns roles list description by name as key |
229,319 | static public function getPermissionsList ( $ except = null ) { $ res = ArrayHelper :: map ( Yii :: $ app -> authManager -> getPermissions ( ) , 'name' , 'description' ) ; if ( $ except !== null ) { unset ( $ res [ $ except ] ) ; } ksort ( $ res ) ; return $ res ; } | Returns permissions list description by name as key |
229,320 | public function query ( $ param , $ handler ) { $ param = new QueryParam ( $ param , $ handler ) ; $ this -> middleware [ ] = $ param ; } | Adds query handlers to a queue . The queue is processed at invocation by RelayPHP . |
229,321 | public function param ( $ param , $ handler ) { $ param = new RouteParam ( $ param , $ handler ) ; $ this -> middleware [ ] = $ param ; } | Adds param handlers to a queue . The queue is processed at invocation by RelayPHP . |
229,322 | protected function manageMediaDetectionAndStoreInSession ( ) { $ detect = new \ Mobile_Detect ( ) ; if ( array_key_exists ( Routers \ IMedia :: MEDIA_VERSION_MOBILE , $ this -> allowedMediaVersionsAndUrlValues ) && $ detect -> isMobile ( ) ) { $ this -> mediaSiteVersion = Routers \ IMedia :: MEDIA_VERSION_MOBILE ; } el... | Detect media site version by sent user agent string by third party \ Mobile_Detect library and store detected result in session namespace for next requests . |
229,323 | protected function setUpMediaSiteVersionToContextAndSession ( $ targetMediaSiteVersion ) { $ this -> session -> { static :: URL_PARAM_MEDIA_VERSION } = $ targetMediaSiteVersion ; $ this -> mediaSiteVersion = $ targetMediaSiteVersion ; return [ \ MvcCore \ Ext \ Routers \ IMedia :: URL_PARAM_MEDIA_VERSION => $ targetMed... | Set up media site version string into current context and into session and return it . |
229,324 | public function getLpPath ( NestedSetRoutingPageInterface $ page , $ action , $ parameters = array ( ) , $ relative = false ) { $ configuration = $ this -> routeConfiguration -> get ( $ action ) ; return $ this -> opGenerator -> generate ( $ configuration -> getPageRouteName ( $ page ) , $ parameters , $ relative ? Url... | Build nested set page route |
229,325 | public function saveMessage ( $ msg ) { $ messages = $ this -> session -> get ( "FlashInSession" , [ ] ) ; $ messages [ ] = $ msg ; $ this -> session -> set ( "FlashInSession" , $ messages ) ; } | Save a message to the session |
229,326 | public function getMessages ( $ removeOnGet = false ) { $ messages = $ this -> session -> get ( "FlashInSession" , [ ] ) ; if ( $ removeOnGet ) { $ this -> clear ( ) ; } return $ messages ; } | Retrievs all stored messages . |
229,327 | private function _setParams ( $ params , $ keys , $ required = true ) { foreach ( $ keys as $ key ) { if ( ! array_key_exists ( $ key , $ params ) ) { if ( $ required == true ) { throw new EmailException ( "Required configuration key '{$key}' was not found." ) ; } else { continue ; } } switch ( strtolower ( $ key ) ) {... | Sets various parameters on our mailer object . |
229,328 | public function subject ( $ subject ) { try { $ this -> mailer -> Subject = $ subject ; } catch ( phpmailerException $ e ) { throw new EmailException ( $ e -> getMessage ( ) , $ e -> getCode ( ) ) ; } return $ this ; } | Sets the subject for your email . |
229,329 | public function body ( $ text ) { try { $ this -> mailer -> MsgHTML ( $ text ) ; } catch ( phpmailerException $ e ) { throw new EmailException ( $ e -> getMessage ( ) , $ e -> getCode ( ) ) ; } return $ this ; } | Sets the email message body |
229,330 | public function altMessage ( $ altMessage ) { try { $ this -> mailer -> IsHTML ( ) ; $ this -> mailer -> AltBody = $ altMessage ; } catch ( phpmailerException $ e ) { throw new EmailException ( $ e -> getMessage ( ) , $ e -> getCode ( ) ) ; } return $ this ; } | Sets the alternative email message body . |
229,331 | public function attach ( $ filename ) { try { $ this -> mailer -> AddAttachment ( $ filename ) ; } catch ( phpmailerException $ e ) { throw new EmailException ( $ e -> getMessage ( ) , $ e -> getCode ( ) ) ; } return $ this ; } | Attaches the file specified to the email . |
229,332 | public function getFileUpload ( ) { $ propertyName = $ this -> getFileUploadPropertyName ( __FUNCTION__ ) ; if ( isset ( $ this -> fileUploads [ $ propertyName ] ) ) { return $ this -> fileUploads [ $ propertyName ] ; } } | Returns the uploaded file . |
229,333 | public function setFileUpload ( UploadedFile $ file = null ) { $ propertyName = $ this -> getFileUploadPropertyName ( __FUNCTION__ ) ; unset ( $ this -> fileUploads [ $ propertyName ] ) ; if ( $ file instanceof UploadedFile ) { $ this -> fileUploads [ $ propertyName ] = $ file ; } } | Sets the uploaded file . |
229,334 | private function getFileUploadPropertyName ( $ realCallerMethod ) { $ backtrace = debug_backtrace ( DEBUG_BACKTRACE_IGNORE_ARGS , 3 ) ; $ callerMethodName = $ backtrace [ 1 ] [ 'function' ] ; if ( $ callerMethodName === $ realCallerMethod ) { $ callerMethodName = $ backtrace [ 2 ] [ 'function' ] ; } return lcfirst ( su... | Returns file upload name based on the called method name . |
229,335 | public function createService ( ServiceLocatorInterface $ serviceLocator ) { $ config = $ serviceLocator -> get ( 'Config' ) ; $ viewConfig = isset ( $ config [ 'view' ] ) ? $ config [ 'view' ] : array ( ) ; $ className = isset ( $ viewConfig [ 'classname' ] ) ? $ viewConfig [ 'classname' ] : 'HumusMvc\View\View' ; $ v... | Create view service |
229,336 | public function archiveAction ( string $ production_slug , PaginatorInterface $ paginator , AuthorizationCheckerInterface $ auth , Request $ request ) : Response { $ production_repo = $ this -> em -> getRepository ( Production :: class ) ; if ( null === $ production = $ production_repo -> findOneBy ( [ 'slug' => $ prod... | Show a list of archived resources for a production . |
229,337 | public function createAction ( string $ production_slug , TokenStorageInterface $ token , AuthorizationCheckerInterface $ auth , Request $ request ) : Response { $ production_repo = $ this -> em -> getRepository ( Production :: class ) ; if ( null === $ production = $ production_repo -> findOneBy ( [ 'slug' => $ produc... | Create a new resource in a production . |
229,338 | public function readAction ( int $ id , string $ production_slug , AuthorizationCheckerInterface $ auth ) : Response { list ( $ resource , $ production ) = $ this -> lookupEntity ( Resource :: class , $ id , $ production_slug ) ; if ( ! $ auth -> isGranted ( 'view' , $ resource ) ) { throw new AccessDeniedException ( )... | Read a resource from this production . |
229,339 | public function updateAction ( int $ id , string $ production_slug , Request $ request , AuthorizationCheckerInterface $ auth ) : Response { list ( $ resource , $ production ) = $ this -> lookupEntity ( Resource :: class , $ id , $ production_slug ) ; if ( ! $ auth -> isGranted ( 'edit' , $ resource ) ) { throw new Acc... | Update a resource for this production . |
229,340 | public static function getConnection ( $ hostname , $ dbname ) { if ( isset ( self :: $ dbConnections [ $ hostname ] ) ) { $ conn = self :: $ dbConnections [ $ hostname ] ; } else { $ section = new kfLogSection ( __METHOD__ ) ; try { $ conn = new LoggedPDO ( 'mysql:host=' . $ hostname . ';dbname=' . $ dbname . '_p;char... | Get a database connection by hostname |
229,341 | public static function getDB ( $ dbname ) { if ( $ dbname === 'meta' ) { return self :: getMetaDB ( ) ; } $ wikiInfo = self :: getDbInfo ( $ dbname ) ; if ( ! $ wikiInfo [ 'slice' ] ) { throw new Exception ( "Incomplete database information for '$dbname'" ) ; } return self :: getConnection ( $ wikiInfo [ 'slice' ] , $ ... | Get a database connection by dbname . |
229,342 | public static function getAllWikiInfos ( ) { if ( ! isset ( self :: $ wikiInfos ) ) { $ wikiInfos = self :: getAllDbInfos ( ) ; foreach ( $ wikiInfos as $ dbname => & $ wikiInfo ) { if ( ! $ wikiInfo [ 'url' ] ) { unset ( $ wikiInfos [ $ dbname ] ) ; } } self :: $ wikiInfos = $ wikiInfos ; } return self :: $ wikiInfos ... | Like getAllDbInfos but without databases that aren t wikis . |
229,343 | protected static function generalizeSQL ( $ sql ) { $ sql = str_replace ( "\\\\" , '' , $ sql ) ; $ sql = str_replace ( "\\'" , '' , $ sql ) ; $ sql = str_replace ( "\\\"" , '' , $ sql ) ; $ sql = preg_replace ( "/'.*'/s" , "'X'" , $ sql ) ; $ sql = preg_replace ( '/".*"/s' , "'X'" , $ sql ) ; $ sql = preg_replace ( '/... | Remove most variables from an SQL query and replace them with X or N markers . |
229,344 | public function setupParams ( $ params = [ ] ) { if ( is_array ( $ params ) ) { $ this -> params = array_merge ( $ this -> params , $ params ) ; } return $ this ; } | Sets fixed parameters to be sent in all calls |
229,345 | public function call ( $ url , $ method = 'GET' , $ params = [ ] ) { $ params = array_merge ( $ this -> params , is_array ( $ params ) ? $ params : [ ] ) ; $ content = '' ; $ queryString = http_build_query ( $ params ) ; if ( $ method === 'GET' ) { $ url = $ url . '?' . $ queryString ; } else { $ content = $ queryStrin... | Makes an HTTP call |
229,346 | public function send ( string $ priority , string $ message , array $ context = [ ] ) { if ( ! $ this -> contextContainsException ( $ context ) ) { $ data = [ 'extra' => $ this -> sanitizer -> sanitize ( $ context ) , 'level' => $ priority , ] ; $ this -> client -> captureMessage ( $ message , [ ] , $ data , $ this -> ... | Send the log |
229,347 | public function to ( string $ target ) : Date { $ modifiedHandle = clone $ this -> originalDate -> handle ( ) ; $ modifiedHandle -> modify ( $ target ) ; return new Date ( $ modifiedHandle ) ; } | returns a new date instance which represents the changed date |
229,348 | public function timeTo ( string $ time ) : Date { $ times = explode ( ':' , $ time ) ; if ( count ( $ times ) != 3 ) { throw new \ InvalidArgumentException ( 'Given time "' . $ time . '" does not follow required format HH:MM:SS' ) ; } list ( $ hour , $ minute , $ second ) = $ times ; if ( ! ctype_digit ( $ hour ) || 0 ... | returns a new date instance with same date but changed time |
229,349 | public function hourTo ( int $ hour ) : Date { return $ this -> createDateWithNewTime ( $ hour , $ this -> originalDate -> minutes ( ) , $ this -> originalDate -> seconds ( ) ) ; } | returns a new date instance with same date minute and second but changed hour |
229,350 | public function byHours ( int $ hours ) : Date { return $ this -> hourTo ( $ this -> originalDate -> hours ( ) + $ hours ) ; } | changes date by given amount of hours |
229,351 | public function minuteTo ( int $ minute ) : Date { return $ this -> createDateWithNewTime ( $ this -> originalDate -> hours ( ) , $ minute , $ this -> originalDate -> seconds ( ) ) ; } | returns a new date instance with same date hour and second but changed minute |
229,352 | public function byMinutes ( int $ minutes ) : Date { return $ this -> minuteTo ( $ this -> originalDate -> minutes ( ) + $ minutes ) ; } | changes date by given amount of minutes |
229,353 | public function secondTo ( int $ second ) : Date { return $ this -> createDateWithNewTime ( $ this -> originalDate -> hours ( ) , $ this -> originalDate -> minutes ( ) , $ second ) ; } | returns a new date instance with same date hour and minute but changed second |
229,354 | public function bySeconds ( int $ seconds ) : Date { return $ this -> secondTo ( $ this -> originalDate -> seconds ( ) + $ seconds ) ; } | changes date by given amount of seconds |
229,355 | private function createDateWithNewTime ( int $ hour , int $ minute , int $ second ) : Date { return new Date ( $ this -> originalDate -> handle ( ) -> setTime ( $ hour , $ minute , $ second ) ) ; } | creates new date instance with changed time |
229,356 | public function dateTo ( string $ date ) : Date { $ dates = explode ( '-' , $ date ) ; if ( count ( $ dates ) != 3 ) { throw new \ InvalidArgumentException ( 'Given date "' . $ date . '" does not follow required format YYYY-MM-DD' ) ; } list ( $ year , $ month , $ day ) = $ dates ; if ( ! ctype_digit ( $ year ) ) { thr... | returns a new date instance with changed date but same time |
229,357 | public function byYears ( int $ years ) : Date { return $ this -> yearTo ( $ this -> originalDate -> year ( ) + $ years ) ; } | changes date by given amount of years |
229,358 | public function byMonths ( int $ months ) : Date { return $ this -> monthTo ( $ this -> originalDate -> month ( ) + $ months ) ; } | changes date by given amount of months |
229,359 | public function dayTo ( int $ day ) : Date { return $ this -> createNewDateWithExistingTime ( $ this -> originalDate -> year ( ) , $ this -> originalDate -> month ( ) , $ day ) ; } | returns a new date instance with changed day but same time year and month |
229,360 | public function byDays ( int $ days ) : Date { return $ this -> dayTo ( $ this -> originalDate -> day ( ) + $ days ) ; } | changes date by given amount of days |
229,361 | private function createNewDateWithExistingTime ( int $ year , int $ month , int $ day ) : Date { return new Date ( $ this -> originalDate -> handle ( ) -> setDate ( $ year , $ month , $ day ) ) ; } | creates new date instance with changed date but same time |
229,362 | public function buildProvider ( string $ key , array $ options = [ ] ) { $ provider = $ this -> get ( $ key ) ; switch ( $ provider [ 'Type' ] ) { case "Database" : if ( ! isset ( $ options [ 'storageHandler' ] ) || ! $ options [ 'storageHandler' ] instanceof \ Nuki \ Skeletons \ Handlers \ StorageHandler ) { throw new... | Build a provider by its key and additional options |
229,363 | private static function getTranslations ( array $ words ) { $ result = array ( ) ; foreach ( $ words as $ i ) { $ result = array_merge ( $ result , array ( ucfirst ( $ i ) , strtoupper ( $ i ) , strtolower ( $ i ) ) ) ; } return $ result ; } | Given a set of words perform the appropriate translations on them to match the YAML 1 . 1 specification for type coercing . |
229,364 | public function redirectTo ( $ location ) { $ app = $ GLOBALS [ 'app' ] ; $ host = $ _SERVER [ 'HTTP_HOST' ] ; if ( isset ( $ _SERVER [ 'HTTP_X_FORWARDED_HOST' ] ) ) { $ host = $ _SERVER [ 'HTTP_X_FORWARDED_HOST' ] ; } $ protocol = isset ( $ _SERVER [ 'HTTPS' ] ) ? 'https://' : 'http://' ; $ redirectLocation = $ protoc... | redirectTo Helper method to allow redirection to a certain url . |
229,365 | public function logout ( ) { $ this -> di -> get ( 'session' ) -> set ( "user" , null ) ; $ this -> di -> get ( "response" ) -> redirect ( "user/login" ) ; } | Logout user by setting user == null in session . |
229,366 | protected function getCalleeClass ( ) { if ( PHP_VERSION_ID < 50205 ) $ backtrace = debug_backtrace ( ) ; else $ backtrace = debug_backtrace ( false ) ; foreach ( $ backtrace as $ bt ) { if ( ! is_a ( $ this , $ bt [ 'class' ] ) && strpos ( $ bt [ 'class' ] , 'Logger' ) === false ) { return $ bt [ 'class' ] ; } } retur... | Returns the name of the class that called the logger function |
229,367 | public function getLogHistory ( $ klass = null ) { if ( empty ( $ klass ) ) return $ this -> history ; if ( ! isset ( $ this -> history [ $ klass ] ) ) return array ( ) ; return $ this -> history [ $ klass ] ; } | This function returns the current array of log message for a particular category . |
229,368 | public function clearLogHistory ( $ klass = null ) { if ( empty ( $ klass ) ) $ this -> history = array ( ) ; if ( ! isset ( $ this -> history [ $ klass ] ) ) return ; $ this -> history [ $ klass ] = array ( ) ; } | This function clears the current array of log message for a particular category . |
229,369 | public function write ( ) { $ gemfile = '' ; foreach ( $ this -> parameters as $ gem ) { $ line = str_replace ( '<gem>' , $ gem , self :: $ template ) ; $ gemfile = sprintf ( '%s%s%s' , $ gemfile , PHP_EOL , $ line ) ; } $ gemfile .= self :: $ sourceTemplate ; fwrite ( $ this -> file , $ this -> addHeaders ( $ gemfile ... | Writes Gemfile . |
229,370 | public function cacheObject ( $ key , $ object , $ timeoutSeconds = - 1 ) { $ cache = HttpSession :: instance ( ) -> getValue ( "__SESSION_CACHED_ITEMS" ) ; if ( ! is_array ( $ cache ) ) { $ cache = array ( ) ; } $ cache [ $ key ] = $ object ; HttpSession :: instance ( ) -> setValue ( "__SESSION_CACHED_ITEMS" , $ cache... | Cache an object with a key and an optional timeout in seconds . |
229,371 | public function getCachedObject ( $ key ) { $ cache = HttpSession :: instance ( ) -> getValue ( "__SESSION_CACHED_ITEMS" ) ; $ timeouts = HttpSession :: instance ( ) -> getValue ( "__SESSION_CACHE_TIMEOUTS" ) ; if ( is_array ( $ timeouts ) && isset ( $ timeouts [ $ key ] ) ) { $ now = new \ DateTime ( ) ; $ expiry = da... | Get a cached object by key |
229,372 | public function getPageUrl ( PagerfantaInterface $ pagerfanta , $ page , array $ options = array ( ) ) { if ( $ page < 0 || $ page > $ pagerfanta -> count ( ) ) { throw new \ InvalidArgumentException ( "Page '{$page}' is out of bounds" ) ; } $ routeGenerator = $ this -> createRouteGenerator ( $ options ) ; return $ rou... | Generates the url for a given page in a pagerfanta instance . |
229,373 | private function createRouteGenerator ( $ options = array ( ) ) { $ options = array_replace ( array ( 'routeName' => null , 'routeParams' => array ( ) , 'pageParameter' => '[page]' , ) , $ options ) ; $ router = $ this -> container -> get ( 'router' ) ; if ( null === $ options [ 'routeName' ] ) { $ request = $ this -> ... | Creates an anonymous function which returns the URL for a given page . |
229,374 | public function build ( array $ schemaDesc ) : Schema { $ this -> schemaDesc = $ schemaDesc ; $ schema = new Schema ( ) ; foreach ( $ schemaDesc [ 'tables' ] as $ name => $ tableDesc ) { $ table = $ schema -> createTable ( $ name ) ; $ this -> buildTable ( $ tableDesc , $ table ) ; } return $ schema ; } | Build an array descriptor into a Schema object |
229,375 | public static function fromValueForClass ( $ value , string $ class ) { $ message = sprintf ( 'Failed to validate value of type %1$s to fit into Value object of type %2$s. (%3$s)' , is_object ( $ value ) ? get_class ( $ value ) : gettype ( $ value ) , $ class , json_encode ( $ value ) ) ; return new static ( $ message ... | Create a new exception instance from a failing value . |
229,376 | public function addCopyRecord ( CopyRecord $ record ) { if ( $ this -> getCopyRecordByItemNumber ( $ record -> getItemNumber ( ) ) ) { throw new InvalidArgumentException ( "Cannot add copy record: Copy record with item number {$record->getItemNumber()} already present" ) ; } $ this -> addRecord ( $ record ) ; $ record ... | Add a copy record . |
229,377 | public function getCopyRecordByItemNumber ( $ itemNumber ) { foreach ( $ this -> _records as $ record ) { if ( $ record -> getItemNumber ( ) === $ itemNumber ) { return $ record ; } } return null ; } | Return copy record by item number . |
229,378 | public function setTitleRecord ( TitleRecord $ record ) { $ this -> unsetTitleRecord ( ) ; if ( ! $ record -> containsLocalRecord ( $ this ) ) { $ record -> addLocalRecord ( $ this ) ; } $ this -> _parent = $ record ; } | Set the containing title record . |
229,379 | public function unsetTitleRecord ( ) { if ( $ this -> _parent ) { if ( $ this -> _parent -> containsLocalRecord ( $ this ) ) { $ this -> _parent -> removeLocalRecord ( $ this ) ; } $ this -> _parent = null ; } } | Unset the containing title record . |
229,380 | public function getParameterQNames ( ) { $ result = array ( ) ; $ forQNames = array ( ) ; $ this -> traverseNodes ( $ this -> exprTree , function ( $ node ) use ( & $ result , & $ forQNames ) { if ( $ node instanceof ForNode ) { $ forQNames [ ] = $ node -> getQNVarName ( ) ; } else if ( $ node instanceof VarRefNode ) {... | Return an array of parameter names |
229,381 | public function isFunctionUsed ( $ functions ) { if ( is_string ( $ functions ) ) { $ functions = array ( $ functions ) ; } $ result = $ this -> traverseNodes ( $ this -> exprTree , function ( $ node ) use ( & $ result , $ functions ) { return true ; } ) ; return ! $ result ; } | Checks to see is one or any of a collection of functions are used in an expression |
229,382 | private function getCostCollection ( OrderInterface $ order ) : Collection { if ( $ order -> hasShippingMethod ( ) ) { $ costs = $ this -> getCurrentShippingMethodCostsCollection ( $ order ) ; if ( $ costs -> count ( ) > 0 ) { return $ costs ; } } return $ this -> getShippingCostCollection ( $ order ) ; } | Returns the costs collection for existing shipping method or all shipping methods if current method is not longer available |
229,383 | private function getCurrentShippingMethodCostsCollection ( OrderInterface $ order ) : Collection { return $ this -> methodProvider -> getShippingMethodCosts ( $ order -> getShippingMethod ( ) , new OrderContext ( $ order ) ) ; } | Returns the collection of costs for current shipping method |
229,384 | public static function getByMimeType ( ? string $ mimeType ) : int { switch ( explode ( '/' , ( string ) $ mimeType ) [ 0 ] ?? null ) { case 'image' : return static :: IMAGE ; case 'audio' : return static :: AUDIO ; case 'video' : return static :: VIDEO ; default : return static :: FILE ; } } | Returns file type by its mime type . |
229,385 | public function literal ( $ input , $ type = null ) { if ( ! is_string ( $ input ) ) { return $ input ; } return $ this -> connection -> quote ( $ input , $ type ) ; } | Quotes a given input parameter . |
229,386 | private function processChangePassword ( User $ user , $ password , $ confirmPassword ) { if ( empty ( $ password ) ) { return Errors :: PASSWORD_INVALID ; } if ( $ password !== $ confirmPassword ) { return Errors :: CONFIRM_PASSWORD_INVALID ; } $ mapper = MapperFactory :: getUserMapper ( ) ; $ user -> setPassword ( $ ... | Change the password of a user and sent them on their way . |
229,387 | private function verifyRecaptcha ( ) { if ( ! isset ( $ this -> recaptchaClientKey ) ) { return true ; } $ recaptcha = $ this -> request -> input ( 'g-recaptcha-response' ) ; if ( ! $ recaptcha ) { return false ; } $ request = new Request ( ) ; $ request -> setUrl ( 'https://www.google.com/recaptcha/api/siteverify' ) ;... | Verify recaptcha code |
229,388 | public function setCache ( $ key , $ value , $ ttl = 0 ) { $ cache_function = $ this -> set_cache_callback ; return $ cache_function ( $ this -> cache_type , array ( 'key' => $ key , 'value' => $ value , 'ttl' => $ ttl ) ) ; } | Persist data in cache |
229,389 | public function useCache ( ) { if ( is_callable ( $ this -> get_cache_callback ) && is_callable ( $ this -> set_cache_callback ) && is_callable ( $ this -> delete_cache_callback ) ) { return true ; } return false ; } | Determine if Cache is activated for this type |
229,390 | public function setConfig ( array $ config ) { foreach ( $ config as $ name => $ value ) { $ setter = 'set' . ucfirst ( $ name ) ; call_user_func_array ( array ( $ this , $ setter ) , array ( $ value ) ) ; } } | Sets the configuration of the builder . |
229,391 | public function getDocumentEntityRepository ( ) { if ( isset ( $ this -> er [ 'Document' ] ) ) { return $ this -> er [ 'Document' ] ; } $ sphinxClient = $ this -> getServiceManager ( ) -> get ( 'sphinxsearch.client.default' ) ; $ entityRepository = $ this -> getEntityManager ( ) -> getRepository ( 'Neobazaar\Entity\Doc... | Get Neobazaar \ Entity \ Document entity repository |
229,392 | public function getTermTaxonomyEntityRepository ( ) { if ( isset ( $ this -> er [ 'TermTaxonomy' ] ) ) { return $ this -> er [ 'TermTaxonomy' ] ; } $ this -> er [ 'TermTaxonomy' ] = $ this -> getEntityManager ( ) -> getRepository ( 'Neobazaar\Entity\TermTaxonomy' ) ; return $ this -> er [ 'TermTaxonomy' ] ; } | Get Neobazaar \ Entity \ TermTaxonomy entity repository |
229,393 | public function getGeonamesEntityRepository ( ) { if ( isset ( $ this -> er [ 'Geonames' ] ) ) { return $ this -> er [ 'Geonames' ] ; } $ this -> er [ 'Geonames' ] = $ this -> getEntityManager ( ) -> getRepository ( 'Neobazaar\Entity\Geonames' ) ; return $ this -> er [ 'Geonames' ] ; } | Get Neobazaar \ Entity \ Geonames entity repository |
229,394 | public function getUserEntityRepository ( ) { if ( isset ( $ this -> er [ 'User' ] ) ) { return $ this -> er [ 'User' ] ; } $ entityRepository = $ this -> getEntityManager ( ) -> getRepository ( 'Neobazaar\Entity\User' ) ; $ entityRepository -> setServiceLocator ( $ this -> getServiceManager ( ) ) ; $ this -> er [ 'Use... | Get Neobazaar \ Entity \ USer entity repository |
229,395 | public static function create ( Validator $ validator = null ) : self { return new self ( new ClosureContainer ( [ 'rollerworks_search.input.json' => function ( ) use ( $ validator ) { return new Input \ JsonInput ( $ validator ) ; } , 'rollerworks_search.input.string_query' => function ( ) use ( $ validator ) { return... | Create a new InputProcessorLoader with the build - in InputProcessors loadable . |
229,396 | protected function load ( ) { $ path = $ this -> vendorDir . '/composer' ; if ( ! is_dir ( $ path ) ) throw new InvalidProjectException ( '"composer" folder has not been found. Be sure to use this bundle on a project managed by Composer' ) ; $ map = require $ path . '/autoload_namespaces.php' ; foreach ( $ map as $ nam... | Loads the bundles when the autoload . json file exists parsing the autoload_namespaces . php file generated by composer |
229,397 | protected function parseExtraFolders ( ) { foreach ( $ this -> extraFolders as $ folder ) { $ finder = new Finder ( ) ; if ( is_dir ( $ folder ) ) { $ bundleFolders = $ finder -> directories ( ) -> depth ( 0 ) -> in ( $ folder ) ; foreach ( $ bundleFolders as $ bundleFolder ) { $ bundleName = basename ( $ bundleFolder ... | parses extra folders to look for autoloaders in different path than the ones saved into the composer file |
229,398 | protected function hasAutoloader ( $ path ) { if ( is_dir ( $ path ) ) { $ finder = new \ Symfony \ Component \ Finder \ Finder ( ) ; $ bundles = $ finder -> files ( ) -> depth ( 0 ) -> name ( 'autoload.json' ) -> in ( $ path ) ; if ( count ( $ bundles ) == 1 ) { return true ; } } return false ; } | Checks if the bundle has an autoloader . json file |
229,399 | public function getRange_ ( $ start , $ end ) { $ ret = new PrettyArray ( ) ; $ collecting = false ; $ start = ( string ) $ start ; $ end = ( string ) $ end ; foreach ( $ this -> data as $ key => & $ value ) { $ key = ( string ) $ key ; if ( $ start == $ key || $ collecting ) { $ collecting = true ; $ ret -> setByRefer... | Will get a range from PrettyArray . Calling it destructively will force the return value to be references to the current PrettyArray . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.