idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
58,600 | public function getSecondsAsText ( $ seconds , $ decimals = 2 , $ decPoint = ',' , $ thousandsSep = '.' ) { $ seconds = floatval ( $ seconds ) ; if ( 60 > $ seconds ) { return sprintf ( '%ss' , number_format ( $ seconds , $ decimals , $ decPoint , $ thousandsSep ) ) ; } $ minutes = floor ( $ seconds / 60 ) ; if ( 3600 ... | Get Seconds As Text |
58,601 | public function getSecondsAsTextExtended ( $ seconds ) { $ seconds = floatval ( $ seconds ) ; $ result = [ ] ; $ steps = [ 'days' => 86400 , 'hours' => 3600 , 'minutes' => 60 , 'seconds' => 1 , ] ; foreach ( $ steps as $ stepName => $ stepDivider ) { $ stepCount = floor ( $ seconds / $ stepDivider ) ; if ( 0 < $ stepCo... | Get Seconds As Text Extended |
58,602 | protected function validate ( ) { if ( $ this -> method === HttpMethods :: POST && empty ( $ this -> data ) ) { throw new Exceptions \ WebException ( "Using method POST without data." ) ; } } | Validates the request values for correctness |
58,603 | protected function prepareCurl ( ) { $ this -> curl = curl_init ( ) ; $ this -> complete = Complete :: factory ( function ( ) { if ( $ this -> curl ) { curl_close ( $ this -> curl ) ; } $ this -> curl = null ; $ this -> complete = null ; } ) ; foreach ( self :: $ curlOptions as $ option => $ value ) { curl_setopt ( $ t... | Initializes the curl resource |
58,604 | protected function prepareData ( ) { if ( ! empty ( $ this -> data ) ) { if ( $ this -> method === HttpMethods :: GET ) { $ this -> url = Utils :: appendUrlQuery ( $ this -> url , $ this -> data ) ; } else if ( $ this -> method === HttpMethods :: POST ) { curl_setopt ( $ this -> curl , CURLOPT_POSTFIELDS , $ this -> da... | Adds the data value to the curl request |
58,605 | protected function prepareHeaders ( ) { if ( $ this -> method === HttpMethods :: POST && ! empty ( $ this -> headers [ "Content-Type" ] ) ) { unset ( $ this -> headers [ "Content-Type" ] ) ; } curl_setopt ( $ this -> curl , CURLOPT_USERAGENT , $ this -> userAgent ) ; if ( ! empty ( $ this -> headers ) ) { $ headers = $... | Adds the set headers to the curl request |
58,606 | protected function exec ( ) { curl_setopt ( $ this -> curl , CURLOPT_URL , $ this -> url ) ; $ response_text = curl_exec ( $ this -> curl ) ; $ this -> info = curl_getinfo ( $ this -> curl ) ; $ this -> logInformation ( ) ; if ( false === $ response_text ) { throw new Exceptions \ WebException ( curl_error ( $ this -> ... | Executes the configured request |
58,607 | protected function logInformation ( ) { if ( $ this -> logger ) { $ level = $ this -> info [ "http_code" ] > 0 && $ this -> info [ "http_code" ] < 400 ? LogLevel :: INFO : LogLevel :: ERROR ; $ this -> info [ "method" ] = $ this -> method ; $ this -> logger -> log ( $ level , $ this -> logFormat , $ this -> info ) ; } ... | Logs request information when logging is enabled |
58,608 | public function Allow ( $ range ) { $ formatted = $ this -> formatRange ( $ range ) ; if ( ! $ formatted ) { return FALSE ; } $ this -> allowIPs [ $ formatted [ 0 ] ] = $ formatted [ 1 ] ; return TRUE ; } | Add an IP address range to allow Return FALSE is the IP range is invalid |
58,609 | public function Deny ( $ range ) { $ formatted = $ this -> formatRange ( $ range ) ; if ( ! $ formatted ) { return FALSE ; } $ this -> denyIPs [ $ formatted [ 0 ] ] = $ formatted [ 1 ] ; return TRUE ; } | Add an IP address range to deny Return FALSE is the IP range is invalid |
58,610 | public function removeAllowed ( $ range ) { $ formatted = $ this -> formatRange ( $ range ) ; if ( ! $ formatted ) { return FALSE ; } unset ( $ this -> allowIPs [ $ formatted [ 0 ] ] ) ; return TRUE ; } | Remove an allowed IP address range Return FALSE is the IP range is invalid |
58,611 | public function removeDenied ( $ range ) { $ formatted = $ this -> formatRange ( $ range ) ; if ( ! $ formatted ) { return FALSE ; } unset ( $ this -> denyIPs [ $ formatted [ 0 ] ] ) ; return TRUE ; } | Remove a denied IP address range Return FALSE is the IP range is invalid |
58,612 | public function formatRange ( $ range ) { if ( strpos ( $ range , '/' ) !== FALSE ) { list ( $ ip , $ netmask ) = explode ( '/' , $ range , 2 ) ; $ ip = implode ( '.' , array_pad ( explode ( '.' , $ ip ) , 4 , 0 ) ) ; if ( strpos ( $ netmask , '.' ) !== FALSE ) { $ netmask = str_replace ( '*' , '0' , $ netmask ) ; $ ip... | Format an IP address range |
58,613 | protected function isInside ( $ ip , $ name , $ range ) { if ( ! is_array ( $ range ) ) { if ( $ ip == $ range ) { return TRUE ; } } elseif ( strpos ( $ name , '/' ) !== FALSE ) { if ( ( $ ip & $ range [ 1 ] ) == ( $ range [ 0 ] & $ range [ 1 ] ) ) { return TRUE ; } } elseif ( strpos ( $ name , '-' ) !== FALSE ) { if (... | Return whether an IP is inside a range |
58,614 | public function isAllowed ( $ ip , $ priority = 'deny,allow' ) { $ ipDec = ( float ) sprintf ( "%u" , ip2long ( $ ip ) ) ; foreach ( explode ( ',' , $ priority ) as $ type ) { switch ( $ type ) { case 'allow' : foreach ( $ this -> allowIPs as $ name => $ range ) { if ( $ this -> isInside ( $ ipDec , $ name , $ range ) ... | Return whether an IP is allowed |
58,615 | protected function row ( $ worker , $ service , $ current , $ ready , $ valid ) { $ mask = "| %-10.10s | %-40.40s | %-40.40s | %-5s | %-5s |" ; $ text = sprintf ( $ mask , $ worker , $ service , $ current , $ ready , $ valid ) ; $ this -> output -> writeln ( $ text ) ; } | Print a single line with information . |
58,616 | protected static function parseValidKeys ( ) { if ( self :: $ validOptions !== null ) { return ; } $ refl = new ReflectionClass ( '\ZMQ' ) ; $ const = $ refl -> getConstants ( ) ; self :: $ validOptions = array ( ) ; foreach ( $ const as $ key => $ value ) { if ( substr ( $ key , 0 , 8 ) == 'SOCKOPT_' ) { self :: $ val... | Fills the attribute validOptions containing a list of options that can be set . |
58,617 | public function isOptionKeyValid ( $ key ) { self :: parseValidKeys ( ) ; if ( isset ( self :: $ validOptions [ $ key ] ) ) { return true ; } return false ; } | Checks if the given option key is valid for ZMQ . |
58,618 | public function addOption ( $ key , $ value ) { if ( ! $ this -> isOptionKeyValid ( $ key ) ) { throw new \ RuntimeException ( 'Invalid socket option ' . $ key . '.' ) ; } $ this -> options [ $ key ] = $ value ; return $ this ; } | Overrides a default ZMQ option . |
58,619 | public function addOptions ( $ options ) { foreach ( $ options as $ key => $ value ) { $ this -> addOption ( $ key , $ value ) ; } return $ this ; } | Adds ZMQ socket options . |
58,620 | public function createPublisher ( $ mode , $ dsn = null , $ options = array ( ) ) { return $ this -> createSocket ( ZMQ :: SOCKET_PUB , $ mode , $ dsn , $ options ) ; } | Creates a publiser socket . |
58,621 | public function createSubscriber ( $ mode , $ dsn = null , $ subscribe = '' , $ options = array ( ) ) { $ options [ ZMQ :: SOCKOPT_SUBSCRIBE ] = $ subscribe ; return $ this -> createSocket ( ZMQ :: SOCKET_SUB , $ mode , $ dsn , $ options ) ; } | Creates a subscriber socket . |
58,622 | public function createRequest ( $ mode , $ dsn = null , $ options = array ( ) ) { return $ this -> createSocket ( ZMQ :: SOCKET_REQ , $ mode , $ dsn , $ options ) ; } | Creates a request socket . |
58,623 | public function createReply ( $ mode , $ dsn = null , $ options = array ( ) ) { return $ this -> createSocket ( ZMQ :: SOCKET_REP , $ mode , $ dsn , $ options ) ; } | Creates a reply socket . |
58,624 | public function createRouter ( $ mode , $ dsn = null , $ options = array ( ) ) { return $ this -> createSocket ( ZMQ :: SOCKET_ROUTER , $ mode , $ dsn , $ options ) ; } | Creates a router socket . |
58,625 | protected function createSocket ( $ type , $ mode , $ dsn = null , $ options = array ( ) ) { $ context = $ this -> getContext ( ) ; $ socket = new Socket ( $ context , $ type ) ; $ options = $ this -> options + $ options ; foreach ( $ options as $ key => $ value ) { $ socket -> setSockOpt ( $ key , $ value ) ; } $ this... | Creates a socket . |
58,626 | public function connect ( ZMQSocket $ socket , $ mode , $ dsn ) { if ( $ mode == self :: MODE_CONSTRUCT ) { return $ this ; } $ func = null ; if ( $ mode == self :: MODE_BIND ) { $ func = 'bind' ; } elseif ( $ mode == self :: MODE_CONNECT ) { $ func = 'connect' ; } if ( is_string ( $ dsn ) ) { $ dsn = array ( $ dsn ) ;... | Connects or binds a socket based on mode . |
58,627 | public function registerMediaDomain ( $ extensions , DomainInterface $ mediaDomain ) { foreach ( ( array ) $ extensions as $ extensions ) { $ this -> mediaDomainsMap [ strtolower ( $ extensions ) ] = $ mediaDomain ; } } | Register a media domain for given file extension set . |
58,628 | private function fetchDomain ( $ extension ) { if ( ! array_key_exists ( $ extension = strtolower ( $ extension ) , $ this -> mediaDomainsMap ) ) { throw new UnsupportedFileException ( sprintf ( 'Extension ".%s" isnt supported by Media component, only ["%s"] are.' , $ extension , implode ( '", "' , array_keys ( $ this ... | Fetch and return domain matching given file extension . |
58,629 | public function can ( $ permission , array $ params = [ ] , $ caching = true ) { return $ this -> canAccess ( $ permission , $ params , $ caching ) ; } | check user permission |
58,630 | public static function get ( $ dottedKey , $ default = null ) { if ( self :: $ flashedVars ) { $ flashedValue = Arr :: get ( self :: $ flashedVars , $ dottedKey , '~no~flashed~value~' ) ; if ( $ flashedValue !== '~no~flashed~value~' ) { return $ flashedValue ; } } return self :: $ storage -> get ( $ dottedKey , $ defau... | Retrieve the value from session . |
58,631 | public function addLogHandler ( array $ logHandlers , $ createLogger = false ) { try { $ this -> configuredLogHandlers = array_merge ( $ this -> configuredLogHandlers , $ logHandlers ) ; if ( $ createLogger === true ) { $ this -> createLogger ( $ this -> channelName ) ; $ this -> createLogHandlers ( ) ; } } catch ( Exc... | Add log handlers to the configuration |
58,632 | protected function createLogHandlers ( ) { $ logHandlers = $ this -> configuredLogHandlers ; foreach ( $ logHandlers as $ handlerNamespace => $ handlerDetails ) { if ( is_array ( $ handlerDetails ) && array_key_exists ( 'handler_parameters' , $ handlerDetails ) ) { $ handlerParameters = $ handlerDetails [ 'handler_para... | Iterate the configured log handlers and create concrete handlers |
58,633 | private static function _getLoggerStderr ( ) { if ( ! isset ( self :: $ loggerStderr ) ) { $ CymapgtStderrLogger = new MonologLogger ( 'cymapgt_stderr' ) ; $ CymapgtStderrLogger -> pushHandler ( new ErrorLogHandler ( ) ) ; self :: $ loggerStderr = $ CymapgtStderrLogger ; } return self :: $ loggerStderr ; } | return the stderr logger |
58,634 | private static function _getLoggerLevel1 ( $ loggerParams ) { if ( ! isset ( self :: $ loggerLevel1 ) ) { $ CymapgtLevel1LogDir = $ loggerParams [ 'log_dir' ] ; $ CymapgtLevel1Stream = new StreamHandler ( $ CymapgtLevel1LogDir , MonologLogger :: DEBUG ) ; $ CymapgtLevel1Logger = new MonologLogger ( 'cymapgt_level1' ) ;... | return the level1 logger |
58,635 | private static function _getLoggerLevel2 ( $ loggerParams ) { if ( ! isset ( self :: $ loggerLevel2 ) ) { $ CymapgtLevel2LogDir = $ loggerParams [ 'log_dir' ] ; $ CymapgtLevel2Stream = new StreamHandler ( $ CymapgtLevel2LogDir , MonologLogger :: ERROR ) ; $ CymapgtLevel2Logger = new MonologLogger ( 'cymapgt_level2' ) ;... | return the level2 logger |
58,636 | private static function _getLoggerLevel3 ( $ loggerParams ) { if ( ! isset ( self :: $ loggerLevel3 ) ) { $ notifierObj = new NotifierSmsAfricasTalkingService ( $ loggerParams [ 'notifier_params' ] , true ) ; $ recipientList = $ loggerParams [ 'notifier_recipients' ] ; $ CymapgtLevel3LogDir = $ loggerParams [ 'log_dir'... | return the level3 logger |
58,637 | private static function _getLoggerSecurity ( $ loggerParams ) { if ( ! isset ( self :: $ loggerSecurity ) ) { $ notifierObj = new NotifierSmsAfricasTalkingService ( ( $ loggerParams [ 'notifier_params' ] ) , ( $ loggerParams [ 'notifier_params' ] [ 'IS_BEHIND_PROXY' ] ) ) ; $ recipientList = $ loggerParams [ 'notifier_... | return the security logger |
58,638 | public function setProperties ( $ propValues ) { foreach ( $ propValues as $ propName => $ propValue ) { if ( property_exists ( $ this , $ propName ) ) { $ this -> { $ propName } = $ propValue ; } else { $ this -> throwException ( 'Property "%propName%" does not exist in class "%className%"' , array ( '%propName%' => $... | Sets properties values |
58,639 | public static function batch ( ClientInterface $ client , $ requests , array $ options = [ ] ) { $ hash = new \ SplObjectStorage ( ) ; foreach ( $ requests as $ request ) { $ hash -> attach ( $ request ) ; } ( new self ( $ client , $ requests , RequestEvents :: convertEventArray ( $ options , [ 'end' ] , [ 'priority' =... | Sends multiple requests in parallel and returns an array of responses and exceptions that uses the same ordering as the provided requests . |
58,640 | public static function send ( ClientInterface $ client , $ requests , array $ options = [ ] ) { $ pool = new self ( $ client , $ requests , $ options ) ; $ pool -> wait ( ) ; } | Creates a Pool and immediately sends the requests . |
58,641 | private function addNextRequests ( ) { $ limit = max ( $ this -> getPoolSize ( ) - count ( $ this -> waitQueue ) , 0 ) ; while ( $ limit -- ) { if ( ! $ this -> addNextRequest ( ) ) { break ; } } } | Add as many requests as possible up to the current pool limit . |
58,642 | private function addNextRequest ( ) { add_next : if ( $ this -> isRealized || ! $ this -> iter || ! $ this -> iter -> valid ( ) ) { return false ; } $ request = $ this -> iter -> current ( ) ; $ this -> iter -> next ( ) ; if ( ! ( $ request instanceof RequestInterface ) ) { throw new \ InvalidArgumentException ( sprint... | Adds the next request to pool and tracks what requests need to be dereferenced when completing the pool . |
58,643 | public function handle ( ServerRequestInterface $ request ) : ResponseInterface { $ input = $ this -> input ( $ request ) ; $ payload = $ this -> domain -> payload ( $ input ) ; return $ this -> responder -> response ( $ request , $ payload ) ; } | Return a response by following the action domain responder pattern . |
58,644 | private function input ( ServerRequestInterface $ request ) : array { if ( ! is_null ( $ this -> parser ) ) { $ input = ( $ this -> parser ) ( $ request ) ; if ( is_array ( $ input ) ) { return $ input ; } throw new InputTypeException ( $ input ) ; } return array_merge ( $ request -> getAttributes ( ) , $ request -> ge... | Return an input array from the given request using the request parser . |
58,645 | public function getStores ( $ langCode = null ) { $ stores = array ( ) ; foreach ( Mage :: app ( ) -> getWebsites ( ) as $ website ) { $ stores = array_replace ( $ stores , $ this -> getWebsiteStores ( $ website , $ langCode ) ) ; } return $ stores ; } | Return an array of stores and attach a language code to them Varien_Object style |
58,646 | public function getWebsiteStores ( $ website , $ langCode = null ) { $ stores = array ( ) ; $ config = Mage :: helper ( 'radial_core' ) -> getConfigModel ( ) ; $ website = Mage :: app ( ) -> getWebsite ( $ website ) ; foreach ( $ website -> getGroups ( ) as $ group ) { foreach ( $ group -> getStores ( ) as $ store ) { ... | Return an array of stores for the given website and attach a language code to them Varien_Object style |
58,647 | public function getLanguageCodesList ( ) { $ languages = array ( ) ; foreach ( $ this -> getStores ( ) as $ store ) { $ languages [ ] = $ store -> getLanguageCode ( ) ; } return array_unique ( $ languages ) ; } | Get a simple array of all language codes used in this installation |
58,648 | public function redirectToRoute ( ) { if ( $ this -> getRequest ( ) -> isXmlHttpRequest ( ) ) { return [ 'redirect' => call_user_func_array ( [ $ this -> url ( ) , 'fromRoute' , ] , func_get_args ( ) ) , ] ; } return call_user_func_array ( [ $ this -> redirect ( ) , 'toRoute' , ] , func_get_args ( ) ) ; } | Redirect to a route or pass the url to the view for a javascript redirect |
58,649 | protected function fetchFromArray ( array $ array , string $ index = '' , $ xss_clean = false ) { if ( ! array_key_exists ( $ index , $ array ) ) { return false ; } if ( $ xss_clean === 'isset' ) { return array_key_exists ( $ index , $ array ) ; } return $ array [ $ index ] ; } | The function that will handle getting the data from the arrays . |
58,650 | protected function keyIsAlreadyInstalled ( ) { $ key = 'APP_KEY=base64:' ; $ output = $ this -> execSSH ( "cd $this->domain;cat .env" ) ; if ( str_contains ( $ output , $ key ) ) { return true ; } return false ; } | Key is already installed on production? |
58,651 | public function getRouteInfo ( ) { if ( $ this -> isSingle ( ) ) { if ( isset ( $ this -> containers [ 'route_info' ] ) && ( $ controller = $ this -> containers [ 'route_info' ] -> get ( 'controller' ) ) && ( $ action = $ this -> containers [ 'route_info' ] -> get ( 'action' ) ) ) { return [ 'controller' => $ controlle... | Get Route Info |
58,652 | public function isHome ( ) { if ( $ this -> isSingle ( ) ) { if ( isset ( $ this -> containers [ 'route_info' ] ) ) { $ home_controller = 'index' ; $ home_action = 'index' ; $ home = $ this -> getHome ( ) ; if ( $ home && isset ( $ home [ 'controller' ] ) && isset ( $ home [ 'action' ] ) && $ home [ 'controller' ] && $... | If is home |
58,653 | public function getHomeUri ( ) { $ homeUri = '' ; if ( $ this -> isSingle ( ) ) { $ controller = 'index' ; $ action = 'index' ; $ home = $ this -> getHome ( ) ; if ( isset ( $ home [ 'controller' ] ) && isset ( $ home [ 'action' ] ) && $ home [ 'controller' ] && $ home [ 'action' ] ) { $ controller = $ home [ 'controll... | Get Home Uri |
58,654 | public function getDb ( $ db_type , $ node_type ) { if ( $ this -> isSingle ( ) ) { switch ( $ db_type ) { case Connection :: DB_TYPE : switch ( $ node_type ) { case 'master' : return Connection :: component ( ) -> write_conn ; case 'slave' : return Connection :: component ( ) -> read_conn ; default : return Connection... | Get Db Connection |
58,655 | public function createAbsoluteUrl ( $ uri , $ query_params = [ ] , $ ssl = false , $ port = 80 , $ request = null ) { if ( $ this -> isSingle ( ) ) { return UrlManager :: createAbsoluteUrl ( $ uri , $ query_params , $ ssl , $ port , $ request ) ; } return '' ; } | Create Absolute Url |
58,656 | public function getParam ( $ param_name , $ default_value = null ) { if ( $ this -> isSingle ( ) ) { return RequestKit :: getParam ( $ param_name , $ default_value ) ; } return false ; } | Get Http Request Param Value |
58,657 | public function import ( $ path ) { if ( $ this -> isSingle ( ) ) { if ( file_exists ( $ path ) && strtolower ( FileHelper :: getExtensionName ( $ path ) ) == 'php' ) { include_once str_replace ( Security :: INSECURE_CODES , '' , $ path ) ; } } } | Import PHP File |
58,658 | public function swiftSend ( $ from_name , $ receivers , & $ successfulRecipients , & $ failedRecipients , $ subject = '' , $ body = '' , $ content_type = 'text/html' , $ charset = 'UTF-8' ) { if ( $ this -> isSingle ( ) ) { Swift :: component ( ) -> send ( $ from_name , $ receivers , $ successfulRecipients , $ failedRe... | Send Swift Mail |
58,659 | public function loginRequired ( $ redirect_url , $ request = null , $ response = null ) { if ( $ this -> isSingle ( ) ) { User :: loginRequired ( $ redirect_url , $ request , $ response ) ; } } | Check If Logged In |
58,660 | public function isAction ( $ request = null ) { $ is_action = false ; if ( $ this -> isSingle ( ) ) { $ queryString = $ request ? $ request -> getQueryString ( ) : Lb :: app ( ) -> getQueryString ( ) ; $ requestUri = $ request ? $ request -> getUri ( ) : Lb :: app ( ) -> getUri ( ) ; if ( Lb :: app ( ) -> isPrettyUrl (... | Detect Action Exists |
58,661 | public function get_rpc_client ( $ url ) { if ( $ this -> isSingle ( ) ) { include_once Lb :: app ( ) -> getRootDir ( ) . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'hprose' . DIRECTORY_SEPARATOR . 'hprose' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Hprose.php' ; return new \ Hprose \ Http \ Cli... | Get RPC Client |
58,662 | public function on ( $ event_name , $ listener , $ data = null ) { if ( $ this -> isSingle ( ) ) { BaseObserver :: on ( $ event_name , $ listener , $ data ) ; } } | Register Event Listener |
58,663 | public function dispatchJob ( $ job , $ data = [ ] , $ handler = 'handler' ) { if ( $ this -> isSingle ( ) ) { if ( ! is_object ( $ job ) ) { $ job = new $ job ; } return call_user_func_array ( [ $ job , $ handler ] , [ 'data' => $ data ] ) ; } return null ; } | Dispatch a job |
58,664 | protected function loadEnv ( ) { if ( defined ( 'ENV_DIR' ) && file_exists ( ENV_DIR ) ) { if ( defined ( 'ENV_FILE' ) && file_exists ( ENV_FILE ) ) { $ dotenv = new \ Dotenv \ Dotenv ( ENV_DIR , ENV_FILE ) ; } else { $ dotenv = new \ Dotenv \ Dotenv ( ENV_DIR ) ; } $ dotenv -> load ( ) ; } } | Load Environment Variables |
58,665 | protected function getPageCache ( $ cache_type ) { $ route_info = Lb :: app ( ) -> getRouteInfo ( ) ; $ page_cache_key = implode ( '_' , [ 'page_cache' , $ route_info [ 'controller' ] , $ route_info [ 'action' ] ] ) ; return Lb :: app ( ) -> getCache ( $ page_cache_key , $ cache_type ) ; } | Get Page Cache |
58,666 | protected function setPageCache ( $ cache_type , $ page_cache , $ expire = 60 ) { $ route_info = Lb :: app ( ) -> getRouteInfo ( ) ; $ page_cache_key = implode ( '_' , [ 'page_cache' , $ route_info [ 'controller' ] , $ route_info [ 'action' ] ] ) ; Lb :: app ( ) -> setCache ( $ page_cache_key , $ page_cache , $ cache_t... | Set Page Cache |
58,667 | protected function setHttpCache ( $ response = null ) { $ http_cache_config = Lb :: app ( ) -> getHttpCacheConfig ( ) ; if ( isset ( $ http_cache_config [ 'cache_control' ] ) && isset ( $ http_cache_config [ 'offset' ] ) ) { HttpHelper :: setCache ( $ http_cache_config [ 'cache_control' ] , $ http_cache_config [ 'offse... | Set Http Cache |
58,668 | private function createSession ( $ sid , $ userId , Request $ req ) { $ sessionCookie = session_get_cookie_params ( ) ; $ expires = time ( ) + $ sessionCookie [ 'lifetime' ] ; $ session = new ActiveSession ( ) ; $ session -> id = $ sid ; $ session -> user_id = $ userId ; $ session -> ip = $ req -> ip ( ) ; $ session ->... | Creates an active session for a user . |
58,669 | private function refreshSession ( $ sid ) { $ sessionCookie = session_get_cookie_params ( ) ; $ expires = time ( ) + $ sessionCookie [ 'lifetime' ] ; $ this -> getDatabase ( ) -> update ( 'ActiveSessions' ) -> where ( 'id' , $ sid ) -> values ( [ 'expires' => $ expires , 'updated_at' => Utility :: unixToDb ( time ( ) )... | Refreshes the expiration on an active session . |
58,670 | private function getUserRememberMe ( Request $ req , Response $ res ) { $ cookie = $ this -> getRememberMeCookie ( $ req ) ; if ( ! $ cookie ) { return false ; } $ user = $ cookie -> verify ( $ req , $ this -> auth ) ; if ( ! $ user ) { $ this -> destroyRememberMeCookie ( $ req , $ res ) ; return false ; } $ signedInUs... | Tries to get an authenticated user via remember me . |
58,671 | private function getRememberMeCookie ( Request $ req ) { $ encoded = $ req -> cookies ( $ this -> rememberMeCookieName ( ) ) ; if ( ! $ encoded ) { return false ; } return RememberMeCookie :: decode ( $ encoded ) ; } | Gets the decoded remember me cookie from the request . |
58,672 | private function sendRememberMeCookie ( UserInterface $ user , RememberMeCookie $ cookie , Response $ res ) { $ sessionCookie = session_get_cookie_params ( ) ; $ res -> setCookie ( $ this -> rememberMeCookieName ( ) , $ cookie -> encode ( ) , $ cookie -> getExpires ( time ( ) ) , $ sessionCookie [ 'path' ] , $ sessionC... | Stores a remember me session cookie on the response . |
58,673 | private function destroyRememberMeCookie ( Request $ req , Response $ res ) { $ cookie = $ this -> getRememberMeCookie ( $ req ) ; if ( $ cookie ) { $ cookie -> destroy ( ) ; } $ sessionCookie = session_get_cookie_params ( ) ; $ res -> setCookie ( $ this -> rememberMeCookieName ( ) , '' , time ( ) - 86400 , $ sessionCo... | Destroys the remember me cookie . |
58,674 | public function setCookie ( $ cookie_key , $ cookie_value , $ expire = null , $ path = null , $ domain = null , $ secure = null , $ httpOnly = null ) { if ( $ this -> isSingle ( ) ) { ResponseKit :: setCookie ( $ cookie_key , $ cookie_value , $ expire , $ path , $ domain , $ secure , $ httpOnly ) ; } } | Set Cookie Value |
58,675 | public function delCookies ( $ cookie_keys ) { if ( $ this -> isSingle ( ) ) { foreach ( $ cookie_keys as $ cookie_key ) { $ this -> delCookie ( $ cookie_key ) ; } } } | Delete Multi Cookies |
58,676 | private function createCommandProphecy ( ) { $ prophet = new Prophet ; $ prophecy = $ prophet -> prophesize ( ) -> willImplement ( InlineConfigCommandInterface :: class ) ; $ prophecy -> setName ( 'foo' ) -> shouldBeCalled ( ) ; $ prophecy -> getConfig ( ) -> willReturn ( [ 'name' => 'foo' ] ) ; return $ prophecy ; } | override prophecy creation |
58,677 | private function validateComponentKeys ( array $ v ) { $ diff = array_diff_key ( $ v , array_flip ( $ this -> enabledComponentTypes ) ) ; if ( ! empty ( $ diff ) ) { throw new InvalidConfigurationException ( sprintf ( 'Only "%s" component types are supported for configuration, "%s" more given.' , implode ( '", "' , $ t... | Validate given array keys are all registered components . |
58,678 | private function hydrateTemplatesNode ( NodeBuilder $ node ) { $ node -> booleanNode ( 'default' ) -> defaultFalse ( ) -> end ( ) -> scalarNode ( 'path' ) -> cannotBeEmpty ( ) -> end ( ) -> arrayNode ( 'contents' ) -> prototype ( 'scalar' ) -> cannotBeEmpty ( ) -> end ( ) -> end ( ) ; return $ node ; } | Hydrate given node with templates configuration nodes . |
58,679 | private function hydrateZonesNode ( NodeBuilder $ node ) { $ node -> booleanNode ( 'main' ) -> defaultFalse ( ) -> end ( ) -> booleanNode ( 'virtual' ) -> defaultFalse ( ) -> end ( ) -> arrayNode ( 'aggregation' ) -> addDefaultsIfNotSet ( ) -> beforeNormalization ( ) -> always ( function ( $ v ) { if ( is_string ( $ v ... | Hydrate given node with zones configuration nodes . |
58,680 | private function hydrateComponentsNode ( NodeBuilder $ node ) { $ node -> scalarNode ( 'path' ) -> end ( ) -> scalarNode ( 'controller' ) -> end ( ) -> arrayNode ( 'config' ) -> useAttributeAsKey ( 'name' ) -> prototype ( 'array' ) -> useAttributeAsKey ( 'name' ) -> beforeNormalization ( ) -> always ( function ( $ v ) ... | Hydrate given node with components configuration nodes . |
58,681 | public function process ( $ inputFile , $ outputFile = null ) { if ( ! file_exists ( $ inputFile ) || ! is_readable ( $ inputFile ) ) { throw new InvalidFileArgumentException ( sprintf ( 'File %s does not exist or is not readable' , $ inputFile ) ) ; } $ arguments = array ( '-quiet' , '-inter' , '0.5' , '-tmp' , dirnam... | Processes a file |
58,682 | public static function create ( $ conf = array ( ) , LoggerInterface $ logger = null ) { if ( ! $ conf instanceof ConfigurationInterface ) { $ conf = new Configuration ( $ conf ) ; } $ binaries = $ conf -> get ( 'mp4box.binaries' , array ( 'MP4Box' ) ) ; return static :: load ( $ binaries , $ logger , $ conf ) ; } | Creates an MP4Box binary adapter . |
58,683 | public function injectWidgetDependencies ( WidgetInterface $ widget , ServiceLocatorInterface $ serviceLocator ) { $ sm = $ serviceLocator -> getServiceLocator ( ) ; if ( ! $ sm ) throw new \ Exception ( 'Service Manager can`t found.' ) ; if ( $ widget instanceof ViewRendererPlugInterface ) { if ( ! $ sm -> has ( 'View... | Inject required dependencies into the widget . |
58,684 | public function loadXmlFile ( $ path , $ parse = false ) { $ this -> preserveWhiteSpace = false ; $ bool = file_exists ( $ path ) ; if ( ! $ bool ) { $ this -> error = 'file_not_exists' ; return false ; } $ bool = @ $ this -> load ( $ path ) ; if ( ! $ bool ) { $ this -> error = 'loading_file_error' ; return false ; } ... | load xml file optionally check file DTD |
58,685 | public function saveXmlFile ( $ path = '' ) { $ this -> formatOutput = true ; if ( $ path ) { $ bool = @ $ this -> save ( $ path ) ; if ( ! $ bool ) { $ this -> error = 'save_file_error' ; return false ; } return true ; } return $ this -> saveXML ( ) ; } | save xml file optionally will return as string |
58,686 | protected function searchByAttributeRecurrent ( DOMNodeList $ node , $ value , array $ list = [ ] ) { foreach ( $ node as $ child ) { if ( $ child -> nodeType === 1 ) { if ( $ child -> hasChildNodes ( ) ) { $ list = $ this -> searchByAttributeRecurrent ( $ child -> childNodes , $ value , $ list ) ; } $ attribute = $ ch... | search for all nodes with given attribute return list of nodes with attribute value as key |
58,687 | final protected function generate_rendered_tags ( ) { $ data_sources = $ this -> data_sources ; $ data_sources [ ] = $ this -> recipient ; $ tags = $ this -> manager -> render_tags ( $ data_sources ) ; $ rendered = array ( ) ; foreach ( $ tags as $ tag => $ value ) { $ rendered [ '{' . $ tag . '}' ] = $ value ; } $ thi... | Generate the rendered forms of the tags . |
58,688 | public function add_data_source ( \ Serializable $ source , $ name = '' ) { if ( $ name ) { $ this -> data_sources [ $ name ] = $ source ; } else { $ this -> data_sources [ ] = $ source ; } $ this -> regenerate ( ) ; return $ this ; } | Add a data source . |
58,689 | protected function get_data_to_serialize ( ) { return array ( 'recipient' => $ this -> recipient -> ID , 'message' => $ this -> message , 'subject' => $ this -> subject , 'strategy' => $ this -> strategy , 'manager' => $ this -> manager -> get_type ( ) , 'data_sources' => $ this -> data_sources ) ; } | Get the data to serialize . |
58,690 | protected function do_unserialize ( array $ data ) { $ this -> recipient = get_user_by ( 'id' , $ data [ 'recipient' ] ) ; $ this -> message = $ data [ 'message' ] ; $ this -> subject = $ data [ 'subject' ] ; $ this -> manager = Factory :: make ( $ data [ 'manager' ] ) ; $ this -> strategy = $ data [ 'strategy' ] ; $ t... | Do the actual unserialization . |
58,691 | public function hasFailed ( ) { if ( $ this -> failed == false || $ this -> passed == true ) { $ this -> failed = true ; $ this -> passed = false ; } } | Set booleans if validator failed |
58,692 | public function hasPassed ( ) { if ( $ this -> passed == false || $ this -> failed == true ) { $ this -> passed = true ; $ this -> failed = false ; } } | Set booleans if validator passed |
58,693 | protected function renderFormActions ( ) { $ rowPlugin = $ this -> getRowPlugin ( ) ; if ( ! empty ( $ this -> formActionElements ) ) { $ this -> getElement ( ) -> addChild ( $ rowPlugin ( $ this -> formActionElements , true ) -> getElement ( ) ) ; } return $ this ; } | Render the form action elements when needed . |
58,694 | public function getString ( $ varname ) { $ value = $ this -> get ( $ varname ) ; return $ value === null ? null : trim ( $ value ) ; } | Gets the configuration option value as a trimmed string . |
58,695 | public function getBool ( $ varname ) { $ value = $ this -> getString ( $ varname ) ; return $ value === null ? null : $ value && strtolower ( $ value ) !== 'off' ; } | Gets configuration option value as a boolean . Interprets the string value off as false . |
58,696 | public function getNumeric ( $ varname ) { $ value = $ this -> getString ( $ varname ) ; return is_numeric ( $ value ) ? $ value + 0 : null ; } | Gets configuration option value as an integer . |
58,697 | public function resolve ( ) { $ url = $ this -> request -> url ( ) ; $ tmp = explode ( '/' , $ url ) ; $ last_seg = end ( $ tmp ) ; return $ this -> repository -> findBySlug ( $ last_seg ) ; } | Resolve the post . |
58,698 | public function isValid ( ) { $ valid = true ; $ this -> validate ( ) ; foreach ( $ this -> getIterator ( ) as $ element ) { if ( $ element instanceof ValidationAwareInterface ) { $ valid = $ element -> isValid ( ) ? $ valid : false ; } } return $ valid ; } | Checks if all elements are valid |
58,699 | public function get ( $ name ) { $ selected = null ; foreach ( $ this as $ element ) { if ( $ element -> getName ( ) == $ name ) { $ selected = $ element ; break ; } if ( $ element instanceof ContainerInterface ) { $ selected = $ element -> get ( $ name ) ; if ( null !== $ selected ) { break ; } } } return $ selected ;... | Gets element by name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.