idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
57,500 | public function getPath ( array $ pathParameters = null ) { $ path = $ this -> path ; if ( ! empty ( $ this -> placeholders ) ) { foreach ( $ this -> placeholders as $ placeholder ) { $ regExp = '~\{' . $ placeholder [ 'name' ] . '(=.*?)?\}~' ; if ( $ pathParameters && array_key_exists ( $ placeholder [ 'name' ] , $ pa... | get path of route |
57,501 | public function setRequestMethods ( array $ requestMethods ) { $ requestMethods = array_map ( 'strtoupper' , $ requestMethods ) ; $ allowedMethods = [ 'GET' , 'POST' , 'PUT' , 'DELETE' , 'PATCH' ] ; foreach ( $ requestMethods as $ requestMethod ) { if ( ! in_array ( $ requestMethod , $ allowedMethods ) ) { throw new \ ... | set all allowed request methods for a route |
57,502 | public function allowsRequestMethod ( $ requestMethod ) { return empty ( $ this -> requestMethods ) || in_array ( strtoupper ( $ requestMethod ) , $ this -> requestMethods ) ; } | check whether a request method is allowed with the route |
57,503 | public function getPathParameter ( $ name , $ default = null ) { if ( empty ( $ this -> pathParameters ) && ! is_null ( $ this -> placeholders ) ) { $ names = array_keys ( $ this -> placeholders ) ; if ( preg_match ( '~' . $ this -> match . '~' , ltrim ( Request :: createFromGlobals ( ) -> getPathInfo ( ) , '/' ) , $ v... | get path parameter |
57,504 | public function redirect ( $ queryParams = [ ] , $ statusCode = 302 ) { $ request = Request :: createFromGlobals ( ) ; $ application = Application :: getInstance ( ) ; $ urlSegments = [ $ request -> getSchemeAndHttpHost ( ) ] ; if ( $ application -> getRouter ( ) -> getServerSideRewrite ( ) ) { if ( ( $ scriptName = ba... | redirect using configured redirect information if route has no redirect set redirect will lead to start page |
57,505 | public static function locateResource ( $ path , ContainerBuilder $ container ) { if ( 0 === stripos ( $ path , '@' ) ) { $ path = str_replace ( '\\' , '/' , $ path ) ; $ parts = explode ( '/' , $ path ) ; $ bundle = array_shift ( $ parts ) ; $ bundleName = str_replace ( '@' , '' , $ bundle ) ; $ bundleClass = null ; f... | Locates a file resource path for a given config path . Is needed in order to retrieve a bundle s directory if used . |
57,506 | public function emittedError ( $ value = null ) { if ( $ value === null ) { return $ this -> emittedErrorEvent ; } elseif ( $ value === true ) { $ this -> emittedErrorEvent = true ; } else { throw new \ InvalidArgumentException ( 'You cannot set the emitted ' . 'error value to false.' ) ; } } | Check or set if the exception was emitted in an error event . |
57,507 | protected function addFileRule ( $ attribute , $ size , $ mimes , $ count = 1 , $ isRequired = false ) { if ( $ this -> has ( $ attribute ) && is_string ( $ this -> $ attribute ) ) { $ this -> rules [ $ attribute ] = "elfinder_max:{$size}|elfinder:{$mimes}" ; } else if ( $ this -> file ( $ attribute ) && is_array ( $ t... | add file rule to rules |
57,508 | public function getSetting ( $ key , $ defaultValue = null ) { return $ this -> hasSetting ( $ key ) ? $ this -> settings [ $ key ] : $ defaultValue ; } | Get app setting with given key |
57,509 | public function get ( $ pattern , $ callback = null , $ inject = null ) { return $ this -> map ( [ 'GET' , 'HEAD' ] , $ pattern , $ callback , $ inject ) ; } | Adds a new route for the HTTP request method GET |
57,510 | public function post ( $ pattern , $ callback = null , $ inject = null ) { return $ this -> map ( [ 'POST' ] , $ pattern , $ callback , $ inject ) ; } | Adds a new route for the HTTP request method POST |
57,511 | public function put ( $ pattern , $ callback = null , $ inject = null ) { return $ this -> map ( [ 'PUT' ] , $ pattern , $ callback , $ inject ) ; } | Adds a new route for the HTTP request method PUT |
57,512 | public function patch ( $ pattern , $ callback = null , $ inject = null ) { return $ this -> map ( [ 'PATCH' ] , $ pattern , $ callback , $ inject ) ; } | Adds a new route for the HTTP request method PATCH |
57,513 | public function delete ( $ pattern , $ callback = null , $ inject = null ) { return $ this -> map ( [ 'DELETE' ] , $ pattern , $ callback , $ inject ) ; } | Adds a new route for the HTTP request method DELETE |
57,514 | public function head ( $ pattern , $ callback = null , $ inject = null ) { return $ this -> map ( [ 'HEAD' ] , $ pattern , $ callback , $ inject ) ; } | Adds a new route for the HTTP request method HEAD |
57,515 | public function trace ( $ pattern , $ callback = null , $ inject = null ) { return $ this -> map ( [ 'TRACE' ] , $ pattern , $ callback , $ inject ) ; } | Adds a new route for the HTTP request method TRACE |
57,516 | public function options ( $ pattern , $ callback = null , $ inject = null ) { return $ this -> map ( [ 'OPTIONS' ] , $ pattern , $ callback , $ inject ) ; } | Adds a new route for the HTTP request method OPTIONS |
57,517 | public function connect ( $ pattern , $ callback = null , $ inject = null ) { return $ this -> map ( [ 'CONNECT' ] , $ pattern , $ callback , $ inject ) ; } | Adds a new route for the HTTP request method CONNECT |
57,518 | public static function createControllerFromRoute ( Route $ route , array $ parameters = null ) { $ controllerClass = Application :: getInstance ( ) -> getApplicationNamespace ( ) . $ route -> getControllerClassName ( ) ; $ instance = new $ controllerClass ( $ route , $ parameters ) ; if ( $ method = $ instance -> route... | determines controller class name from a routes controllerString property and returns a controller instance an additional parameters array will be passed on to the constructor |
57,519 | protected function addEchoToJsonResponse ( JsonResponse $ r ) { if ( $ this -> isXhr && $ this -> xhrBag && $ this -> xhrBag -> get ( 'echo' ) == 1 ) { $ echo = json_decode ( $ this -> xhrBag -> get ( 'xmlHttpRequest' ) ) ; unset ( $ echo -> echo ) ; } else { if ( $ this -> request -> getMethod ( ) === 'POST' && $ this... | add an echo property to a JsonResponse if request indicates that echo was requested useful with vxJS . xhr based widgets |
57,520 | protected function assertEntityIsValid ( $ entity , $ scope = null ) { if ( ! $ this -> validator ) { throw new \ BadMethodCallException ( sprintf ( 'Method %s() cannot be used while validator is not configured.' , __METHOD__ ) ) ; } $ scopes = $ scope ? ( array ) $ scope : null ; $ violationList = $ this -> validator ... | assert given entity is valid on given scope . |
57,521 | protected function fireEvent ( $ eventName , Event $ event ) { if ( ! $ this -> eventDispatcher ) { throw new \ BadMethodCallException ( sprintf ( 'Method %s() cannot be used while event dispatcher is not configured.' , __METHOD__ ) ) ; } $ this -> eventDispatcher -> dispatch ( $ eventName , $ event ) ; } | fire given event . |
57,522 | protected function prepareForm ( Form $ form ) { $ form -> getElementPrototype ( ) -> class [ ] = 'form-horizontal' ; $ translator = $ form -> getTranslator ( ) ; foreach ( $ form -> controls as $ control ) { if ( $ control instanceof HiddenField ) { continue ; } elseif ( $ control instanceof Button ) { $ control -> co... | Make form and controls compatible with Twitter Bootstrap |
57,523 | public static function rectangle ( Point $ corner , $ width , $ height , $ ccw = false ) { $ points = new Points ( $ corner ) ; $ points -> addPoint ( $ corner ) ; $ points -> addPoint ( $ corner ) -> translateX ( $ width ) ; $ points -> addPoint ( $ corner ) -> translate ( $ width , $ height ) ; $ points -> addPoint (... | Calculates the points for a rectangle . |
57,524 | public static function polygon ( Point $ center , $ n , $ radius , $ ccw = false ) { return self :: star ( $ center , $ n , $ radius , [ ] , $ ccw ) ; } | Calculates the points for a regular polygon . |
57,525 | public static function star ( Point $ center , $ n , $ radius , $ starRadii = [ ] , $ ccw = false ) { $ points = new Points ( $ center ) ; if ( ! is_array ( $ starRadii ) ) { $ starRadii = [ $ starRadii ] ; } $ radii = array_merge ( [ $ radius ] , $ starRadii ) ; $ count = count ( $ radii ) ; $ delta = deg2rad ( 360 ) ... | Calculates the Points for a regular star polygon . |
57,526 | public static function sector ( Point $ center , Angle $ start , Angle $ stop , $ radius , $ ccw = false ) { $ points = new Points ( $ center ) ; $ points -> addPoint ( $ center ) ; $ points -> addPoint ( $ center ) -> translateX ( $ radius ) -> rotate ( $ center , $ start ) ; $ points -> addPoint ( $ center ) -> trans... | Calculates the points for a sector of a circle . |
57,527 | public static function ringSector ( Point $ center , Angle $ start , Angle $ stop , $ radius , $ innerRadius , $ ccw = false ) { $ points = new Points ( $ center , false ) ; if ( $ ccw ) { $ swap = $ start ; $ start = $ stop ; $ stop = $ swap ; } $ points -> addPoint ( $ center ) -> translateX ( $ radius ) -> rotate ( ... | Calculates the points for a sector of a ring . |
57,528 | public static function roundedRectangle ( Point $ corner , $ width , $ height , $ radius , $ ccw = false ) { $ points = new Points ( $ corner , false ) ; $ points -> addPoint ( $ corner ) -> translateX ( $ width - $ radius ) ; $ points -> addPoint ( $ corner ) -> translate ( $ width , $ radius ) ; $ points -> addPoint ... | Calculates the points for a rounded rectangle . |
57,529 | public function scale ( Point $ center , $ factor ) { foreach ( $ this -> points as $ point ) { $ point -> scale ( $ center , $ factor ) ; } $ this -> start -> scale ( $ center , $ factor ) ; return $ this ; } | Scales points . |
57,530 | public function scaleX ( Point $ center , $ factor ) { foreach ( $ this -> points as $ point ) { $ point -> scaleX ( $ center , $ factor ) ; } $ this -> start -> scaleX ( $ center , $ factor ) ; $ this -> reverseIfCcw ( $ factor < 0 ) ; return $ this ; } | Scales points along the X - axis . |
57,531 | public function translate ( $ deltaX , $ deltaY ) { foreach ( $ this -> points as $ point ) { $ point -> translate ( $ deltaX , $ deltaY ) ; } $ this -> start -> translate ( $ deltaX , $ deltaY ) ; return $ this ; } | Translates points . |
57,532 | public function translateX ( $ deltaX ) { foreach ( $ this -> points as $ point ) { $ point -> translateX ( $ deltaX ) ; } $ this -> start -> translateX ( $ deltaX ) ; return $ this ; } | Translates points along the X - axis . |
57,533 | public function translateY ( $ deltaY ) { foreach ( $ this -> points as $ point ) { $ point -> translateY ( $ deltaY ) ; } $ this -> start -> translateY ( $ deltaY ) ; return $ this ; } | Translates points along the Y - axis . |
57,534 | public static function getLogger ( $ module = "" ) { if ( is_object ( $ module ) ) $ module = get_class ( $ module ) ; elseif ( empty ( $ module ) || strtoupper ( $ module ) === "ROOT" ) $ module = "" ; $ module = trim ( str_replace ( '\\' , '.' , $ module ) , ". \\" ) ; if ( ! isset ( self :: $ module_loggers [ $ modu... | Get a logger for a specific module . |
57,535 | public static function resetGlobalState ( ) { foreach ( self :: $ module_loggers as $ logger ) $ logger -> removeLogWriters ( ) ; self :: $ module_loggers = [ ] ; self :: $ accept_mode = self :: MODE_ACCEPT_MOST_SPECIFIC ; } | This method will reset all global state in the Logger object . It will remove all writers from all loggers and then remove all loggers . Note that this will not remove existing logger instances from other objects - this is why the writers are removed . |
57,536 | public function setLevel ( string $ level ) { if ( ! defined ( LogLevel :: class . '::' . strtoupper ( $ level ) ) ) throw new \ DomainException ( "Invalid log level: $level" ) ; $ this -> level = $ level ; $ this -> level_num = self :: $ LEVEL_NUMERIC [ $ level ] ; return $ this ; } | Set the log level for this module . Any log messages with a severity lower than this threshold will not bubble up . |
57,537 | public static function fillPlaceholders ( string $ message , array $ context ) { $ message = ( string ) $ message ; foreach ( $ context as $ key => $ value ) { $ placeholder = '{' . $ key . '}' ; $ strval = null ; $ pos = 0 ; while ( ( $ pos = strpos ( $ message , $ placeholder , $ pos ) ) !== false ) { $ strval = $ st... | Fill the place holders in the message with values from the context array |
57,538 | public static function getLevelNumeric ( string $ level ) { return isset ( self :: $ LEVEL_NUMERIC [ $ level ] ) ? self :: $ LEVEL_NUMERIC [ $ level ] : 0 ; } | Get the severity number for a specific LogLevel . |
57,539 | public function get ( $ connection , $ cache = true ) { if ( ! is_string ( $ connection ) ) { throw new BadTypeException ( $ connection , 'string' ) ; } if ( ! isset ( $ this -> instances [ $ connection ] ) or ! $ cache ) { if ( ! isset ( $ this -> connectionSettings [ $ connection ] ) ) { throw new UnknownNamedConnect... | Get the singleton pg connection |
57,540 | public function remove ( Resource $ resource ) { $ cnt = 0 ; if ( false !== $ key = array_search ( $ resource , $ this -> instances , true ) ) { unset ( $ this -> instances [ $ key ] ) ; $ cnt ++ ; } return $ cnt ; } | Remove a resource from the multiton cache |
57,541 | protected function sendOne ( $ dry_run ) { $ message = $ this -> messages [ 0 ] ; $ adapter = $ this -> getAdapter ( ) ; $ adapter -> setEndpoint ( self :: SINGLE_ENDPOINT ) ; $ adapter -> setParameters ( array ( 'user' => $ this -> config [ 'user' ] , 'password' => $ this -> config [ 'password' ] , 'serviceid' => $ th... | We use smspush for sending single messages . |
57,542 | public function restore ( string $ key ) : self { if ( array_key_exists ( $ key , $ this -> original ) ) { ini_set ( $ key , $ this -> original [ $ key ] ) ; } return $ this ; } | Restore a previous ini setting . |
57,543 | public function cleanup ( ) : self { foreach ( $ this -> original as $ key => $ value ) { ini_set ( $ key , $ value ) ; } $ this -> original = [ ] ; return $ this ; } | Restore the previous ini settings . |
57,544 | public function getType ( $ name ) { if ( false === $ this -> hasType ( $ name ) ) { throw new InvalidArgumentException ( sprintf ( 'The type "%s" was not found.' , $ name ) ) ; } if ( isset ( $ this -> loaded [ $ name ] ) ) { return $ this -> loaded [ $ name ] ; } $ fqcn = $ this -> types [ $ name ] ; $ type = new $ f... | Gets a type object . |
57,545 | public function addType ( $ name , $ fqcn ) { if ( true === $ this -> hasType ( $ name ) ) { throw new InvalidArgumentException ( sprintf ( 'The type "%s" already exists.' , $ name ) ) ; } return $ this -> setType ( $ name , $ fqcn ) ; } | Adds a type object . |
57,546 | public function overrideType ( $ name , $ fqcn ) { if ( false === $ this -> hasType ( $ name ) ) { throw new InvalidArgumentException ( sprintf ( 'The type "%s" was not found.' , $ name ) ) ; } return $ this -> setType ( $ name , $ fqcn ) ; } | Overrides a type object with new class . |
57,547 | public function setInvitedLink ( TimelineLinkEvent $ event ) : void { $ action = $ event -> getAction ( ) ; if ( 'invited' != $ action -> getVerb ( ) ) { return ; } $ event = $ action -> getComponent ( 'indirectComplement' ) -> getData ( ) ; $ event -> setLink ( $ this -> url_generator -> generate ( 'bkstg_event_read' ... | Set the link for invited actions . |
57,548 | public function setScheduledLink ( TimelineLinkEvent $ event ) : void { $ action = $ event -> getAction ( ) ; if ( 'scheduled' != $ action -> getVerb ( ) ) { return ; } $ production = $ action -> getComponent ( 'indirectComplement' ) -> getData ( ) ; $ schedule = $ action -> getComponent ( 'directComplement' ) -> getDa... | Set the link for scheduled actions . |
57,549 | public function updateEntry ( $ package , $ theme ) { $ this -> verifyCommand ( $ package ) ; $ lines = file ( $ this -> config ) ; $ config = $ this -> compactConfig ( $ package ) ; $ lines = $ this -> updateConfigDetails ( $ theme , $ lines , $ config ) ; $ this -> file -> delete ( $ this -> config ) ; $ this -> file... | Update the config with the color values for easy retrieval |
57,550 | public function TopMost ( ) { $ sql = Access :: SqlBuilder ( ) ; $ tbl = Page :: Schema ( ) -> Table ( ) ; $ where = $ sql -> Equals ( $ tbl -> Field ( 'Site' ) , $ sql -> Value ( $ this -> site -> GetID ( ) ) ) -> And_ ( $ sql -> IsNull ( $ tbl -> Field ( 'Parent' ) ) ) -> And_ ( $ sql -> IsNull ( $ tbl -> Field ( 'Pr... | Gets the first and root page of the site |
57,551 | public function connect ( $ credentials = [ ] ) { if ( $ diff = array_diff ( array_keys ( $ this -> settings ) , array_keys ( $ credentials ) ) ) { throw new \ Exception ( "Missing credentials, the following fields are missing " . implode ( '/' , $ diff ) ) ; } $ this -> settings = array_merge ( $ this -> settings , $ ... | Open a connection to a mail server . |
57,552 | public function getMailbox ( ) { $ mailbox = str_replace ( "{" . $ this -> settings [ 'server' ] . "}" , '' , $ this -> mailbox ) ; $ mailbox = ( substr ( $ mailbox , 0 , 6 ) == 'INBOX.' ) ? substr ( $ mailbox , - 6 ) : $ mailbox ; return $ mailbox ; } | Return the name of the current mailbox . |
57,553 | public function subscribeMailbox ( $ name = '' ) { if ( empty ( $ name ) ) { return false ; } $ name = imap_utf7_encode ( $ name ) ; return imap_subscribe ( $ this -> conn , "{" . $ this -> settings [ 'server' ] . "}INBOX." . $ name ) ; } | Subscribe to a mailbox . |
57,554 | public function getMessageInformation ( $ id = '' ) { $ message = [ ] ; if ( is_array ( $ this -> messages ) == true ) { foreach ( $ this -> messages as $ msg ) { if ( $ msg [ 'index' ] == $ id ) { return $ msg ; } } } return $ message ; } | Return message information without reading it from the server |
57,555 | public function getMessage ( $ id = '' ) { $ message = [ ] ; if ( is_array ( $ this -> messages ) == true ) { foreach ( $ this -> messages as $ msg ) { if ( $ msg [ 'index' ] == $ id ) { $ message = $ msg ; break ; } } } if ( is_array ( $ message ) === true ) { $ message [ 'body' ] = quoted_printable_decode ( imap_fetc... | Return a message based on its index in the mailbox . |
57,556 | public function readMailbox ( ) { $ msg_cnt = imap_num_msg ( $ this -> conn ) ; $ messages = [ ] ; for ( $ i = 1 ; $ i <= $ msg_cnt ; $ i ++ ) { $ header = imap_headerinfo ( $ this -> conn , $ i ) ; $ messages [ ] = [ 'index' => trim ( $ header -> Msgno ) , 'header' => $ header , 'structure' => imap_fetchstructure ( $ ... | Retrieve a list of message in the mailbox . |
57,557 | private function loadVersion ( ) { try { $ this -> dao = $ this -> db -> getDAO ( DBVersion :: class ) ; $ this -> db_version = $ this -> dao -> get ( QB :: where ( [ "module" => $ this -> module ] ) , QB :: order ( [ 'migration_date' => 'DESC' ] ) ) ? : new NullVersion ; } catch ( TableNotExistsException $ e ) { if ( ... | Load the current version from the database |
57,558 | public function migrateTo ( int $ target_version ) { if ( $ this -> max_version === null ) $ this -> scanMigrations ( ) ; $ current_version = $ this -> getCurrentVersion ( ) ; $ trajectory = $ this -> plan ( $ current_version , $ target_version ) ; $ db = $ this -> db ; foreach ( $ trajectory as $ migration ) { $ migra... | Perform a migration from the current version to the target version |
57,559 | protected function plan ( int $ from , int $ to ) { $ migrations = [ ] ; if ( $ from === $ to ) return $ migrations ; $ is_downgrade = $ to < $ from ; $ reachable = $ this -> migrations [ $ from ] ?? [ ] ; if ( ! $ is_downgrade ) $ reachable = array_reverse ( $ reachable , true ) ; foreach ( $ reachable as $ direct_to ... | Plan a path through available migrations to reach a specified version from another version . This is always done in one direction opportunistically . This means that when downgrading no intermediate upgrades are performed even if they may result in shorter path . |
57,560 | protected function AddUniqueSubmit ( $ label ) { $ name = $ label . '-' . $ this -> Content ( ) -> GetID ( ) ; $ fullLabel = $ this -> Label ( $ label ) ; $ this -> AddSubmit ( $ name , Trans ( $ fullLabel ) ) ; } | Adds a submit button with a unique name |
57,561 | public function toArray ( ) { $ class = $ this -> get ( ) ; $ class = ( array ) $ class ; foreach ( $ class as $ key => $ value ) { if ( is_object ( $ value ) ) { $ class [ $ key ] = ( new static ( $ value ) ) -> toArray ( ) ; } } return $ class ; } | Recursively convert our object into an array . |
57,562 | protected function validateTypes ( Dictionary $ types , $ path = "" ) { $ spath = empty ( $ path ) ? "" : $ path . "." ; foreach ( $ types as $ key => $ value ) { $ kpath = $ spath . $ key ; if ( $ value instanceof Dictionary ) { $ this -> validateTypes ( $ value , $ kpath ) ; } elseif ( is_string ( $ value ) ) { $ typ... | Validate that all provided types are actually type validators |
57,563 | public function setType ( $ key , $ type ) { $ args = func_get_args ( ) ; $ type = array_pop ( $ args ) ; if ( ! ( $ type instanceof Validator ) ) $ type = new Validator ( $ type ) ; if ( $ this -> types -> has ( $ args ) ) { $ old_type = $ this -> types -> get ( $ args ) ; if ( $ old_type != $ type ) throw new \ Logic... | Add a type for a parameter |
57,564 | public function set ( $ key , $ value ) { if ( is_array ( $ key ) && $ value === null ) $ args = $ key ; else $ args = func_get_args ( ) ; $ path = $ args ; $ value = array_pop ( $ path ) ; $ type = $ this -> types -> dget ( $ path ) ; $ kpath = implode ( '.' , $ path ) ; if ( $ type === null ) { $ cpy = $ path ; while... | Set a value after type checking |
57,565 | public function & dget ( $ key , $ default = null ) { $ args = WF :: flatten_array ( func_get_args ( ) ) ; if ( func_num_args ( ) > 1 ) { $ default = array_pop ( $ args ) ; if ( ! ( $ default instanceof DefVal ) ) $ default = new DefVal ( $ default ) ; $ args [ ] = $ default ; } $ result = parent :: dget ( $ args , nul... | We override dget as dget returns a reference allowing the TypedDictionary to be modified from the outside . This avoids the checks so this needs to be disallowed . |
57,566 | public function addAll ( $ values ) { foreach ( $ values as $ key => $ value ) $ this -> set ( $ key , $ value ) ; return $ this ; } | Add all provided values checking their types |
57,567 | public static function wrap ( array & $ values ) { $ types = new Dictionary ; self :: determineTypes ( $ values , $ types ) ; return new TypedDictionary ( $ types , $ values ) ; } | Customize wrapping of the TypedDictionary - the wrapped array can still be modified externally so we need to make sure the appropriate types are propagated |
57,568 | private function globRecursive ( $ pattern ) { $ paths = glob ( $ pattern ) ; foreach ( $ paths as $ path ) { if ( strpos ( $ path , '.' ) === false ) { $ paths = array_merge ( $ paths , $ this -> globRecursive ( $ path . '/*' ) ) ; } } return $ paths ; } | watch out can be slow! 4 . 75s for 20k paths |
57,569 | public function get ( $ key ) { if ( $ this -> frontHas ( $ key ) ) { return $ this -> front -> get ( $ key ) ; } return $ this -> back -> get ( $ key ) ; } | Either end get ok is ok |
57,570 | public function has ( $ key ) { $ res = $ this -> frontHas ( $ key ) ; if ( $ res ) { return $ res ; } return $ this -> backHas ( $ key ) ; } | Either end has is ok |
57,571 | public function clear ( ) { $ ends = [ $ this -> front , $ this -> back ] ; foreach ( $ ends as $ end ) { if ( ! $ end -> clear ( ) ) { return $ this -> falseAndSetError ( $ end -> getError ( ) , $ end -> getErrorCode ( ) ) ; } } return $ this -> trueAndFlushError ( ) ; } | Need both ends clear ok |
57,572 | public function delete ( $ key ) { $ ends = [ $ this -> front , $ this -> back ] ; foreach ( $ ends as $ end ) { if ( ! $ end -> delete ( $ key ) ) { return $ this -> falseAndSetError ( $ end -> getError ( ) , $ end -> getErrorCode ( ) ) ; } } return $ this -> trueAndFlushError ( ) ; } | Need both ends delete ok |
57,573 | public function commit ( ) { $ ends = [ $ this -> front , $ this -> back ] ; $ res = false ; foreach ( $ ends as $ end ) { if ( ! $ end -> commit ( ) ) { $ this -> setError ( $ end -> getError ( ) , $ end -> getErrorCode ( ) ) ; } else { $ res = true ; } } return $ res ; } | One end commit ok is ok |
57,574 | public function purge ( $ maxlife ) { $ ends = [ $ this -> front , $ this -> back ] ; foreach ( $ ends as $ end ) { if ( ! $ end -> purge ( $ maxlife ) ) { return $ this -> falseAndSetError ( $ end -> getError ( ) , $ end -> getErrorCode ( ) ) ; } } return $ this -> trueAndFlushError ( ) ; } | Need both ends purge ok |
57,575 | protected function protectedSave ( CacheItemInterface $ item , $ function = 'save' ) { $ func = $ this -> tester ; $ both = $ func ( $ item ) ; $ res1 = false ; if ( $ both ) { if ( $ this -> front -> $ function ( $ item ) ) { $ res1 = true ; } else { $ this -> setError ( $ this -> front -> getError ( ) , $ this -> fro... | local save method one end save ok is ok |
57,576 | private function fill ( $ attributes ) { if ( is_string ( $ attributes ) ) { $ attributes = json_decode ( $ attributes , true ) ; } if ( ! is_array ( $ attributes ) ) { throw new \ InvalidArgumentException ( 'Attributes must be of type array or a valid json string' ) ; } foreach ( $ attributes as $ key => $ value ) { $... | Fill the attributes |
57,577 | public function makeCollection ( array $ values , $ class = null ) { $ collection = new Collection ( $ values ) ; if ( ! is_null ( $ class ) && class_exists ( $ class ) ) { $ model = new $ class ( ) ; if ( $ model instanceof Model ) { foreach ( $ collection as $ key => $ item ) { $ collection [ $ key ] = $ model -> new... | Transform an array of values into a collection of models |
57,578 | public function registerService ( ) { $ this -> app -> bind ( 'mrs.attributes.translator' , function ( $ attributeMap = [ ] ) { return new AttributeTranslator ( $ attributeMap ) ; } ) ; $ this -> app -> alias ( 'mrs.attributes.translator' , 'attributes.translator' ) ; $ this -> app -> alias ( 'mrs.attributes.translator... | Register services to the application container . |
57,579 | public function readElement ( ) { $ csv_line_data = $ this -> spl_file_object -> fgetcsv ( ) ; if ( $ csv_line_data ) { $ csv_line_data [ 0 ] = $ this -> convertToUtf8 ( $ csv_line_data ) ; if ( $ this -> isValidLine ( $ csv_line_data ) ) { $ csv_line = array_combine ( $ this -> columns_name , $ csv_line_data ) ; retur... | Reads a single element from the source then return a Object instance |
57,580 | public function readElements ( ) { $ iterator = new ArrayIterator ; do { $ object = $ this -> readElement ( ) ; if ( $ object ) $ iterator -> append ( $ object ) ; } while ( ( boolean ) $ object ) ; $ this -> objects = $ iterator ; return $ this -> objects ; } | Read all the objects from the source |
57,581 | public function addField ( $ fieldName , $ getMethod , $ setMethod , ByConfigBuilder $ include = null , $ formatter = null ) { if ( method_exists ( $ this -> getEntityPrototype ( ) , $ getMethod ) === false ) { throw new Exception \ ConfigFailed ( sprintf ( $ this -> exceptions [ 2 ] , $ getMethod , $ this -> entityCla... | Set a mapping |
57,582 | public function isInclude ( $ fieldName ) { if ( $ this -> hasField ( $ fieldName ) === false ) { return false ; } $ class = __CLASS__ ; return ( $ this -> mapping [ $ fieldName ] [ 'include' ] instanceof $ class ) ; } | Check if the given fieldName is an include |
57,583 | public function getSetter ( $ fieldName ) { if ( $ this -> hasField ( $ fieldName ) === false ) { return false ; } return $ this -> mapping [ $ fieldName ] [ 'setter' ] ; } | Return the setter name |
57,584 | public function getGetter ( $ fieldName ) { if ( $ this -> hasField ( $ fieldName ) === false ) { return false ; } return $ this -> mapping [ $ fieldName ] [ 'getter' ] ; } | Return the getter name |
57,585 | public function getInclude ( $ fieldName ) { if ( $ this -> isInclude ( $ fieldName ) === false ) { return false ; } return $ this -> mapping [ $ fieldName ] [ 'include' ] ; } | Get the include config |
57,586 | public function setCatchAllSetter ( $ setMethod ) { if ( method_exists ( $ this -> getEntityPrototype ( ) , $ setMethod ) === false ) { throw new Exception \ ConfigFailed ( sprintf ( $ this -> exceptions [ 2 ] , $ setMethod , $ this -> entityClassName ) , 2 ) ; } $ this -> catchAllSetter = $ setMethod ; return $ this ;... | Sets an catchall Setter |
57,587 | public static function init ( ) { $ c = new Configuration ( ) ; $ cc = $ c -> from ( 'app' ) -> get ( 'session' ) ; if ( strtolower ( $ cc ) == 'session' ) { return new Session ( ) ; } elseif ( strtolower ( $ cc ) == 'file' ) { return new File ( ) ; } elseif ( strtolower ( $ cc ) == 'cookie' ) { return new Cookie ( ) ;... | Initializes session handler . |
57,588 | public function getByName ( $ name ) { $ response = $ this -> getPuppetDbClient ( ) -> send ( new KmbPuppetDb \ Request ( '/nodes/' . $ name ) ) ; return $ this -> createNodeFromData ( $ response -> getData ( ) ) ; } | Retrieves a node by its name . |
57,589 | public function registerInternalCache ( ) { $ cacheManager = $ this -> getCacheManager ( ) ; if ( false === $ cacheManager -> hasCache ( self :: CACHE_IDENTIFIER ) ) { $ cacheManager -> setCacheConfigurations ( [ self :: CACHE_IDENTIFIER => $ this -> cacheOptions ] ) ; } } | Function called from ext_localconf file which will register the internal cache earlier . |
57,590 | public function registerDynamicCaches ( ) { $ dynamicCaches = $ this -> getCache ( ) -> getByTag ( self :: CACHE_TAG_DYNAMIC_CACHE ) ; foreach ( $ dynamicCaches as $ cacheData ) { $ identifier = $ cacheData [ 'identifier' ] ; $ options = $ cacheData [ 'options' ] ; $ this -> registerCacheInternal ( $ identifier , $ opt... | This function will take care of initializing all caches that were defined previously by the CacheService which allows dynamic caches to be used for every configuration object type . |
57,591 | public static function injectInstance ( Resolver $ resolver ) { $ sub = $ resolver -> getResolver ( 'assets' ) ; return $ sub !== null ? new static ( $ sub ) : null ; } | Generate an instance for the injector |
57,592 | public function addScript ( string $ script , $ depends = null ) { $ script = $ this -> stripSuffix ( $ script , ".min" , ".js" ) ; $ this -> scripts [ $ script ] = array ( "path" => $ script , "depends" => $ depends ) ; return $ this ; } | Add a javascript file to be loaded . This will strip the . min and . js suffixes and add them to the stack of included scripts . |
57,593 | public function addCSS ( string $ stylesheet , $ media = "screen" ) { $ stylesheet = $ this -> stripSuffix ( $ stylesheet , ".min" , ".css" ) ; $ this -> CSS [ $ stylesheet ] = array ( "path" => $ stylesheet , "media" => $ media ) ; return $ this ; } | Add a CSS stylesheet to be loaded . This will strip the . min and . css suffixes and add them to the stack of included stylesheets . |
57,594 | public function addVariable ( string $ name , $ value ) { if ( WF :: is_array_like ( $ value ) ) { $ value = WF :: to_array ( $ value ) ; } elseif ( is_subclass_of ( $ value , JSONSerializable :: class ) ) { $ value = $ value -> jsonSerialize ( ) ; } elseif ( ! is_scalar ( $ value ) ) { throw new InvalidArgumentExcepti... | Add a javascript variable to be added to the output document . A script will be generated to definie these variables on page load . |
57,595 | protected function stripSuffix ( string $ path , string $ suffix1 , string $ suffix2 ) { if ( substr ( $ path , - strlen ( $ suffix2 ) ) === $ suffix2 ) $ path = substr ( $ path , 0 , - strlen ( $ suffix2 ) ) ; if ( substr ( $ path , - strlen ( $ suffix1 ) ) === $ suffix1 ) $ path = substr ( $ path , 0 , - strlen ( $ s... | Remove the suffix from a file name such as . min . css or . min . js |
57,596 | public function executeHook ( Dictionary $ params ) { $ responder = $ params [ 'responder' ] ?? null ; $ mime = $ params [ 'mime' ] ?? null ; $ result = empty ( $ responder ) ? null : $ responder -> getResult ( ) ; $ response = empty ( $ result ) ? null : $ result -> getResponse ( ) ; if ( $ response instanceof HTTPErr... | Execute the hook to replace the Javascript and CSS tokens in the HTTP Responder . This will be called by Wedeto \ Util \ Hook through Wedeto \ HTTP . It can be called directly when you want to replace the content at a different time . |
57,597 | public function getRoomsListAction ( ParamFetcher $ paramFetcher ) { $ page = $ paramFetcher -> get ( 'page' ) ; $ count = $ paramFetcher -> get ( 'count' ) ; $ pager = $ this -> getRoomManager ( ) -> getPager ( $ this -> filterCriteria ( $ paramFetcher ) , $ page , $ count ) ; return $ pager ; } | Retrieve the list of available rooms |
57,598 | public function query ( $ statement , $ params = array ( ) ) { if ( ! is_array ( $ params ) ) { $ params = array ( $ params ) ; } return $ this -> _link -> query ( $ statement , $ params ) ; } | Run database query and return complete result set |
57,599 | public function exec ( $ statement , $ params = array ( ) ) { if ( ! is_array ( $ params ) ) { $ params = array ( $ params ) ; } return $ this -> _link -> exec ( $ statement , $ params ) ; } | Execute a database statement that does not return a result set |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.