idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
239,000 | public function input ( $ buffer , $ connection ) { $ len = strlen ( $ buffer ) ; if ( $ this -> max_packet_size > 0 && $ len >= $ this -> max_packet_size ) { throw new \ Exception ( $ connection . ' request packet size exceed max_packet_size ' , Server :: ERROR_LARGE_PACKET ) ; } return $ len ; } | Determines whether the current connection has received the complete packet zero value indicates that a complete packet is not received yet positive value indicates that a complete packet has been received and represents the number of bytes of the packet negative value indicates that the data is invalid or unrecognized |
239,001 | public function body ( ) { $ event = [ ] ; if ( ! empty ( $ this -> replyToken ) ) { $ event [ 'replyToken' ] = $ this -> replyToken ; } $ event [ 'type' ] = $ this -> eventType ( ) ; $ event [ 'timestamp' ] = time ( ) ; $ event [ 'source' ] = $ this -> source ; $ event [ 'message' ] = $ this -> message ; $ result = [ ... | Build webhook event and return body . Original webhook request body has this signature . |
239,002 | public function getCustomConfig ( $ name = '' ) { $ custom_config = $ this -> getConfigByName ( 'custom' ) ; return $ name ? ( $ custom_config [ $ name ] ?? null ) : $ custom_config ; } | Get Custom Configuration |
239,003 | public function getConfigByName ( $ config_name ) { if ( $ this -> isSingle ( ) ) { if ( isset ( $ this -> containers [ 'config' ] ) ) { return $ this -> containers [ 'config' ] -> get ( $ config_name ) ; } } return [ ] ; } | Get Configuration By Name |
239,004 | public function getUrlManagerConfig ( $ item ) { $ urlManager = $ this -> getConfigByName ( 'urlManager' ) ; if ( isset ( $ urlManager [ $ item ] ) ) { return $ urlManager [ $ item ] ; } return false ; } | Get Url Manager Config By Item Name |
239,005 | public function getJsFiles ( $ controller_id , $ template_id ) { $ js_files = [ ] ; $ asset_config = $ this -> getConfigByName ( 'assets' ) ; if ( isset ( $ asset_config [ $ controller_id ] [ $ template_id ] [ 'js' ] ) ) { $ js_files = $ asset_config [ $ controller_id ] [ $ template_id ] [ 'js' ] ; } return $ js_files ... | Get Js Files |
239,006 | public function getCssFiles ( $ controller_id , $ template_id ) { $ css_files = [ ] ; $ asset_config = $ this -> getConfigByName ( 'assets' ) ; if ( isset ( $ asset_config [ $ controller_id ] [ $ template_id ] [ 'css' ] ) ) { $ css_files = $ asset_config [ $ controller_id ] [ $ template_id ] [ 'css' ] ; } return $ css_... | Get Css Files |
239,007 | public function prepare ( $ content , ThemeInterface $ theme , TemplateInterface $ template , ZoneInterface $ zone , ComponentInterface $ component ) { $ this -> contextStack -> push ( $ this -> contextBuilder -> setContent ( $ content ) -> setTheme ( $ theme ) -> setTemplate ( $ template ) -> setZone ( $ zone ) -> set... | Prepare decorator context . |
239,008 | protected function usePropertyOptions ( $ selector , $ content , $ type ) { $ this -> isBootstrapAttribute ( 'on' , function ( $ return ) use ( $ type ) { $ this -> settings [ 'attr' ] [ 'on' ] = Base :: suffix ( $ return , '.bs.' . $ type ) ; } ) ; return $ this -> bootstrapObjectOptions ( $ selector === 'all' ? '[dat... | Protected use property options |
239,009 | public static function json ( $ json , $ member = '' , $ default_key = '' ) { return self :: option_group ( json_decode ( $ json , true ) , $ member , $ default_key ) ; } | Takes a JSON object as a string to convert to query string keys . |
239,010 | public static function yaml ( $ yaml , $ member = '' , $ default_key = '' ) { return self :: option_group ( sfYaml :: load ( $ yaml ) , $ member , $ default_key ) ; } | Takes a YAML object as a string to convert to query string keys . |
239,011 | public static function create ( $ reason ) : self { $ arguments = func_get_args ( ) ; switch ( $ reason ) { case static :: CLASS_DOES_NOT_EXIST : $ message = sprintf ( 'Class %s does not exist. Cannot retrieve its metadata' , $ arguments [ 1 ] ) ; return new static ( $ message ) ; case static :: VALUE_IS_NOT_AN_OBJECT ... | Create a new instance of InvalidArgumentException with meaningful message . |
239,012 | public static function getPatternFor ( Pattern $ parent , $ word ) { if ( self :: isWildcard ( $ word ) ) { return self :: getWildcardPattern ( $ parent , $ word ) ; } return new Word ( $ word ) ; } | Builds a pattern node based on a given word and its parent . |
239,013 | protected function loadFromStore ( ) { if ( false === $ this -> isLoaded ( ) ) { $ models = $ this -> store -> loadCollection ( $ this ) ; $ this -> setModels ( $ models ) ; $ this -> loaded = true ; } } | Loads this collection from the store . |
239,014 | public function setDelay ( $ delay ) { if ( ! ctype_digit ( ( string ) $ delay ) ) { throw new \ InvalidArgumentException ( 'Delay must be a number.' ) ; } $ this -> delay = $ delay ; return $ this ; } | The time it takes for the handler to respond . |
239,015 | public function start ( ) { $ this -> workerHandlerReady = true ; $ this -> serviceStreamReady = true ; $ this -> sendToService ( new ActionListRequest ( ) ) ; } | Initializes the worker . |
239,016 | public function process ( ) { if ( $ this -> worker -> getState ( ) == Worker :: INVALID ) { throw new \ RuntimeException ( 'Invalid state to process.' ) ; } $ expiry = 5000 + $ this -> delay ; if ( $ this -> worker -> isExpired ( $ expiry ) ) { $ this -> getLogger ( ) -> debug ( 'Worker is expired, no longer registere... | Perform one service cycle . This method checks whether there are any new requests to be handled either from the Worker Handler or from the Service . |
239,017 | protected function createWorkerHandlerStream ( Socket $ socket ) { $ socket -> setId ( 'manager' ) ; $ this -> getPoller ( ) -> add ( $ socket , ZMQ :: POLL_IN ) ; $ that = $ this ; $ this -> workerHandlerStream = $ socket -> getStream ( ) ; $ this -> workerHandlerStream -> addListener ( StreamInterface :: MESSAGE , fu... | Creates a socket to communicate with the worker handler . |
239,018 | protected function createServiceStream ( Socket $ socket ) { $ socket -> setId ( 'worker_service' ) ; $ this -> getPoller ( ) -> add ( $ socket , ZMQ :: POLL_IN ) ; $ that = $ this ; $ this -> serviceStream = $ socket -> getStream ( ) ; $ this -> serviceStream -> addListener ( StreamInterface :: MESSAGE , function ( Me... | Creates a socket to communicate with the service . |
239,019 | public function onWorkerHandlerMessage ( MessageInterface $ msg ) { $ this -> workerHandlerReady = true ; $ this -> worker -> touch ( ) ; if ( $ msg instanceof Destroy ) { $ this -> worker -> setState ( Worker :: INVALID ) ; return ; } if ( $ msg instanceof ExecuteJobRequest ) { $ this -> startJob ( $ msg ) ; return ; ... | Handles a Message from the Worker Handler . |
239,020 | private function handleHeartbeatResponse ( ) { $ state = $ this -> worker -> getState ( ) ; if ( Worker :: BUSY == $ state ) { return ; } if ( Worker :: RESULT_AVAILABLE == $ state ) { $ this -> handleResult ( ) ; return ; } if ( in_array ( $ state , array ( Worker :: READY , Worker :: RESULT , Worker :: REGISTER ) ) )... | Handles the heartbeat response from the worker handler . |
239,021 | public function onServiceMessage ( MessageInterface $ msg ) { $ this -> serviceStreamReady = true ; $ this -> getLogger ( ) -> debug ( 'Received Service Message of Type: ' . get_class ( $ msg ) ) ; if ( $ msg instanceof ActionListResponse ) { $ actions = $ msg -> getActions ( ) ; $ this -> getLogger ( ) -> debug ( 'The... | Handles a Message from the Service Handler . |
239,022 | public function startJob ( ExecuteJobRequest $ request ) { $ this -> worker -> setState ( Worker :: BUSY ) ; $ requestId = $ request -> getRequestId ( ) ; $ action = $ request -> getAction ( ) ; if ( ! $ this -> worker -> hasAction ( $ action ) ) { $ this -> getLogger ( ) -> debug ( 'Action ' . $ action . ' not found.'... | Starts a Job . |
239,023 | public function heartbeat ( ) { $ state = $ this -> worker -> getState ( ) ; if ( ! in_array ( $ state , array ( Worker :: BUSY , Worker :: READY ) ) ) { return ; } $ timeout = 2500 ; if ( ! $ this -> worker -> isExpired ( $ timeout ) ) { return ; } if ( $ this -> isWorkerHandlerReady ( ) ) { $ this -> sendToWorkerHand... | Performs a heartbeat with the Worker Handler . |
239,024 | public function handleResult ( ) { $ result = $ this -> worker -> getResult ( ) ; if ( $ result === null ) { return ; } if ( ! $ this -> isWorkerHandlerReady ( ) ) { return ; } $ this -> sendToWorkerHandler ( new Protocol \ JobResult ( $ this -> worker -> getRequestId ( ) , $ result ) ) ; $ this -> worker -> setState (... | Sends when the Service is done working this sends the result to the Worker Handler . |
239,025 | public function sendToWorkerHandler ( MessageInterface $ msg ) { if ( ! $ this -> isWorkerHandlerReady ( ) ) { $ this -> getLogger ( ) -> debug ( 'WorkerHandler socket not ready to send.' ) ; return ; } $ this -> workerHandlerReady = false ; $ this -> workerHandlerStream -> send ( $ msg ) ; } | Send the given Message to the Worker Handler . |
239,026 | public function sendToService ( MessageInterface $ msg ) { if ( ! $ this -> isServiceStreamReady ( ) ) { $ this -> getLogger ( ) -> debug ( 'Service socket not ready to send.' ) ; return ; } $ this -> getLogger ( ) -> debug ( 'Sending to service.' ) ; $ this -> serviceStreamReady = false ; $ this -> serviceStream -> se... | Send the given Message to the Service . |
239,027 | public function finish ( ) { $ writer = $ this -> writer ; if ( ! $ writer ) { $ writer = PHPExcel_IOFactory :: createWriter ( $ this -> excel , $ this -> format ) ; } $ writer -> save ( $ this -> filename ) ; } | Finish the writer . |
239,028 | private function delegateAuthenticator ( TokenInterface $ token ) { if ( ! $ authenticator = $ this -> resolveAuthenticator ( $ token ) ) { throw new \ RuntimeException ( sprintf ( 'No authentication authenticator found for token: "%s".' , get_class ( $ token ) ) ) ; } return $ authenticator ; } | Delegate a authenticator for a token . |
239,029 | private function resolveAuthenticator ( TokenInterface $ token ) { foreach ( $ this -> authenticators as $ authenticator ) { if ( $ authenticator -> supports ( $ token ) ) { return $ authenticator ; } } return false ; } | Resolve a token to its authenticator . |
239,030 | public function handle ( ) { if ( ! ( $ this -> exception instanceof \ ErrorException ) ) { $ this -> quit = true ; } else { switch ( $ this -> exception -> getSeverity ( ) ) { case E_ERROR : case E_CORE_ERROR : case E_USER_ERROR : $ this -> quit = true ; } } return self :: get_html ( $ this -> exception ) ; } | Handle an error with the most basic handler |
239,031 | public static function get_subject ( $ exception ) { $ application = null ; try { $ application = \ Skeleton \ Core \ Application :: get ( ) ; } catch ( \ Exception $ e ) { } if ( $ application === null ) { $ hostname = 'unknown' ; $ name = 'unknown' ; } else { $ hostname = $ application -> hostname ; $ name = $ applic... | Produce a subject based on the error |
239,032 | public static function get_html ( $ exception ) { $ subject = self :: get_subject ( $ exception ) ; if ( $ exception instanceof \ ErrorException ) { $ error_type = \ Skeleton \ Error \ Util \ Misc :: translate_error_code ( $ exception -> getSeverity ( ) ) ; } else { $ error_type = 'Exception' ; } $ error_info = '' ; $ ... | Produce some HTML around the error |
239,033 | public function loadRelFor ( Models $ models , $ relName , $ flags = null ) { $ rel = $ this -> getRelOrError ( $ relName ) ; $ foreign = $ rel -> loadModelsIfAvailable ( $ models , $ flags ) ; $ rel -> linkModels ( $ models , $ foreign , function ( AbstractLink $ link ) { $ class = get_class ( $ link -> getModel ( ) )... | Load models for a given relation . |
239,034 | public function loadAllRelsFor ( Models $ models , array $ rels , $ flags = null ) { $ rels = Arr :: toAssoc ( $ rels ) ; foreach ( $ rels as $ relName => $ childRels ) { $ foreign = $ this -> loadRelFor ( $ models , $ relName , $ flags ) ; if ( $ childRels ) { $ rel = $ this -> getRel ( $ relName ) ; $ rel -> getRepo ... | Load all the models for the provided relations . This is the meat of the eager loading |
239,035 | public function updateModels ( Models $ models ) { foreach ( $ models as $ model ) { if ( $ model -> isSoftDeleted ( ) ) { $ this -> dispatchBeforeEvent ( $ model , Event :: DELETE ) ; } else { $ this -> dispatchBeforeEvent ( $ model , Event :: UPDATE ) ; $ this -> dispatchBeforeEvent ( $ model , Event :: SAVE ) ; } } ... | Call all the events associated with model updates . Perform the update itself . |
239,036 | public function deleteModels ( Models $ models ) { foreach ( $ models as $ model ) { $ this -> dispatchBeforeEvent ( $ model , Event :: DELETE ) ; } $ this -> deleteAll ( ) -> executeModels ( $ models ) ; foreach ( $ models as $ model ) { $ this -> dispatchAfterEvent ( $ model , Event :: DELETE ) ; } return $ this ; } | Call all the events associated with model deletion . Perform the deletion itself . |
239,037 | public function insertModels ( Models $ models ) { foreach ( $ models as $ model ) { $ this -> dispatchBeforeEvent ( $ model , Event :: INSERT ) ; $ this -> dispatchBeforeEvent ( $ model , Event :: SAVE ) ; } $ this -> insertAll ( ) -> executeModels ( $ models ) ; foreach ( $ models as $ model ) { $ model -> resetOrigi... | Call all the events associated with model insertion . Perform the insertion itself . |
239,038 | protected function build ( OutputInterface $ output ) { $ this -> command -> run ( $ this -> input , $ output ) ; $ this -> lastBuild = new DateTime ( ) ; } | Run the build command |
239,039 | public static function setUp ( NodeName $ nodeName , array $ tasks , array $ config = array ( ) ) { $ instance = new static ( ) ; $ instance -> assertConfig ( $ config ) ; $ processId = ProcessId :: generate ( ) ; $ taskList = TaskList :: scheduleTasks ( TaskListId :: linkWith ( $ nodeName , $ processId ) , $ tasks ) ;... | Creates new process from given tasks and config |
239,040 | public function receiveMessage ( $ message , WorkflowEngine $ workflowEngine ) { if ( $ message instanceof WorkflowMessage ) { if ( MessageNameUtils :: isProcessingCommand ( $ message -> messageName ( ) ) ) { $ this -> perform ( $ workflowEngine , $ message ) ; return ; } $ this -> assertTaskEntryExists ( $ message -> ... | A Process can start or continue with the next step after it has received a message |
239,041 | public function assertIsEmpty ( $ value , $ message = '%s must not be empty' , $ exception = 'Asserts' ) { if ( isset ( $ value ) === false || empty ( $ value ) ) { $ this -> throwException ( $ exception , $ message , $ value ) ; } } | Verifies that the specified condition is not empty . The assertion fails if the condition is empty . |
239,042 | private static function makeCallable ( $ expression ) { if ( ! array_key_exists ( $ expression , static :: $ map ) ) { $ return = "return ($expression);" ; try { $ lambda = create_function ( static :: $ signature , $ return ) ; } catch ( \ ParseError $ ex ) { $ lambda = false ; } finally { if ( false === $ lambda ) { t... | Given a string expression turn that into an anonymous function . Cache the result so as to keep memory impacts low . |
239,043 | public function setCookie ( $ cookieName , $ value = null , $ expire = null ) { if ( $ expire !== null ) { $ expire = time ( ) + ( 60 * 60 * $ expire ) ; } if ( setcookie ( $ cookieName , $ this -> encodeCookie ( $ value ) , $ expire , "/" ) ) { return true ; } else { return false ; } } | Sets a cookie in the user s browser |
239,044 | public function getCookie ( $ cookieName ) { if ( isset ( $ _COOKIE [ $ cookieName ] ) ) { return $ this -> decodeCookie ( $ _COOKIE [ $ cookieName ] ) ; } else { return false ; } } | Check if a cookie is set and returns its content |
239,045 | public function taggedWith ( $ tag ) { $ results = [ ] ; if ( isset ( $ this -> tags [ $ tag ] ) ) { foreach ( $ this -> tags [ $ tag ] as $ view ) { $ results [ ] = $ view ; } } return $ results ; } | Return all the views for a given tag . |
239,046 | private function registerFilters ( ) { $ filters = config ( 'app.render_filters' , [ ] ) ; foreach ( $ filters as $ filter ) { $ filter = app ( $ filter ) ; if ( $ filter instanceof FilterContract ) { $ this -> twigEnvironment -> addFilter ( new \ Twig_SimpleFilter ( $ filter -> getName ( ) , $ filter -> getFilter ( ) ... | Registers the template filters . |
239,047 | public function addPath ( $ path ) { try { $ this -> twigFileLoader -> addPath ( $ path ) ; } catch ( \ Twig_Error_Loader $ e ) { throw new InvalidPathException ( $ e -> getMessage ( ) ) ; } } | Adds a path to the template environment . |
239,048 | public function getData ( ) { $ systemInformation = [ ] ; $ systemInformation [ 'newup_version' ] = Application :: VERSION ; return $ this -> dataArray + $ systemInformation + $ this -> collectData ( ) ; } | Gets the environment data . |
239,049 | public function render ( $ templateName ) { try { return $ this -> twigEnvironment -> render ( $ templateName , $ this -> getData ( ) ) ; } catch ( SecurityException $ e ) { throw new SecurityException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } catch ( \ Twig_Error_Runtime $ e ) { throw new RuntimeExcepti... | Renders a template by name . |
239,050 | public function renderString ( $ templateString ) { try { return $ this -> twigStringEnvironment -> render ( $ templateString , $ this -> getData ( ) ) ; } catch ( SecurityException $ e ) { throw new SecurityException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } catch ( \ Twig_Error_Runtime $ e ) { throw ne... | Renders a string as a template . |
239,051 | public function collectData ( ) { $ collectedData = [ ] ; foreach ( $ this -> dataCollectors as $ collector ) { $ collectedData = $ collectedData + $ collector -> collect ( ) ; } return $ collectedData ; } | Collects all data from data collectors . |
239,052 | public static function instance ( ) : NumberSyntax { if ( self :: $ instance === null ) self :: $ instance = new NumberSyntax ; return self :: $ instance ; } | Returns the NumberSyntax instance . |
239,053 | public function set_hostname ( $ hostname , $ port_number = null ) { if ( $ this -> override_hostname ) { $ this -> hostname = $ hostname ; if ( $ port_number ) { $ this -> port_number = $ port_number ; $ this -> hostname .= ':' . ( string ) $ this -> port_number ; } } return $ this ; } | Set the hostname to connect to . This is useful for alternate services that are API - compatible with AWS but run from a different hostname . |
239,054 | public function set_cache_config ( $ location , $ gzip = true ) { if ( is_array ( $ location ) ) { $ this -> cache_class = 'CacheMC' ; } else { $ type = strtolower ( substr ( $ location , 0 , 3 ) ) ; switch ( $ type ) { case 'apc' : $ this -> cache_class = 'CacheAPC' ; break ; case 'xca' : $ this -> cache_class = 'Cach... | Set the caching configuration to use for response caching . |
239,055 | public function batch ( CFBatchRequest & $ queue = null ) { if ( $ queue ) { $ this -> batch_object = $ queue ; } elseif ( $ this -> internal_batch_object ) { $ this -> batch_object = & $ this -> internal_batch_object ; } else { $ this -> internal_batch_object = new $ this -> batch_class ( ) ; $ this -> batch_object = ... | Specifies that the intended request should be queued for a later batch request . |
239,056 | public function send ( $ clear_after_send = true ) { if ( $ this -> use_batch_flow ) { $ this -> use_batch_flow = false ; if ( ! $ this -> use_cache_flow ) { $ response = $ this -> batch_object -> send ( ) ; $ parsed_data = array_map ( array ( $ this , 'parse_callback' ) , $ response ) ; $ parsed_data = new CFArray ( $... | Executes the batch request queue by sending all queued requests . |
239,057 | public function parse_callback ( $ response , $ headers = null ) { if ( isset ( $ response -> body ) ) { if ( is_string ( $ response -> body ) ) { $ body = $ response -> body ; } else { return $ response ; } } elseif ( is_string ( $ response ) ) { $ body = $ response ; } else { return $ response ; } if ( isset ( $ head... | Parses a response body into a PHP object if appropriate . |
239,058 | public static function autoloader ( $ class ) { $ path = dirname ( __FILE__ ) . DIRECTORY_SEPARATOR ; if ( strstr ( $ class , 'Amazon' ) ) { $ path .= 'services' . DIRECTORY_SEPARATOR . str_ireplace ( 'Amazon' , '' , strtolower ( $ class ) ) . '.class.php' ; } elseif ( strstr ( $ class , 'CF' ) ) { $ path .= 'utilities... | Automatically load classes that aren t included . |
239,059 | public function html ( $ data ) { if ( is_array ( $ data ) ) { echo $ this -> json ( $ data ) ; } else { echo $ data ; } if ( $ this -> app -> config ( 'session.enable' ) ) { $ this -> session -> create ( 'previous_uri' , $ _SERVER [ 'REQUEST_URI' ] ) ; $ this -> session -> create ( 'planet_oldInput' , null ) ; } } | To response with html |
239,060 | public function json ( $ data , $ status = 200 ) { $ this -> header ( 'Content-Type: application/json' ) ; $ this -> statusCode ( $ status ) ; return json_encode ( $ data ) ; } | To response with json |
239,061 | public function download ( $ path , $ removeDownloadedFile = false ) { if ( ! file_exists ( $ path ) ) { throw new Exception ( "File [ $path ] not found." ) ; } $ filename = pathinfo ( $ path , PATHINFO_BASENAME ) ; header ( "Content-Description: File Transfer" ) ; header ( "Content-Type: application/octet-stream" ) ; ... | Http Response to download file |
239,062 | protected function updateDeploymentScript ( ) { $ this -> info ( 'Updating deployment script for site ' . $ this -> site . '...' ) ; $ this -> url = $ this -> obtainAPIURLEndpoint ( 'update_deployment_script_uri' ) ; if ( ! File :: exists ( $ this -> file ) ) { $ this -> error ( "File " . $ this -> file . " doesn't exi... | Update deployment script . |
239,063 | protected function obtainAPIURLEndpoint ( $ type ) { $ uri = str_replace ( '{forgeserver}' , $ this -> server , config ( 'forge-publish.' . $ type ) ) ; $ uri = str_replace ( '{forgesite}' , $ this -> site , $ uri ) ; return config ( 'forge-publish.url' ) . $ uri ; } | Obtain API URL endpoint . |
239,064 | public function onTwigView ( ViewEvent $ event ) { $ view = $ event -> getView ( ) ; if ( function_exists ( 'drupal_add_library' ) && $ view instanceof TwigView ) { drupal_add_library ( 'calista' , 'calista_page' ) ; } } | Add JS libraries |
239,065 | public function run ( ) { $ res1 = $ this -> gcPersistent ( ) ; $ res2 = $ this -> gcUserLinks ( ) ; $ res3 = $ this -> gcActive ( ) ; return $ res1 && $ res2 && $ res3 ; } | Runs the auth garbage collection . |
239,066 | private function gcPersistent ( ) { return ( bool ) $ this -> app [ 'database' ] -> getDefault ( ) -> delete ( 'PersistentSessions' ) -> where ( 'created_at' , U :: unixToDb ( time ( ) - PersistentSession :: $ sessionLength ) , '<' ) -> execute ( ) ; } | Clears out expired persistent sessions . |
239,067 | private function gcUserLinks ( ) { return ( bool ) $ this -> app [ 'database' ] -> getDefault ( ) -> delete ( 'UserLinks' ) -> where ( 'type' , UserLink :: FORGOT_PASSWORD ) -> where ( 'created_at' , U :: unixToDb ( time ( ) - UserLink :: $ forgotLinkTimeframe ) , '<' ) -> execute ( ) ; } | Clears out expired user links . |
239,068 | public static function singleton ( $ sessionID = FALSE ) { if ( self :: $ _instance === FALSE ) { self :: $ _instance = new static ( $ sessionID ) ; } return self :: $ _instance ; } | Return a single object instance |
239,069 | public function query ( string $ sql , array $ params = [ ] ) { X :: logger ( ) -> trace ( "$sql with params " . $ this -> serializeArray ( $ params ) ) ; try { $ st = $ this -> pdo -> prepare ( $ sql ) ; if ( $ st === false ) { $ e = $ this -> pdo -> errorInfo ( ) ; throw new DataBaseException ( $ e [ 2 ] , $ e [ 1 ] ... | run sql and return the result |
239,070 | public function getAvatarTag ( $ size = 96 , $ alt = null ) { return get_avatar ( $ this -> getId ( ) , $ size , null , $ alt ? : $ this -> getDisplayName ( ) ) ; } | Get an image tag for this author s avatar . |
239,071 | public function syntax ( Syntax $ value = null ) : Syntax { if ( null === $ value ) { return $ this -> syntax ; } $ this -> syntax = $ value ; return $ this ; } | Item syntax getter and setter . |
239,072 | public function separator ( string $ value = null ) { if ( null === $ value ) { return $ this -> separator ; } $ this -> separator = $ value ; return $ this ; } | Separator getter and setter . |
239,073 | public function parse ( string $ text ) : array { $ index = 0 ; $ items = Text :: split ( $ text , $ this -> separator ) ; $ array = [ ] ; try { foreach ( $ items as $ item ) { $ array [ ] = $ this -> syntax -> parse ( $ item ) ; $ index += strlen ( $ item ) + 1 ; } } catch ( ParseException $ e ) { $ extra = [ 'type' =... | Transforms a string to array based on the syntax or throws a ParseException . |
239,074 | public function dump ( $ values ) : string { if ( ! is_array ( $ values ) ) throw new DumpException ( $ this , $ values , self :: ERROR ) ; $ items = [ ] ; $ index = 0 ; try { foreach ( $ values as $ key => $ value ) { $ index = $ key ; $ items [ ] = $ this -> syntax -> dump ( $ value ) ; } } catch ( DumpException $ e ... | Converts the given array to a string based on the syntax or throws a DumpException . |
239,075 | protected function settings ( $ key = false ) { if ( $ this -> settings == false ) { return false ; } if ( $ key == false ) { return $ this -> settings ; } if ( isset ( $ this -> settings [ $ key ] ) ) { return $ this -> settings [ $ key ] ; } return false ; } | - > merchantSettings |
239,076 | public function handle ( Request $ request ) { try { $ restRequest = new RestRequest ( $ this -> config , $ request -> getMethod ( ) , $ request -> getUri ( ) , $ request -> getContent ( ) ) ; $ restResponse = $ this -> adapter -> processRequest ( $ restRequest ) ; } catch ( \ Exception $ e ) { if ( true === $ this -> ... | Processes an incoming Request object routes it to the adapter and returns a response . |
239,077 | protected function loadContainer ( array $ config = [ ] , $ environment = null ) { $ this -> container = new Container ; $ this -> configureContainerInternal ( ) ; $ this -> configureContainer ( $ this -> container , $ config , $ environment ) ; return $ this -> container -> get ( 'instantiator' ) ; } | Setup the Dependency Injection Container |
239,078 | protected function configureContainerInternal ( ) { $ this -> container -> add ( 'instantiator' , function ( ) { return function ( $ name ) { return $ this -> container -> get ( $ name ) ; } ; } ) ; $ this -> container -> add ( \ Weave \ Middleware \ Middleware :: class ) -> withArgument ( \ Weave \ Middleware \ Middle... | Configure s the internal Weave requirements . |
239,079 | public function register ( ) { $ this -> app -> singleton ( Grammar :: class ) ; $ this -> app -> singleton ( Lexer :: class ) ; $ this -> app -> singleton ( Parser :: class ) ; $ this -> app -> singleton ( IntToRomanFilter :: class ) ; $ this -> app -> singleton ( RomanToIntFilter :: class ) ; $ this -> app -> resolvi... | Register Romans Services |
239,080 | static public function shellColor ( $ color , $ string , $ conditional = true ) { if ( ! $ conditional ) { return $ string ; } $ color = self :: shellColorCode ( $ color ) ; return $ color . $ string . self :: shellColorCode ( 'plain' ) ; } | Wraps string in bash shell color escape sequences for the provided color . |
239,081 | static public function fromCamel ( $ str ) { $ str [ 0 ] = strtolower ( $ str [ 0 ] ) ; return preg_replace_callback ( '/([A-Z])/' , function ( $ char ) { return "_" . strtolower ( $ char [ 1 ] ) ; } , $ str ) ; } | Converts camel - case to corresponding underscores . |
239,082 | static public function toCamel ( $ str , $ capitalise_first_char = false ) { if ( $ capitalise_first_char ) { $ str [ 0 ] = strtoupper ( $ str [ 0 ] ) ; } return preg_replace_callback ( '/_([a-z])/' , function ( $ char ) { return strtoupper ( $ char [ 1 ] ) ; } , $ str ) ; } | Converts underscores to a corresponding camel - case string . |
239,083 | public function deleteSession ( $ clientId , $ ownerType , $ ownerId ) { DB :: table ( 'oauth_sessions' ) -> where ( 'client_id' , $ clientId ) -> where ( 'owner_type' , $ ownerType ) -> where ( 'owner_id' , $ ownerId ) -> delete ( ) ; } | Delete a session |
239,084 | public function associateRedirectUri ( $ sessionId , $ redirectUri ) { DB :: table ( 'oauth_session_redirects' ) -> insert ( array ( 'session_id' => $ sessionId , 'redirect_uri' => $ redirectUri , 'created_at' => Carbon :: now ( ) , 'updated_at' => Carbon :: now ( ) ) ) ; } | Associate a redirect URI with a session |
239,085 | public function associateAccessToken ( $ sessionId , $ accessToken , $ expireTime ) { return DB :: table ( 'oauth_session_access_tokens' ) -> insertGetId ( array ( 'session_id' => $ sessionId , 'access_token' => $ accessToken , 'access_token_expires' => $ expireTime , 'created_at' => Carbon :: now ( ) , 'updated_at' =>... | Associate an access token with a session |
239,086 | public function associateRefreshToken ( $ accessTokenId , $ refreshToken , $ expireTime , $ clientId ) { DB :: table ( 'oauth_session_refresh_tokens' ) -> insert ( array ( 'session_access_token_id' => $ accessTokenId , 'refresh_token' => $ refreshToken , 'refresh_token_expires' => $ expireTime , 'client_id' => $ client... | Associate a refresh token with a session |
239,087 | public function associateAuthCode ( $ sessionId , $ authCode , $ expireTime ) { $ id = DB :: table ( 'oauth_session_authcodes' ) -> insertGetId ( array ( 'session_id' => $ sessionId , 'auth_code' => $ authCode , 'auth_code_expires' => $ expireTime , 'created_at' => Carbon :: now ( ) , 'updated_at' => Carbon :: now ( ) ... | Assocate an authorization code with a session |
239,088 | public function validateAuthCode ( $ clientId , $ redirectUri , $ authCode ) { $ result = DB :: table ( 'oauth_sessions' ) -> select ( 'oauth_sessions.id as session_id' , 'oauth_session_authcodes.id as authcode_id' ) -> join ( 'oauth_session_authcodes' , 'oauth_sessions.id' , '=' , 'oauth_session_authcodes.session_id' ... | Validate an authorization code |
239,089 | public function validateAccessToken ( $ accessToken ) { $ result = DB :: table ( 'oauth_session_access_tokens' ) -> select ( 'oauth_session_access_tokens.session_id as session_id' , 'oauth_sessions.client_id as client_id' , 'oauth_clients.secret as client_secret' , 'oauth_sessions.owner_id as owner_id' , 'oauth_session... | Validate an access token |
239,090 | public function validateRefreshToken ( $ refreshToken , $ clientId ) { $ result = DB :: table ( 'oauth_session_refresh_tokens' ) -> where ( 'refresh_token' , $ refreshToken ) -> where ( 'client_id' , $ clientId ) -> where ( 'refresh_token_expires' , '>=' , time ( ) ) -> first ( ) ; return ( is_null ( $ result ) ) ? fal... | Validate a refresh token |
239,091 | public function getAccessToken ( $ accessTokenId ) { $ result = DB :: table ( 'oauth_session_access_tokens' ) -> where ( 'id' , $ accessTokenId ) -> first ( ) ; return ( is_null ( $ result ) ) ? false : ( array ) $ result ; } | Get an access token by ID |
239,092 | public function associateScope ( $ accessTokenId , $ scopeId ) { DB :: table ( 'oauth_session_token_scopes' ) -> insert ( array ( 'session_access_token_id' => $ accessTokenId , 'scope_id' => $ scopeId , 'created_at' => Carbon :: now ( ) , 'updated_at' => Carbon :: now ( ) ) ) ; } | Associate a scope with an access token |
239,093 | public function getScopes ( $ accessToken ) { $ scopeResults = DB :: table ( 'oauth_session_token_scopes' ) -> select ( 'oauth_scopes.*' ) -> join ( 'oauth_session_access_tokens' , 'oauth_session_token_scopes.session_access_token_id' , '=' , 'oauth_session_access_tokens.id' ) -> join ( 'oauth_scopes' , 'oauth_session_t... | Get all associated access tokens for an access token |
239,094 | public function getAuthCodeScopes ( $ oauthSessionAuthCodeId ) { $ scopesResults = DB :: table ( 'oauth_session_authcode_scopes' ) -> where ( 'oauth_session_authcode_id' , '=' , $ oauthSessionAuthCodeId ) -> get ( ) ; $ scopes = array ( ) ; foreach ( $ scopesResults as $ key => $ scope ) { $ scopes [ $ key ] = get_obje... | Get the scopes associated with an auth code |
239,095 | public function append ( $ content , $ create = false ) { if ( $ this -> writeable !== true || empty ( $ content ) ) return false ; if ( strpos ( $ this -> _option , 'a' ) === false ) { if ( ! empty ( $ this -> fp ) ) fclose ( $ this -> fp ) ; $ this -> open_fp ( ( is_bool ( $ create ) && $ create === true ? 'a+' : 'a'... | appends to a file based + create if wanted |
239,096 | public function change_owner ( $ owner ) { if ( empty ( $ owner ) || ! is_int ( $ owner ) || $ this -> owner != getmyuid ( ) ) return false ; if ( ! empty ( $ this -> fp ) ) fclose ( $ this -> fp ) ; if ( chown ( $ this -> path . $ this -> filename , $ owner ) ) { return $ this -> open ( $ this -> path . $ this -> file... | changes file owner |
239,097 | public function change_group ( $ group ) { if ( empty ( $ group ) || ! is_int ( $ group ) ) return false ; if ( chgrp ( $ this -> path . $ this -> filename , $ group ) ) { return $ this -> open ( $ this -> path . $ this -> filename ) ; } return false ; } | changes the group |
239,098 | private function _extract_file_extension ( ) { if ( empty ( $ this -> filename ) ) return false ; if ( ! empty ( $ this -> mime_type ) ) { $ array = explode ( '/' , $ this -> mime_type ) ; $ this -> file_extension = array_pop ( $ array ) ; } else { if ( strpos ( $ this -> filename , '.' ) !== false ) { $ array = explod... | extracts the extension of the current file |
239,099 | private function _extract_filename ( ) { if ( empty ( $ this -> file ) ) return false ; $ tmp_array = explode ( '/' , $ this -> file ) ; $ count = ( int ) count ( $ tmp_array ) ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { if ( $ i + 1 == $ count ) { $ this -> filename = ( string ) $ tmp_array [ 0 ] ; } array_shift ( $ ... | gets the filename of the file |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.