idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
9,100 | static public function removeRecursive ( $ directory ) { $ sourceDir = realpath ( $ directory ) ; if ( ! $ sourceDir ) { throw new ezcBaseFileNotFoundException ( $ directory , 'directory' ) ; } $ d = @ dir ( $ sourceDir ) ; if ( ! $ d ) { throw new ezcBaseFilePermissionException ( $ directory , ezcBaseFileException :: ... | Removes files and directories recursively from a file system |
9,101 | static public function copyRecursive ( $ source , $ destination , $ depth = - 1 , $ dirMode = 0775 , $ fileMode = 0664 ) { if ( ! is_file ( $ source ) && ! is_dir ( $ source ) ) { throw new ezcBaseFileNotFoundException ( $ source ) ; } if ( is_file ( $ destination ) || is_dir ( $ destination ) ) { throw new ezcBaseFile... | Recursively copy a file or directory . |
9,102 | public function request ( $ path , $ body = null , $ httpMethod = 'GET' , array $ options = array ( ) ) { $ headers = array ( ) ; $ options = array_merge ( $ this -> options , $ options ) ; if ( isset ( $ options [ 'headers' ] ) ) { $ headers = $ options [ 'headers' ] ; unset ( $ options [ 'headers' ] ) ; } $ headers =... | Intermediate function which does three main things |
9,103 | public function createRequest ( $ httpMethod , $ path , $ body = null , array $ headers = array ( ) , array $ options = array ( ) ) { $ version = ( isset ( $ options [ 'api_version' ] ) ? "/" . $ options [ 'api_version' ] : "" ) ; $ path = $ version . $ path ; return $ this -> client -> createRequest ( $ httpMethod , $... | Creating a request with the given arguments |
9,104 | public function setBody ( RequestInterface $ request , $ body , $ options ) { return RequestHandler :: setBody ( $ request , $ body , $ options ) ; } | Set request body in correct format |
9,105 | public function getClient ( ) { if ( ! $ this -> client ) { $ client = new GuzzleHelper ( ) ; $ this -> configureClient ( $ client ) ; return $ this -> client = $ client -> getClient ( ) ; } return $ this -> client ; } | Get new Curl instance |
9,106 | public function performRequest ( $ url ) { $ client = $ this -> getClient ( ) ; return $ this -> response = $ client -> get ( $ url ) ; } | Perform HTTP request |
9,107 | public function getPageTitle ( ) { if ( ! $ this -> parser ) { return ; } $ node = $ this -> parser -> find ( 'title' , 0 ) ; if ( $ node ) { return $ node -> innertext ; } } | Get page title |
9,108 | public function getPageDescription ( ) { if ( ! $ this -> parser ) { return ; } $ node = $ this -> parser -> find ( 'meta[name=description]' , 0 ) ; if ( $ node ) { return $ node -> getAttribute ( 'content' ) ; } } | Get page description |
9,109 | public function getPageKeywords ( ) { if ( ! $ this -> parser ) { return ; } $ node = $ this -> parser -> find ( 'meta[name=keywords]' , 0 ) ; if ( $ node ) { return $ node -> getAttribute ( 'content' ) ; } } | Get page keywords |
9,110 | public function getPageCanonical ( ) { if ( ! $ this -> parser ) { return ; } $ node = $ this -> parser -> find ( 'link[rel=canonical]' , 0 ) ; if ( $ node ) { return $ node -> getAttribute ( 'href' ) ; } } | Get page canonical url |
9,111 | public function getPageFavicon ( ) { if ( ! $ this -> parser ) { return ; } $ node = $ this -> parser -> find ( 'link[rel=shortcut], link[rel=icon], link[rel=shortcut icon]' , 0 ) ; if ( $ node ) { return $ node -> getAttribute ( 'href' ) ; } } | Get page favicon url |
9,112 | public function getPageMetas ( ) { if ( ! $ this -> parser ) { return ; } $ nodes = $ this -> parser -> find ( 'meta' ) ; $ metas = array ( ) ; foreach ( $ nodes as $ node ) { if ( $ node -> hasAttribute ( 'name' ) ) { $ metas [ $ node -> getAttribute ( 'name' ) ] = $ node -> getAttribute ( 'content' ) ; } elseif ( $ n... | Get meta description |
9,113 | public function getPageFeeds ( ) { if ( ! $ this -> parser ) { return ; } $ nodes = $ this -> parser -> find ( 'link' ) ; $ feeds = array ( ) ; $ types = array ( 'application/rss+xml' , 'application/atom+xml' , 'text/xml' , ) ; foreach ( $ nodes as $ node ) { $ type = strtolower ( $ node -> getAttribute ( 'type' ) ) ; ... | Get rss feeds urls |
9,114 | public function clear ( ) { $ this -> response = null ; if ( $ this -> parser ) { $ this -> parser -> clear ( ) ; } $ this -> parser = null ; } | Clean up memory |
9,115 | private static function data_type ( $ column ) { global $ wpdb ; $ sql = $ column [ 'type' ] ; if ( self :: DECIMAL == $ column [ 'type' ] ) { $ sql .= sprintf ( '(%d, %d)' , $ column [ 'max_digit' ] , $ column [ 'float' ] ) ; } if ( isset ( $ column [ 'length' ] ) ) { $ sql .= sprintf ( '(%d)' , $ column [ 'length' ] ... | Build data type on create statement |
9,116 | public static function filter ( $ column ) { $ column = wp_parse_args ( $ column , [ 'type' => '' , 'null' => false , ] ) ; if ( ! self :: exists ( $ column [ 'type' ] ) ) { throw new \ Exception ( 'You must properly specify the data type of column.' ) ; } if ( self :: is_length_required ( $ column [ 'type' ] ) && ! is... | Filter column array |
9,117 | protected function convertArgs ( $ step ) { if ( $ step instanceof Operator ) { $ arguments = $ step -> getArguments ( ) ; } else { $ arguments = $ step ; } if ( is_array ( $ arguments ) ) { $ values = [ ] ; foreach ( $ arguments as $ key => $ args ) { if ( $ args instanceof Operator ) { if ( is_string ( $ key ) ) { $ ... | Recursive convert args |
9,118 | public function makeCall ( array $ input ) { $ input = array_replace_recursive ( array ( 'function' => null , ) , $ input , array ( 'arguments' => array ( ) , 'options' => array ( ) , 'headers' => array ( ) , ) ) ; if ( empty ( $ input [ 'function' ] ) ) { throw new EssenceException ( 'The SOAP function is not set' ) ;... | Make SOAP call |
9,119 | public function ask ( $ question , $ weight = "y" ) { $ question = self :: format ( $ question ) ; $ y = $ weight == 'y' ? 'Y' : 'y' ; $ n = $ weight == 'n' ? 'N' : 'n' ; $ answer = $ this -> prompt ( "$question [$y/$n]" ) ; $ line = trim ( strtolower ( $ answer ) ) ; if ( empty ( $ line ) ) { $ line = $ weight ; } ret... | Asks the user a question . If a y value is entered returns true |
9,120 | public function prompt ( $ question ) { $ question = self :: format ( $ question ) ; $ this -> write ( "$question: " ) ; $ handle = fopen ( "php://stdin" , "r" ) ; return fgets ( $ handle ) ; } | Prompts the user for input |
9,121 | public function updateProgress ( $ text ) { $ text = self :: format ( $ text ) ; if ( $ this -> progressValue ) { $ len = strlen ( $ this -> progressValue ) ; fwrite ( STDOUT , "\033[{$len}D" ) ; } $ this -> progressValue = $ text ; fwrite ( STDOUT , $ this -> progressValue ) ; } | Updates the output with new text |
9,122 | public function setBackplaneProperties ( array $ params ) { if ( ! isset ( $ params [ 'server' ] ) ) { throw new MissingArgumentException ( 'server' ) ; } if ( ! isset ( $ params [ 'bus' ] ) ) { throw new MissingArgumentException ( 'bus' ) ; } return $ this -> post ( 'set_backplane_properties' , $ params ) ; } | Configures Backplane server used to communicate with all of the Backplane enabled widgets on a page . |
9,123 | public function build ( $ name , Collection $ fields = null ) { $ path = $ this -> getClassFilePath ( $ name ) ; $ contents = view ( '_hierarchy::entities.form' , [ 'name' => $ this -> getClassName ( $ name ) , 'fields' => $ fields ? : [ ] ] ) -> render ( ) ; $ this -> write ( $ path , $ contents ) ; } | Builds a source form |
9,124 | protected function getFileNames ( string $ directory = 'default' ) : array { $ directoryIterator = $ this -> getDirectoryIterator ( $ directory ) ; $ files = [ ] ; foreach ( $ directoryIterator as $ file ) { $ this -> resolveFile ( $ file , $ files ) ; } return $ files ; } | Get list of paths in directory |
9,125 | private function resolveFile ( \ DirectoryIterator $ file , array & $ files ) { if ( $ file -> isDir ( ) && ! $ file -> isDot ( ) ) { $ files = Tools :: resolvePath ( $ files , $ this -> getFileNames ( ) ) ; } if ( $ file -> isFile ( ) && ! $ file -> isLink ( ) && $ file -> isReadable ( ) ) { $ files = Tools :: resolve... | Add file to list or scan directory |
9,126 | private function getDirectoryIterator ( string $ directory ) : \ DirectoryIterator { if ( $ directory === 'default' ) { return new \ DirectoryIterator ( $ this -> dataDirectory ) ; } return new \ DirectoryIterator ( $ directory ) ; } | Get Directory Iterator |
9,127 | protected function getDateTimeFormat ( $ parameters ) { $ format = 'Y-m-d H:i:s' ; $ parametersCount = count ( $ parameters ) ; if ( $ parametersCount > $ this -> amountOfParameters ) { $ format = $ parameters [ $ parametersCount - 1 ] ; } return $ format ; } | Gets a date time format from the parameters if given or a default one . |
9,128 | protected function getDateTimes ( array $ parameters , $ format ) { if ( ! $ this -> dateTimeParameters ) { return [ ] ; } $ datetimes = [ ] ; for ( $ i = 0 ; $ i < $ this -> amountOfParameters ; ++ $ i ) { $ datetime = \ DateTime :: createFromFormat ( $ format , $ parameters [ $ i ] ) ; if ( $ datetime === false ) { t... | Interprets the given parameters as date times and returns them . |
9,129 | public function jsonSerialize ( ) { $ json = array ( ) ; foreach ( get_object_vars ( $ this ) as $ var => $ val ) { if ( $ val instanceof \ DateTime ) $ json [ $ var ] = $ val -> getTimestamp ( ) ; else $ json [ $ var ] = $ val ; } return $ json ; } | Get a json serialized version of this object . |
9,130 | protected function doSaveDependingOnFiles ( $ id , $ data , array $ files , $ lifeTime = 0 ) { $ dependencies = [ NetteCache :: TAGS => [ 'doctrine' ] , NetteCache :: FILES => $ files ] ; if ( $ lifeTime != 0 ) { $ dependencies [ NetteCache :: EXPIRE ] = time ( ) + $ lifeTime ; } $ this -> cache -> save ( $ id , $ data... | Puts data into the cache and makes them depending on the files . |
9,131 | protected function toMarkdown ( $ content ) { $ tmpfname = tempnam ( sys_get_temp_dir ( ) , 'fillet' ) ; file_put_contents ( $ tmpfname , $ content ) ; $ cmd = $ this -> config [ 'pandoc' ] [ 'bin' ] . ' --no-wrap -f html -t markdown ' . $ tmpfname ; $ content = shell_exec ( $ cmd ) ; unlink ( $ tmpfname ) ; return $ c... | Converts content from HTML to Markdown via pandoc |
9,132 | public function get ( $ id ) { $ resource = self :: $ BASE_URI . '/' . $ this -> cityId . '/bairros/' . $ this -> neighborhoodId . '/logradouro/' . $ id ; $ data = $ this -> execute ( self :: HTTP_GET , $ resource ) ; return $ data ; } | Gets the street data according to the id parameter |
9,133 | public function addBefore ( $ before , $ name , SymfonyRoute $ route ) { $ newRoute = $ route ; foreach ( $ this -> all ( ) as $ routeName => $ route ) { if ( null !== $ newRoute && $ before === $ routeName ) { $ this -> add ( $ name , $ newRoute ) ; $ newRoute = null ; } if ( null === $ newRoute ) { $ this -> add ( $ ... | Adds a route before another . |
9,134 | public function key_search ( array $ array , $ key , $ value ) { foreach ( $ array as $ key => $ a ) { if ( isset ( $ a [ $ key ] ) && $ a [ $ key ] == $ value ) { return $ key ; } } return false ; } | Get index of array member with specified key |
9,135 | public function prop_search ( array $ array , $ property , $ value ) { foreach ( $ array as $ key => $ a ) { if ( property_exists ( $ a , $ property ) && $ a -> { $ property } == $ value ) { return $ key ; } } return false ; } | Search array member with specified property |
9,136 | private function queueConfigs ( ) { $ config = $ this -> getConfig ( ) ; if ( ! isset ( $ config [ 'schedulers' ] ) ) { yield $ config ; return ; } foreach ( $ config [ 'schedulers' ] as $ child_config ) { yield mergeConfigOptions ( $ config , $ child_config ) ; } } | return only the normalized queue configurations |
9,137 | public function parseBody ( $ line ) { $ this -> mailParser -> parseBody ( $ line ) ; $ this -> size += strlen ( $ line ) ; } | Parses each line of the digest body . |
9,138 | public function finish ( ) { $ digest = new ezcMailRfc822Digest ( $ this -> mailParser -> finish ( ) ) ; ezcMailPartParser :: parsePartHeaders ( $ this -> headers , $ digest ) ; $ digest -> size = $ this -> size ; return $ digest ; } | Returns a ezcMailRfc822Digest with the digested mail in it . |
9,139 | protected function typeEnum ( Fluent $ column ) { $ allowed = array_map ( function ( $ a ) { return "'{$a}'" ; } , $ column -> allowed ) ; return "varchar(255) check (\"{$column->name}\" in (" . implode ( ', ' , $ allowed ) . '))' ; } | Create the column definition for an enum type . |
9,140 | public function tunnel ( $ host , $ port ) { $ stream = @ ssh2_tunnel ( $ this -> connection , $ command ) ; if ( ! $ stream ) { throw new \ Exception ( 'Cannot create tunnel to: ' . $ host . ' on port' . $ port ) ; } return $ stream ; } | Tunnels a connection |
9,141 | public function merge ( array $ logics ) { foreach ( $ logics as $ name => $ specs ) { $ this -> set ( $ name , $ specs ) ; } return $ this ; } | Merge multiple logics |
9,142 | protected function before ( Context $ context ) { $ context -> forwarder = $ context -> forwarder ? : [ $ this , 'forward' ] ; return parent :: before ( $ context ) ; } | Setup context before process |
9,143 | protected function route ( Context $ context ) { $ this -> logger -> debug ( 'kernel.route: find route from http query' ) ; if ( $ context -> logic ) { $ this -> logger -> debug ( 'kernel.route: forward to #' . $ context -> logic -> name . ', skip routing' ) ; return $ context ; } $ query = $ context -> request -> meth... | Find route from context |
9,144 | public static function formatAttributes ( $ destroy_callback = null , $ create_callback = null , $ sticky = null , $ life = null , $ classname = null , $ width = null ) { $ options = [ ] ; if ( $ destroy_callback !== null ) { $ options [ 'destroyed' ] = $ destroy_callback ; } if ( $ create_callback !== null ) { $ optio... | Static method for retrieving the options - array . |
9,145 | private function getFacebookSession ( $ accessToken ) { $ facebookSession = new FacebookSession ( $ accessToken ) ; try { $ facebookSession -> validate ( ) ; return $ facebookSession ; } catch ( FacebookRequestException $ ex ) { throw new FacebookException ( $ ex -> getMessage ( ) ) ; } catch ( \ Exception $ ex ) { thr... | Get the FacebookSession through an access_token . |
9,146 | public function connect ( $ accessToken = null ) { if ( is_null ( $ accessToken ) ) { return $ this -> getRedirectLoginHelper ( ) ; } else { return $ this -> getFacebookSession ( $ accessToken ) ; } } | Trigger method that can get either a facebook session with access token or a redirect login helper . |
9,147 | public function process ( ) { try { $ redirectLoginHelper = $ this -> getRedirectLoginHelper ( ) ; return $ this -> connect ( $ redirectLoginHelper -> getSessionFromRedirect ( ) -> getToken ( ) ) ; } catch ( FacebookRequestException $ ex ) { throw new FacebookException ( $ ex -> getMessage ( ) ) ; } catch ( \ Exception... | Get the redirect postback sent from facebook processed ready to a facebook session . |
9,148 | public function api ( FacebookSession $ fbsession , $ method , $ call ) { try { $ facebookResponse = ( new FacebookRequest ( $ fbsession , $ method , $ call ) ) -> execute ( ) ; return $ graphObject = $ facebookResponse -> getGraphObject ( ) ; } catch ( FacebookRequestException $ ex ) { throw new FacebookException ( $ ... | Make a request into facebook api . |
9,149 | public function change ( $ appId , $ appSecret , $ redirectUrl = null ) { \ Config :: set ( 'facebook::app.appId' , $ appId ) ; \ Config :: set ( 'facebook::app.appSecret' , $ appSecret ) ; if ( ! is_null ( $ redirectUrl ) ) \ Config :: set ( 'facebook::app.redirectUrl' , $ redirectUrl ) ; return $ this ; } | Change the appId appSecret and redirectUrl before connecting . |
9,150 | public function has ( $ name ) : bool { try { $ this -> container -> get ( $ name ) ; return true ; } catch ( \ Exception $ e ) { return false ; } } | Check if service is registered . |
9,151 | public function transform ( $ translation ) { $ translation = $ this -> entityToArray ( BlockTranslation :: class , $ translation ) ; return [ 'id' => ( int ) $ translation [ 'id' ] , 'langCode' => $ translation [ 'lang_code' ] , 'title' => $ translation [ 'title' ] , 'body' => $ translation [ 'body' ] , 'customFields'... | Transforms block translation entity |
9,152 | public function toSeconds ( ) { $ seconds = $ this -> s ; $ seconds += $ this -> i * 60 ; $ seconds += $ this -> h * 3600 ; if ( $ this -> days ) { $ seconds += $ this -> days * 86400 ; } else { if ( $ this -> d ) { $ seconds += $ this -> d * 86400 ; } if ( $ this -> m ) { trigger_error ( 'Calculating seconds for inter... | Convert interval to number of seconds |
9,153 | protected static function isQuirkMode ( ) { if ( null === self :: $ quirkMode ) { self :: $ quirkMode = version_compare ( PHP_VERSION , '5.5.4' , '<' ) && version_compare ( PHP_VERSION , '5.5.0' , '>' ) || version_compare ( PHP_VERSION , '5.4.20' , '<' ) ; } return self :: $ quirkMode ; } | Test if PHP version has quirks |
9,154 | protected function compileInitialization ( Buffer $ buffer ) { $ buffer -> write ( '$app = new Zicht\Tool\Application(' ) -> asPhp ( $ this -> appName ) -> raw ( ', Zicht\Version\Version::fromString(' ) -> asPhp ( $ this -> appVersion ) -> raw ( ') ?: new Zicht\Version\Version(), Zicht\Tool\Configuration\ConfigurationL... | Writes the initialization code for a dynamic build |
9,155 | public function reset ( ) { $ this -> _current_cfg = [ ] ; $ this -> _cfg = [ ] ; $ this -> _root_element = false ; $ this -> _current_element = false ; foreach ( $ this -> _defaults as $ k => $ v ) { $ this -> _current_cfg [ $ k ] = $ v ; } return $ this ; } | Sets the configuration back to its default value |
9,156 | public function export_config ( ) { if ( isset ( $ this -> _root_element ) ) { return bbn \ str :: make_readable ( $ this -> _root_element -> get_config ( ) ) ; } return bbn \ str :: make_readable ( $ this -> _cfg ) ; } | Returns the current configuration |
9,157 | public function option ( $ opt ) { $ args = \ func_get_args ( ) ; if ( \ is_array ( $ opt ) && isset ( $ opt [ 0 ] , $ this -> _defaults [ $ opt [ 0 ] ] ) ) { $ this -> _current_cfg [ $ opt [ 0 ] ] = $ opt [ 1 ] ; } else if ( isset ( $ args [ 0 ] , $ args [ 1 ] , $ this -> _defaults [ $ args [ 0 ] ] ) ) { $ this -> _cu... | Change an option in the current configuration - Chainable |
9,158 | public function passesOrFail ( $ action = null ) { if ( ! $ this -> passes ( $ action ) ) { throw new ValidatorException ( $ this -> errorsBag ( ) ) ; } return true ; } | Pass the data and the rules to the validator or throws ValidatorException |
9,159 | protected function parserValidationRules ( $ rules , $ id = null ) { if ( $ id === null ) { return $ rules ; } array_walk ( $ rules , function ( & $ rules , $ field ) use ( $ id ) { if ( ! is_array ( $ rules ) ) { $ rules = explode ( "|" , $ rules ) ; } foreach ( $ rules as $ ruleIdx => $ rule ) { @ list ( $ name , $ p... | Parser Validation Rules |
9,160 | public function convert ( ResponseInterface $ psrResponse ) { return new BrowserKitResponse ( ( string ) $ psrResponse -> getBody ( ) , $ psrResponse -> getStatusCode ( ) ? : 200 , $ this -> flattenHeaders ( $ psrResponse -> getHeaders ( ) ) ) ; } | Convert a PSR - 7 response to a codeception response |
9,161 | public static function fromObjects ( $ array , $ key ) { $ elements = array ( ) ; foreach ( $ array as $ element ) { $ result = call_user_func ( array ( $ element , $ key ) ) ; $ elements = array_merge ( $ elements , is_array ( $ result ) ? $ result : array ( $ result ) ) ; } return new self ( $ elements ) ; } | Creates a partition from a set of objects . |
9,162 | public function partitionBy ( $ key ) { $ partition = array ( ) ; foreach ( $ this -> elements as $ element ) { $ newEquivalenceClass = true ; for ( $ i = 0 ; $ i < count ( $ partition ) ; $ i ++ ) if ( call_user_func ( array ( $ element , $ key ) , $ partition [ $ i ] [ 0 ] ) ) { $ partition [ $ i ] [ ] = $ element ; ... | Partitions the elements using an equivalence relation . |
9,163 | public static function escape ( $ mixed , $ quote_style = ENT_QUOTES , $ charset = 'UTF-8' ) { if ( is_string ( $ mixed ) ) { $ mixed = htmlspecialchars ( $ mixed , $ quote_style , $ charset ) ; } elseif ( is_object ( $ mixed ) || is_array ( $ mixed ) ) { foreach ( $ mixed as $ k => & $ v ) { if ( $ v ) { if ( is_objec... | Recursively htmlspecialchars string properties of objects and arrays |
9,164 | public static function unescape ( $ mixed , $ quote_style = ENT_QUOTES , $ charset = 'UTF-8' ) { if ( is_string ( $ mixed ) ) { $ mixed = str_replace ( '&' , '&' , $ mixed ) ; $ mixed = str_replace ( ''' , '\'' , $ mixed ) ; $ mixed = str_replace ( '"' , '"' , $ mixed ) ; $ mixed = str_replace ( '<' , ... | Recursively unhtmlspecialchars string properties of objects and arrays |
9,165 | public function authenticate ( Request $ request ) { $ email = $ request -> input ( self :: AUTH_PARAM_EMAIL , null ) ; $ password = $ request -> input ( self :: AUTH_PARAM_PASSWORD , null ) ; if ( $ email !== null && $ password !== null && ( $ user = User :: query ( ) -> where ( User :: FIELD_EMAIL , '=' , strtolower ... | Issue auth token . |
9,166 | public function getFilteredParameter ( $ name ) { if ( array_key_exists ( $ name , $ this -> parameters ) == false ) { throw new \ Exception ( 'Parameter ' . $ name . ' does not exist.' ) ; } $ value = $ this -> parameters [ $ name ] ; return $ value ; } | Apply any filters necessary to the parameter |
9,167 | public function get_extension ( ) { parent :: get_extension ( ) ; if ( ! $ this -> ext2 && $ this -> file ) { if ( function_exists ( 'exif_imagetype' ) ) { if ( $ r = exif_imagetype ( $ this -> file ) ) { if ( ! array_key_exists ( $ r , bbn \ file \ image :: $ allowed_extensions ) ) { $ this -> ext = false ; } } else {... | Returns the extension of the image . If the file has jpg extension will return jpeg . |
9,168 | public function display ( ) { if ( $ this -> test ( ) ) { if ( ! headers_sent ( ) ) { header ( 'Content-Type: image/' . $ this -> ext2 ) ; } if ( class_exists ( '\\Imagick' ) ) { echo $ this -> img ; $ this -> img -> clear ( ) ; $ this -> img -> destroy ( ) ; } else { \ call_user_func ( 'image' . $ this -> ext2 , $ thi... | Sends the image with Content - Type . |
9,169 | public function crop ( $ w , $ h , $ x , $ y ) { if ( $ this -> test ( ) ) { $ args = \ func_get_args ( ) ; foreach ( $ args as $ arg ) { if ( ! is_numeric ( $ arg ) ) { $ this -> error = \ defined ( 'BBN_ARGUMENTS_MUST_BE_NUMERIC' ) ? BBN_ARGUMENTS_MUST_BE_NUMERIC : 'Arguments must be numeric' ; } } if ( $ w + $ x > $... | Returns a crop of the image . |
9,170 | public function brightness ( $ val = '+' ) { if ( $ this -> test ( ) ) { if ( class_exists ( '\\Imagick' ) ) { $ p = ( $ val == '-' ) ? 90 : 110 ; if ( ! $ this -> img -> modulateImage ( $ p , 100 , 100 ) ) { $ this -> error = \ defined ( 'BBN_THERE_HAS_BEEN_A_PROBLEM' ) ? BBN_THERE_HAS_BEEN_A_PROBLEM : 'There has been... | Adjusts the image s brightness . |
9,171 | public function contrast ( $ val = '+' ) { if ( $ this -> test ( ) ) { if ( class_exists ( '\\Imagick' ) ) { $ p = ( $ val == '-' ) ? 0 : 1 ; if ( ! $ this -> img -> contrastImage ( $ p ) ) { $ this -> error = \ defined ( 'BBN_THERE_HAS_BEEN_A_PROBLEM' ) ? BBN_THERE_HAS_BEEN_A_PROBLEM : 'There has been a problem' ; } }... | Adjusts the image contrast . |
9,172 | public function grayscale ( ) { if ( $ this -> test ( ) ) { if ( class_exists ( '\\Imagick' ) ) { if ( ! $ this -> img -> modulateImage ( 100 , 0 , 100 ) ) { $ this -> error = \ defined ( 'BBN_THERE_HAS_BEEN_A_PROBLEM' ) ? BBN_THERE_HAS_BEEN_A_PROBLEM : 'There has been a problem' ; } } else if ( function_exists ( 'imag... | Converts the image s color to grayscale . |
9,173 | public function negate ( ) { if ( $ this -> test ( ) ) { if ( class_exists ( '\\Imagick' ) ) { if ( ! $ this -> img -> negateImage ( false ) ) { $ this -> error = \ defined ( 'BBN_THERE_HAS_BEEN_A_PROBLEM' ) ? BBN_THERE_HAS_BEEN_A_PROBLEM : 'There has been a problem' ; } } else if ( function_exists ( 'imagefilter' ) ) ... | Converts the image s color to negative . |
9,174 | public function polaroid ( ) { if ( $ this -> test ( ) ) { if ( class_exists ( '\\Imagick' ) ) { if ( ! $ this -> img -> polaroidImage ( new \ ImagickDraw ( ) , 0 ) ) { $ this -> error = \ defined ( 'BBN_THERE_HAS_BEEN_A_PROBLEM' ) ? BBN_THERE_HAS_BEEN_A_PROBLEM : 'There has been a problem' ; } } } return $ this ; } | Converts the image s color with polaroid filter . |
9,175 | public function thumbs ( $ dest = '.' , $ sizes = [ [ false , 960 ] , [ false , 480 ] , [ false , 192 ] , [ false , 96 ] , [ false , 48 ] ] , $ mask = '_%s' , $ crop = false , $ bigger = false ) { if ( $ this -> test ( ) && is_dir ( $ dest ) ) { $ this -> get_extension ( ) ; $ w = $ this -> get_width ( ) ; $ h = $ this... | Creates miniature of the image |
9,176 | public function toString ( ) { if ( $ this -> test ( ) ) { if ( class_exists ( '\\Imagick' ) ) $ m = $ this -> img ; else { ob_start ( ) ; \ call_user_func ( 'image' . $ this -> ext2 , $ this -> img ) ; $ m = ob_get_contents ( ) ; ob_end_clean ( ) ; } return 'data:image/' . $ this -> ext . ';base64,' . base64_encode ( ... | Return the image as string . |
9,177 | public function addProvider ( PathProviderInterface $ provider , $ priority = 0 ) { $ this -> providers [ $ priority ] [ ] = $ provider ; $ this -> sorted = null ; } | For automatically injecting provider should be registered as DI service with tag layout . resource . path_provider |
9,178 | public function getLastVersion ( $ page_id ) { $ qb = $ this -> createQueryBuilder ( 'p' ) ; $ qb -> where ( 'p.original=:page_id' ) -> orderBy ( 'p.createdAt' , 'DESC' ) -> setParameter ( ':page_id' , $ page_id ) ; $ result = $ qb -> getQuery ( ) -> setMaxResults ( 1 ) -> getResult ( ) ; if ( is_null ( $ result ) ) { ... | Get last version for a page |
9,179 | public function findBySlug ( $ path ) { $ qb = $ this -> createQueryBuilder ( 'p' ) ; $ qb instanceof QueryBuilder ; $ qb -> add ( 'where' , $ qb -> expr ( ) -> like ( 'p.slug' , $ qb -> expr ( ) -> lower ( ':searched_term' ) ) ) -> setParameter ( 'searched_term' , $ path ) ; return $ qb -> getQuery ( ) -> getResult ( ... | Find page by slug |
9,180 | protected function initializeState ( RawLayout $ rawLayout , ContextInterface $ context ) { $ this -> rawLayout = $ rawLayout ; $ this -> context = $ context ; $ this -> dataAccessor = new DataAccessor ( $ this -> registry , $ this -> context ) ; $ this -> optionsResolver = new BlockOptionsResolver ( $ this -> registry... | Initializes the state of this factory |
9,181 | protected function clearState ( ) { $ this -> rawLayout = null ; $ this -> context = null ; $ this -> dataAccessor = null ; $ this -> optionsResolver = null ; $ this -> typeHelper = null ; $ this -> blockBuilder = null ; $ this -> block = null ; } | Clears the state of this factory |
9,182 | protected function buildBlocks ( $ rootId ) { if ( ! $ this -> rawLayout -> hasProperty ( $ rootId , RawLayout :: RESOLVED_OPTIONS , true ) ) { $ this -> buildBlock ( $ rootId ) ; } $ iterator = $ this -> rawLayout -> getHierarchyIterator ( $ rootId ) ; foreach ( $ iterator as $ id ) { if ( ! $ this -> rawLayout -> has... | Builds all blocks starting with and including the given root block |
9,183 | protected function buildBlockViews ( $ rootId ) { $ views = [ ] ; $ rootView = $ this -> buildBlockView ( $ rootId ) ; $ views [ $ rootId ] = $ rootView ; $ iterator = $ this -> rawLayout -> getHierarchyIterator ( $ rootId ) ; foreach ( $ iterator as $ id ) { $ parentView = $ views [ $ iterator -> getParent ( ) ] ; $ v... | Builds views for all blocks starting with and including the given root block |
9,184 | protected function buildBlock ( $ id ) { $ blockType = $ this -> rawLayout -> getProperty ( $ id , RawLayout :: BLOCK_TYPE , true ) ; $ options = $ this -> rawLayout -> getProperty ( $ id , RawLayout :: OPTIONS , true ) ; $ types = $ this -> typeHelper -> getTypes ( $ blockType ) ; $ this -> setBlockResolvedOptions ( $... | Builds the block |
9,185 | protected function buildBlockView ( $ id , BlockView $ parentView = null ) { $ blockType = $ this -> rawLayout -> getProperty ( $ id , RawLayout :: BLOCK_TYPE , true ) ; $ resolvedOptions = $ this -> rawLayout -> getProperty ( $ id , RawLayout :: RESOLVED_OPTIONS , true ) ; $ types = $ this -> typeHelper -> getTypes ( ... | Created and builds the block view |
9,186 | protected function finishBlockView ( BlockView $ view , $ id ) { $ blockType = $ this -> rawLayout -> getProperty ( $ id , RawLayout :: BLOCK_TYPE , true ) ; $ types = $ this -> typeHelper -> getTypes ( $ blockType ) ; $ this -> block -> initialize ( $ id ) ; foreach ( $ types as $ type ) { $ type -> finishView ( $ vie... | Finishes the building of the block view |
9,187 | protected function isContainerBlock ( $ id ) { return $ this -> typeHelper -> isInstanceOf ( $ this -> rawLayout -> getProperty ( $ id , RawLayout :: BLOCK_TYPE , true ) , ContainerType :: NAME ) ; } | Checks whether the given block is a container for other blocks |
9,188 | protected function processExpressions ( Options $ options ) { if ( ! $ this -> context -> getOr ( 'expressions_evaluate' ) ) { return ; } $ values = $ options -> toArray ( ) ; if ( $ this -> context -> getOr ( 'expressions_evaluate_deferred' ) ) { $ this -> expressionProcessor -> processExpressions ( $ values , $ this ... | Processes expressions that don t work with data |
9,189 | protected function setBlockResolvedOptions ( $ id , $ blockType , $ options , $ types ) { $ resolvedOptions = new Options ( $ this -> optionsResolver -> resolveOptions ( $ blockType , $ options ) ) ; $ this -> processExpressions ( $ resolvedOptions ) ; $ resolvedOptions = $ this -> resolveValueBags ( $ resolvedOptions ... | Setting resolved options for block |
9,190 | public function log ( $ level , $ message , array $ context = [ ] ) { $ category = ArrayHelper :: remove ( $ context , 'category' , $ this -> category ) ; $ level = ArrayHelper :: getValue ( $ this -> map , $ level , $ this -> level ) ; $ this -> logger -> log ( $ this -> interpolate ( $ message , $ context ) , $ level... | Log a message transforming from PSR3 to the closest Yii2 . |
9,191 | protected function generateSchemaAsSql ( ) { $ prefix = ezcDbSchema :: $ options -> tableNamePrefix ; foreach ( $ this -> schema as $ tableName => $ tableDefinition ) { $ this -> generateDropTableSql ( $ prefix . $ tableName ) ; $ this -> generateCreateTableSql ( $ prefix . $ tableName , $ tableDefinition ) ; } } | Creates SQL DDL statements from a schema definitin . |
9,192 | public function getValidators ( ) { $ allValidatorData = $ this -> validators -> toArray ( PriorityQueue :: EXTR_DATA ) ; foreach ( $ allValidatorData as $ key => $ validatorData ) { $ allValidatorData [ $ key ] = $ validatorData [ 'instance' ] ; } return $ allValidatorData ; } | Returns array of all validators . |
9,193 | protected function encodeArray ( array $ action_result , ResponseInterface $ response , $ status = 200 ) { return $ response -> write ( json_encode ( $ action_result ) ) -> withStatus ( $ status ) ; } | Encode regular array response with status 200 . |
9,194 | protected function encodeScalar ( $ action_result , ResponseInterface $ response , $ status = 200 ) { return $ response -> write ( json_encode ( $ action_result ) ) -> withStatus ( $ status ) ; } | Encode scalar value with status 200 . |
9,195 | protected function encodeStatus ( StatusResponse $ action_result , ResponseInterface $ response ) { $ response = $ response -> withStatus ( $ action_result -> getHttpCode ( ) , $ action_result -> getMessage ( ) ) ; if ( $ action_result -> getHttpCode ( ) >= 400 ) { $ response = $ response -> write ( json_encode ( [ 'me... | Encode and return status response . |
9,196 | protected function encodeException ( $ exception , ResponseInterface $ response , $ status = 500 ) { $ error = [ 'message' => $ exception -> getMessage ( ) , 'type' => get_class ( $ exception ) ] ; if ( $ this -> getDisplayErrorDetails ( ) ) { $ error [ 'exception' ] = [ ] ; do { $ error [ 'exception' ] [ ] = [ 'type' ... | Encode and return exception . |
9,197 | public function renderException ( $ e , $ output ) { if ( $ output -> getVerbosity ( ) > OutputInterface :: VERBOSITY_VERBOSE ) { parent :: renderException ( $ e , $ output ) ; } else { $ ancestry = array ( ) ; $ maxLength = 0 ; do { $ ancestry [ ] = $ e ; $ maxLength = max ( $ maxLength , strlen ( get_class ( $ e ) ) ... | Custom exception rendering renders only the exception types and messages hierarchically but with regular formatting if verbosity is higher . |
9,198 | public function getContainer ( $ forceRecompile = false ) { if ( null === $ this -> container ) { $ config = $ this -> loader -> processConfiguration ( ) ; $ config [ 'z' ] [ 'sources' ] = $ this -> loader -> getSourceFiles ( ) ; $ config [ 'z' ] [ 'cache_file' ] = sys_get_temp_dir ( ) . '/z_' . $ this -> getCacheKey (... | Returns the container instance and initializes it if not yet available . |
9,199 | public function newAction ( Request $ request ) { $ series = $ this -> get ( 'oktolab_media' ) -> createSeries ( ) ; $ form = $ this -> createForm ( SeriesType :: class , $ series ) ; $ form -> add ( 'submit' , SubmitType :: class , [ 'label' => 'oktolab_media.new_series_button' , 'attr' => [ 'class' => 'btn btn-primar... | Displays a form to create a new Series entity . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.