idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
9,300 | private static function contextValueToString ( $ val ) { if ( is_bool ( $ val ) ) { return var_export ( $ val , true ) ; } elseif ( is_scalar ( $ val ) ) { return ( string ) $ val ; } elseif ( is_null ( $ val ) ) { return 'NULL' ; } elseif ( is_object ( $ val ) ) { if ( is_callable ( array ( $ val , '__toString' ) ) ) ... | Converts a context value into its appropriate string representation |
9,301 | public function get ( $ name , $ default = null ) { if ( substr ( $ name , - 1 ) == '.' ) { $ ret = array ( ) ; foreach ( $ this -> settings as $ setting_name => $ setting_value ) { if ( preg_match ( '/^' . preg_quote ( $ name , '/' ) . '/' , $ setting_name ) ) { $ ret [ $ setting_name ] = $ setting_value ; } } return ... | Returns config value . |
9,302 | public function set ( $ name , $ value ) { if ( $ value === null ) { unset ( $ this -> settings [ $ name ] ) ; } else { $ this -> settings [ $ name ] = $ value ; } $ this -> store ( ) ; } | Sets config value . |
9,303 | protected function load ( array $ defaults ) { if ( file_exists ( $ this -> filename ) ) { $ stored_settings = json_decode ( file_get_contents ( $ this -> filename ) , true ) ; $ new_defaults = array_diff_key ( $ defaults , $ stored_settings ) ; if ( $ new_defaults ) { $ this -> settings = array_merge ( $ stored_settin... | Loads config contents from disk . |
9,304 | protected function store ( ) { $ options = defined ( 'JSON_PRETTY_PRINT' ) ? JSON_PRETTY_PRINT : 0 ; file_put_contents ( $ this -> filename , json_encode ( $ this -> settings , $ options ) ) ; } | Stores config contents to the disk . |
9,305 | public function asArray ( ) { $ headers = [ ] ; foreach ( array_filter ( $ this -> storage ) as $ header => $ value ) { $ headers [ ] = $ header . ': ' . $ value ; } return $ headers ; } | Builds array of headers |
9,306 | public static function getId ( $ url ) { if ( strpos ( $ url , 'youtube.com' ) !== false ) { $ url = parse_url ( $ url ) ; if ( empty ( $ url [ 'query' ] ) ) { return false ; } parse_str ( $ url [ 'query' ] , $ url ) ; return empty ( $ url [ 'v' ] ) ? false : $ url [ 'v' ] ; } if ( preg_match ( '/youtu\.be\/([^?]+)/' ,... | Parses a YouTube url and returns the YouTube ID |
9,307 | private function clearLogs ( ) { if ( ! $ this -> logger instanceof Logger ) { return ; } $ logger = $ this -> logger ; foreach ( $ logger -> getHandlers ( ) as $ handler ) { if ( $ handler instanceof FingersCrossedHandler ) { $ handler -> clear ( ) ; } } } | Clear logs . |
9,308 | public function remove ( Folder $ entity ) { $ this -> em -> remove ( $ entity ) ; $ this -> em -> flush ( ) ; } | Remove entity . |
9,309 | public function command ( $ command , $ args = [ ] , $ id = null ) { $ target = Router :: getInstance ( ) -> getTarget ( $ command ) ; $ fn = function ( ) use ( $ target ) { return $ target -> run ( ) ; } ; return $ this -> call ( $ fn , $ args , $ id ) ; } | Queues a command for execution . |
9,310 | protected function isAllowedKey ( $ key ) : bool { return empty ( $ this -> allowedKeys ) || \ in_array ( $ key , $ this -> allowedKeys , true ) ; } | Determine if a given key is permitted . |
9,311 | public function all ( ) { $ query = new \ Peyote \ Select ( 'report_types' ) ; $ query -> columns ( 'id, value' ) -> where ( 'public' , '=' , 1 ) ; return $ this -> db -> fetch ( $ query ) ; } | All report types |
9,312 | public function get ( $ id = NULL ) { if ( ! isset ( $ id ) ) return $ this -> all ( ) ; $ query = new \ Peyote \ Select ( 'report_types' ) ; $ query -> columns ( 'id, value' ) -> where ( 'id' , '=' , $ id ) ; return $ this -> db -> fetch ( $ query ) ; } | Get report type |
9,313 | public function get ( string $ directive , $ default = null ) { return $ this -> has ( $ directive ) ? $ this -> definition [ $ directive ] : $ default ; } | Get the value for a directive if it exists otherwise return a default . |
9,314 | public static function jsonEncode ( $ obj ) { if ( self :: $ nativeJsonEncode === null ) self :: $ nativeJsonEncode = function_exists ( 'json_encode' ) ; if ( self :: $ nativeJsonEncode === true ) return json_encode ( $ obj ) ; $ inst = self :: getInstance ( ) ; return $ inst -> phpJsonEncode ( $ obj ) ; } | Wrapper function for encoding to json with native or php version depending on what the system supports |
9,315 | public function pullCommand ( string $ directory = null , bool $ publish = false , bool $ database = false , bool $ migrate = false , bool $ flush = false , bool $ dryRun = false , string $ configuration = '.platform.app.yaml' , string $ environment = 'master' , bool $ yes = false ) { $ this -> askForUserAgreement ( $ ... | platform . sh - > Local |
9,316 | public function buildCommand ( $ debug = false ) { $ this -> outputLine ( '<b>Run build hook commands</b>' ) ; $ this -> commandService -> executeHooks ( $ this -> buildHooks , function ( ... $ args ) { $ this -> outputLine ( ... $ args ) ; } ) ; $ this -> sendAndExit ( 0 ) ; } | Run command for build hook |
9,317 | public function deployCommand ( $ debug = false ) { $ this -> outputLine ( '<b>Run deploy hook commands</b>' ) ; $ this -> commandService -> executeHooks ( $ this -> deployHooks , function ( ... $ args ) { $ this -> outputLine ( ... $ args ) ; } ) ; } | Run command for deploy hook |
9,318 | public function user ( ) { $ relation = $ this -> belongsTo ( $ this -> getUserModelName ( ) ) ; if ( in_array ( 'Illuminate\Database\Eloquent\SoftDeletes' , class_uses ( $ this -> getUserModelName ( ) ) ) ) { $ relation -> withTrashed ( ) ; } return $ relation ; } | User relation for the activity |
9,319 | public function scopeOlderThan ( $ query , $ time ) { if ( ! $ time instanceof Carbon ) { $ time = Carbon :: createFromTimestamp ( $ time ) ; } return $ query -> where ( 'created_at' , '<=' , $ time -> toDateTimeString ( ) ) -> latest ( ) ; } | Scope a query to only include activities older than a timestamp |
9,320 | public function next ( ) { $ row = $ this -> cursor -> getNextItem ( ) ; if ( $ row ) { $ beans = $ this -> repository -> convertToBeans ( $ this -> type , array ( $ row ) ) ; $ bean = array_shift ( $ beans ) ; return Model :: wrap ( $ bean ) ; } return null ; } | Returns the next bean in the collection . If called the first time this will return the first bean in the collection . If there are no more beans left in the collection this method will return NULL . |
9,321 | public static function getRecords ( $ routesConfigFile , $ resource , $ objectId , $ lang , $ copyAttachment = false ) { $ response [ 'attachments' ] = Attachment :: getRecords ( [ 'lang_id_016' => $ lang , 'resource_id_016' => $ resource , 'object_id_016' => $ objectId , 'orderBy' => [ 'column' => 'sorting_016' , 'ord... | Function to get attachment element with json string to new element |
9,322 | public static function deleteAttachment ( $ routesConfigFile , $ resource , $ objectId , $ lang = null ) { Attachment :: deleteAttachment ( [ 'lang_id_016' => $ lang , 'resource_id_016' => $ resource , 'object_id_016' => $ objectId ] ) ; if ( isset ( $ lang ) ) { if ( ! empty ( $ objectId ) && ! empty ( $ lang ) ) { $ ... | Function to delete attachment |
9,323 | public function addLocation ( $ path ) { $ retval = false ; if ( ! ( $ retval = array_search ( $ path , $ this -> model_location_array , $ path ) ) ) { if ( ( $ retval = is_dir ( $ path ) ) ) { $ this -> model_location_array [ ] = $ path ; } } return $ retval ; } | Adds a new location path for model templates . Precedence order is the order in which additions are made . |
9,324 | public function bindInjector ( string $ class , $ injector ) : Container { if ( ! is_string ( $ injector ) ) { throw new \ InvalidArgumentException ( 'Injector can only be set as string binding' ) ; } $ this -> injectors [ $ class ] = $ injector ; return $ this ; } | Specify binding which has to be used for class injection . |
9,325 | final protected function autowire ( string $ class , array $ parameters , string $ context = null ) { if ( ! class_exists ( $ class ) ) { throw new NotFoundException ( "Undefined class or binding '{$class}'" ) ; } $ instance = $ this -> createInstance ( $ class , $ parameters , $ context ) ; return $ this -> registerIn... | Automatically create class . |
9,326 | public static function getEntityPaths ( ) : array { if ( self :: $ paths === null ) { self :: $ paths = [ realpath ( __DIR__ . DIRECTORY_SEPARATOR . 'Entity' ) ] ; } return self :: $ paths ; } | Return entity paths . |
9,327 | private function startCore ( bool $ isConsole ) { $ this -> bootEnv ( ) ; $ this -> initialize ( ) ; $ this -> logger ( ) ; $ this -> errorHandling ( $ isConsole ) ; $ this -> bootRemember ( ) ; $ aliases = config ( 'app.aliases' ) ; foreach ( $ aliases as $ alias => $ class ) { class_alias ( $ class , $ alias ) ; } } | Load the core components |
9,328 | public function paginator ( $ nItemsTotal , $ nItemsPerPage , $ nCurrentPage ) { $ this -> pgFactory -> setPaginationProperties ( $ nItemsTotal , $ nItemsPerPage , $ nCurrentPage ) ; return $ this -> pgFactory ; } | Get the paginator factory . |
9,329 | public function instance ( $ name ) { if ( substr ( $ name , 0 , 1 ) == '.' ) { $ name = $ this -> getJaxonClassPath ( ) . $ name ; } elseif ( substr ( $ name , 0 , 1 ) == ':' && ( $ namespace = $ this -> getJaxonNamespace ( ) ) ) { $ name = str_replace ( '\\' , '.' , trim ( $ namespace , '\\' ) ) . '.' . substr ( $ na... | Get an instance of a Jaxon class by name |
9,330 | protected function addBodies ( \ Swift_Message $ message , MailRenderedInterface $ mailRendered ) : void { $ textPlain = $ mailRendered -> getBody ( ) ; $ html = $ mailRendered -> getHtmlBody ( ) ; if ( null === $ html ) { $ message -> setBody ( $ textPlain , 'text/plain' ) ; return ; } $ message -> setBody ( $ html , ... | Add html and plain text bodies or only plain text if html is empty . |
9,331 | public static function getCorrectActionName ( $ action ) { $ action = strtolower ( $ action ) ; $ action = str_replace ( array ( '-' , '.' ) , ' ' , $ action ) ; $ action = str_replace ( ' ' , '' , ucwords ( $ action ) ) ; return lcfirst ( $ action ) ; } | Action name normaliser |
9,332 | public static function getCorrectControllerName ( $ controller ) { $ controller = strtolower ( $ controller ) ; $ controller = str_replace ( array ( '-' , '.' ) , ' ' , $ controller ) ; $ controller = ucwords ( $ controller ) ; $ controller = str_replace ( ' ' , '' , $ controller ) ; return $ controller ; } | Controller name normaliser |
9,333 | public function isPost ( $ id = false , $ filter = null , $ filterOptions = array ( ) ) { if ( ! $ id ) { return ( isset ( $ _SERVER [ 'REQUEST_METHOD' ] ) && strtoupper ( $ _SERVER [ 'REQUEST_METHOD' ] ) == 'POST' ) ? true : false ; } else { if ( isset ( $ _POST [ $ id ] ) ) { return $ filter ? filter_var ( $ _POST [ ... | HTTP POST checker |
9,334 | public function isQuery ( $ id = false , $ filter = null , $ filterOptions = array ( ) ) { if ( ! $ id ) { return ( isset ( $ _SERVER [ 'REQUEST_METHOD' ] ) && strtoupper ( $ _SERVER [ 'REQUEST_METHOD' ] ) == 'GET' ) ? true : false ; } else { if ( isset ( $ _GET [ $ id ] ) ) { return $ filter ? filter_var ( $ _GET [ $ ... | HTTP GET checker |
9,335 | public function isRequest ( $ id = false , $ filter = null , $ filterOptions = array ( ) ) { if ( ! $ id ) { return ( isset ( $ _SERVER [ 'REQUEST_METHOD' ] ) && ( strtoupper ( $ _SERVER [ 'REQUEST_METHOD' ] ) == 'GET' OR strtoupper ( $ _SERVER [ 'REQUEST_METHOD' ] ) == 'POST' ) ) ? true : false ; } else { if ( isset (... | HTTP REQUEST checker |
9,336 | public function getQuery ( $ id = null , $ sanitizeFilter = FILTER_SANITIZE_STRING , $ sanitizeFilterOptions = array ( 'flags' => FILTER_FLAG_STRIP_HIGH ) ) { if ( $ id == null ) return $ _GET ; if ( isset ( $ _GET [ $ id ] ) ) { if ( is_array ( $ _GET [ $ id ] ) ) { $ RETURN = array ( ) ; foreach ( $ _GET [ $ id ] as ... | HTTP GET getter |
9,337 | public function getPost ( $ id = null , $ sanitizeFilter = FILTER_SANITIZE_STRING , $ sanitizeFilterOptions = array ( 'flags' => FILTER_FLAG_STRIP_HIGH ) ) { if ( $ id == null ) return $ _POST ; if ( isset ( $ _POST [ $ id ] ) ) { if ( is_array ( $ _POST [ $ id ] ) ) { $ RETURN = array ( ) ; foreach ( $ _POST [ $ id ] ... | HTTP POST getter |
9,338 | public function getRequest ( $ id = null , $ sanitizeFilter = FILTER_SANITIZE_STRING , $ sanitizeFilterOptions = array ( 'flags' => FILTER_FLAG_STRIP_HIGH ) ) { if ( $ id == null ) return $ _REQUEST ; if ( isset ( $ _REQUEST [ $ id ] ) ) { if ( is_array ( $ _REQUEST [ $ id ] ) ) { $ RETURN = array ( ) ; foreach ( $ _RE... | HTTP REQUEST getter |
9,339 | public function getParamByIndex ( $ index = '' ) { if ( ! $ index ) return $ this -> _params [ 'number' ] ; return isset ( $ this -> _params [ 'number' ] [ $ index ] ) ? ( string ) $ this -> _params [ 'number' ] [ $ index ] : null ; } | Get URL Param by index |
9,340 | protected function buildRegExp ( $ pattern ) { $ pattern = '/' . trim ( $ pattern , '/' ) ; $ pattern = str_replace ( '/' , '\/' , $ pattern ) ; preg_match_all ( '#((\\\/)?[^\\\/]+)#im' , $ pattern , $ patternMatches ) ; foreach ( $ patternMatches [ 1 ] as & $ match ) { if ( strpos ( $ match , '*' ) !== false ) { $ mat... | Builds regular expression |
9,341 | public function authorize ( UserInterface $ user , $ ip = null ) { return $ this -> authRoles ( $ user ) && $ this -> authIps ( $ ip ) ; } | Returns true if use has access |
9,342 | protected function authRoles ( UserInterface $ user ) { if ( empty ( $ this -> roles ) ) { return true ; } foreach ( $ this -> roles as $ role ) { if ( $ user -> hasRole ( $ role ) ) { return true ; } } return false ; } | Returns true if use has role to access area |
9,343 | protected function authIps ( $ userIp ) { if ( empty ( $ this -> ips ) ) { return true ; } foreach ( $ this -> ips as $ ip ) { if ( $ userIp === $ ip ) { return true ; } } return false ; } | Returns true if user has IP to access area |
9,344 | public function getItemConfig ( $ name = null , array $ config = [ ] ) { return array_merge ( [ 'domain' => $ name , 'nginx' => $ this , 'class' => $ this -> defaultClass , ] , $ config ) ; } | Prepares item config . |
9,345 | public function onBeforeAddPageCommit ( BeforeAddPageCommitEvent $ event ) { if ( $ event -> isAborted ( ) ) { return ; } $ pageManager = $ event -> getContentManager ( ) ; $ templateManager = $ pageManager -> getTemplateManager ( ) ; $ pageRepository = $ pageManager -> getPageRepository ( ) ; try { $ languages = $ thi... | Adds the contents for the page when a new page is added for each language of the site |
9,346 | public function execute ( Request $ request ) { $ controllerClass = $ request -> attributes -> get ( '_controller' ) ; if ( ! ( $ this -> isJwtRequired ( $ controllerClass ) ) ) { return null ; } if ( ! $ this -> authoriser -> isAuthorised ( $ request ) ) { return new JsonResponse ( [ 'error' => 'Invalid token' ] , 403... | Authorise this request |
9,347 | public function mkdir ( $ uri , $ mode , $ options ) { return ( $ this -> cxt ( 'swiftfs_fake_isdir_true' , FALSE ) || ! ( $ this -> testDirectoryExists ( $ uri ) ) ) ; } | Fake a make a dir . |
9,348 | protected function fakeStat ( $ dir = FALSE ) { $ request_time = time ( ) ; $ type = $ dir ? 040000 : 0100000 ; $ mode = $ type + $ this -> cxt ( 'swiftfs_fake_stat_mode' , 0777 ) ; $ values = array ( 'dev' => 0 , 'ino' => 0 , 'mode' => $ mode , 'nlink' => 0 , 'uid' => 0 , 'gid' => 0 , 'rdev' => 0 , 'size' => 0 , 'atim... | Fake stat data . |
9,349 | public static function getMaxKeyLength ( array $ array ) { $ maxKeyLength = '0' ; foreach ( $ array as $ key => $ value ) { $ currentLength = static :: getVisibleStringLength ( $ key ) ; if ( $ currentLength > $ maxKeyLength ) { $ maxKeyLength = $ currentLength ; } } return $ maxKeyLength ; } | Find longest string length among keys |
9,350 | public static function getMaxValueLength ( array $ array ) { $ maxValueLength = '0' ; foreach ( $ array as $ value ) { $ currentLength = static :: getVisibleStringLength ( $ value ) ; if ( $ currentLength > $ maxValueLength ) { $ maxValueLength = $ currentLength ; } } return $ maxValueLength ; } | Find longest string length among values |
9,351 | public static function getVisibleStringLength ( $ string ) { $ pattern = '#' . static :: ESCAPE_CHARACTER_REGEX . '#' ; $ cleanString = preg_replace ( $ pattern , '' , $ string ) ; return strlen ( $ cleanString ) ; } | Compute string length of only visible characters |
9,352 | protected function adjustPosition ( $ op , array $ managers ) { if ( count ( $ managers ) == 0 ) { return null ; } $ this -> checkValidOperation ( $ op ) ; try { $ result = null ; $ this -> blockRepository -> startTransaction ( ) ; foreach ( $ managers as $ blockManager ) { $ block = $ blockManager -> get ( ) ; $ conte... | Adjusts the blocks position on the slot when a new block is added or a block is deleted . |
9,353 | public function build ( array $ config , ContainerInterface $ container = null ) { $ dispatcher = new Dispatcher ( $ container ) ; foreach ( ( array ) $ config as $ name => $ listeners ) { foreach ( $ listeners as $ listener ) { if ( is_callable ( $ listener ) ) { $ dispatcher -> register ( $ name , $ listener ) ; cont... | Builds event dispatcher and event listeners |
9,354 | public function applyDefaults ( $ definition ) { if ( ! is_array ( $ definition ) ) { return $ definition ; } if ( ! isset ( $ definition [ 'component' ] ) ) { throw new AppException ( 'Missing required "component" key in listener definition' ) ; } return array_merge ( $ this -> defaults , $ definition ) ; } | Applies default values or missing properties to listener definition |
9,355 | public function buildDefinition ( $ definition ) { if ( is_callable ( $ definition ) ) { return $ definition ; } if ( is_array ( $ definition ) && isset ( $ definition [ 'component' ] ) ) { return new Listener ( $ definition [ 'component' ] , $ definition [ 'method' ] ? : null , $ definition [ 'arguments' ] ? ( array )... | Creates listener definition |
9,356 | private function getPath ( $ folderId ) { $ folder = $ this -> repository -> find ( $ folderId ) ; $ path = [ ] ; while ( $ folder ) { $ path [ ] = $ folder ; $ folder = $ folder -> folder ; } $ firstItem = new stdClass ( ) ; $ firstItem -> name = __ ( 'Files' ) ; $ firstItem -> type = 'f' ; $ firstItem -> id = '' ; $ ... | Get folders path . |
9,357 | public function invokeArguments ( array $ arguments ) { $ parsedArguments = $ this -> argumentParser -> parse ( $ arguments , $ this -> getParameters ( ) ) ; return call_user_func_array ( $ this -> callable , $ parsedArguments ) ; } | Invoke callback using the given array as arguments . |
9,358 | public function init ( ) { if ( ! empty ( $ this -> belongs_to ) ) { try { $ model = $ this -> belongs_to [ 'model' ] ; $ this -> parent_model = $ model :: find ( $ this -> params [ $ this -> belongs_to [ 'param' ] ] ) ; } catch ( \ PDOException $ e ) { return $ this -> http_status ( 404 ) ; } } return parent :: init (... | Returns Bacon \ Presenter |
9,359 | public function execute ( Arguments $ args , ConsoleIo $ io ) { $ this -> createFile ( $ io , Folder :: slashTerm ( WWW_ROOT ) . 'robots.txt' , 'User-agent: *' . PHP_EOL . 'Disallow: /admin/' . PHP_EOL . 'Disallow: /ckeditor/' . PHP_EOL . 'Disallow: /css/' . PHP_EOL . 'Disallow: /js/' . PHP_EOL . 'Disallow: /vendor/' )... | Creates the robots . txt file |
9,360 | public function match ( $ sender , ProtocolInterface $ protocol ) { $ callback = $ this -> matcher ; return $ callback ( $ sender , $ protocol ) ; } | Match given message protocol . |
9,361 | public function handle ( $ sender , ProtocolInterface $ protocol , $ flags , callable $ success = null , callable $ failure = null , callable $ cancel = null , $ timeout = 0.0 ) { $ callback = $ this -> handler ; $ callback ( $ sender , $ protocol , $ flags , $ success , $ failure , $ cancel , $ timeout ) ; if ( $ this... | Handle given message protocol . |
9,362 | public function cancel ( ) { if ( isset ( $ this -> pointer ) && isset ( $ this -> router ) && ! $ this -> cancelled ) { $ this -> router -> removeHandler ( $ this -> pointer [ 0 ] , $ this -> pointer [ 1 ] ) ; $ this -> cancelled = true ; } } | Remove this handler . |
9,363 | public function saved ( $ username = NULL , $ sid = NULL ) { $ current = $ this -> current ( $ sid ) ; if ( $ username ) { $ user = $ this -> get ( $ username , 'username' ) ; if ( $ current [ 'id' ] != $ user [ 'id' ] ) throw new \ Exception ( 'This users saved images are not publicly shared' ) ; } else { $ user = $ c... | User s saved images |
9,364 | public function requestPwReset ( $ username ) { $ setting = new Setting ; $ site_name = $ setting -> get ( 'site_name' ) ; $ user = $ this -> get ( $ username , 'username' ) ; $ uid = $ this -> getSecureID ( ) ; $ req = new \ JohnVanOrange \ Core \ Request ; $ data = [ 'ip' => $ req -> ip ( ) , 'user_id' => $ user [ 'i... | Request a reset of the users password |
9,365 | public function equals ( $ signature ) : bool { if ( $ signature instanceof Signature ) { $ signature = $ signature -> signature ; } if ( $ this === $ signature || $ this -> signature == $ signature ) { return true ; } return false ; } | Checks if the two signatures are equal . |
9,366 | public static function mutate ( array & $ array , string $ writeKey , $ value ) { $ ref = & $ array ; $ keys = explode ( '.' , $ writeKey ) ; while ( ( $ key = array_shift ( $ keys ) ) !== null ) { $ hasMoreKeys = \ count ( $ keys ) > 0 ; if ( $ hasMoreKeys ) { if ( ! \ array_key_exists ( $ key , $ ref ) ) { $ ref [ $ ... | Mutate an array using dot - notation . |
9,367 | public function setHeaders ( $ key , $ value = null ) { if ( is_array ( $ key ) ) { foreach ( $ key as $ a_key => $ value ) { $ this -> headers [ strtolower ( $ a_key ) ] = "$a_key: $value" ; } } elseif ( empty ( $ value ) ) { $ this -> headers [ ] = $ key ; } else { $ this -> headers [ strtolower ( $ key ) ] = "$key: ... | Add value to header . Same header values will be replaced . |
9,368 | public function removeHeaders ( $ keys ) { $ key_array = ( array ) $ keys ; foreach ( $ key_array as $ key ) { unset ( $ this -> headers [ $ key ] ) ; } } | Remove header values |
9,369 | public function setOption ( $ option , $ value = null ) { if ( is_array ( $ option ) ) { $ this -> options += $ option ; } else { $ this -> options [ $ option ] = $ value ; } return $ this ; } | Set or override a cURL option |
9,370 | public function updateURLWithParameters ( $ url , array $ params ) { if ( empty ( $ params ) ) { return $ url ; } $ parts = parse_url ( $ url ) ; $ scheme = isset ( $ parts [ 'scheme' ] ) ? $ parts [ 'scheme' ] : null ; if ( $ scheme ) { $ scheme .= ':' ; } $ host = isset ( $ parts [ 'host' ] ) ? $ parts [ 'host' ] : n... | Updates the URL provided with the new parameters |
9,371 | public static function post ( $ url , $ data = null , $ accepts_cookie = true , $ compression = 'gzip' , $ proxy = '' ) { $ self = new static ( $ accepts_cookie , $ compression , $ proxy ) ; return $ self -> sendPOST ( $ url , $ data ) ; } | Quick POST request |
9,372 | public static function get ( $ url , $ data = [ ] , $ accepts_cookie = true , $ compression = 'gzip' , $ proxy = '' ) { $ self = new static ( $ accepts_cookie , $ compression , $ proxy ) ; return $ self -> sendGET ( $ url , $ data ) ; } | Quick GET request |
9,373 | public function getIncludeMap ( ) : array { if ( $ this -> cachedIncludeMap === null ) { $ this -> cachedIncludeMap = $ this -> getRawIncludeMap ( ) ; } return $ this -> cachedIncludeMap ; } | Return a cached version of the include map . |
9,374 | public function item ( $ data , $ transformer = null , $ resourceKey = null ) : Item { return new Item ( $ data , $ transformer , $ resourceKey ) ; } | Create a new Item resource . |
9,375 | public function collection ( $ data , $ transformer = null , $ resourceKey = null ) : Collection { return new Collection ( $ data , $ transformer , $ resourceKey ) ; } | Create new Collection resource . |
9,376 | public function start_el ( & $ output , $ item , $ depth = 0 , $ args = [ ] , $ item_id = 0 ) { parent :: start_el ( $ output , $ item , $ depth , $ args , $ item_id ) ; $ output = preg_replace ( '/menu-item-has-children([^>\"]*?)">/ms' , 'menu-item-has-children$1" aria-haspopup="true">' , $ output ) ; } | Starts the element output . |
9,377 | public function _nav_menu_css_class ( $ classes , $ item , $ args , $ depth ) { if ( ! is_object ( $ args -> walker ) ) { return $ classes ; } if ( ! $ args -> walker instanceof \ Inc2734 \ WP_Basis \ App \ Walker \ Navbar ) { return $ classes ; } if ( $ depth > 0 ) { $ classes [ ] = 'c-navbar__subitem' ; } else { $ cl... | Sets up classes |
9,378 | public function address ( $ address = null ) { if ( $ address !== null ) { $ this -> address = str_replace ( '&' , '&' , $ address ) ; } $ this -> setRedirectHeaders ( ) ; return $ this -> address ; } | Sets redirection address |
9,379 | public function delay ( $ delay = null ) { if ( $ delay !== null ) { $ this -> delay = ( int ) $ delay ; } $ this -> setRedirectHeaders ( ) ; return $ this -> delay ; } | Sets redirection delay |
9,380 | protected function generateSettings ( ) { $ settings = new LoginProviderSettings ( ) ; $ settings -> identityColumnName = $ this -> usernameColumnName ; $ settings -> lockoutAccountAfterFailedLoginAttempts = true ; $ settings -> numberOfFailedLoginAttemptsBeforeLockout = 3 ; $ settings -> numberOfPreviousPasswords = 3 ... | Returns the configured settings for this provider |
9,381 | public function login ( $ identity , $ password ) { try { $ loginStatus = $ this -> attemptLogin ( $ identity , $ password ) ; if ( $ loginStatus ) { $ this -> createSuccessfulUserLoginAttempt ( $ identity ) ; } return $ loginStatus ; } catch ( LoginDisabledException $ loginDisabledException ) { $ this -> createFailedU... | Attempts to authenticate a user using an identity and a password |
9,382 | protected function checkUserIsPermitted ( $ user ) { if ( ! isset ( $ user ) ) { Log :: debug ( "Login failed for " . $ user [ $ this -> usernameColumnName ] . " - the user is disabled." , "LOGIN" ) ; throw new LoginDisabledException ( ) ; } if ( $ this -> hasPasswordExpired ( $ user ) ) { Log :: debug ( "Login failed ... | Provides an opportunity for extending classes to do additional checks on the user object before allowing them to login . |
9,383 | public function filter ( $ node , $ tagname ) { $ userDefFunction = $ this -> _userDefFunction ; $ nodes = $ userDefFunction ( $ node , $ tagname ) ; if ( ! is_array ( $ nodes ) ) { throw new CssParserException ( "The user defined combinator is not an array" ) ; } $ items = array ( ) ; foreach ( $ nodes as $ node ) { i... | Gets the child nodes . |
9,384 | public function delete ( ) { shmop_write ( $ this -> shmid , str_pad ( '' , shmop_size ( $ this -> shmid ) , ' ' ) , 0 ) ; return shmop_delete ( $ this -> shmid ) ; } | Mark a shared memory block for deletion . |
9,385 | private function generateFilename ( ) { $ filename = str_random ( 100 ) . "." . $ this -> extension ; if ( Storage :: exists ( $ this -> folder . '/' . $ filename ) ) { $ this -> generateFilename ( ) ; } return $ filename ; } | Generate random string for a filename |
9,386 | public function read ( $ text ) { $ initializeOptions = $ this -> getOptions ( ) -> getInitializeOptions ( ) ; $ pollyClient = new PollyClient ( [ 'version' => $ initializeOptions -> getVersion ( ) , 'region' => $ initializeOptions -> getRegion ( ) , 'credentials' => [ 'key' => $ initializeOptions -> getCredentials ( )... | Get audio for text from adapter |
9,387 | public function onKernelException ( GetResponseForExceptionEvent $ event ) { $ exception = $ event -> getException ( ) ; if ( ! $ exception instanceof RedKiteCmsExceptionInterface ) { return ; } $ message = $ exception -> getMessage ( ) ; $ jsonMessage = json_decode ( $ message , true ) ; if ( ! is_array ( $ jsonMessag... | Handles RedKiteCmsExceptionInterface exceptions |
9,388 | public static function checkReportTaskDelivery ( ) { $ reportTasks = ReportTask :: builder ( ) -> whereNotNull ( 'next_run_023' ) -> where ( 'next_run_023' , '<' , date ( 'U' ) ) -> get ( ) ; foreach ( $ reportTasks as $ reportTask ) self :: executeReportTask ( $ reportTask ) ; } | Function to manage reports task to delivery |
9,389 | public static function make ( ... $ ruts ) { $ ruts = array_values ( $ ruts ) ; if ( is_array ( $ ruts [ 0 ] ) && func_num_args ( ) === 1 ) { $ ruts = $ ruts [ 0 ] ; } foreach ( $ ruts as & $ rut ) { $ rut = new static ( $ rut ) ; } return count ( $ ruts ) === 1 ? $ ruts [ 0 ] : $ ruts ; } | Creates a new Rut instance |
9,390 | public static function makeValid ( ... $ ruts ) { $ ruts = self :: make ( ... $ ruts ) ; $ ruts = is_array ( $ ruts ) ? $ ruts : [ $ ruts ] ; foreach ( $ ruts as $ rut ) { if ( ! $ rut -> isValid ( ) ) { throw new InvalidRutException ( $ rut ) ; } } return count ( $ ruts ) === 1 ? $ ruts [ 0 ] : $ ruts ; } | Makes only Valid Ruts |
9,391 | public function addRut ( string $ rut ) { [ $ this -> attributes [ 'num' ] , $ this -> attributes [ 'vd' ] ] = $ this -> separateRut ( $ rut ) ; return $ this ; } | Adds a RUT to the instance |
9,392 | public function toFormattedString ( ) { switch ( self :: $ format ) { case 'full' : return number_format ( $ this -> num , 0 , ',' , '.' ) . '-' . $ this -> vd ; case 'basic' : return $ this -> num . '-' . $ this -> vd ; case 'raw' : default : return $ this -> num . $ this -> vd ; } } | Returns a formatted RUT string |
9,393 | public static function setStringFormat ( string $ format ) { switch ( $ format ) { case 'raw' : self :: $ format = 'raw' ; break ; case 'basic' : self :: $ format = 'basic' ; break ; case 'full' : default : self :: $ format = 'full' ; break ; } } | How to serialize as a string |
9,394 | public function setContent ( $ content , $ code = 200 ) { $ this -> content = $ content ? $ content : '' ; $ this -> statusCode = $ code ; if ( ! is_scalar ( $ content ) ) { $ this -> toJson ( ) ; } return $ this ; } | Set response content . |
9,395 | public function appendContent ( $ content , $ code = 200 ) { if ( ! empty ( $ content ) ) { $ oldContent = $ this -> getContent ( ) ; if ( ! empty ( $ oldContent ) ) { if ( ! is_scalar ( $ content ) ) { $ content = json_encode ( $ content ) ; } $ this -> toHTML ( ) ; $ content = $ oldContent . $ content ; } $ this -> s... | Append content to response . |
9,396 | public function json ( $ content ) { $ this -> header ( 'Content-Type' , 'application/json' ) ; $ this -> json = true ; $ this -> content = $ content ; return $ this ; } | Set a json content as response . |
9,397 | public function download ( $ path , $ name = null ) { $ fResponse = new FileResponse ( $ path ) ; return $ fResponse -> forceDownload ( $ name ) ; } | Force download of file |
9,398 | public function getContent ( ) { if ( $ this -> content && ! is_scalar ( $ this -> content ) && ! $ this -> json ) { $ this -> toJson ( ) ; } if ( ( $ this -> json || $ this -> request -> wantsJson ( ) ) && ! is_scalar ( $ this -> content ) ) { if ( $ this -> content instanceof Collection ) { return json_encode ( $ thi... | Get content of this response object . |
9,399 | protected function getStatusText ( ) { $ code = $ this -> statusCode ; if ( empty ( $ code ) ) { $ code = 200 ; } return "HTTP/1.1 $code " . $ this -> getHttpResponseMessage ( $ code ) ; } | Get the response status text . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.