idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
13,300 | private function removeFileExtensionFromPath ( $ path ) { if ( strrpos ( $ path , '.' ) !== false ) { $ path = substr ( $ path , 0 , strrpos ( $ path , '.' ) ) ; } return $ path ; } | Removes the file extension from the provided path . |
13,301 | private function disableCache ( array $ configuration ) : array { if ( isset ( $ this -> options [ 'force' ] ) && $ this -> options [ 'force' ] ) { $ configuration [ 'phpdocumentor' ] [ 'use-cache' ] = false ; } return $ configuration ; } | Changes the given configuration array so that the cache handling is disabled . |
13,302 | private function overwriteTemplates ( array $ configuration ) : array { if ( isset ( $ this -> options [ 'template' ] ) && $ this -> options [ 'template' ] ) { $ configuration [ 'phpdocumentor' ] [ 'templates' ] = array_map ( function ( $ templateName ) { return [ 'name' => $ templateName ] ; } , ( array ) $ this -> op... | Changes the given configuration array to feature the templates from the options . |
13,303 | public function filter ( Filterable $ descriptor ) : ? Filterable { $ chain = $ this -> factory -> getChainFor ( get_class ( $ descriptor ) ) ; return $ chain -> filter ( $ descriptor ) ; } | Filters the given Descriptor and returns the altered object . |
13,304 | public function offsetGet ( $ index ) { if ( ! $ this -> offsetExists ( $ index ) ) { throw new Exception \ FormatNotFoundException ( 'Format ' . $ index . ' is not known' ) ; } return parent :: offsetGet ( $ index ) ; } | Finds a format by the given name or throws an exception if that index is not found . |
13,305 | private function buildArrayFromNode ( SimpleXMLElement $ node ) : array { $ array = [ ] ; foreach ( $ node -> children ( ) as $ child ) { if ( ( string ) $ child !== '' ) { $ array [ ] = ( string ) $ child ; } } return $ array ; } | Loops over a node and fills an array with the found children . |
13,306 | private function buildExtensions ( SimpleXMLElement $ phpDocumentor ) : array { if ( ( array ) $ phpDocumentor -> parser === [ ] ) { return $ this -> extensions ; } if ( ( array ) $ phpDocumentor -> parser -> extensions === [ ] ) { return $ this -> extensions ; } return $ this -> buildArrayFromNode ( $ phpDocumentor ->... | Builds the extensions part of the array from the configuration xml . |
13,307 | private function buildMarkers ( SimpleXMLElement $ phpDocumentor ) : array { if ( ( array ) $ phpDocumentor -> parser === [ ] ) { return $ this -> markers ; } if ( ( array ) $ phpDocumentor -> parser -> markers === [ ] ) { return $ this -> markers ; } return $ this -> buildArrayFromNode ( $ phpDocumentor -> parser -> m... | Builds the markers part of the array from the configuration xml . |
13,308 | private function buildVisibility ( SimpleXMLElement $ phpDocumentor ) : array { if ( ( array ) $ phpDocumentor -> parser === [ ] ) { return $ this -> visibility ; } if ( ( string ) $ phpDocumentor -> parser -> visibility === '' ) { return $ this -> visibility ; } return explode ( ',' , ( string ) $ phpDocumentor -> par... | Builds the visibility part of the array from the configuration xml . |
13,309 | private function buildDefaultPackageName ( SimpleXMLElement $ phpDocumentor ) : string { if ( ( array ) $ phpDocumentor -> parser === [ ] ) { return $ this -> defaultPackageName ; } if ( ( string ) $ phpDocumentor -> parser -> { 'default-package-name' } === '' ) { return $ this -> defaultPackageName ; } return ( string... | Builds the defaultPackageName part of the array from the configuration xml . |
13,310 | private function buildIgnoreHidden ( SimpleXMLElement $ phpDocumentor ) : bool { if ( ( array ) $ phpDocumentor -> files === [ ] ) { return $ this -> ignoreHidden ; } if ( ( string ) $ phpDocumentor -> files -> { 'ignore-hidden' } === '' ) { return $ this -> ignoreHidden ; } return filter_var ( $ phpDocumentor -> files... | Builds the ignore - hidden part of the array from the configuration xml . |
13,311 | private function buildIgnoreSymlinks ( SimpleXMLElement $ phpDocumentor ) : bool { if ( ( array ) $ phpDocumentor -> files === [ ] ) { return $ this -> ignoreSymlinks ; } if ( ( string ) $ phpDocumentor -> files -> { 'ignore-symlinks' } === '' ) { return $ this -> ignoreSymlinks ; } return filter_var ( $ phpDocumentor ... | Builds the ignore - symlinks part of the array from the configuration xml . |
13,312 | private function buildIgnorePaths ( SimpleXMLElement $ phpDocumentor ) : array { if ( ( array ) $ phpDocumentor -> files === [ ] ) { return $ this -> ignorePaths ; } $ ignorePaths = [ ] ; foreach ( $ phpDocumentor -> files -> children ( ) as $ child ) { if ( $ child -> getName ( ) === 'ignore' ) { $ ignorePaths [ ] = (... | Builds the ignorePaths part of the array from the configuration xml . |
13,313 | private function buildOutputDirectory ( SimpleXMLElement $ phpDocumentor ) : string { if ( ( array ) $ phpDocumentor -> transformer === [ ] ) { return $ this -> outputDirectory ; } if ( ( string ) $ phpDocumentor -> transformer -> target === '' ) { return $ this -> outputDirectory ; } return ( string ) $ phpDocumentor ... | Builds the outputDirectory part of the array from the configuration xml . |
13,314 | private function buildDirectories ( SimpleXMLElement $ phpDocumentor ) : array { if ( ( array ) $ phpDocumentor -> files === [ ] ) { return $ this -> directories ; } if ( ( string ) $ phpDocumentor -> files -> directory === '' ) { return $ this -> directories ; } return ( array ) $ phpDocumentor -> files -> directory ;... | Builds the directories that are used in the sourcePaths . |
13,315 | private function buildSourcePaths ( SimpleXMLElement $ phpDocumentor ) : array { $ sourcePaths = [ ] ; $ directories = $ this -> buildDirectories ( $ phpDocumentor ) ; foreach ( $ directories as $ directory ) { $ sourcePaths [ ] = ( new Dsn ( $ directory ) ) -> getPath ( ) ; } return $ sourcePaths ; } | Builds the sourcePaths part of the array from the configuration xml . |
13,316 | private function validate ( SimpleXMLElement $ xml ) : void { if ( $ xml -> getName ( ) !== 'phpdocumentor' ) { throw new InvalidArgumentException ( sprintf ( 'Root element name should be phpdocumentor, %s found' , $ xml -> getName ( ) ) ) ; } } | Validates if the xml has a root element which name is phpdocumentor . |
13,317 | public static function markdown ( $ text ) { if ( ! is_string ( $ text ) ) { return $ text ; } $ markdown = \ Parsedown :: instance ( ) ; return $ markdown -> parse ( $ text ) ; } | Markdown filter . |
13,318 | private static function getDocumentedElement ( $ fqsen ) { $ projectDescriptor = self :: $ descriptorBuilder -> getProjectDescriptor ( ) ; $ elementList = $ projectDescriptor -> getIndexes ( ) -> get ( 'elements' ) ; $ prefixedLink = '~\\' . $ fqsen ; if ( isset ( $ elementList [ $ fqsen ] ) ) { return $ elementList [ ... | Returns a Descriptor Object if the given FQSEN exists in the project . |
13,319 | public function send ( RequestInterface $ request ) : ResponseInterface { $ this -> emit ( 'beforeRequest' , [ $ request ] ) ; $ retryCount = 0 ; $ redirects = 0 ; do { $ doRedirect = false ; $ retry = false ; try { $ response = $ this -> doRequest ( $ request ) ; $ code = $ response -> getStatus ( ) ; if ( $ redirects... | Sends a request to a HTTP server and returns a response . |
13,320 | public function sendAsync ( RequestInterface $ request , callable $ success = null , callable $ error = null ) { $ this -> emit ( 'beforeRequest' , [ $ request ] ) ; $ this -> sendAsyncInternal ( $ request , $ success , $ error ) ; $ this -> poll ( ) ; } | Sends a HTTP request asynchronously . |
13,321 | public function poll ( ) : bool { if ( ! $ this -> curlMultiMap ) { return false ; } do { $ r = curl_multi_exec ( $ this -> curlMultiHandle , $ stillRunning ) ; } while ( CURLM_CALL_MULTI_PERFORM === $ r ) ; $ messagesInQueue = 0 ; do { messageQueue : $ status = curl_multi_info_read ( $ this -> curlMultiHandle , $ mess... | This method checks if any http requests have gotten results and if so call the appropriate success or error handlers . |
13,322 | protected function doRequest ( RequestInterface $ request ) : ResponseInterface { $ settings = $ this -> createCurlSettingsArray ( $ request ) ; if ( ! $ this -> curlHandle ) { $ this -> curlHandle = curl_init ( ) ; } else { curl_reset ( $ this -> curlHandle ) ; } curl_setopt_array ( $ this -> curlHandle , $ settings )... | This method is responsible for performing a single request . |
13,323 | protected function createCurlSettingsArray ( RequestInterface $ request ) : array { $ settings = $ this -> curlSettings ; switch ( $ request -> getMethod ( ) ) { case 'HEAD' : $ settings [ CURLOPT_NOBODY ] = true ; $ settings [ CURLOPT_CUSTOMREQUEST ] = 'HEAD' ; break ; case 'GET' : $ settings [ CURLOPT_CUSTOMREQUEST ]... | Turns a RequestInterface object into an array with settings that can be fed to curl_setopt . |
13,324 | protected function sendAsyncInternal ( RequestInterface $ request , callable $ success , callable $ error , int $ retryCount = 0 ) { if ( ! $ this -> curlMultiHandle ) { $ this -> curlMultiHandle = curl_multi_init ( ) ; } $ curl = curl_init ( ) ; curl_setopt_array ( $ curl , $ this -> createCurlSettingsArray ( $ reques... | Sends an asynchronous HTTP request . |
13,325 | protected function curlExec ( $ curlHandle ) : string { $ this -> headerLinesMap [ ( int ) $ curlHandle ] = [ ] ; $ result = curl_exec ( $ curlHandle ) ; if ( false === $ result ) { $ result = '' ; } return $ result ; } | Calls curl_exec . |
13,326 | public function getToken ( ) { $ auth = $ this -> request -> getHeader ( 'Authorization' ) ; if ( ! $ auth ) { return null ; } if ( 'bearer ' !== strtolower ( substr ( $ auth , 0 , 7 ) ) ) { return null ; } return substr ( $ auth , 7 ) ; } | This method returns a string with an access token . |
13,327 | public function getCredentials ( ) { $ auth = $ this -> request -> getHeader ( 'Authorization' ) ; if ( ! $ auth ) { return null ; } if ( 'basic ' !== strtolower ( substr ( $ auth , 0 , 6 ) ) ) { return null ; } $ credentials = explode ( ':' , base64_decode ( substr ( $ auth , 6 ) ) , 2 ) ; if ( 2 !== count ( $ credent... | This method returns a numeric array with a username and password as the only elements . |
13,328 | public static function getRequest ( ) : Request { $ serverArr = $ _SERVER ; if ( 'cli' === PHP_SAPI ) { $ serverArr [ 'REQUEST_URI' ] = $ _SERVER [ 'REQUEST_URI' ] ?? '/' ; $ serverArr [ 'REQUEST_METHOD' ] = $ _SERVER [ 'REQUEST_METHOD' ] ?? 'CLI' ; } $ r = self :: createFromServerArray ( $ serverArr ) ; $ r -> setBody... | This static method will create a new Request object based on the current PHP request . |
13,329 | public static function sendResponse ( ResponseInterface $ response ) { header ( 'HTTP/' . $ response -> getHttpVersion ( ) . ' ' . $ response -> getStatus ( ) . ' ' . $ response -> getStatusText ( ) ) ; foreach ( $ response -> getHeaders ( ) as $ key => $ value ) { foreach ( $ value as $ k => $ v ) { if ( 0 === $ k ) {... | Sends the HTTP response back to a HTTP client . |
13,330 | public function validatePassword ( string $ password ) : bool { $ this -> A1 = md5 ( $ this -> digestParts [ 'username' ] . ':' . $ this -> realm . ':' . $ password ) ; return $ this -> validate ( ) ; } | Validates authentication through a password . The actual password must be provided here . It is strongly recommended not store the password in plain - text and use validateA1 instead . |
13,331 | protected function validate ( ) : bool { $ A2 = $ this -> request -> getMethod ( ) . ':' . $ this -> digestParts [ 'uri' ] ; if ( 'auth-int' === $ this -> digestParts [ 'qop' ] ) { if ( ! ( $ this -> qop & self :: QOP_AUTHINT ) ) { return false ; } $ body = $ this -> request -> getBody ( $ asString = true ) ; $ this ->... | Validates the digest challenge . |
13,332 | public function requireLogin ( ) { $ qop = '' ; switch ( $ this -> qop ) { case self :: QOP_AUTH : $ qop = 'auth' ; break ; case self :: QOP_AUTHINT : $ qop = 'auth-int' ; break ; case self :: QOP_AUTH | self :: QOP_AUTHINT : $ qop = 'auth,auth-int' ; break ; } $ this -> response -> addHeader ( 'WWW-Authenticate' , 'Di... | Returns an HTTP 401 header forcing login . |
13,333 | protected function parseDigest ( string $ digest ) { $ needed_parts = [ 'nonce' => 1 , 'nc' => 1 , 'cnonce' => 1 , 'qop' => 1 , 'username' => 1 , 'uri' => 1 , 'response' => 1 ] ; $ data = [ ] ; preg_match_all ( '@(\w+)=(?:(?:")([^"]+)"|([^\s,$]+))@' , $ digest , $ matches , PREG_SET_ORDER ) ; foreach ( $ matches as $ m... | Parses the different pieces of the digest string into an array . |
13,334 | public function getQueryParameters ( ) : array { $ url = $ this -> getUrl ( ) ; if ( false === ( $ index = strpos ( $ url , '?' ) ) ) { return [ ] ; } parse_str ( substr ( $ url , $ index + 1 ) , $ queryParams ) ; return $ queryParams ; } | Returns the list of query parameters . |
13,335 | public function getAbsoluteUrl ( ) : string { if ( ! $ this -> absoluteUrl ) { $ this -> absoluteUrl = 'http://' . ( $ this -> getHeader ( 'Host' ) ?? 'localhost' ) . $ this -> getUrl ( ) ; } return $ this -> absoluteUrl ; } | Returns the absolute url . |
13,336 | public function getPath ( ) : string { $ uri = str_replace ( '//' , '/' , $ this -> getUrl ( ) ) ; $ uri = Uri \ normalize ( $ uri ) ; $ baseUri = Uri \ normalize ( $ this -> getBaseUrl ( ) ) ; if ( 0 === strpos ( $ uri , $ baseUri ) ) { list ( $ uri ) = explode ( '?' , $ uri ) ; return trim ( decodePath ( substr ( $ u... | Returns the relative path . |
13,337 | public function validate ( string $ secretKey ) : bool { $ contentMD5 = $ this -> request -> getHeader ( 'Content-MD5' ) ; if ( $ contentMD5 ) { $ body = $ this -> request -> getBody ( ) ; $ this -> request -> setBody ( $ body ) ; if ( $ contentMD5 !== base64_encode ( md5 ( ( string ) $ body , true ) ) ) { $ this -> er... | Validates the signature based on the secretKey . |
13,338 | protected function validateRFC2616Date ( string $ dateHeader ) : bool { $ date = HTTP \ parseDate ( $ dateHeader ) ; if ( ! $ date ) { $ this -> errorCode = self :: ERR_INVALIDDATEFORMAT ; return false ; } $ min = new \ DateTime ( '-15 minutes' ) ; $ max = new \ DateTime ( '+15 minutes' ) ; if ( $ date > $ max || $ dat... | Makes sure the supplied value is a valid RFC2616 date . |
13,339 | protected function getAmzHeaders ( ) : string { $ amzHeaders = [ ] ; $ headers = $ this -> request -> getHeaders ( ) ; foreach ( $ headers as $ headerName => $ headerValue ) { if ( 0 === strpos ( strtolower ( $ headerName ) , 'x-amz-' ) ) { $ amzHeaders [ strtolower ( $ headerName ) ] = str_replace ( [ "\r\n" ] , [ ' '... | Returns a list of AMZ headers . |
13,340 | private function hmacsha1 ( string $ key , string $ message ) : string { if ( function_exists ( 'hash_hmac' ) ) { return hash_hmac ( 'sha1' , $ message , $ key , true ) ; } $ blocksize = 64 ; if ( strlen ( $ key ) > $ blocksize ) { $ key = pack ( 'H*' , sha1 ( $ key ) ) ; } $ key = str_pad ( $ key , $ blocksize , chr (... | Generates an HMAC - SHA1 signature . |
13,341 | public function getBodyAsStream ( ) { $ body = $ this -> getBody ( ) ; if ( is_callable ( $ this -> body ) ) { $ body = $ this -> getBodyAsString ( ) ; } if ( is_string ( $ body ) || null === $ body ) { $ stream = fopen ( 'php://temp' , 'r+' ) ; fwrite ( $ stream , ( string ) $ body ) ; rewind ( $ stream ) ; return $ s... | Returns the body as a readable stream resource . |
13,342 | public function getBodyAsString ( ) : string { $ body = $ this -> getBody ( ) ; if ( is_string ( $ body ) ) { return $ body ; } if ( null === $ body ) { return '' ; } if ( is_callable ( $ body ) ) { ob_start ( ) ; $ body ( ) ; return ob_get_clean ( ) ; } $ contentLength = $ this -> getHeader ( 'Content-Length' ) ; if (... | Returns the body as a string . |
13,343 | public function getHeaders ( ) : array { $ result = [ ] ; foreach ( $ this -> headers as $ headerInfo ) { $ result [ $ headerInfo [ 0 ] ] = $ headerInfo [ 1 ] ; } return $ result ; } | Returns all the HTTP headers as an array . |
13,344 | public function addHeader ( string $ name , $ value ) { $ lName = strtolower ( $ name ) ; if ( isset ( $ this -> headers [ $ lName ] ) ) { $ this -> headers [ $ lName ] [ 1 ] = array_merge ( $ this -> headers [ $ lName ] [ 1 ] , ( array ) $ value ) ; } else { $ this -> headers [ $ lName ] = [ $ name , ( array ) $ value... | Adds a HTTP header . |
13,345 | public function removeHeader ( string $ name ) : bool { $ name = strtolower ( $ name ) ; if ( ! isset ( $ this -> headers [ $ name ] ) ) { return false ; } unset ( $ this -> headers [ $ name ] ) ; return true ; } | Removes a HTTP header . |
13,346 | public function aggregate ( array $ pipeline , array $ options = [ ] ) { $ hasOutStage = \ MongoDB \ is_last_pipeline_operator_out ( $ pipeline ) ; if ( ! isset ( $ options [ 'readPreference' ] ) ) { $ options [ 'readPreference' ] = $ this -> readPreference ; } if ( $ hasOutStage ) { $ options [ 'readPreference' ] = ne... | Executes an aggregation framework pipeline on the collection . |
13,347 | public function count ( $ filter = [ ] , array $ options = [ ] ) { if ( ! isset ( $ options [ 'readPreference' ] ) ) { $ options [ 'readPreference' ] = $ this -> readPreference ; } $ server = $ this -> manager -> selectServer ( $ options [ 'readPreference' ] ) ; if ( ! isset ( $ options [ 'readConcern' ] ) && \ MongoDB... | Gets the number of documents matching the filter . |
13,348 | public function distinct ( $ fieldName , $ filter = [ ] , array $ options = [ ] ) { if ( ! isset ( $ options [ 'readPreference' ] ) ) { $ options [ 'readPreference' ] = $ this -> readPreference ; } $ server = $ this -> manager -> selectServer ( $ options [ 'readPreference' ] ) ; if ( ! isset ( $ options [ 'readConcern'... | Finds the distinct values for a specified field across the collection . |
13,349 | public function insertMany ( array $ documents , array $ options = [ ] ) { if ( ! isset ( $ options [ 'writeConcern' ] ) && ! $ this -> isInTransaction ( $ options ) ) { $ options [ 'writeConcern' ] = $ this -> writeConcern ; } $ operation = new InsertMany ( $ this -> databaseName , $ this -> collectionName , $ documen... | Inserts multiple documents . |
13,350 | public function insertOne ( $ document , array $ options = [ ] ) { if ( ! isset ( $ options [ 'writeConcern' ] ) && ! $ this -> isInTransaction ( $ options ) ) { $ options [ 'writeConcern' ] = $ this -> writeConcern ; } $ operation = new InsertOne ( $ this -> databaseName , $ this -> collectionName , $ document , $ opt... | Inserts one document . |
13,351 | public function mapReduce ( JavascriptInterface $ map , JavascriptInterface $ reduce , $ out , array $ options = [ ] ) { $ hasOutputCollection = ! \ MongoDB \ is_mapreduce_output_inline ( $ out ) ; if ( ! isset ( $ options [ 'readPreference' ] ) ) { $ options [ 'readPreference' ] = $ this -> readPreference ; } if ( $ h... | Executes a map - reduce aggregation on the collection . |
13,352 | public function watch ( array $ pipeline = [ ] , array $ options = [ ] ) { if ( ! isset ( $ options [ 'readPreference' ] ) ) { $ options [ 'readPreference' ] = $ this -> readPreference ; } $ server = $ this -> manager -> selectServer ( $ options [ 'readPreference' ] ) ; if ( ! isset ( $ options [ 'readConcern' ] ) && \... | Create a change stream for watching changes to the collection . |
13,353 | private function isInTransaction ( array $ options ) { if ( isset ( $ options [ 'session' ] ) && $ options [ 'session' ] instanceof \ MongoDB \ Driver \ Session && $ options [ 'session' ] -> isInTransaction ( ) ) { return true ; } return false ; } | Returns whether we are currently in a transaction |
13,354 | private function createCommandDocument ( Server $ server ) { $ cmd = [ 'findAndModify' => $ this -> collectionName ] ; if ( $ this -> options [ 'remove' ] ) { $ cmd [ 'remove' ] = true ; } else { $ cmd [ 'new' ] = $ this -> options [ 'new' ] ; $ cmd [ 'upsert' ] = $ this -> options [ 'upsert' ] ; } foreach ( [ 'collati... | Create the findAndModify command document . |
13,355 | public static function isTypeName ( string $ typeName ) : bool { $ matches = [ ] ; $ result = preg_match ( '~^\\\\?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)(\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)*$~' , $ typeName , $ matches ) ; if ( $ result === false ) { throw new Exception ( 'PREG error ' . preg_last_error (... | Validates type name according to the allowed characters in type names + namespaces |
13,356 | private static function getUseStatementPointers ( File $ phpcsFile , int $ openTagPointer ) : array { $ tokens = $ phpcsFile -> getTokens ( ) ; $ pointer = $ openTagPointer + 1 ; $ pointers = [ ] ; while ( true ) { $ typesToFind = array_merge ( [ T_USE ] , TokenHelper :: $ typeKeywordTokenCodes ) ; $ pointer = TokenHel... | Searches for all use statements in a file skips bodies of classes and traits . |
13,357 | public function displaySubmit ( $ formIdentifier , $ text = 'submit' , $ attributes = [ ] ) { $ javascript = '' ; if ( ! isset ( $ attributes [ 'data-callback' ] ) ) { $ functionName = 'onSubmit' . str_replace ( [ '-' , '=' , '\'' , '"' , '<' , '>' , '`' ] , '' , $ formIdentifier ) ; $ attributes [ 'data-callback' ] = ... | Display a Invisible reCAPTCHA by embedding a callback into a form submit button . |
13,358 | public function renderJs ( $ lang = null , $ callback = false , $ onLoadClass = 'onloadCallBack' ) { return '<script src="' . $ this -> getJsLink ( $ lang , $ callback , $ onLoadClass ) . '" async defer></script>' . "\n" ; } | Render js source |
13,359 | public function verifyResponse ( $ response , $ clientIp = null ) { if ( empty ( $ response ) ) { return false ; } if ( in_array ( $ response , $ this -> verifiedResponses ) ) { return true ; } $ verifyResponse = $ this -> sendRequestVerify ( [ 'secret' => $ this -> secret , 'response' => $ response , 'remoteip' => $ c... | Verify no - captcha response . |
13,360 | public function getJsLink ( $ lang = null , $ callback = false , $ onLoadClass = 'onloadCallBack' ) { $ client_api = static :: CLIENT_API ; $ params = [ ] ; $ callback ? $ this -> setCallBackParams ( $ params , $ onLoadClass ) : false ; $ lang ? $ params [ 'hl' ] = $ lang : null ; return $ client_api . '?' . http_build... | Get recaptcha js link . |
13,361 | protected function prepareAttributes ( array $ attributes ) { $ attributes [ 'data-sitekey' ] = $ this -> sitekey ; if ( ! isset ( $ attributes [ 'class' ] ) ) { $ attributes [ 'class' ] = '' ; } $ attributes [ 'class' ] = trim ( 'g-recaptcha ' . $ attributes [ 'class' ] ) ; return $ attributes ; } | Prepare HTML attributes and assure that the correct classes and attributes for captcha are inserted . |
13,362 | protected function buildAttributes ( array $ attributes ) { $ html = [ ] ; foreach ( $ attributes as $ key => $ value ) { $ html [ ] = $ key . '="' . $ value . '"' ; } return count ( $ html ) ? ' ' . implode ( ' ' , $ html ) : '' ; } | Build HTML attributes . |
13,363 | protected function resolve ( $ name ) { if ( strpos ( $ name , '\\' ) === false ) { if ( strpos ( $ name , '/' ) === false ) { $ app = '' ; } else { list ( $ app , $ name ) = explode ( '/' , $ name , 2 ) ; } $ name = ( $ this -> app -> config -> get ( 'app.app_namespace' ) ? : 'app\\' ) . ( $ app ? strtolower ( $ app )... | Resolve the given job handler . |
13,364 | protected function registerTimeoutHandler ( $ job , $ timeout ) { pcntl_signal ( SIGALRM , function ( ) { $ this -> kill ( 1 ) ; } ) ; pcntl_alarm ( max ( $ this -> timeoutForJob ( $ job , $ timeout ) , 0 ) ) ; } | Register the worker timeout handler . |
13,365 | protected function displayFailedJobs ( array $ jobs ) { $ table = new Table ( ) ; $ table -> setHeader ( $ this -> headers ) ; $ table -> setRows ( $ jobs ) ; $ this -> table ( $ table ) ; } | Display the failed jobs in the console . |
13,366 | protected function matchJobName ( $ payload ) { preg_match ( '/"([^"]+)"/' , $ payload [ 'data' ] [ 'command' ] , $ matches ) ; if ( isset ( $ matches [ 1 ] ) ) { return $ matches [ 1 ] ; } return $ payload [ 'job' ] ?? null ; } | Match the job name from the payload . |
13,367 | public static function getHumanReadableBytes ( $ value ) { static $ unit = array ( 'B' , 'KB' , 'MB' , 'GB' , 'TB' ) ; $ i = \ floor ( \ log ( $ value , 1024 ) ) ; $ i = \ min ( $ i , 4 ) ; return array ( 'value' => ( float ) ( $ value / \ pow ( 1024 , $ i ) ) , 'unit' => $ unit [ $ i ] , ) ; } | Turns a byte value into a human - readable representation . |
13,368 | public function dumpAll ( array $ vars , array $ base ) { if ( \ array_keys ( $ vars ) !== \ array_keys ( $ base ) ) { throw new InvalidArgumentException ( 'Kint::dumpAll requires arrays of identical size and keys as arguments' ) ; } $ output = $ this -> renderer -> preRender ( ) ; if ( $ vars === array ( ) ) { $ outpu... | Renders a list of vars including the pre and post renders . |
13,369 | public function dumpVar ( & $ var , BasicObject $ base ) { return $ this -> renderer -> render ( $ this -> parser -> parse ( $ var , $ base ) ) ; } | Dumps and renders a var . |
13,370 | public static function getStatics ( ) { return array ( 'aliases' => self :: $ aliases , 'app_root_dirs' => self :: $ app_root_dirs , 'cli_detection' => self :: $ cli_detection , 'display_called_from' => self :: $ display_called_from , 'enabled_mode' => self :: $ enabled_mode , 'expanded' => self :: $ expanded , 'file_l... | Gets all static settings at once . |
13,371 | public static function createFromStatics ( array $ statics ) { $ mode = false ; if ( isset ( $ statics [ 'enabled_mode' ] ) ) { $ mode = $ statics [ 'enabled_mode' ] ; if ( true === $ statics [ 'enabled_mode' ] && isset ( $ statics [ 'mode_default' ] ) ) { $ mode = $ statics [ 'mode_default' ] ; if ( PHP_SAPI === 'cli'... | Creates a Kint instances based on static settings . |
13,372 | public static function getBasesFromParamInfo ( array $ params , $ argc ) { static $ blacklist = array ( 'null' , 'true' , 'false' , 'array(...)' , 'array()' , '[...]' , '[]' , '(...)' , '()' , '"..."' , 'b"..."' , "'...'" , "b'...'" , ) ; $ params = \ array_values ( $ params ) ; $ bases = array ( ) ; for ( $ i = 0 ; $ ... | Creates base objects given parameter info . |
13,373 | public static function getCallInfo ( array $ aliases , array $ trace , $ argc ) { $ found = false ; $ callee = null ; $ caller = null ; $ miniTrace = array ( ) ; foreach ( $ trace as $ index => $ frame ) { if ( Utils :: traceFrameIsListed ( $ frame , $ aliases ) ) { $ found = true ; $ miniTrace = array ( ) ; } if ( ! U... | Gets call info from the backtrace alias and argument count . |
13,374 | public static function trace ( ) { if ( ! self :: $ enabled_mode ) { return 0 ; } Utils :: normalizeAliases ( self :: $ aliases ) ; $ args = \ func_get_args ( ) ; $ call_info = self :: getCallInfo ( self :: $ aliases , \ debug_backtrace ( DEBUG_BACKTRACE_IGNORE_ARGS ) , \ count ( $ args ) ) ; $ statics = self :: getSta... | Dumps a backtrace . |
13,375 | public static function dump ( ) { if ( ! self :: $ enabled_mode ) { return 0 ; } Utils :: normalizeAliases ( self :: $ aliases ) ; $ args = \ func_get_args ( ) ; $ call_info = self :: getCallInfo ( self :: $ aliases , \ debug_backtrace ( DEBUG_BACKTRACE_IGNORE_ARGS ) , \ count ( $ args ) ) ; $ statics = self :: getStat... | Dumps some data . |
13,376 | public static function shortenPath ( $ file ) { $ file = \ array_values ( \ array_filter ( \ explode ( '/' , \ str_replace ( '\\' , '/' , $ file ) ) , 'strlen' ) ) ; $ longest_match = 0 ; $ match = '/' ; foreach ( self :: $ app_root_dirs as $ path => $ alias ) { if ( empty ( $ path ) ) { continue ; } $ path = \ array_v... | generic path display callback can be configured in app_root_dirs ; purpose is to show relevant path info and hide as much of the path as possible . |
13,377 | protected static function getSingleCall ( array $ frame , $ argc ) { if ( ! isset ( $ frame [ 'file' ] , $ frame [ 'line' ] , $ frame [ 'function' ] ) || ! \ is_readable ( $ frame [ 'file' ] ) ) { return null ; } if ( empty ( $ frame [ 'class' ] ) ) { $ callfunc = $ frame [ 'function' ] ; } else { $ callfunc = array ( ... | Returns specific function call info from a stack trace frame or null if no match could be found . |
13,378 | public static function getSource ( $ filename , $ start_line = 1 , $ length = null ) { if ( ! $ filename || ! \ file_exists ( $ filename ) || ! \ is_readable ( $ filename ) ) { return null ; } $ source = \ preg_split ( "/\r\n|\n|\r/" , \ file_get_contents ( $ filename ) ) ; $ source = \ array_combine ( \ range ( 1 , \ ... | Gets section of source code . |
13,379 | public function matchPlugins ( array $ plugins , array $ hints ) { $ out = array ( ) ; foreach ( $ hints as $ key ) { if ( isset ( $ plugins [ $ key ] ) ) { $ out [ $ key ] = $ plugins [ $ key ] ; } } return $ out ; } | Returns the first compatible plugin available . |
13,380 | public static function sortProperties ( array $ contents , $ sort ) { switch ( $ sort ) { case self :: SORT_VISIBILITY : $ containers = array ( BasicObject :: ACCESS_PUBLIC => array ( ) , BasicObject :: ACCESS_PROTECTED => array ( ) , BasicObject :: ACCESS_PRIVATE => array ( ) , BasicObject :: ACCESS_NONE => array ( ) ... | Sorts an array of BasicObject . |
13,381 | public function parseDeep ( & $ var , BasicObject $ o ) { $ depth_limit = $ this -> depth_limit ; $ this -> depth_limit = false ; $ out = $ this -> parse ( $ var , $ o ) ; $ this -> depth_limit = $ depth_limit ; return $ out ; } | Disables the depth limit and parses a variable . |
13,382 | public function parse ( & $ var , BasicObject $ o ) { $ o -> type = \ strtolower ( \ gettype ( $ var ) ) ; if ( ! $ this -> applyPlugins ( $ var , $ o , self :: TRIGGER_BEGIN ) ) { return $ o ; } switch ( $ o -> type ) { case 'array' : return $ this -> parseArray ( $ var , $ o ) ; case 'boolean' : case 'double' : case ... | Parses a variable into a Kint object structure . |
13,383 | private function parseString ( & $ var , BasicObject $ o ) { $ string = new BlobObject ( ) ; $ string -> transplant ( $ o ) ; $ string -> encoding = BlobObject :: detectEncoding ( $ var ) ; $ string -> size = BlobObject :: strlen ( $ var , $ string -> encoding ) ; $ rep = new Representation ( 'Contents' ) ; $ rep -> co... | Parses a string into a Kint BlobObject structure . |
13,384 | private function parseArray ( array & $ var , BasicObject $ o ) { $ array = new BasicObject ( ) ; $ array -> transplant ( $ o ) ; $ array -> size = \ count ( $ var ) ; if ( isset ( $ var [ $ this -> marker ] ) ) { -- $ array -> size ; $ array -> hints [ ] = 'recursion' ; $ this -> applyPlugins ( $ var , $ array , self ... | Parses an array into a Kint object structure . |
13,385 | private function parseResource ( & $ var , BasicObject $ o ) { $ resource = new ResourceObject ( ) ; $ resource -> transplant ( $ o ) ; $ resource -> resource_type = \ get_resource_type ( $ var ) ; $ this -> applyPlugins ( $ var , $ resource , self :: TRIGGER_SUCCESS ) ; return $ resource ; } | Parses a resource into a Kint ResourceObject structure . |
13,386 | private function parseUnknown ( & $ var , BasicObject $ o ) { $ o -> type = 'unknown' ; $ this -> applyPlugins ( $ var , $ o , self :: TRIGGER_SUCCESS ) ; return $ o ; } | Parses an unknown into a Kint object structure . |
13,387 | private function applyPlugins ( & $ var , BasicObject & $ o , $ trigger ) { $ break_stash = $ this -> parse_break ; $ this -> parse_break = false ; $ plugins = array ( ) ; if ( isset ( $ this -> plugins [ $ o -> type ] [ $ trigger ] ) ) { $ plugins = $ this -> plugins [ $ o -> type ] [ $ trigger ] ; } foreach ( $ plugi... | Applies plugins for an object type . |
13,388 | public function renderLockedHeader ( BasicObject $ o , $ content ) { $ header = '<dt class="kint-parent kint-locked">' ; if ( RichRenderer :: $ access_paths && $ o -> depth > 0 && $ ap = $ o -> getAccessPath ( ) ) { $ header .= '<span class="kint-access-path-trigger" title="Show access path">⇄</span>' ; } $ heade... | Renders a locked header . |
13,389 | public static function hslToRgb ( $ h , $ s , $ l ) { if ( \ min ( $ h , $ s , $ l ) < 0 ) { throw new InvalidArgumentException ( 'The parameters for hslToRgb should be no less than 0' ) ; } if ( $ h > 360 || \ max ( $ s , $ l ) > 100 ) { throw new InvalidArgumentException ( 'The parameters for hslToRgb should be no mo... | Turns HSL color to RGB . Black magic . |
13,390 | public static function rgbToHsl ( $ red , $ green , $ blue ) { if ( \ min ( $ red , $ green , $ blue ) < 0 ) { throw new InvalidArgumentException ( 'The parameters for rgbToHsl should be no less than 0' ) ; } if ( \ max ( $ red , $ green , $ blue ) > 0xFF ) { throw new InvalidArgumentException ( 'The parameters for rgb... | Converts RGB to HSL . Color inversion of previous black magic is white magic? |
13,391 | private static function hueToRgb ( $ m1 , $ m2 , $ hue ) { $ hue = ( $ hue < 0 ) ? $ hue + 1 : ( ( $ hue > 1 ) ? $ hue - 1 : $ hue ) ; if ( $ hue * 6 < 1 ) { return $ m1 + ( $ m2 - $ m1 ) * $ hue * 6 ; } if ( $ hue * 2 < 1 ) { return $ m2 ; } if ( $ hue * 3 < 2 ) { return $ m1 + ( $ m2 - $ m1 ) * ( 2 / 3 - $ hue ) * 6 ... | Helper function for hslToRgb . Even blacker magic . |
13,392 | public static function blank ( $ name = null , $ access_path = null ) { $ o = new self ( ) ; $ o -> name = $ name ; $ o -> access_path = $ access_path ; return $ o ; } | Creates a new basic object with a name and access path . |
13,393 | public function getDocstringWithoutComments ( ) { if ( ! $ this -> contents ) { return null ; } $ string = \ substr ( $ this -> contents , 3 , - 2 ) ; $ string = \ preg_replace ( '/^\\s*\\*\\s*?(\\S|$)/m' , '\\1' , $ string ) ; return \ trim ( $ string ) ; } | Returns the representation s docstring without surrounding comments . |
13,394 | protected static function xmlToDOMDocument ( $ var , $ parent_path ) { if ( ! self :: xmlToSimpleXML ( $ var , $ parent_path ) ) { return null ; } $ xml = new DOMDocument ( ) ; $ xml -> loadXML ( $ var ) ; $ xml = $ xml -> firstChild ; if ( null === $ parent_path ) { $ access_path = null ; } else { $ access_path = '@\\... | Get the DOMDocument info . |
13,395 | public static function getPageAuthority ( $ url = false ) { $ data = static :: getCols ( '34359738368' , $ url ) ; return ( parent :: noDataDefaultValue ( ) == $ data ) ? $ data : $ data [ 'upa' ] ; } | of the URL to rank well in search engine results . |
13,396 | public static function getDomainAuthority ( $ url = false ) { $ data = static :: getCols ( '68719476736' , Helper \ Url :: parseHost ( $ url ) ) ; return ( parent :: noDataDefaultValue ( ) == $ data ) ? $ data : $ data [ 'pda' ] ; } | of the domain of the URL to rank well in search engine results . |
13,397 | public static function getMozRank ( $ url = false ) { $ data = static :: getCols ( '16384' , $ url ) ; return ( parent :: noDataDefaultValue ( ) == $ data ) ? $ data : $ data [ 'umrp' ] ; } | The normalized 10 - point MozRank score of the URL . |
13,398 | public static function getMozRankRaw ( $ url = false ) { $ data = static :: getCols ( '16384' , $ url ) ; return ( parent :: noDataDefaultValue ( ) == $ data ) ? $ data : number_format ( $ data [ 'umrr' ] , 16 ) ; } | The raw MozRank score of the URL . |
13,399 | public static function getUrl ( $ url = false ) { $ url = false !== $ url ? $ url : self :: $ _url ; return $ url ; } | Ensure the URL is set return default otherwise |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.