idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
53,700 | public static function build ( ) { switch ( true ) { case extension_loaded ( 'apc' ) : $ cacheDriver = new ApcuCache ; break ; case extension_loaded ( 'xcache' ) : $ cacheDriver = new XcacheCache ; break ; case extension_loaded ( 'memcache' ) : $ memcache = new \ Memcache ; $ memcache -> connect ( '127.0.0.1' ) ; $ cac... | Retrieve a newly created doctrine cache driver . |
53,701 | public function get ( $ token ) { foreach ( $ this -> getDbConnection ( ) -> fetchAll ( 'SELECT * FROM oauth_refresh_token WHERE refresh_token = :token' , [ 'token' => $ token ] ) as $ row ) { if ( $ row ) { return ( new RefreshTokenEntity ( $ this -> server ) ) -> setAccessTokenId ( $ row [ 'access_token' ]... | Return a new instance of \ League \ OAuth2 \ Server \ Entity \ RefreshTokenEntity |
53,702 | public function create ( $ token , $ expireTime , $ accessToken ) { $ this -> getDbConnection ( ) -> insert ( 'oauth_refresh_token' , [ 'refresh_token' => $ token , 'access_token' => $ accessToken , 'expire_time' => $ expireTime ] ) ; } | Create a new refresh token_name |
53,703 | public function addSnippet ( $ sSnptName ) { $ oSnpt = ViewFactory :: createSnippet ( $ sSnptName ) ; $ this -> snippets [ $ sSnptName ] = $ oSnpt ; } | It adds snippet to the view object . |
53,704 | public function getSnippet ( $ sSnptName = '' ) { if ( empty ( $ sSnptName ) ) { return $ this -> snippets ; } else { return isset ( $ this -> snippets [ $ sSnptName ] ) ? $ this -> snippets [ $ sSnptName ] : null ; } } | It returns assigned snippet object by the name . If the name not presents then it returns the map with all View - assigned snippets . |
53,705 | public function apply ( $ testable ) { $ violations = array ( ) ; $ warnings = array ( ) ; $ success = true ; foreach ( $ this -> _rules as $ ruleSet ) { $ rule = $ ruleSet [ 'rule' ] ; $ options = $ ruleSet [ 'options' ] ; $ rule -> apply ( $ testable , $ options ) ; $ warnings = array_merge ( $ warnings , $ rule -> w... | Will iterate over each rule calling apply on them |
53,706 | public function options ( array $ variables ) { foreach ( $ this -> _rules as $ key => & $ rule ) { if ( isset ( $ variables [ $ key ] ) && is_array ( $ variables [ $ key ] ) ) { $ rule [ 'options' ] = $ variables [ $ key ] ; } } } | Will remove unnecessary items and add options . |
53,707 | public function errorResponse ( $ connection , $ statusCode , $ body = null , $ reason = null , array $ headers = [ ] ) { $ res = new Response ( $ statusCode , $ body ) ; if ( ! $ reason ) { $ res -> statusReason = \ yii \ web \ Response :: $ httpStatuses [ $ statusCode ] ; } if ( $ body === null ) { $ res -> body = \ ... | send error response and close the connection . |
53,708 | public function sendFile ( $ event , $ req , $ res , $ path ) { clearstatcache ( ) ; $ filesize = sprintf ( "%u" , filesize ( $ path ) ) ; $ res -> headers -> set ( 'Content-Length' , $ filesize ) ; $ res -> headers -> set ( 'Accept-Ranges' , 'bytes' ) ; if ( $ req -> method == 'HEAD' ) { return ; } if ( in_array ( $ r... | send static file response . |
53,709 | protected function sendGzipContent ( $ event , $ req , $ res , $ path , $ filesize ) { if ( ! $ this -> gzip || ! $ req -> gzipSupport ( ) || $ filesize < $ this -> gzip_min_bytes || $ filesize > $ this -> gzip_max_bytes ) { return false ; } $ res -> headers -> set ( 'Content-Encoding' , 'gzip' ) ; $ res -> body = gzen... | send gzip file response . |
53,710 | protected function attachFile ( $ event , $ req , $ res , $ path , $ size ) { $ range = null ; $ event -> sender -> setAttribute ( 'accept-range' , null ) ; if ( $ req -> headers -> has ( 'Range' ) ) { list ( $ range [ 0 ] , $ range [ 1 ] ) = explode ( '-' , str_ireplace ( 'bytes=' , '' , $ req -> headers -> get ( 'Ran... | attach file file to be readed for current request . |
53,711 | public function processPhpFile ( $ event , $ request , $ response , $ file ) { if ( ! $ this -> php_engine ) { $ response -> statusCode = 403 ; $ response -> body = "php engine disabled" ; return ; } if ( ! $ response -> headers -> has ( 'Content-type' ) ) { if ( $ response -> charset === null && $ this -> default_char... | send php file response . |
53,712 | public function processDir ( $ event , $ req , $ res , $ path ) { foreach ( $ this -> index as $ name ) { $ index_path = realpath ( $ path . '/' . $ name ) ; if ( is_file ( $ index_path ) ) { return $ this -> sendFile ( $ event , $ req , $ res , $ index_path ) ; } } if ( ! $ this -> auto_index ) { throw new \ Exception... | process dir request . |
53,713 | public function processLocation ( MessageEvent $ event , $ req , $ res , $ path ) { foreach ( $ this -> callback as $ location => $ callable ) { if ( ! preg_match ( $ location , $ path ) ) continue ; $ callable = is_string ( $ callable ) ? [ $ this , $ callable ] : $ callable ; if ( ! is_callable ( $ callable ) ) { ret... | process location match and callback . |
53,714 | protected function getErrorPageFile ( $ statusCode ) { $ errorpage = null ; if ( isset ( $ this -> error_pages [ $ statusCode ] ) ) { $ errorpage = $ this -> error_pages [ $ statusCode ] ; } else if ( isset ( $ this -> error_pages [ substr ( $ statusCode , 0 , 2 ) . 'x' ] ) ) { $ errorpage = $ this -> error_pages [ sub... | find error page file by response status code . |
53,715 | public function sendPartial ( $ event ) { $ range = $ event -> sender -> getAttribute ( 'accept-range' ) ; $ readSize = $ this -> read_buffer ; $ pos = ftell ( $ event -> sender -> getFileHandler ( $ this -> fileKey ) ) ; if ( $ range ) { $ readSize = min ( $ range [ 1 ] - $ pos + 1 , $ readSize ) ; } if ( $ readSize <... | send partial bytes of file to client . |
53,716 | public function plugins ( ) { if ( is_array ( $ this -> plugins ) ) { return $ this -> plugins ; } if ( $ this -> plugins ) { $ plugins = apply_filters ( 'all_plugins' , get_plugins ( ) ) ; return array_keys ( $ plugins ) ; } return [ ] ; } | Get a list of plugins to be activated . |
53,717 | public function theme ( ) { if ( ! $ this -> theme || ! isset ( $ this -> theme -> name ) ) { return false ; } if ( is_string ( $ this -> theme ) ) { return ( object ) [ 'name' => $ this -> theme , 'mods' => [ ] , 'options' => [ ] , 'menus' => [ ] , 'sidebars' => [ ] ] ; } return ( object ) [ 'name' => $ this -> theme ... | Get the theme object or false if not to be set . |
53,718 | public function getRoutes ( ) { $ routes = array ( 'ezpListAtom' => new ezpRestVersionedRoute ( new ezpMvcRailsRoute ( '/content/node/:nodeId/listAtom' , 'ezpRestAtomController' , array ( 'http-get' => 'collection' ) ) , 1 ) , 'ezpList' => new ezpRestVersionedRoute ( new ezpMvcRegexpRoute ( '@^/content/node/(?P<nodeId>... | Returns registered versioned routes for provider |
53,719 | public static function getNextVersion ( $ module ) { $ root = cradle ( 'global' ) -> path ( 'module' ) ; $ install = $ root . '/' . $ module . '/install' ; if ( ! is_dir ( $ install ) ) { return '0.0.1' ; } $ versions = [ ] ; $ files = scandir ( $ install , 0 ) ; foreach ( $ files as $ file ) { if ( $ file === '.' || $... | Checks if a path exists |
53,720 | public function validatePassed ( $ attr , $ opts = [ ] ) { $ params = $ this -> $ attr ; $ missing = $ invalid = $ columns = [ ] ; $ class = $ this -> modelClass ; $ pk = $ class :: primaryKey ( ) ; $ keys = count ( $ pk ) > 1 ? $ pk : [ 'id' ] ; foreach ( $ keys as $ key ) { if ( ! array_key_exists ( $ key , $ params ... | Validator for params |
53,721 | public function getModel ( ) { if ( ! isset ( $ this -> _pk ) ) throw new InvalidCallException ( 'Invalid usage. You must call this method only if load method succeeds' ) ; if ( isset ( $ this -> _model ) ) return $ this -> _model ; $ class = $ this -> modelClass ; return $ this -> _model = $ class :: findOne ( $ this ... | Get founded model |
53,722 | public function addRouteDefinition ( RouteDefinition $ definition ) : void { $ name = $ definition -> getName ( ) ; if ( isset ( $ this -> routesByName [ $ name ] ) ) { throw new \ InvalidArgumentException ( "Route with name '$name' already exists" ) ; } $ routeId = \ count ( $ this -> routeDefinitions ) ; $ segments =... | Adds a new route definition . |
53,723 | public function getCacheFile ( callable $ encoder = null ) : string { if ( \ is_null ( $ encoder ) ) { $ encoder = function ( $ value ) : string { return var_export ( $ value , true ) ; } ; } $ statics = $ encoder ( $ this -> staticRoutes ) ; $ counts = $ encoder ( $ this -> segmentCounts ) ; $ values = $ encoder ( $ t... | Returns PHP code for cached RouteDefinitionProvider that can be stored in file and included . |
53,724 | public function getRouteDefinition ( int $ routeId ) : RouteDefinition { if ( ! isset ( $ this -> routeDefinitions [ $ routeId ] ) ) { throw new \ InvalidArgumentException ( "Invalid route id '$routeId'" ) ; } return RouteDefinition :: createFromCache ( $ this -> routeDefinitions [ $ routeId ] ) ; } | Returns a route definition by a specific id . |
53,725 | public function getRouteDefinitionByName ( string $ name ) : RouteDefinition { if ( ! isset ( $ this -> routesByName [ $ name ] ) ) { throw new \ InvalidArgumentException ( "Invalid route name '$name'" ) ; } return $ this -> getRouteDefinition ( $ this -> routesByName [ $ name ] ) ; } | Returns a route definition by the name of the route . |
53,726 | public function getEmbed ( ) { if ( $ this -> link ) { switch ( $ this -> type ) { case 'argus360' : return '<iframe src="//car360app.com/viewer/portable.php?spin=' . $ this -> getHash ( $ this -> link ) . '&res=1920x1080&maximages=-1&frameSize=1920x1080"></iframe>' ; break ; case 'dailymotion' : return '<iframe frameb... | Generate embed according to category |
53,727 | public function getHash ( $ url ) { switch ( parse_url ( $ url ) [ 'host' ] ) { case 'www.youtube.com' : parse_str ( parse_url ( $ url ) [ 'query' ] , $ result ) ; return $ result [ 'v' ] ; break ; case 'dai.ly' : case 'vimeo.com' : case 'youtu.be' : return ltrim ( parse_url ( $ url ) [ 'path' ] , '/' ) ; break ; case ... | Get video hash from url |
53,728 | public function resolve ( ThemeInterface $ theme , Content $ content , Variation $ variation , $ templateName ) { $ templateTypes = $ theme -> getTemplateTypes ( ) ; switch ( true ) { case $ templateName : if ( ! $ templateType = $ templateTypes -> search ( array ( 'name' => $ templateName ) ) -> first ( ) ) { throw ne... | Resolve current template from given Theme and template name . |
53,729 | public function renderNav ( $ numberOfPages , $ currentPage = 1 , $ queryParameters = array ( ) , $ maxPagesDisplayedAroundCurrent = 2 ) { $ navigation = array ( ) ; $ firstPageDisplayed = 1 ; $ lastPageDisplayed = ( int ) $ numberOfPages ; $ leftPartUrl = $ this -> prepareQueryString ( $ queryParameters ) ; if ( $ cur... | Render a customizable navigation bar |
53,730 | protected function prepareQueryString ( $ queryParameters ) { unset ( $ queryParameters [ self :: PARAMETER_PAGE ] ) ; $ queryParameters [ self :: PARAMETER_PAGE ] = '' ; return '?' . http_build_query ( $ queryParameters ) ; } | Generate navigator queryString without page number |
53,731 | public function calculate ( $ elo0 , $ elo1 , $ win , $ reliability0 = 1.0 , $ reliability1 = 1.0 , $ kFactor0 = null , $ kFactor1 = null ) { self :: checkCoef ( $ reliability0 , 'reliability0' ) ; self :: checkCoef ( $ reliability1 , 'reliability1' ) ; self :: checkCoef ( $ win , 'win' ) ; $ kFactor0 = ( null === $ kF... | Calculate new elo scores |
53,732 | public function lose ( $ elo0 , $ elo1 , $ reliability0 = 1.0 , $ reliability1 = 1.0 , $ kFactor0 = null , $ kFactor1 = null ) { return $ this -> calculate ( $ elo0 , $ elo1 , 0 , $ reliability0 , $ reliability1 , $ kFactor0 , $ kFactor1 ) ; } | Player 0 lose against player 1 |
53,733 | private static function rectifyReliabilityCoefs ( & $ coef0 , & $ coef1 ) { $ reliabilityRectification = 1 - max ( $ coef0 , $ coef1 ) ; $ coef0 += $ reliabilityRectification ; $ coef1 += $ reliabilityRectification ; } | Increase coefficients the same value so one of them reaches 1 |
53,734 | protected function dropzoneAttributes ( $ url ) { $ init = new JavaScriptExpression ( $ this -> init ( 'translationImport' ) ) ; $ validator = app ( CsvValidator :: class ) ; $ rules = $ this -> getValidationRules ( 'file' , $ validator ) ; return [ 'container' => 'translationImport' , 'paramName' => 'file' , 'view' =>... | dropzone attributes creator |
53,735 | public function redirect ( ) { $ this -> execute ( ) ; if ( $ this -> gatewayUrl ) { $ code = 302 ; $ message = $ code . " Found" ; header ( "HTTP/1.1 " . $ message , true , $ code ) ; header ( "Status: " . $ message , true , $ code ) ; header ( "Location: {$this->gatewayUrl}" ) ; exit ; } } | Redirects user to gateway URL |
53,736 | public function getField ( $ name ) { $ component = $ this -> getComponent ( $ name ) ; if ( $ component instanceof Field === false ) throw new \ UnexpectedValueException ( 'The component with name "' . $ name , '" is not of type Field but of type ' . get_class ( $ component ) ) ; return $ component ; } | Returns a connected form field of this form handler instance selected by its name |
53,737 | private function prepare ( $ data ) { foreach ( $ data as $ code => & $ item ) { $ item = $ this -> prepareItem ( $ code , $ item ) ; } return $ data ; } | prepare array for sorting |
53,738 | public function hex_to_base64 ( $ str ) { $ raw = '' ; for ( $ i = 0 ; $ i < strlen ( $ str ) ; $ i += 2 ) { $ raw .= chr ( hexdec ( substr ( $ str , $ i , 2 ) ) ) ; } return base64_encode ( $ raw ) ; } | Convert a HEX value to Base64 . |
53,739 | public function to_query_string ( $ array ) { $ temp = array ( ) ; foreach ( $ array as $ key => $ value ) { if ( is_string ( $ key ) && ! is_array ( $ value ) ) { $ temp [ ] = rawurlencode ( $ key ) . '=' . rawurlencode ( $ value ) ; } } return implode ( '&' , $ temp ) ; } | Convert an associative array into a query string . |
53,740 | public function to_signable_string ( $ array ) { $ t = array ( ) ; foreach ( $ array as $ k => $ v ) { $ t [ ] = $ this -> encode_signature2 ( $ k ) . '=' . $ this -> encode_signature2 ( $ v ) ; } return implode ( '&' , $ t ) ; } | Convert an associative array into a sign - able string . |
53,741 | public function query_to_array ( $ qs ) { $ query = explode ( '&' , $ qs ) ; $ data = array ( ) ; foreach ( $ query as $ q ) { $ q = explode ( '=' , $ q ) ; if ( isset ( $ data [ $ q [ 0 ] ] ) && is_array ( $ data [ $ q [ 0 ] ] ) ) { $ data [ $ q [ 0 ] ] [ ] = urldecode ( $ q [ 1 ] ) ; } else if ( isset ( $ data [ $ q ... | Convert a query string into an associative array . Multiple identical keys will become an indexed array . |
53,742 | public function size_readable ( $ size , $ unit = null , $ default = null ) { $ sizes = array ( 'B' , 'kB' , 'MB' , 'GB' , 'TB' , 'PB' , 'EB' ) ; $ mod = 1024 ; $ ii = count ( $ sizes ) - 1 ; $ unit = array_search ( ( string ) $ unit , $ sizes ) ; if ( $ unit === null || $ unit === false ) { $ unit = $ ii ; } if ( $ de... | Return human readable file sizes . |
53,743 | public function convert_date_to_iso8601 ( $ datestamp ) { if ( ! preg_match ( '/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}((\+|-)\d{2}:\d{2}|Z)/m' , $ datestamp ) ) { return gmdate ( self :: DATE_FORMAT_ISO8601 , strtotime ( $ datestamp ) ) ; } return $ datestamp ; } | Checks to see if a date stamp is ISO - 8601 formatted and if not makes it so . |
53,744 | public function decode_uhex ( $ s ) { preg_match_all ( '/\\\u([0-9a-f]{4})/i' , $ s , $ matches ) ; $ matches = $ matches [ count ( $ matches ) - 1 ] ; $ map = array ( ) ; foreach ( $ matches as $ match ) { if ( ! isset ( $ map [ $ match ] ) ) { $ map [ '\u' . $ match ] = html_entity_decode ( '&#' . hexdec ( $ match ) ... | Decodes \ uXXXX entities into their real unicode character equivalents . |
53,745 | public function generate_guid ( ) { return sprintf ( '%04X%04X-%04X-%04X-%04X-%04X%04X%04X' , mt_rand ( 0 , 65535 ) , mt_rand ( 0 , 65535 ) , mt_rand ( 0 , 65535 ) , mt_rand ( 16384 , 20479 ) , mt_rand ( 32768 , 49151 ) , mt_rand ( 0 , 65535 ) , mt_rand ( 0 , 65535 ) , mt_rand ( 0 , 65535 ) ) ; } | Generates a random GUID . |
53,746 | public function getTtl ( ) { if ( false === $ this -> ttl ) { $ this -> ttl = $ this -> getDefaultTtl ( ) ; } return $ this -> ttl ; } | Set the cache driver |
53,747 | private function getBeforeEvent ( BeforeEvent $ event ) { $ request = $ event -> getRequest ( ) ; if ( 'api.embed.ly' === $ request -> getHost ( ) ) { $ requestQuery = $ request -> getQuery ( ) ; $ requestQuery -> setEncodingType ( false ) ; $ requestQuery -> set ( 'key' , $ this -> apiKey ) ; $ request -> setQuery ( $... | Guzzle event used to set the key parameter . |
53,748 | public function display ( $ method = null , array $ params = array ( ) ) { $ httpClient = $ this -> getHttpClient ( ) ; if ( trim ( $ method ) ) { $ method = '/' . ltrim ( $ method , '/' ) ; } $ params [ 'key' ] = $ this -> getApiKey ( ) ; $ response = $ httpClient -> get ( 'http://i.embed.ly/1/display' . $ method , [ ... | The display based routes . |
53,749 | public function findNext ( ) { if ( ! isset ( $ this -> cache [ 'wdb_next' ] ) ) { $ this -> cache [ 'wdb_next' ] = null ; $ filepath = $ this -> getPathname ( ) ; if ( $ this -> isLink ( ) || $ this -> isRootLink ( ) ) { $ filepath = FilesystemHelper :: slashDirname ( $ this -> getWebPath ( ) ) . $ this -> getFilename... | Find next file in current chapter |
53,750 | public function optimize ( stdClass $ data ) { $ this -> createRouteFolders ( $ data ) ; $ fi = new FilesystemIterator ( $ data -> rootDirectory . 'app/routes/admin/' , FilesystemIterator :: SKIP_DOTS ) ; $ count = str_pad ( iterator_count ( $ fi ) + 1 , 2 , '0' , STR_PAD_LEFT ) . '_' ; $ data -> serviceRouteName = 'ro... | Optimizing configuration for routes |
53,751 | public function generate ( stdClass $ serviceData ) { $ files = [ ] ; $ files [ ] = $ this -> generateRoutes ( $ serviceData , 'admin' ) ; $ files [ ] = $ this -> generateRoutes ( $ serviceData , 'api' ) ; return $ files ; } | Create route files |
53,752 | private function generateRoutes ( stdClass $ service , string $ type ) { switch ( $ type ) { case 'api' : $ destination = $ service -> apiRoutesDestination ; break ; case 'admin' : $ destination = $ service -> adminRoutesDestination ; break ; default : return '' ; } $ this -> createFileFromTemplate ( [ "destination" =>... | Generating routes file |
53,753 | public function is_valid ( ) { $ ret = false ; if ( is_null ( $ this -> deleteInsteadOfAppend ) === false && is_null ( $ this -> subscriberIds ) === false && is_null ( $ this -> emails ) === false ) { $ ret = true ; } return $ ret ; } | Validates a subscriber list |
53,754 | protected function _sort ( ) { if ( $ this -> _dirtyIndex ) { $ newIndex = array ( ) ; $ index = 0 ; foreach ( $ this -> _pages as $ hash => $ page ) { $ order = $ page -> getOrder ( ) ; if ( $ order === null ) { $ newIndex [ $ hash ] = $ index ; $ index ++ ; } else { $ newIndex [ $ hash ] = $ order ; } } asort ( $ new... | Sorts the page index according to page order |
53,755 | public function addPage ( $ page ) { if ( $ page === $ this ) { throw new Exception ( 'A page cannot have itself as a parent' ) ; } if ( is_array ( $ page ) ) { $ page = Page :: factory ( $ page ) ; } elseif ( ! $ page instanceof Page ) { throw new Exception ( 'Invalid argument: $page must be an array' ) ; } $ hash = $... | Adds a page to the container |
53,756 | public function addPages ( $ pages ) { if ( $ pages instanceof Container ) { $ pages = iterator_to_array ( $ pages ) ; } if ( ! is_array ( $ pages ) ) { throw new Exception ( 'Invalid argument: $pages must be an array, an instance of Container' ) ; } foreach ( $ pages as $ page ) { $ this -> addPage ( $ page ) ; } retu... | Adds several pages at once |
53,757 | public function removePage ( $ page , $ recursive = false ) { if ( $ page instanceof Page ) { $ hash = $ page -> hashCode ( ) ; } elseif ( is_int ( $ page ) ) { $ this -> _sort ( ) ; if ( ! $ hash = array_search ( $ page , $ this -> _index ) ) { return false ; } } else { return false ; } if ( isset ( $ this -> _pages [... | Removes the given page from the container |
53,758 | public function hasPage ( Page $ page , $ recursive = false ) { if ( array_key_exists ( $ page -> hashCode ( ) , $ this -> _index ) ) { return true ; } elseif ( $ recursive ) { foreach ( $ this -> _pages as $ childPage ) { if ( $ childPage -> hasPage ( $ page , true ) ) { return true ; } } } return false ; } | Checks if the container has the given page |
53,759 | public function toArray ( ) { $ pages = array ( ) ; $ this -> _dirtyIndex = true ; $ this -> _sort ( ) ; $ indexes = array_keys ( $ this -> _index ) ; foreach ( $ indexes as $ hash ) { $ pages [ ] = $ this -> _pages [ $ hash ] -> toArray ( ) ; } return $ pages ; } | Returns an array representation of all pages in container |
53,760 | public function current ( ) { $ this -> _sort ( ) ; current ( $ this -> _index ) ; $ hash = key ( $ this -> _index ) ; if ( isset ( $ this -> _pages [ $ hash ] ) ) { return $ this -> _pages [ $ hash ] ; } else { throw new Exception ( 'Corruption detected in container; ' . 'invalid key found in internal iterator' ) ; } ... | Returns current page |
53,761 | public function getChildren ( ) { $ hash = key ( $ this -> _index ) ; if ( isset ( $ this -> _pages [ $ hash ] ) ) { return $ this -> _pages [ $ hash ] ; } return null ; } | Returns the child container . |
53,762 | public function debug ( $ message = '' , $ context = [ ] , $ role = 'system' , $ times = 0 , $ ttl = 0 ) { if ( $ this -> isSingle ( ) ) { $ this -> log ( $ message , $ context , Logger :: DEBUG , $ role , $ times , $ ttl ) ; } } | Record debug log |
53,763 | public function info ( $ message = '' , $ context = [ ] , $ role = 'system' , $ times = 0 , $ ttl = 0 ) { if ( $ this -> isSingle ( ) ) { $ this -> log ( $ message , $ context , Logger :: INFO , $ role , $ times , $ ttl ) ; } } | Record info log |
53,764 | public function notice ( $ message = '' , $ context = [ ] , $ role = 'system' , $ times = 0 , $ ttl = 0 ) { if ( $ this -> isSingle ( ) ) { $ this -> log ( $ message , $ context , Logger :: NOTICE , $ role , $ times , $ ttl ) ; } } | Record notice log |
53,765 | public function warning ( $ message = '' , $ context = [ ] , $ role = 'system' , $ times = 0 , $ ttl = 0 ) { if ( $ this -> isSingle ( ) ) { $ this -> log ( $ message , $ context , Logger :: WARNING , $ role , $ times , $ ttl ) ; } } | Record warning log |
53,766 | public function error ( $ message = '' , $ context = [ ] , $ role = 'system' , $ times = 0 , $ ttl = 0 ) { if ( $ this -> isSingle ( ) ) { $ this -> log ( $ message , $ context , Logger :: ERROR , $ role , $ times , $ ttl ) ; } } | Record error log |
53,767 | public function critical ( $ message = '' , $ context = [ ] , $ role = 'system' , $ times = 0 , $ ttl = 0 ) { if ( $ this -> isSingle ( ) ) { $ this -> log ( $ message , $ context , Logger :: CRITICAL , $ role , $ times , $ ttl ) ; } } | Record critical log |
53,768 | public function alert ( $ message = '' , $ context = [ ] , $ role = 'system' , $ times = 0 , $ ttl = 0 ) { if ( $ this -> isSingle ( ) ) { $ this -> log ( $ message , $ context , Logger :: ALERT , $ role , $ times , $ ttl ) ; } } | Record alert log |
53,769 | public function emergency ( $ message = '' , $ context = [ ] , $ role = 'system' , $ times = 0 , $ ttl = 0 ) { if ( $ this -> isSingle ( ) ) { $ this -> log ( $ message , $ context , Logger :: EMERGENCY , $ role , $ times , $ ttl ) ; } } | Record emergency log |
53,770 | public function handleRequest ( ) { global $ argv ; if ( ! is_array ( $ argv ) || empty ( $ argv ) ) { throw new Exception ( "Invalid value of the cli args array was given." ) ; } $ oCtrlResolver = new CliCtrlResolver ( $ argv ) ; $ oCtrlResolver -> run ( ) ; } | It processes the call parameters of cli - script and passed them to the CliCtrlResolver object . |
53,771 | public function getUser ( ) { if ( ! $ this -> getState ( ) ) { $ oauth_verifier = $ this -> request -> get ( 'oauth_verifier' ) ; if ( $ oauth_verifier !== null ) { $ this -> setState ( App :: STATE_AUTHORIZED ) ; $ secret = $ this -> storage -> getRequestSecret ( ) ; $ oauth_token = $ this -> request -> get ( 'oauth_... | Retrieves the Twitter User . If there s no logged user yet it will check if the user is coming back from the Twitter Auth page and retrieve its tokens . |
53,772 | public function getLoggedUser ( ) { $ credentials = $ this -> storage -> getLoggedUser ( ) ; return is_array ( $ credentials ) ? new User ( $ credentials ) : null ; } | Returns a User object with ArrayAccess . Returns null if there s no logged user . |
53,773 | public function get ( $ path , $ params = [ ] ) { return $ this -> ttools -> makeRequest ( TTools :: API_BASE . '/' . TTools :: API_VERSION . $ path , $ params , 'GET' , false ) ; } | Performs a GET request to the Twitter API |
53,774 | public function post ( $ path , $ params , $ multipart = false ) { return $ this -> ttools -> makeRequest ( TTools :: API_BASE . '/' . TTools :: API_VERSION . $ path , $ params , 'POST' , $ multipart ) ; } | Performs a POST request to the Twitter API |
53,775 | public function getProfile ( array $ params = null ) { if ( count ( $ params ) ) { return $ this -> get ( '/users/show.json' , $ params ) ; } return $ this -> getCredentials ( ) ; } | Gets a user profile . If you want to get another user s profile you just need to provide an array with either the user_id or the screen_name . |
53,776 | public function linkify ( $ message ) { $ message = preg_replace ( '/(https?:\/\/.+?)(\s|$)/' , '<a href="$1">$1</a>$2' , $ message ) ; $ message = preg_replace ( '/#(.+?)(\s|$)/' , '<a href="https://twitter.com/hashtag/$1">#$1</a>$2' , $ message ) ; $ message = preg_replace ( '/@([\w]{1,15})(\b)/' , '<a href="https://... | Renders links hash tags and account mentions of a Tweet message as clickable links |
53,777 | protected function getArg ( $ name ) { switch ( $ this -> action ) { case 'get' ; case 'put' : return $ this -> getURLArg ( $ name ) ; break ; case 'post' ; case 'delete' : return $ this -> getPostArg ( $ name ) ; break ; default : return parent :: getArg ( $ name ) ; break ; } } | Return an argument from request |
53,778 | function createFilter ( $ callbackOrFilterName , $ options = null , $ resursive = false ) { if ( is_callable ( $ callbackOrFilterName ) ) { $ filter = new Callback ( array ( 'callback' => $ callbackOrFilterName , 'arguments' => $ options ) , $ resursive ) ; } elseif ( is_string ( $ callbackOrFilterName ) ) { if ( class... | Factory method to create a filter from various options |
53,779 | public function input ( $ buffer , $ connection ) { $ len = strlen ( $ buffer ) ; $ method = substr ( $ buffer , 0 , strpos ( $ buffer , ' ' ) ) ; if ( $ len >= 8 && ! in_array ( $ method , $ this -> methods ) ) { throw new \ Exception ( 'Bad Request Method' , 400 ) ; } if ( ! strpos ( $ buffer , "\r\n\r\n" ) ) { if ( ... | parse http request package size |
53,780 | public function __doRequest ( $ request , $ location , $ action , $ version , $ one_way = 0 ) { $ this -> __last_request = $ request ; if ( empty ( $ this -> headers ) ) { $ headers = array ( 'Connection: Close' , 'Content-Type: application/soap+xml' ) ; } else { $ headers = $ this -> headers ; } $ soapHeaders = array ... | We override this function from parent to use cURL . |
53,781 | public function setName ( $ name ) { if ( empty ( ( string ) $ name ) ) { throw new ConfigurationException ( 'The configuration must specify a non-empty name for the Tool Provider.' , ConfigurationException :: TOOL_PROVIDER ) ; } else { $ this -> name = ( string ) $ name ; } } | Set human - readable name of Tool Provider |
53,782 | public function setID ( $ id ) { if ( empty ( ( string ) $ id ) ) { throw new ConfigurationException ( 'The configuration must specify a non-empty (and globally unique) ID for the Tool Provider.' , ConfigurationException :: TOOL_PROVIDER ) ; } else { $ this -> id = ( string ) $ id ; } } | Set globally unique tokenized ID for Tool Provider |
53,783 | public function setLaunchURL ( $ launchURL ) { if ( empty ( ( string ) $ launchURL ) ) { throw new ConfigurationException ( 'The configuration must specify a valid launch URL for the Tool Provider.' , ConfigurationException :: TOOL_PROVIDER ) ; } else { $ this -> launchURL = ( string ) $ launchURL ; } } | Set the launch URL to which the Tool Consumer will pass the initial request |
53,784 | public function setDescription ( $ description ) { $ this -> description = ( empty ( ( string ) $ description ) ? false : ( string ) $ description ) ; } | Set the human - readable description of the Tool Provider |
53,785 | public function setIconURL ( $ iconURL ) { $ this -> iconURL = ( empty ( ( string ) $ iconURL ) ? false : ( string ) $ iconURL ) ; } | Set URL of 16x16 pixel icon image for Tool Provider |
53,786 | public function setLaunchPrivacy ( $ launchPrivacy ) { if ( ! is_a ( $ launchPrivacy , LaunchPrivacy :: class ) && ! LaunchPrivacy :: isValid ( $ launchPrivacy ) ) { throw new ConfigurationException ( "Invalid launch privacy setting '$launchPrivacy'" , ConfigurationException :: TOOL_PROVIDER ) ; } else { $ this -> laun... | Set the level of user profile privacy requested of the Tool Consumer |
53,787 | public function setOption ( $ option , array $ properties ) { if ( ! is_a ( $ option , Option :: class ) && ! Option :: isValid ( $ option ) ) { throw new ConfigurationException ( "Invalid configuration option '$option'" , ConfigurationException :: TOOL_PROVIDER ) ; } else { $ this -> options [ ( string ) $ option ] = ... | Set a tool placement option |
53,788 | public function setOptionProperty ( $ option , $ property , $ value ) { if ( ! is_a ( $ option , Option :: class ) && ! Option :: isValid ( $ option ) ) { throw new ConfigurationException ( "Invalid configuration option '$option'" , ConfigurationException :: TOOL_PROVIDER ) ; } else { $ this -> options [ ( string ) $ o... | Set a particular property of a particular tool placment option |
53,789 | private function getOptionsElement ( DOMDocument $ config , $ option , array $ properties ) { if ( is_a ( $ option , Option :: class ) || Option :: isValid ( $ option ) ) { $ options = $ config -> createElementNS ( self :: LTICM , 'lticm:options' ) ; $ options -> setAttribute ( 'name' , $ option ) ; if ( ! array_key_ex... | Build a tool placement option element |
53,790 | public function field ( $ field ) { return $ this -> fieldFactory -> createFromField ( $ this -> getFieldData ( $ field ) , $ this -> getFieldValue ( $ field ) ) ; } | Get a field from the group . |
53,791 | private function getFieldData ( $ field ) { if ( ! isset ( $ this -> _fieldData [ $ field ] ) ) { foreach ( $ this -> fields as $ f ) { if ( ( $ f [ 'key' ] === $ field ) || ( $ f [ 'name' ] === $ field ) ) { $ this -> _fieldData [ $ field ] = $ f ; break ; } } } if ( isset ( $ this -> _fieldData [ $ field ] ) ) { retu... | Get field data by field name or key . |
53,792 | private function getFieldValue ( $ field ) { return isset ( $ this -> values [ $ field ] ) ? $ this -> values [ $ field ] : null ; } | Get field value by name or key . |
53,793 | public function values ( ) { return array_filter ( $ this -> blueprint , function ( $ value ) { return ! is_string ( $ value ) && ! $ value instanceof HasOneRelationship && ! $ value instanceof Dependency ; } ) ; } | Return current blueprint values including dependencies and relationships |
53,794 | public function mailTo ( String $ mail , String $ value = NULL , Array $ attributes = [ ] ) : String { if ( ! IS :: email ( $ mail ) ) { throw new InvalidArgumentException ( 'Error' , 'emailParameter' , '1.($mail)' ) ; } $ attributes [ 'href' ] = 'mailto:' . $ mail ; return $ this -> _multiElement ( 'a' , $ value ?? $ ... | Creates mail to element |
53,795 | public function font ( String $ str , String $ size = NULL , String $ color = NULL , String $ face = NULL , Array $ attributes = [ ] ) : String { if ( ! empty ( $ size ) ) { $ attributes [ 'size' ] = $ size ; } if ( ! empty ( $ color ) ) { $ attributes [ 'color' ] = $ color ; } if ( ! empty ( $ face ) ) { $ attributes ... | Creates font elements |
53,796 | public function script ( String $ path ) : String { if ( ! IS :: url ( $ path ) ) { $ path = Request :: getBaseURL ( Base :: suffix ( $ path , '.js' ) ) ; } $ attributes [ 'href' ] = $ path ; $ attributes [ 'type' ] = 'text/javascript' ; return $ this -> _singleElement ( __FUNCTION__ , $ attributes ) ; } | Creates script element |
53,797 | public function heading ( String $ str , Int $ type = 3 , Array $ attributes = [ ] ) : String { return $ this -> _multiElement ( 'h' . $ type , $ str , $ attributes ) ; } | Gets head element |
53,798 | public function element ( String $ element , String $ str = NULL , Array $ attributes = [ ] ) : String { return $ this -> _multiElement ( $ element , $ str , $ attributes ) ; } | Gets multiple element |
53,799 | public function multiAttr ( String $ str , Array $ array = [ ] ) : String { $ perm = $ this -> settings [ 'attr' ] [ 'perm' ] ?? NULL ; if ( is_array ( $ array ) ) { $ open = '' ; $ close = '' ; $ att = '' ; foreach ( $ array as $ k => $ v ) { if ( ! is_numeric ( $ k ) ) { $ element = $ k ; if ( ! is_array ( $ v ) ) { ... | Gets multiple attributes |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.