idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
45,200 | public static function format ( $ query , array $ options = [ ] ) { $ lexer = new Lexer ( $ query ) ; $ formatter = new self ( $ options ) ; return $ formatter -> formatList ( $ lexer -> list ) ; } | Formats a query . |
45,201 | public static function getGroupLength ( $ list ) { $ count = 1 ; $ length = 0 ; for ( $ idx = $ list -> idx ; $ idx < $ list -> count ; ++ $ idx ) { if ( $ list -> tokens [ $ idx ] -> type === Token :: TYPE_OPERATOR ) { if ( $ list -> tokens [ $ idx ] -> value === '(' ) { ++ $ count ; } elseif ( $ list -> tokens [ $ id... | Computes the length of a group . |
45,202 | public static function isClause ( $ token ) { if ( ( $ token -> type === Token :: TYPE_KEYWORD && isset ( Parser :: $ STATEMENT_PARSERS [ $ token -> keyword ] ) ) || ( $ token -> type === Token :: TYPE_NONE && strtoupper ( $ token -> token ) === 'DELIMITER' ) ) { return 2 ; } elseif ( $ token -> type === Token :: TYPE_... | Checks if a token is a statement or a clause inside a statement . |
45,203 | public static function get ( $ objs ) { $ ret = [ ] ; foreach ( $ objs as $ obj ) { if ( $ obj instanceof Lexer ) { foreach ( $ obj -> errors as $ err ) { $ ret [ ] = [ $ err -> getMessage ( ) , $ err -> getCode ( ) , $ err -> ch , $ err -> pos , ] ; } } elseif ( $ obj instanceof Parser ) { foreach ( $ obj -> errors as... | Gets the errors of a lexer and a parser . |
45,204 | public static function format ( $ errors , $ format = '#%1$d: %2$s (near "%4$s" at position %5$d)' ) { $ ret = [ ] ; $ i = 0 ; foreach ( $ errors as $ key => $ err ) { $ ret [ $ key ] = sprintf ( $ format , ++ $ i , $ err [ 0 ] , $ err [ 1 ] , htmlspecialchars ( ( string ) $ err [ 2 ] ) , $ err [ 3 ] ) ; } return $ ret... | Formats the specified errors . |
45,205 | public function getClauses ( ) { if ( ! empty ( $ this -> union ) ) { $ clauses = static :: $ CLAUSES ; unset ( $ clauses [ 'ORDER BY' ] , $ clauses [ 'LIMIT' ] ) ; $ clauses [ 'ORDER BY' ] = [ 'ORDER BY' , 3 , ] ; $ clauses [ 'LIMIT' ] = [ 'LIMIT' , 3 , ] ; return $ clauses ; } return static :: $ CLAUSES ; } | Gets the clauses of this statement . |
45,206 | public function has ( $ key , $ getExpr = false ) { foreach ( $ this -> options as $ option ) { if ( is_array ( $ option ) ) { if ( ! strcasecmp ( $ key , $ option [ 'name' ] ) ) { return $ getExpr ? $ option [ 'expr' ] : $ option [ 'value' ] ; } } elseif ( ! strcasecmp ( $ key , $ option ) ) { return true ; } } return... | Checks if it has the specified option and returns it value or true . |
45,207 | public function remove ( $ key ) { foreach ( $ this -> options as $ idx => $ option ) { if ( is_array ( $ option ) ) { if ( ! strcasecmp ( $ key , $ option [ 'name' ] ) ) { unset ( $ this -> options [ $ idx ] ) ; return true ; } } elseif ( ! strcasecmp ( $ key , $ option ) ) { unset ( $ this -> options [ $ idx ] ) ; re... | Removes the option from the array . |
45,208 | public function merge ( $ options ) { if ( is_array ( $ options ) ) { $ this -> options = array_merge_recursive ( $ this -> options , $ options ) ; } elseif ( $ options instanceof self ) { $ this -> options = array_merge_recursive ( $ this -> options , $ options -> options ) ; } } | Merges the specified options with these ones . Values with same ID will be replaced . |
45,209 | public static function getParameters ( $ statement ) { $ retval = [ 'num' => 0 , 'dir' => [ ] , 'name' => [ ] , 'type' => [ ] , 'length' => [ ] , 'length_arr' => [ ] , 'opts' => [ ] , ] ; if ( ! empty ( $ statement -> parameters ) ) { $ idx = 0 ; foreach ( $ statement -> parameters as $ param ) { $ retval [ 'dir' ] [ $... | Gets the parameters of a routine from the parse tree . |
45,210 | public function before ( Parser $ parser , TokensList $ list , Token $ token ) { if ( ( $ token -> type === Token :: TYPE_KEYWORD ) && ( $ token -> keyword === 'RENAME' ) ) { $ list -> getNextOfTypeAndValue ( Token :: TYPE_KEYWORD , 'TABLE' ) ; } } | Function called before the token is processed . |
45,211 | public static function getForeignKeys ( $ statement ) { if ( empty ( $ statement -> fields ) || ( ! is_array ( $ statement -> fields ) ) || ( ! $ statement -> options -> has ( 'TABLE' ) ) ) { return [ ] ; } $ ret = [ ] ; foreach ( $ statement -> fields as $ field ) { if ( empty ( $ field -> key ) || ( $ field -> key ->... | Gets the foreign keys of the table . |
45,212 | public static function getFields ( $ statement ) { if ( empty ( $ statement -> fields ) || ( ! is_array ( $ statement -> fields ) ) || ( ! $ statement -> options -> has ( 'TABLE' ) ) ) { return [ ] ; } $ ret = [ ] ; foreach ( $ statement -> fields as $ field ) { if ( empty ( $ field -> type ) ) { continue ; } $ ret [ $... | Gets fields of the table . |
45,213 | public static function sortWords ( array & $ arr ) { ksort ( $ arr ) ; foreach ( $ arr as & $ wordsByLen ) { ksort ( $ wordsByLen ) ; foreach ( $ wordsByLen as & $ words ) { sort ( $ words , SORT_STRING ) ; } } return $ arr ; } | Sorts an array of words . |
45,214 | public static function readWords ( array $ files ) { $ words = [ ] ; foreach ( $ files as $ file ) { $ words = array_merge ( $ words , file ( $ file , FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES ) ) ; } $ types = [ ] ; for ( $ i = 0 , $ count = count ( $ words ) ; $ i !== $ count ; ++ $ i ) { $ type = 1 ; $ value = t... | Reads a list of words and sorts it by type length and keyword . |
45,215 | public static function printWords ( $ words , $ spaces = 8 , $ line = 80 ) { $ typesCount = count ( $ words ) ; $ ret = '' ; $ j = 0 ; foreach ( $ words as $ type => $ wordsByType ) { foreach ( $ wordsByType as $ len => $ wordsByLen ) { $ count = round ( ( $ line - $ spaces ) / ( $ len + 9 ) ) ; $ i = 0 ; foreach ( $ w... | Prints an array of a words in PHP format . |
45,216 | public static function generate ( $ options ) { if ( isset ( $ options [ 'keywords' ] ) ) { $ options [ 'keywords' ] = static :: printWords ( $ options [ 'keywords' ] ) ; } return sprintf ( static :: TEMPLATE , $ options [ 'name' ] , $ options [ 'class' ] , $ options [ 'link' ] , $ options [ 'keywords' ] ) ; } | Generates a context s class . |
45,217 | public static function formatName ( $ name ) { $ parts = [ ] ; if ( preg_match ( '/([^[0-9]*)([0-9]*)/' , $ name , $ parts ) === false ) { return $ name ; } $ base = $ parts [ 1 ] ; switch ( $ base ) { case 'MySql' : $ base = 'MySQL' ; break ; case 'MariaDb' : $ base = 'MariaDB' ; break ; } $ ver_str = $ parts [ 2 ] ; ... | Formats context name . |
45,218 | public static function build ( $ input , $ output ) { $ directory = dirname ( $ input ) . '/' ; $ file = basename ( $ input ) ; $ name = substr ( $ file , 0 , - 4 ) ; $ class = 'Context' . $ name ; $ formattedName = static :: formatName ( $ name ) ; file_put_contents ( $ output . '/' . $ class . '.php' , static :: gene... | Builds a test . |
45,219 | public static function buildAll ( $ input , $ output ) { $ files = scandir ( $ input ) ; foreach ( $ files as $ file ) { if ( ( $ file [ 0 ] === '.' ) || ( $ file [ 0 ] === '_' ) ) { continue ; } sprintf ( "Building context for %s...\n" , $ file ) ; static :: build ( $ input . '/' . $ file , $ output ) ; } } | Generates recursively all tests preserving the directory structure . |
45,220 | public static function load ( ) { if ( is_null ( self :: $ loader ) ) { self :: $ loader = new \ PhpMyAdmin \ MoTranslator \ Loader ( ) ; self :: $ loader -> setlocale ( self :: $ loader -> detectlocale ( ) ) ; self :: $ loader -> textdomain ( 'sqlparser' ) ; self :: $ loader -> bindtextdomain ( 'sqlparser' , __DIR__ .... | Loads transator . |
45,221 | public static function match ( Token $ token , array $ pattern ) { if ( isset ( $ pattern [ 'token' ] ) && ( $ pattern [ 'token' ] !== $ token -> token ) ) { return false ; } if ( isset ( $ pattern [ 'value' ] ) && ( $ pattern [ 'value' ] !== $ token -> value ) ) { return false ; } if ( isset ( $ pattern [ 'value_str' ... | Checks if a pattern is a match for the specified token . |
45,222 | public function search ( $ q , $ maxResults = 10 , $ part = [ 'id' , 'snippet' ] ) { $ params = [ 'q' => $ q , 'part' => implode ( ', ' , $ part ) , 'maxResults' => $ maxResults , ] ; return $ this -> searchAdvanced ( $ params ) ; } | Simple search interface this search all stuffs and order by relevance |
45,223 | public function searchAdvanced ( $ params , $ pageInfo = false ) { $ API_URL = $ this -> getApi ( 'search.list' ) ; if ( empty ( $ params ) || ( ! isset ( $ params [ 'q' ] ) && ! isset ( $ params [ 'channelId' ] ) && ! isset ( $ params [ 'videoCategoryId' ] ) ) ) { throw new \ InvalidArgumentException ( 'at least the S... | Generic Search interface use any parameters specified in the API reference |
45,224 | public function decodeList ( & $ apiData ) { $ resObj = json_decode ( $ apiData ) ; if ( isset ( $ resObj -> error ) ) { $ msg = "Error " . $ resObj -> error -> code . " " . $ resObj -> error -> message ; if ( isset ( $ resObj -> error -> errors [ 0 ] ) ) { $ msg .= " : " . $ resObj -> error -> errors [ 0 ] -> reason ;... | Decode the response from youtube extract the list of resource objects |
45,225 | protected function getRouter ( ) { return isset ( $ this -> laravel -> router ) ? $ this -> laravel -> router : $ this -> laravel ; } | Get the router . |
45,226 | public static function castModel ( Model $ model ) { $ attributes = array_merge ( $ model -> getAttributes ( ) , $ model -> getRelations ( ) ) ; $ visible = array_flip ( $ model -> getVisible ( ) ? : array_diff ( array_keys ( $ attributes ) , $ model -> getHidden ( ) ) ) ; $ results = [ ] ; foreach ( array_intersect_ke... | Get an array representing the properties of a model . |
45,227 | public static function compiles ( ) { $ files = [ ] ; foreach ( modules ( ) -> repositories ( ) as $ repository ) { foreach ( $ repository -> all ( ) as $ module ) { $ serviceProvider = module_class ( $ module [ 'slug' ] , 'Providers\\ModuleServiceProvider' , $ repository -> location ) ; if ( class_exists ( $ servicePr... | Register compilable code . |
45,228 | protected function addMiddleware ( $ middleware ) { $ kernel = $ this -> app [ 'Illuminate\Contracts\Http\Kernel' ] ; if ( is_array ( $ middleware ) ) { foreach ( $ middleware as $ ware ) { $ kernel -> pushMiddleware ( $ ware ) ; } } else { $ kernel -> pushMiddleware ( $ middleware ) ; } } | Register any additional module middleware . |
45,229 | protected function loadConfigsFrom ( $ path ) { if ( ! $ this -> app -> configurationIsCached ( ) ) { $ files = $ this -> getConfigurationFiles ( $ path ) ; foreach ( $ files as $ key => $ path ) { config ( ) -> set ( $ key , require $ path ) ; } } } | Register any additional config . |
45,230 | protected function reset ( Repository $ repository ) { $ this -> migrator -> setconnection ( $ this -> input -> getOption ( 'database' ) ) ; $ migrationPaths = $ this -> getMigrationPaths ( $ repository ) ; $ files = $ this -> migrator -> setOutput ( $ this -> output ) -> getMigrationFiles ( $ migrationPaths ) ; $ migr... | Run the migration reset for the current list of slugs . |
45,231 | protected function getSlugsToReset ( Repository $ repository ) { if ( $ this -> validSlugProvided ( $ repository ) ) { return collect ( [ $ this -> argument ( 'slug' ) ] ) ; } if ( $ this -> option ( 'force' ) ) { return $ repository -> all ( ) -> pluck ( 'slug' ) ; } return $ repository -> enabled ( ) -> pluck ( 'slug... | Using the arguments generate a list of slugs to reset the migrations for . |
45,232 | protected function validSlugProvided ( Repository $ repository ) { if ( empty ( $ this -> argument ( 'slug' ) ) ) { return false ; } if ( $ repository -> isEnabled ( $ this -> argument ( 'slug' ) ) ) { return true ; } if ( $ this -> option ( 'force' ) ) { return true ; } return false ; } | Determine if a valid slug has been provided as an argument . |
45,233 | public function where ( $ key , $ value ) { return collect ( $ this -> all ( ) -> where ( $ key , $ value ) -> first ( ) ) ; } | Get modules based on where clause . |
45,234 | public function get ( $ property , $ default = null ) { list ( $ slug , $ key ) = explode ( '::' , $ property ) ; $ module = $ this -> where ( 'slug' , $ slug ) ; return $ module -> get ( $ key , $ default ) ; } | Get a module property value . |
45,235 | public function set ( $ property , $ value ) { list ( $ slug , $ key ) = explode ( '::' , $ property ) ; $ cachePath = $ this -> getCachePath ( ) ; $ cache = $ this -> getCache ( ) ; $ module = $ this -> where ( 'slug' , $ slug ) ; if ( isset ( $ module [ $ key ] ) ) { unset ( $ module [ $ key ] ) ; } $ module [ $ key ... | Set the given module property value . |
45,236 | public function optimize ( ) { $ cachePath = $ this -> getCachePath ( ) ; $ cache = $ this -> getCache ( ) ; $ basenames = $ this -> getAllBasenames ( ) ; $ modules = collect ( ) ; $ basenames -> each ( function ( $ module , $ key ) use ( $ modules , $ cache ) { $ basename = collect ( [ 'basename' => $ module ] ) ; $ t... | Update cached repository of module information . |
45,237 | private function createCache ( ) { $ cachePath = $ this -> getCachePath ( ) ; $ content = json_encode ( [ ] , JSON_PRETTY_PRINT ) ; $ this -> files -> put ( $ cachePath , $ content ) ; return collect ( json_decode ( $ content , true ) ) ; } | Create an empty instance of the cache file . |
45,238 | private function getCachePath ( ) { if ( ! $ this -> files -> isDirectory ( storage_path ( "app/modules" ) ) ) { $ this -> files -> makeDirectory ( storage_path ( "app/modules" ) ) ; } $ location = str_slug ( $ this -> location ) ; return storage_path ( "app/modules/$location.json" ) ; } | Get the path to the cache file . |
45,239 | protected function getModules ( Repository $ repository ) { $ modules = $ repository -> all ( ) ; $ results = [ ] ; foreach ( $ modules as $ module ) { $ results [ ] = $ this -> getModuleInformation ( $ repository , $ module ) ; } return array_filter ( $ results ) ; } | Get all modules . |
45,240 | protected function getModuleInformation ( Repository $ repository , $ module ) { return [ '#' => $ module [ 'order' ] , 'location' => $ repository -> location , 'name' => isset ( $ module [ 'name' ] ) ? $ module [ 'name' ] : '' , 'slug' => $ module [ 'slug' ] , 'description' => isset ( $ module [ 'description' ] ) ? $ ... | Returns module manifest information . |
45,241 | protected function displayHeader ( $ file = '' , $ level = 'info' ) { $ stub = $ this -> files -> get ( __DIR__ . '/../../../resources/stubs/console/' . $ file . '.stub' ) ; return $ this -> $ level ( $ stub ) ; } | Pull the given stub file contents and display them on screen . |
45,242 | protected function generateModule ( ) { $ location = $ this -> container [ 'location' ] ; $ root = module_path ( null , '' , $ location ) ; $ manifest = config ( "modules.locations.$location.manifest" ) ? : 'module.json' ; $ provider = config ( "modules.locations.$location.provider" ) ? : 'ModuleServiceProvider' ; if (... | Generate defined module folders . |
45,243 | public function register ( ) { foreach ( array_keys ( config ( 'modules.locations' ) ) as $ location ) { $ repository = $ this -> repository ( $ location ) ; $ modules = $ repository -> enabled ( ) ; $ modules -> each ( function ( $ module ) use ( $ repository ) { try { $ this -> registerServiceProvider ( $ repository ... | Register the module service provider file from all modules . |
45,244 | private function autoloadFiles ( $ module ) { if ( isset ( $ module [ 'autoload' ] ) ) { foreach ( $ module [ 'autoload' ] as $ file ) { $ path = module_path ( $ module [ 'slug' ] , $ file ) ; if ( file_exists ( $ path ) ) { include $ path ; } } } } | Autoload custom module files . |
45,245 | protected function getAllBasenames ( ) { $ path = $ this -> getPath ( ) ; try { $ collection = collect ( $ this -> files -> directories ( $ path ) ) ; $ basenames = $ collection -> map ( function ( $ item , $ key ) { return basename ( $ item ) ; } ) ; return $ basenames ; } catch ( \ InvalidArgumentException $ e ) { re... | Get all module basenames . |
45,246 | public function getManifest ( $ slug ) { if ( ! is_null ( $ slug ) ) { $ path = $ this -> getManifestPath ( $ slug ) ; $ contents = $ this -> files -> get ( $ path ) ; $ validate = @ json_decode ( $ contents , true ) ; if ( json_last_error ( ) === JSON_ERROR_NONE ) { $ collection = collect ( json_decode ( $ contents , ... | Get a module s manifest contents . |
45,247 | public function getModulePath ( $ slug ) { $ module = studly_case ( $ slug ) ; if ( \ File :: exists ( $ this -> getPath ( ) . "/{$module}/" ) ) { return $ this -> getPath ( ) . "/{$module}/" ; } return $ this -> getPath ( ) . "/{$slug}/" ; } | Get path for the specified module . |
45,248 | public function getRanMigrations ( ) { $ query = $ this -> resolveConnection ( $ this -> connection ) -> table ( $ this -> table ) ; return $ query -> orderBy ( 'batch' , 'desc' ) -> orderBy ( 'migration' , 'desc' ) -> get ( ) ; } | Get all the ran migrations . |
45,249 | public function boot ( ) { $ this -> loadTranslationsFrom ( module_path ( 'DummySlug' , 'ResourcesLangMapping' , 'DummyLocation' ) , 'DummySlug' ) ; $ this -> loadViewsFrom ( module_path ( 'DummySlug' , 'ResourcesViewsMapping' , 'DummyLocation' ) , 'DummySlug' ) ; $ this -> loadMigrationsFrom ( module_path ( 'DummySlug... | Bootstrap the module services . |
45,250 | public function getNameWithExtension ( ) { return $ this -> extension === '' ? $ this -> name : sprintf ( '%s.%s' , $ this -> name , $ this -> extension ) ; } | Get file name with extension |
45,251 | public function isValid ( ) { foreach ( $ this -> objects as $ fileInfo ) { $ this -> applyCallback ( 'beforeValidation' , $ fileInfo ) ; if ( $ fileInfo -> isUploadedFile ( ) === false ) { $ this -> errors [ ] = sprintf ( '%s: %s' , $ fileInfo -> getNameWithExtension ( ) , 'Is not an uploaded file' ) ; continue ; } fo... | Is this collection valid and without errors? |
45,252 | public function register ( Transaction $ transaction ) { $ name = $ transaction -> getTransactionName ( ) ; if ( isset ( $ this -> store [ $ name ] ) === true ) { throw new DuplicateTransactionNameException ( $ name ) ; } $ this -> store [ $ name ] = $ transaction ; } | Register a Transaction |
45,253 | final public function generateRequest ( ) : array { $ headers = getallheaders ( ) ; $ http_or_https = isset ( $ _SERVER [ 'HTTPS' ] ) ? 'https' : 'http' ; $ SERVER_PROTOCOL = $ _SERVER [ 'SERVER_PROTOCOL' ] ?? '' ; $ remote_address = $ _SERVER [ 'REMOTE_ADDR' ] ?? '' ; if ( array_key_exists ( 'HTTP_X_FORWARDED_FOR' , $... | Generate request data |
45,254 | final protected function getEnv ( ) : array { $ envMask = $ this -> contexts [ 'env' ] ; $ env = empty ( $ envMask ) ? $ _SERVER : array_intersect_key ( $ _SERVER , array_flip ( $ envMask ) ) ; return $ env ; } | Get the Environment Variables |
45,255 | final protected function getCookies ( ) : array { $ cookieMask = $ this -> contexts [ 'cookies' ] ; return empty ( $ cookieMask ) ? $ _COOKIE : array_intersect_key ( $ _COOKIE , array_flip ( $ cookieMask ) ) ; } | Get the cookies |
45,256 | final protected function getCookieHeader ( string $ cookieHeader ) : string { $ cookieMask = $ this -> contexts [ 'cookies' ] ; return empty ( $ cookieMask ) ? $ cookieHeader : '' ; } | Get the cookie header |
45,257 | final protected function getContext ( ) : array { $ context = [ 'request' => empty ( $ this -> contexts [ 'request' ] ) ? $ this -> generateRequest ( ) : $ this -> contexts [ 'request' ] ] ; if ( empty ( $ this -> contexts [ 'user' ] ) === false ) { $ context [ 'user' ] = $ this -> contexts [ 'user' ] ; } if ( empty ( ... | Get the Events Context |
45,258 | private function configureHttpClient ( ) { $ httpClientDefaults = [ 'timeout' => $ this -> config -> get ( 'timeout' ) , ] ; $ httpClientConfig = $ this -> config -> get ( 'httpClient' ) ?? [ ] ; $ this -> client = new Client ( array_merge ( $ httpClientDefaults , $ httpClientConfig ) ) ; } | Create and configure the HTTP client |
45,259 | public function sendTransactions ( TransactionsStore $ store ) : bool { $ request = new Request ( 'POST' , $ this -> getEndpoint ( 'transactions' ) , $ this -> getRequestHeaders ( ) , json_encode ( new Transactions ( $ this -> config , $ store ) ) ) ; $ response = $ this -> client -> send ( $ request ) ; return ( $ res... | Push the Transactions to APM Server |
45,260 | public function sendErrors ( ErrorsStore $ store ) : bool { $ request = new Request ( 'POST' , $ this -> getEndpoint ( 'errors' ) , $ this -> getRequestHeaders ( ) , json_encode ( new Errors ( $ this -> config , $ store ) ) ) ; $ response = $ this -> client -> send ( $ request ) ; return ( $ response -> getStatusCode (... | Push the Errors to APM Server |
45,261 | private function getEndpoint ( string $ endpoint ) : string { return sprintf ( '%s/%s/%s' , $ this -> config -> get ( 'serverUrl' ) , $ this -> config -> get ( 'apmVersion' ) , $ endpoint ) ; } | Get the Endpoint URI of the APM Server |
45,262 | private function getRequestHeaders ( ) : array { $ headers = [ 'Content-Type' => 'application/json' , 'User-Agent' => sprintf ( 'elasticapm-php/%s' , Agent :: VERSION ) , ] ; if ( $ this -> config -> get ( 'secretToken' ) !== null ) { $ headers [ 'Authorization' ] = sprintf ( 'Bearer %s' , $ this -> config -> get ( 'se... | Get the Headers for the POST Request |
45,263 | public function getDuration ( ) : float { if ( $ this -> stoppedOn === null ) { throw new NotStoppedException ( ) ; } return $ this -> toMicro ( $ this -> stoppedOn - $ this -> startedOn ) ; } | Get the elapsed Duration of this Timer in MicroSeconds |
45,264 | public function getDurationInMilliseconds ( ) : float { if ( $ this -> stoppedOn === null ) { throw new NotStoppedException ( ) ; } return $ this -> toMilli ( $ this -> stoppedOn - $ this -> startedOn ) ; } | Get the elapsed Duration of this Timer in MilliSeconds |
45,265 | public function getElapsed ( ) : float { if ( $ this -> startedOn === null ) { throw new NotStartedException ( ) ; } return ( $ this -> stoppedOn === null ) ? $ this -> toMicro ( microtime ( true ) - $ this -> startedOn ) : $ this -> getDuration ( ) ; } | Get the current elapsed Interval of the Timer in MicroSeconds |
45,266 | public function getElapsedInMilliseconds ( ) : float { if ( $ this -> startedOn === null ) { throw new NotStartedException ( ) ; } return ( $ this -> stoppedOn === null ) ? $ this -> toMilli ( microtime ( true ) - $ this -> startedOn ) : $ this -> getDurationInMilliseconds ( ) ; } | Get the current elapsed Interval of the Timer in MilliSeconds |
45,267 | public function startTransaction ( string $ name , array $ context = [ ] , float $ start = null ) : Transaction { $ this -> transactionsStore -> register ( $ this -> eventFactory -> createTransaction ( $ name , array_replace_recursive ( $ this -> sharedContext , $ context ) , $ start ) ) ; $ transaction = $ this -> tra... | Start the Transaction capturing |
45,268 | public function getTransaction ( string $ name ) { $ transaction = $ this -> transactionsStore -> fetch ( $ name ) ; if ( $ transaction === null ) { throw new UnknownTransactionException ( $ name ) ; } return $ transaction ; } | Get a Transaction |
45,269 | public function captureThrowable ( \ Throwable $ thrown , array $ context = [ ] ) { $ this -> errorsStore -> register ( $ this -> eventFactory -> createError ( $ thrown , array_replace_recursive ( $ this -> sharedContext , $ context ) ) ) ; } | Register a Thrown Exception Error etc . |
45,270 | public function send ( ) : bool { if ( $ this -> config -> get ( 'active' ) === false ) { return true ; } $ connector = new Connector ( $ this -> config ) ; $ status = true ; if ( $ this -> errorsStore -> isEmpty ( ) === false ) { $ status = $ status && $ connector -> sendErrors ( $ this -> errorsStore ) ; if ( $ statu... | Send Data to APM Service |
45,271 | public function jsonSerialize ( ) : array { return [ 'id' => $ this -> getId ( ) , 'timestamp' => $ this -> getTimestamp ( ) , 'context' => $ this -> getContext ( ) , 'culprit' => sprintf ( '%s:%d' , $ this -> throwable -> getFile ( ) , $ this -> throwable -> getLine ( ) ) , 'exception' => [ 'message' => $ this -> thro... | Serialize Error Event |
45,272 | private function mapStacktrace ( ) : array { $ stacktrace = [ ] ; foreach ( $ this -> throwable -> getTrace ( ) as $ trace ) { $ item = [ 'function' => $ trace [ 'function' ] ?? '(closure)' ] ; if ( isset ( $ trace [ 'line' ] ) === true ) { $ item [ 'lineno' ] = $ trace [ 'line' ] ; } if ( isset ( $ trace [ 'file' ] ) ... | Map the Stacktrace to Schema |
45,273 | protected function getSkeleton ( ) : array { return [ 'service' => [ 'name' => $ this -> config -> get ( 'appName' ) , 'version' => $ this -> config -> get ( 'appVersion' ) , 'framework' => [ 'name' => $ this -> config -> get ( 'framework' ) ?? '' , 'version' => $ this -> config -> get ( 'frameworkVersion' ) ?? '' , ] ... | Get the shared Schema Skeleton |
45,274 | public function jsonSerialize ( ) : array { return [ 'id' => $ this -> getId ( ) , 'timestamp' => $ this -> getTimestamp ( ) , 'name' => $ this -> getTransactionName ( ) , 'duration' => $ this -> summary [ 'duration' ] , 'type' => $ this -> getMetaType ( ) , 'result' => $ this -> getMetaResult ( ) , 'context' => $ this... | Serialize Transaction Event |
45,275 | public static function getGroupedFields ( $ formatString , FieldOverrides $ fieldOverrides = null ) { $ groupedFields = [ ] ; $ hiddenFields = $ fieldOverrides ? $ fieldOverrides -> getHiddenFields ( ) : [ ] ; $ expression = '/\%(' . implode ( '|' , AddressField :: getAll ( ) ) . ')/' ; $ formatLines = explode ( "\n" ,... | Gets the list of used fields grouped by line . |
45,276 | public static function getRequiredFields ( AddressFormat $ addressFormat , FieldOverrides $ fieldOverrides ) { $ requiredFields = $ addressFormat -> getRequiredFields ( ) ; $ requiredFields = array_diff ( $ requiredFields , $ fieldOverrides -> getOptionalFields ( ) ) ; $ requiredFields = array_diff ( $ requiredFields ,... | Gets the required fields . |
45,277 | public static function splitRecipient ( $ recipient , $ countryCode ) { $ reverseCountries = [ 'KH' , 'CN' , 'HU' , 'JP' , 'KO' , 'MG' , 'TW' , 'VN' , ] ; $ recipientParts = explode ( ' ' , $ recipient ) ; if ( in_array ( $ countryCode , $ reverseCountries ) ) { $ familyName = array_shift ( $ recipientParts ) ; $ given... | Splits the recipient into givenName and familyName fields . |
45,278 | public static function updateSubdivision ( $ oldValue ) { $ supportedCountries = [ 'AD' , 'AE' , 'AM' , 'AR' , 'AU' , 'BR' , 'BS' , 'CA' , 'CL' , 'CN' , 'CV' , 'EG' , 'ES' , 'HK' , 'ID' , 'IE' , 'IN' , 'IT' , 'JM' , 'JP' , 'KN' , 'KR' , 'KY' , 'MX' , 'MY' , 'NG' , 'NI' , 'NR' , 'PH' , 'RU' , 'SO' , 'SR' , 'SV' , 'TH' ,... | Updates the subdivision . |
45,279 | public static function loadSubdivisionUpdateMap ( ) { if ( empty ( static :: $ subdivisionUpdateMap ) ) { $ path = __DIR__ . '/../resources/' ; $ rawMap = file_get_contents ( $ path . 'subdivision_update_map.json' ) ; static :: $ subdivisionUpdateMap = json_decode ( $ rawMap , true ) ; } return static :: $ subdivisionU... | Loads the subdivision update map . |
45,280 | public function match ( AddressInterface $ address ) { foreach ( $ this -> territories as $ territory ) { if ( $ territory -> match ( $ address ) ) { return true ; } } return false ; } | Checks whether the provided address belongs to the zone . |
45,281 | public function match ( AddressInterface $ address ) { if ( $ address -> getCountryCode ( ) != $ this -> countryCode ) { return false ; } if ( $ this -> administrativeArea && $ this -> administrativeArea != $ address -> getAdministrativeArea ( ) ) { return false ; } if ( $ this -> locality && $ this -> locality != $ ad... | Checks whether the provided address belongs to the territory . |
45,282 | public static function match ( $ firstLocale , $ secondLocale ) { if ( empty ( $ firstLocale ) || empty ( $ secondLocale ) ) { return false ; } return self :: canonicalize ( $ firstLocale ) === self :: canonicalize ( $ secondLocale ) ; } | Checks whether two locales match . |
45,283 | public static function matchCandidates ( $ firstLocale , $ secondLocale ) { if ( empty ( $ firstLocale ) || empty ( $ secondLocale ) ) { return false ; } $ firstLocale = self :: canonicalize ( $ firstLocale ) ; $ secondLocale = self :: canonicalize ( $ secondLocale ) ; $ firstLocaleCandidates = self :: getCandidates ( ... | Checks whether two locales have at least one common candidate . |
45,284 | public static function resolve ( array $ availableLocales , $ locale , $ fallbackLocale = null ) { $ locale = self :: canonicalize ( $ locale ) ; $ resolvedLocale = null ; foreach ( self :: getCandidates ( $ locale , $ fallbackLocale ) as $ candidate ) { if ( in_array ( $ candidate , $ availableLocales ) ) { $ resolved... | Resolves the locale from the available locales . |
45,285 | public static function canonicalize ( $ locale ) { if ( empty ( $ locale ) ) { return $ locale ; } $ locale = str_replace ( '_' , '-' , strtolower ( $ locale ) ) ; $ localeParts = explode ( '-' , $ locale ) ; foreach ( $ localeParts as $ index => $ part ) { if ( $ index === 0 ) { continue ; } if ( strlen ( $ part ) == ... | Canonicalizes the given locale . |
45,286 | public static function getCandidates ( $ locale , $ fallbackLocale = null ) { $ locale = self :: replaceAlias ( $ locale ) ; $ candidates = [ $ locale ] ; while ( $ parent = self :: getParent ( $ locale ) ) { $ candidates [ ] = $ parent ; $ locale = $ parent ; } if ( isset ( $ fallbackLocale ) ) { $ candidates [ ] = $ ... | Gets locale candidates . |
45,287 | public static function getParent ( $ locale ) { $ parent = null ; if ( isset ( self :: $ parents [ $ locale ] ) ) { $ parent = self :: $ parents [ $ locale ] ; } elseif ( strpos ( $ locale , '-' ) !== false ) { $ localeParts = explode ( '-' , $ locale ) ; array_pop ( $ localeParts ) ; $ parent = implode ( '-' , $ local... | Gets the parent for the given locale . |
45,288 | public static function replaceAlias ( $ locale ) { if ( ! empty ( $ locale ) && isset ( self :: $ aliases [ $ locale ] ) ) { $ locale = self :: $ aliases [ $ locale ] ; } return $ locale ; } | Replaces a locale alias with the real locale . |
45,289 | protected function validateSubdivisions ( $ values , AddressFormat $ addressFormat , $ constraint ) { if ( $ addressFormat -> getSubdivisionDepth ( ) < 1 ) { return [ ] ; } $ countryCode = $ addressFormat -> getCountryCode ( ) ; $ subdivisionFields = $ addressFormat -> getUsedSubdivisionFields ( ) ; $ hiddenFields = $ ... | Validates the provided subdivision values . |
45,290 | protected function validatePostalCode ( $ postalCode , array $ subdivisions , AddressFormat $ addressFormat , $ constraint ) { if ( empty ( $ postalCode ) ) { return ; } $ fullPattern = $ addressFormat -> getPostalCodePattern ( ) ; $ startPattern = null ; foreach ( $ subdivisions as $ subdivision ) { $ pattern = $ subd... | Validates the provided postal code . |
45,291 | protected function addViolation ( $ field , $ message , $ invalidValue , AddressFormat $ addressFormat ) { $ this -> context -> buildViolation ( $ message ) -> atPath ( '[' . $ field . ']' ) -> setInvalidValue ( $ invalidValue ) -> addViolation ( ) ; } | Adds a violation . |
45,292 | protected function extractAddressValues ( AddressInterface $ address ) { $ values = [ ] ; foreach ( AddressField :: getAll ( ) as $ field ) { $ getter = 'get' . ucfirst ( $ field ) ; $ values [ $ field ] = $ address -> $ getter ( ) ; } return $ values ; } | Extracts the address values . |
45,293 | protected function buildView ( AddressInterface $ address , AddressFormat $ addressFormat , array $ options ) { $ countries = $ this -> countryRepository -> getList ( $ options [ 'locale' ] ) ; $ values = $ this -> getValues ( $ address , $ addressFormat ) ; $ countryCode = $ address -> getCountryCode ( ) ; $ view = [ ... | Builds the view for the given address . |
45,294 | protected function renderView ( array $ view ) { foreach ( $ view as $ key => $ element ) { if ( empty ( $ element [ 'value' ] ) ) { $ view [ $ key ] = '' ; continue ; } if ( ! empty ( $ element [ 'html' ] ) ) { $ attributes = $ this -> renderAttributes ( $ element [ 'html_attributes' ] ) ; $ prefix = '<' . $ element [... | Renders the given view . |
45,295 | protected function renderAttributes ( array $ attributes ) { foreach ( $ attributes as $ name => $ value ) { if ( is_array ( $ value ) ) { $ value = implode ( ' ' , ( array ) $ value ) ; } $ attributes [ $ name ] = $ name . '="' . htmlspecialchars ( $ value , ENT_QUOTES , 'UTF-8' ) . '"' ; } return implode ( ' ' , $ at... | Renders the given attributes . |
45,296 | protected function cleanupOutput ( $ output ) { $ lines = explode ( "\n" , $ output ) ; foreach ( $ lines as $ index => $ line ) { $ line = trim ( preg_replace ( '/^[-,]+/' , '' , $ line , 1 ) ) ; $ line = preg_replace ( '/\s\s+/' , ' ' , $ line ) ; $ lines [ $ index ] = $ line ; } $ lines = array_filter ( $ lines ) ; ... | Removes empty lines leading punctuation excess whitespace . |
45,297 | protected function getValues ( AddressInterface $ address , AddressFormat $ addressFormat ) { $ values = [ ] ; foreach ( AddressField :: getAll ( ) as $ field ) { $ getter = 'get' . ucfirst ( $ field ) ; $ values [ $ field ] = $ address -> $ getter ( ) ; } $ originalValues = [ ] ; $ subdivisionFields = $ addressFormat ... | Gets the address values used to build the view . |
45,298 | public static function getAll ( ) { $ class = get_called_class ( ) ; if ( ! isset ( static :: $ values [ $ class ] ) ) { $ reflection = new \ ReflectionClass ( $ class ) ; static :: $ values [ $ class ] = $ reflection -> getConstants ( ) ; } return static :: $ values [ $ class ] ; } | Gets all available values . |
45,299 | public static function assertExists ( $ value ) { if ( static :: exists ( $ value ) == false ) { $ class = substr ( strrchr ( get_called_class ( ) , '\\' ) , 1 ) ; throw new \ InvalidArgumentException ( sprintf ( '"%s" is not a valid %s value.' , $ value , $ class ) ) ; } } | Asserts that the provided value is defined . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.