idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
45,000 | public function getByAccessToken ( AccessTokenEntity $ accessToken ) { $ result = $ this -> getConnection ( ) -> table ( 'oauth_sessions' ) -> select ( 'oauth_sessions.*' ) -> join ( 'oauth_access_tokens' , 'oauth_sessions.id' , '=' , 'oauth_access_tokens.session_id' ) -> where ( 'oauth_access_tokens.id' , $ accessToke... | Get a session from an access token . |
45,001 | public function getScopes ( SessionEntity $ session ) { $ result = $ this -> getConnection ( ) -> table ( 'oauth_session_scopes' ) -> select ( 'oauth_scopes.*' ) -> join ( 'oauth_scopes' , 'oauth_session_scopes.scope_id' , '=' , 'oauth_scopes.id' ) -> where ( 'oauth_session_scopes.session_id' , $ session -> getId ( ) )... | Get a session s scopes . |
45,002 | public function associateScope ( SessionEntity $ session , ScopeEntity $ scope ) { $ this -> getConnection ( ) -> table ( 'oauth_session_scopes' ) -> insert ( [ 'session_id' => $ session -> getId ( ) , 'scope_id' => $ scope -> getId ( ) , 'created_at' => Carbon :: now ( ) , 'updated_at' => Carbon :: now ( ) , ] ) ; } | Associate a scope with a session . |
45,003 | public function getByAuthCode ( AuthCodeEntity $ authCode ) { $ result = $ this -> getConnection ( ) -> table ( 'oauth_sessions' ) -> select ( 'oauth_sessions.*' ) -> join ( 'oauth_auth_codes' , 'oauth_sessions.id' , '=' , 'oauth_auth_codes.session_id' ) -> where ( 'oauth_auth_codes.id' , $ authCode -> getId ( ) ) -> f... | Get a session from an auth code . |
45,004 | public function get ( $ token ) { $ result = $ this -> getConnection ( ) -> table ( 'oauth_access_tokens' ) -> where ( 'oauth_access_tokens.id' , $ token ) -> first ( ) ; if ( is_null ( $ result ) ) { return ; } return ( new AccessTokenEntity ( $ this -> getServer ( ) ) ) -> setId ( $ result -> id ) -> setExpireTime ( ... | Get an instance of Entities \ AccessToken . |
45,005 | public function getAuthCodeRequestParam ( $ key , $ default = null ) { if ( array_key_exists ( $ key , $ this -> authCodeRequestParams ) ) { return $ this -> authCodeRequestParams [ $ key ] ; } return $ default ; } | Get a single parameter from the auth code request parameters . |
45,006 | public function authCodeRequestDeniedRedirectUri ( ) { $ error = new AccessDeniedException ( ) ; return $ this -> getRedirectUriGenerator ( ) -> make ( $ this -> getAuthCodeRequestParam ( 'redirect_uri' ) , [ 'error' => $ error -> errorType , 'error_description' => $ error -> getMessage ( ) , ] ) ; } | Generate a redirect uri when the auth code request is denied by the user . |
45,007 | public function validateAccessToken ( $ httpHeadersOnly = false , $ accessToken = null ) { return $ this -> checker -> isValidRequest ( $ httpHeadersOnly , $ accessToken ) ; } | Validate a request with an access token in it . |
45,008 | public function hasScope ( $ scope ) { if ( is_array ( $ scope ) ) { foreach ( $ scope as $ s ) { if ( $ this -> hasScope ( $ s ) === false ) { return false ; } } return true ; } return $ this -> getAccessToken ( ) -> hasScope ( $ scope ) ; } | Check if the current request has all the scopes passed . |
45,009 | public function setRequest ( Request $ request ) { $ this -> issuer -> setRequest ( $ request ) ; $ this -> checker -> setRequest ( $ request ) ; } | Set the request to use on the issuer and checker . |
45,010 | public function setTokenType ( TokenTypeInterface $ tokenType ) { $ this -> issuer -> setTokenType ( $ tokenType ) ; $ this -> checker -> setTokenType ( $ tokenType ) ; } | Set the token type to use . |
45,011 | public function get ( $ scope , $ grantType = null , $ clientId = null ) { $ query = $ this -> getConnection ( ) -> table ( 'oauth_scopes' ) -> select ( 'oauth_scopes.id as id' , 'oauth_scopes.description as description' ) -> where ( 'oauth_scopes.id' , $ scope ) ; if ( $ this -> limitClientsToScopes === true && ! is_n... | Return information about a scope . |
45,012 | protected function setupMigrations ( Application $ app ) { $ source = realpath ( __DIR__ . '/../database/migrations/' ) ; if ( $ app instanceof LaravelApplication && $ app -> runningInConsole ( ) ) { $ this -> publishes ( [ $ source => database_path ( 'migrations' ) ] , 'migrations' ) ; } } | Setup the migrations . |
45,013 | public function registerAuthorizer ( Application $ app ) { $ app -> singleton ( 'oauth2-server.authorizer' , function ( $ app ) { $ config = $ app [ 'config' ] -> get ( 'oauth2' ) ; $ issuer = $ app -> make ( AuthorizationServer :: class ) -> setClientStorage ( $ app -> make ( ClientInterface :: class ) ) -> setSession... | Register the Authorization server with the IoC container . |
45,014 | public function registerMiddlewareBindings ( Application $ app ) { $ app -> singleton ( CheckAuthCodeRequestMiddleware :: class , function ( $ app ) { return new CheckAuthCodeRequestMiddleware ( $ app [ 'oauth2-server.authorizer' ] ) ; } ) ; $ app -> singleton ( OAuthMiddleware :: class , function ( $ app ) { $ httpHea... | Register the Middleware to the IoC container because some middleware need additional parameters . |
45,015 | public function get ( $ token ) { $ result = $ this -> getConnection ( ) -> table ( 'oauth_refresh_tokens' ) -> where ( 'oauth_refresh_tokens.id' , $ token ) -> where ( 'oauth_refresh_tokens.expire_time' , '>=' , time ( ) ) -> first ( ) ; if ( is_null ( $ result ) ) { return ; } return ( new RefreshTokenEntity ( $ this... | Return a new instance of \ League \ OAuth2 \ Server \ Entity \ RefreshTokenEntity . |
45,016 | public function delete ( RefreshTokenEntity $ token ) { $ this -> getConnection ( ) -> table ( 'oauth_refresh_tokens' ) -> where ( 'id' , $ token -> getId ( ) ) -> delete ( ) ; } | Delete the refresh token . |
45,017 | protected function proceedingAllowed ( ) : bool { if ( $ this -> input -> getOption ( 'no-interaction' ) ) { return true ; } return $ this -> getHelper ( 'question' ) -> ask ( $ this -> input , $ this -> output , new ConfirmationQuestion ( '<question>Are you sure you wish to flush the whole database? (y/n)</question>' ... | Checks if either the no - interaction option was chosen or asks the user to proceed |
45,018 | private function call ( $ name , array $ arguments = array ( ) ) { $ startTime = microtime ( true ) ; $ result = call_user_func_array ( "parent::$name" , $ arguments ) ; $ duration = ( microtime ( true ) - $ startTime ) * 1000 ; if ( null !== $ this -> logger ) { $ this -> logger -> logCommand ( $ this -> getCommandStr... | Proxy function . |
45,019 | private function getCommandString ( $ command , array $ arguments ) { $ list = array ( ) ; $ this -> flatten ( $ arguments , $ list ) ; return trim ( strtoupper ( $ command ) . ' ' . implode ( ' ' , $ list ) ) ; } | Returns a string representation of the given command including arguments . |
45,020 | private function flatten ( $ arguments , array & $ list ) { foreach ( $ arguments as $ key => $ item ) { if ( ! is_numeric ( $ key ) ) { $ list [ ] = $ key ; } if ( is_scalar ( $ item ) ) { $ list [ ] = strval ( $ item ) ; } elseif ( null === $ item ) { $ list [ ] = '<null>' ; } else { $ this -> flatten ( $ item , $ li... | Flatten arguments to single dimension array . |
45,021 | protected function loadClient ( array $ client , ContainerBuilder $ container ) { $ dsnResolver = function ( $ dsn ) use ( $ container ) { $ usedEnvs = null ; if ( method_exists ( $ container , 'resolveEnvPlaceholders' ) ) { $ container -> resolveEnvPlaceholders ( $ dsn , null , $ usedEnvs ) ; } if ( $ usedEnvs ) { ret... | Loads a redis client . |
45,022 | protected function loadPredisConnectionParameters ( $ clientAlias , array $ connection , ContainerBuilder $ container , $ dsn ) { $ parametersClass = $ container -> getParameter ( 'snc_redis.connection_parameters.class' ) ; $ parameterId = sprintf ( 'snc_redis.connection.%s_parameters.%s' , $ connection [ 'alias' ] , $... | Loads a connection . |
45,023 | protected function loadPhpredisClient ( array $ client , ContainerBuilder $ container ) { $ connectionCount = count ( $ client [ 'dsns' ] ) ; if ( 1 !== $ connectionCount ) { throw new \ RuntimeException ( 'Support for RedisArray is not yet implemented.' ) ; } $ dsn = $ client [ 'dsns' ] [ 0 ] ; $ phpRedisVersion = php... | Loads a redis client using phpredis . |
45,024 | protected function loadSession ( array $ config , ContainerBuilder $ container , XmlFileLoader $ loader ) { $ loader -> load ( 'session.xml' ) ; $ container -> setParameter ( 'snc_redis.session.client' , $ config [ 'session' ] [ 'client' ] ) ; $ container -> setParameter ( 'snc_redis.session.prefix' , $ config [ 'sessi... | Loads the session configuration . |
45,025 | protected function loadSwiftMailer ( array $ config , ContainerBuilder $ container ) { $ def = new Definition ( $ container -> getParameter ( 'snc_redis.swiftmailer_spool.class' ) ) ; $ def -> setPublic ( false ) ; $ def -> addMethodCall ( 'setRedis' , array ( new Reference ( sprintf ( 'snc_redis.%s' , $ config [ 'swif... | Loads the SwiftMailer configuration . |
45,026 | public function increment ( $ subject ) { $ bucket = $ this -> getBucket ( ) ; $ subject = $ this -> key . ':' . $ subject ; $ multi = $ this -> client -> transaction ( ) ; $ this -> addMultiExecIncrement ( $ multi , $ subject , $ bucket ) ; $ multi -> exec ( ) ; } | Increment the count for the specified subject . |
45,027 | public function reset ( $ subject ) { $ subject = $ this -> key . ':' . $ subject ; return ( bool ) $ this -> client -> del ( $ subject ) ; } | Resets the counter for the specified subject . |
45,028 | private function getBucket ( $ time = null ) { $ time = $ time ? : time ( ) ; return ( int ) floor ( ( $ time % $ this -> bucketSpan ) / $ this -> bucketInterval ) ; } | Get the bucket associated with the current time . |
45,029 | private function addMultiExecIncrement ( MultiExec $ multi , $ subject , $ bucket ) { $ multi -> hincrby ( $ subject , $ bucket , 1 ) ; $ multi -> hdel ( $ subject , ( $ bucket + 1 ) % $ this -> bucketCount ) -> hdel ( $ subject , ( $ bucket + 2 ) % $ this -> bucketCount ) ; $ multi -> expire ( $ subject , $ this -> su... | Adds the commands needed for the increment function . |
45,030 | private function addMultiExecCount ( MultiExec $ multi , $ subject , $ bucket , $ count ) { $ multi -> hget ( $ subject , $ bucket ) ; while ( $ count -- ) { $ multi -> hget ( $ subject , ( -- $ bucket + $ this -> bucketCount ) % $ this -> bucketCount ) ; } } | Adds the commands needed for the count function . |
45,031 | private function addSessionSection ( ArrayNodeDefinition $ rootNode ) { $ rootNode -> children ( ) -> arrayNode ( 'session' ) -> canBeUnset ( ) -> children ( ) -> scalarNode ( 'client' ) -> isRequired ( ) -> end ( ) -> scalarNode ( 'prefix' ) -> defaultValue ( 'session' ) -> end ( ) -> scalarNode ( 'ttl' ) -> end ( ) -... | Adds the snc_redis . session configuration |
45,032 | private function addDoctrineSection ( ArrayNodeDefinition $ rootNode ) { $ doctrineNode = $ rootNode -> children ( ) -> arrayNode ( 'doctrine' ) -> canBeUnset ( ) ; foreach ( array ( 'metadata_cache' , 'result_cache' , 'query_cache' , 'second_level_cache' ) as $ type ) { $ doctrineNode -> children ( ) -> arrayNode ( $ ... | Adds the snc_redis . doctrine configuration |
45,033 | private function addMonologSection ( ArrayNodeDefinition $ rootNode ) { $ rootNode -> children ( ) -> arrayNode ( 'monolog' ) -> canBeUnset ( ) -> children ( ) -> scalarNode ( 'client' ) -> isRequired ( ) -> end ( ) -> scalarNode ( 'key' ) -> isRequired ( ) -> end ( ) -> scalarNode ( 'formatter' ) -> end ( ) -> end ( )... | Adds the snc_redis . monolog configuration |
45,034 | protected function lockSession ( $ sessionId ) { $ attempts = ( 1000000 / $ this -> spinLockWait ) * $ this -> lockMaxWait ; $ this -> token = uniqid ( ) ; $ this -> lockKey = $ this -> getRedisKey ( $ sessionId ) . '.lock' ; $ setFunction = function ( $ redis , $ key , $ token , $ ttl ) { if ( $ redis instanceof \ Red... | Lock the session data . |
45,035 | private function unlockSession ( ) { if ( $ this -> redis instanceof \ Redis ) { $ script = <<<LUA if redis.call("GET", KEYS[1]) == ARGV[1] then return redis.call("DEL", KEYS[1]) else return 0 endLUA ; $ token = $ this -> redis -> _serialize ( $ this -> to... | Unlock the session data . |
45,036 | protected function createProfileFromData ( $ token , $ data , $ parent = null ) { $ profile = new Profile ( $ token ) ; $ profile -> setIp ( $ data [ 'ip' ] ) ; $ profile -> setMethod ( $ data [ 'method' ] ) ; $ profile -> setUrl ( $ data [ 'url' ] ) ; $ profile -> setTime ( $ data [ 'time' ] ) ; $ profile -> setCollec... | Creates a Profile . |
45,037 | protected function getItemName ( $ token ) { $ name = $ this -> prefixKey ( $ token ) ; if ( $ this -> isItemNameValid ( $ name ) ) { return $ name ; } return false ; } | Gets the item name . |
45,038 | protected function getIndexName ( ) { $ name = $ this -> prefixKey ( self :: INDEX_NAME ) ; if ( $ this -> isItemNameValid ( $ name ) ) { return $ name ; } return false ; } | Gets the name of the index . |
45,039 | protected function isItemNameValid ( $ name ) { $ length = strlen ( $ name ) ; if ( $ length > 2147483648 ) { throw new \ RuntimeException ( sprintf ( 'The Redis item key "%s" is too long (%s bytes). Allowed maximum size is 2^31 bytes.' , $ name , $ length ) ) ; } return true ; } | Check if the item name is valid . |
45,040 | protected function getValue ( $ key , $ serializer = self :: REDIS_SERIALIZER_NONE ) { $ value = $ this -> redis -> get ( $ key ) ; if ( $ value && ( self :: REDIS_SERIALIZER_PHP === $ serializer ) ) { $ value = unserialize ( $ value ) ; } return $ value ; } | Retrieves an item from the Redis server . |
45,041 | protected function setValue ( $ key , $ value , $ expiration = 0 , $ serializer = self :: REDIS_SERIALIZER_NONE ) { if ( self :: REDIS_SERIALIZER_PHP === $ serializer ) { $ value = serialize ( $ value ) ; } return $ this -> redis -> setex ( $ key , $ expiration , $ value ) ; } | Stores an item on the Redis server under the specified key . |
45,042 | protected function appendValue ( $ key , $ value , $ expiration = 0 ) { if ( $ this -> redis -> exists ( $ key ) ) { $ this -> redis -> append ( $ key , $ value ) ; return $ this -> redis -> expire ( $ key , $ expiration ) ; } return $ this -> redis -> setex ( $ key , $ expiration , $ value ) ; } | Appends data to an existing item on the Redis server . |
45,043 | public function logCommand ( $ command , $ duration , $ connection , $ error = false ) { ++ $ this -> nbCommands ; if ( null !== $ this -> logger ) { $ this -> commands [ ] = array ( 'cmd' => $ command , 'executionMS' => $ duration , 'conn' => $ connection , 'error' => $ error ) ; if ( $ error ) { $ message = 'Command ... | Logs a command |
45,044 | private function toStringArgumentReducer ( $ accumulator , $ argument ) { if ( strlen ( $ argument ) > 10240 ) { $ argument = substr ( $ argument , 0 , 10240 ) . ' (truncated, complete string is ' . strlen ( $ argument ) . ' bytes)' ; } $ accumulator .= " $argument" ; return $ accumulator ; } | Helper function used to reduce a list of arguments to a string . |
45,045 | protected function buildBody ( ) { $ message = [ 'to' => $ this -> getTo ( ) , 'registration_ids' => $ this -> getRegistrationIds ( ) , 'notification' => $ this -> getNotification ( ) , 'data' => $ this -> getData ( ) , ] ; $ message = array_merge ( $ message , $ this -> getOptions ( ) ) ; return array_filter ( $ messa... | Build the body for the request . |
45,046 | protected function getTo ( ) { $ to = is_array ( $ this -> to ) ? null : $ this -> to ; if ( $ this -> topic && $ this -> topic -> hasOnlyOneTopic ( ) ) { $ to = $ this -> topic -> build ( ) ; } return $ to ; } | get to key transformed . |
45,047 | protected function getOptions ( ) { $ options = $ this -> options ? $ this -> options -> toArray ( ) : [ ] ; if ( $ this -> topic && ! $ this -> topic -> hasOnlyOneTopic ( ) ) { $ options = array_merge ( $ options , $ this -> topic -> build ( ) ) ; } return $ options ; } | get Options transformed . |
45,048 | public function sendTo ( $ to , Options $ options = null , PayloadNotification $ notification = null , PayloadData $ data = null ) { $ response = null ; if ( is_array ( $ to ) && ! empty ( $ to ) ) { $ partialTokens = array_chunk ( $ to , self :: MAX_TOKEN_PER_REQUEST , false ) ; foreach ( $ partialTokens as $ tokens )... | send a downstream message to . |
45,049 | public function sendToGroup ( $ notificationKey , Options $ options = null , PayloadNotification $ notification = null , PayloadData $ data = null ) { $ request = new Request ( $ notificationKey , $ options , $ notification , $ data ) ; $ responseGuzzle = $ this -> post ( $ request ) ; return new GroupResponse ( $ resp... | Send a message to a group of devices identified with them notification key . |
45,050 | public function sendToTopic ( Topics $ topics , Options $ options = null , PayloadNotification $ notification = null , PayloadData $ data = null ) { $ request = new Request ( null , $ options , $ notification , $ data , $ topics ) ; $ responseGuzzle = $ this -> post ( $ request ) ; return new TopicResponse ( $ response... | Send message devices registered at a or more topics . |
45,051 | private function isJsonResponse ( ResponseInterface $ response ) { if ( $ response -> getStatusCode ( ) == 200 ) { return ; } if ( $ response -> getStatusCode ( ) == 400 ) { throw new InvalidRequestException ( $ response ) ; } if ( $ response -> getStatusCode ( ) == 401 ) { throw new UnauthorizedRequestException ( $ re... | Check if the response given by fcm is parsable . |
45,052 | public function toArray ( ) { $ notification = [ 'title' => $ this -> title , 'body' => $ this -> body , 'android_channel_id' => $ this -> channelId , 'icon' => $ this -> icon , 'sound' => $ this -> sound , 'badge' => $ this -> badge , 'tag' => $ this -> tag , 'color' => $ this -> color , 'click_action' => $ this -> cl... | convert PayloadNotification to array . |
45,053 | public function merge ( DownstreamResponse $ response ) { $ this -> numberTokensSuccess += $ response -> numberSuccess ( ) ; $ this -> numberTokensFailure += $ response -> numberFailure ( ) ; $ this -> numberTokenModify += $ response -> numberModification ( ) ; $ this -> tokensToDelete = array_merge ( $ this -> tokensT... | Merge two response . |
45,054 | public function build ( ) { $ this -> checkIfOneTopicExist ( ) ; if ( $ this -> hasOnlyOneTopic ( ) ) { foreach ( $ this -> conditions [ 0 ] as $ topic ) { return '/topics/' . $ topic ; } } return [ 'condition' => $ this -> topicsForFcm ( $ this -> conditions ) , ] ; } | Transform to array . |
45,055 | public function addToGroup ( $ notificationKeyName , $ notificationKey , array $ registrationIds ) { $ request = new GroupRequest ( self :: ADD , $ notificationKeyName , $ notificationKey , $ registrationIds ) ; $ response = $ this -> client -> request ( 'post' , $ this -> url , $ request -> build ( ) ) ; return $ this... | add registrationId to a existing group . |
45,056 | public function removeFromGroup ( $ notificationKeyName , $ notificationKey , array $ registeredIds ) { $ request = new GroupRequest ( self :: REMOVE , $ notificationKeyName , $ notificationKey , $ registeredIds ) ; $ response = $ this -> client -> request ( 'post' , $ this -> url , $ request -> build ( ) ) ; return $ ... | remove registrationId to a existing group . |
45,057 | public function toArray ( ) { $ contentAvailable = $ this -> contentAvailable ? true : null ; $ mutableContent = $ this -> isMutableContent ? true : null ; $ delayWhileIdle = $ this -> delayWhileIdle ? true : null ; $ dryRun = $ this -> isDryRun ? true : null ; $ options = [ 'collapse_key' => $ this -> collapseKey , 'p... | Transform Option to array . |
45,058 | public function setPriority ( $ priority ) { if ( ! OptionsPriorities :: isValid ( $ priority ) ) { throw new InvalidOptionsException ( 'priority is not valid, please refer to the documentation or use the constants of the class "OptionsPriorities"' ) ; } $ this -> priority = $ priority ; return $ this ; } | Sets the priority of the message . Valid values are normal and high . By default messages are sent with normal priority . |
45,059 | public static function serve ( $ filename , $ contentType , $ options ) { $ options = array_merge ( self :: $ defaultOptions , $ options ) ; if ( $ options [ 'set-last-modified-header' ] === true ) { Header :: setHeader ( "Last-Modified: " . gmdate ( "D, d M Y H:i:s" , @ filemtime ( $ filename ) ) . " GMT" ) ; } if ( $... | Serve existing file |
45,060 | public static function serve ( $ source , $ destination , $ options = [ ] ) { if ( empty ( $ source ) ) { throw new ServeFailedException ( 'Source argument missing' ) ; } if ( empty ( $ destination ) ) { throw new ServeFailedException ( 'Destination argument missing' ) ; } if ( @ ! file_exists ( $ source ) ) { throw ne... | Serve converted webp . |
45,061 | protected static function hasNiceSupport ( ) { exec ( "nice 2>&1" , $ niceOutput ) ; if ( is_array ( $ niceOutput ) && isset ( $ niceOutput [ 0 ] ) ) { if ( preg_match ( '/usage/' , $ niceOutput [ 0 ] ) || ( preg_match ( '/^\d+$/' , $ niceOutput [ 0 ] ) ) ) { return true ; } return false ; } } | Helper function for examining if nice command is available |
45,062 | private function createImageResource ( ) { $ mimeType = $ this -> getMimeTypeOfSource ( ) ; if ( $ mimeType == 'image/png' ) { $ image = imagecreatefrompng ( $ this -> source ) ; if ( $ image === false ) { throw new ConversionFailedException ( 'Gd failed when trying to load/create image (imagecreatefrompng() failed)' )... | Create Gd image resource from source |
45,063 | protected function tryToMakeTrueColorIfNot ( & $ image ) { $ mustMakeTrueColor = false ; if ( function_exists ( 'imageistruecolor' ) ) { if ( imageistruecolor ( $ image ) ) { $ this -> logLn ( 'image is true color' ) ; } else { $ this -> logLn ( 'image is not true color' ) ; $ mustMakeTrueColor = true ; } } else { $ th... | Try to make image resource true color if it is not already . |
45,064 | public static function decide ( $ source , $ destination , $ options ) { $ options = array_merge ( self :: $ defaultOptions , $ options ) ; if ( $ options [ 'show-report' ] ) { return [ 'report' , 'explicitly-told-to' , 'Serving report (explicitly told to)' ] ; } if ( $ options [ 'serve-original' ] ) { return [ 'source... | Decides what to serve . |
45,065 | public function checkOperationality ( ) { parent :: checkOperationality ( ) ; $ options = $ this -> options ; $ apiVersion = $ options [ 'api-version' ] ; if ( $ apiVersion == 0 ) { if ( ! empty ( $ this -> getApiKey ( ) ) ) { if ( ! function_exists ( 'md5' ) ) { throw new ConverterNotOperationalException ( 'A secret h... | Check operationality of Wpc converter . |
45,066 | public function checkOperationality ( ) { if ( ! extension_loaded ( 'imagick' ) ) { throw new SystemRequirementsNotMetException ( 'Required iMagick extension is not available.' ) ; } if ( ! class_exists ( '\\Imagick' ) ) { throw new SystemRequirementsNotMetException ( 'iMagick is installed, but not correctly. The class... | Check operationality of Imagick converter . |
45,067 | public function checkOperationality ( ) { parent :: checkOperationality ( ) ; $ apiKey = $ this -> getKey ( ) ; if ( $ apiKey === false ) { throw new InvalidApiKeyException ( 'Missing API key.' ) ; } if ( strlen ( $ apiKey ) < 20 ) { throw new InvalidApiKeyException ( 'Key is invalid. Keys are supposed to be 32 charact... | Check operationality of Ewww converter . |
45,068 | public static function getKeyStatus ( $ key ) { $ ch = self :: initCurl ( ) ; curl_setopt ( $ ch , CURLOPT_URL , "https://optimize.exactlywww.com/verify/" ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( $ ch , CURLOPT_POSTFIELDS , [ 'api_key' => $ key ] ) ; curl_setopt ( $ ch , CURLOPT_USERAGEN... | Return great exceeded or invalid |
45,069 | private static function detectQualityOfJpgUsingImagickExtension ( $ filename ) { if ( extension_loaded ( 'imagick' ) && class_exists ( '\\Imagick' ) ) { try { $ img = new \ Imagick ( $ filename ) ; if ( method_exists ( $ img , 'getImageCompressionQuality' ) ) { return $ img -> getImageCompressionQuality ( ) ; } } catch... | Try to detect quality of jpeg using imagick extension |
45,070 | private static function detectQualityOfJpgUsingImagickBinary ( $ filename ) { if ( function_exists ( 'exec' ) ) { exec ( "identify -format '%Q' " . escapeshellarg ( $ filename ) . " 2>&1" , $ output , $ returnCode ) ; if ( ( intval ( $ returnCode ) == 0 ) && ( is_array ( $ output ) ) && ( count ( $ output ) == 1 ) ) { ... | Try to detect quality of jpeg using imagick binary |
45,071 | public static function detectQualityOfJpg ( $ filename ) { if ( ! file_exists ( $ filename ) ) { return null ; } $ quality = self :: detectQualityOfJpgUsingImagickExtension ( $ filename ) ; if ( is_null ( $ quality ) ) { $ quality = self :: detectQualityOfJpgUsingImagickBinary ( $ filename ) ; } if ( is_null ( $ qualit... | Try to detect quality of jpeg . |
45,072 | public static function createInstance ( $ source , $ destination , $ options = [ ] , $ logger = null ) { return new static ( $ source , $ destination , $ options , $ logger ) ; } | Create an instance of this class |
45,073 | public static function convert ( $ source , $ destination , $ options = [ ] , $ logger = null ) { $ instance = self :: createInstance ( $ source , $ destination , $ options , $ logger ) ; $ instance -> doConvert ( ) ; } | Convert an image to webp . |
45,074 | public static function convert ( $ source , $ destination , $ options = [ ] , $ logger = null ) { Stack :: convert ( $ source , $ destination , $ options , $ logger ) ; } | Convert jpeg or png into webp |
45,075 | private function createImageResource ( ) { $ result = vips_image_new_from_file ( $ this -> source , [ ] ) ; if ( $ result === - 1 ) { $ message = vips_error_buffer ( ) ; throw new ConversionFailedException ( $ message ) ; } if ( ! is_array ( $ result ) ) { throw new ConversionFailedException ( 'vips_image_new_from_file... | Create vips image resource from source file |
45,076 | private function createParamsForVipsWebPSave ( ) { $ options = [ "Q" => $ this -> getCalculatedQuality ( ) , 'lossless' => $ this -> options [ 'lossless' ] , 'strip' => $ this -> options [ 'metadata' ] == 'none' , ] ; if ( $ this -> options [ 'smart-subsample' ] !== false ) { $ options [ 'smart_subsample' ] = $ this ->... | Create parameters for webpsave |
45,077 | public function setProvidedOptions ( $ providedOptions = [ ] ) { $ this -> providedOptions = $ providedOptions ; if ( isset ( $ this -> providedOptions [ 'png' ] ) ) { if ( $ this -> getMimeTypeOfSource ( ) == 'image/png' ) { $ this -> providedOptions = array_merge ( $ this -> providedOptions , $ this -> providedOption... | Set provided options This also sets the internal options array by merging in the default options |
45,078 | public static function serve ( $ source , $ destination , $ options = [ ] ) { $ options = array_merge ( self :: $ defaultOptions , $ options ) ; try { ServeConvertedWebP :: serve ( $ source , $ destination , $ options ) ; } catch ( \ Exception $ e ) { self :: performFailAction ( $ options [ 'fail' ] , $ options [ 'fail... | Serve webp image and handle errors . |
45,079 | protected function warningHandler ( $ errno , $ errstr , $ errfile , $ errline ) { $ errorTypes = [ E_WARNING => "Warning" , E_NOTICE => "Notice" , E_USER_ERROR => "User Error" , E_USER_WARNING => "User Warning" , E_USER_NOTICE => "User Notice" , E_STRICT => "Strict Notice" , E_DEPRECATED => "Deprecated" , E_USER_DEPRE... | Handle errors during conversion . The function is a callback used with set_error_handler . It logs |
45,080 | protected function getClassName ( ) { $ name = implode ( '' , array_map ( 'ucwords' , $ this -> getSortedSingularTableNames ( ) ) ) ; $ name = preg_replace_callback ( '/(\_)([a-z]{1})/' , function ( $ matches ) { return studly_case ( $ matches [ 0 ] ) ; } , $ name ) ; return "Create{$name}PivotTable" ; } | Get the class name from table names . |
45,081 | private function constructSchema ( $ schema , $ direction = 'Add' ) { if ( ! $ schema ) return '' ; $ fields = array_map ( function ( $ field ) use ( $ direction ) { $ method = "{$direction}Column" ; return $ this -> $ method ( $ field ) ; } , $ schema ) ; return implode ( "\n" . str_repeat ( ' ' , 12 ) , $ fields ) ; ... | Construct the schema fields . |
45,082 | protected function makeMigration ( ) { $ name = $ this -> argument ( 'name' ) ; if ( $ this -> files -> exists ( $ path = $ this -> getPath ( $ name ) ) ) { return $ this -> error ( $ this -> type . ' already exists!' ) ; } $ this -> makeDirectory ( $ path ) ; $ this -> files -> put ( $ path , $ this -> compileMigratio... | Generate the desired migration . |
45,083 | protected function makeModel ( ) { $ modelPath = $ this -> getModelPath ( $ this -> getModelName ( ) ) ; if ( $ this -> option ( 'model' ) && ! $ this -> files -> exists ( $ modelPath ) ) { $ this -> call ( 'make:model' , [ 'name' => $ this -> getModelName ( ) ] ) ; } } | Generate an Eloquent model if the user wishes . |
45,084 | private function parseOptions ( $ options ) { if ( empty ( $ options ) ) return [ ] ; foreach ( $ options as $ option ) { if ( str_contains ( $ option , '(' ) ) { preg_match ( '/([a-z]+)\(([^\)]+)\)/i' , $ option , $ matches ) ; $ results [ $ matches [ 1 ] ] = $ matches [ 2 ] ; } else { $ results [ $ option ] = true ; ... | Parse any given options into something usable . |
45,085 | private function addForeignConstraint ( $ segments ) { $ string = sprintf ( "%s:foreign:references('id'):on('%s')" , $ segments [ 'name' ] , $ this -> getTableNameFromForeignKey ( $ segments [ 'name' ] ) ) ; $ this -> addField ( $ this -> parseSegments ( $ string ) ) ; } | Add a foreign constraint field to the schema . |
45,086 | public function parse ( $ name ) { $ segments = array_reverse ( explode ( '_' , $ name ) ) ; if ( $ segments [ 0 ] == 'table' ) { array_shift ( $ segments ) ; } return [ 'action' => $ this -> getAction ( $ segments ) , 'table' => $ this -> getTableName ( $ segments ) ] ; } | Parse the migration name into something we can use . |
45,087 | private function getTableName ( $ segments ) { $ tableName = [ ] ; foreach ( $ segments as $ segment ) { if ( $ this -> isConnectingWord ( $ segment ) ) { break ; } $ tableName [ ] = $ segment ; } return implode ( '_' , array_reverse ( $ tableName ) ) ; } | Calculate the table name . |
45,088 | public function withBasicAuth ( ? string $ username = null , string $ password = null ) : self { if ( $ username === null ) { return $ this -> withoutHeader ( 'Authorization' ) ; } else { $ auth = base64_encode ( $ username . ':' . $ password ) ; return $ this -> withHeader ( 'Authorization' , "Basic {$auth}" ) ; } } | Add basic authorization header |
45,089 | public function withSocks5 ( string $ host , int $ port , ? string $ username , ? string $ password ) : self { $ this -> proxy = [ 'socks5_host' => $ host , 'socks5_port' => $ port , 'socks5_username' => $ username , 'socks5_password' => $ password , ] ; return $ this ; } | enable socks5 proxy |
45,090 | protected function clear ( ) { $ this -> _redirect_times = 0 ; $ this -> _redirect_headers = [ ] ; $ this -> _start_time = 0 ; $ this -> _time = 0.000 ; if ( ! ( $ this -> _form_flag ) & self :: FROM_RETRY ) { $ this -> _retried_time = 0 ; } $ this -> incremental_cookies -> reset ( ) ; $ this -> _form_flag = 0 ; } | clear tmp arguments |
45,091 | public function withMock ( bool $ ssl ) : self { $ settings = [ 'websocket_mask' => true ] ; if ( $ ssl ) { $ settings [ 'ssl_host_name' ] = $ this -> uri -> getHost ( ) ; } $ this -> client -> set ( $ settings ) ; return $ this ; } | enable mask to mock the browser |
45,092 | public function prependIf ( $ condition , string $ prepend ) { if ( $ this -> resolveCondition ( $ condition ) ) { return $ this -> prepend ( $ prepend ) ; } return $ this ; } | Prepend the text with a string of html on render if a certain condition is met . |
45,093 | public function appendIf ( $ condition , string $ append ) { if ( $ this -> resolveCondition ( $ condition ) ) { return $ this -> append ( $ append ) ; } return $ this ; } | Append the text with a string of html on render if a certain condition is met . |
45,094 | public static function build ( $ items , callable $ callback , self $ initial = null ) { return ( $ initial ? : static :: new ( ) ) -> fill ( $ items , $ callback ) ; } | Build a new menu from an array . The callback receives a menu instance as the accumulator the array item as the second parameter and the item s key as the third . |
45,095 | public function fill ( $ items , callable $ callback ) { $ menu = $ this ; foreach ( $ items as $ key => $ item ) { $ menu = $ callback ( $ menu , $ item , $ key ) ? : $ menu ; } return $ menu ; } | Fill a menu from an array . The callback receives a menu instance as the accumulator the array item as the second parameter and the item s key as the third . |
45,096 | public function add ( Item $ item ) { foreach ( $ this -> filters as $ filter ) { $ this -> applyFilter ( $ filter , $ item ) ; } $ this -> items [ ] = $ item ; return $ this ; } | Add an item to the menu . This also applies all registered filters to the item . |
45,097 | public function link ( string $ url , string $ text ) { return $ this -> add ( Link :: to ( $ url , $ text ) ) ; } | Shortcut function to add a plain link to the menu . |
45,098 | public function html ( string $ html , array $ parentAttributes = [ ] ) { return $ this -> add ( Html :: raw ( $ html ) -> setParentAttributes ( $ parentAttributes ) ) ; } | Shortcut function to add raw html to the menu . |
45,099 | public function each ( callable $ callable ) { $ type = Reflection :: firstParameterType ( $ callable ) ; foreach ( $ this -> items as $ item ) { if ( ! Reflection :: itemMatchesType ( $ item , $ type ) ) { continue ; } $ callable ( $ item ) ; } return $ this ; } | Iterate over all the items and apply a callback . If you typehint the item parameter in the callable it wil only be applied to items of that type . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.