idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
17,800 | protected function call ( $ command , $ params , $ data = [ ] , $ options = [ ] ) { $ uri = $ this -> getRequestURI ( $ command ) ; $ body = $ this -> getRequestBody ( $ params , $ data , $ options ) ; $ xml = $ this -> client -> post ( $ uri , $ body ) ; return $ this -> factory -> createResponse ( $ xml , $ this -> m... | Make the call using the client |
17,801 | protected function getRequestURI ( $ command ) { if ( empty ( $ this -> module ) ) { throw new \ RuntimeException ( 'Zoho CRM module is not set.' ) ; } $ parts = [ $ this -> baseUri , $ this -> format , $ this -> module , $ command ] ; return implode ( '/' , $ parts ) ; } | Get the current request uri |
17,802 | protected function getRequestBody ( $ params , $ data , $ options ) { $ params [ 'scope' ] = 'crmapi' ; $ params [ 'authtoken' ] = $ this -> authtoken ; $ params += [ 'newFormat' => 1 ] ; if ( ! empty ( $ data ) ) { $ params [ 'xmlData' ] = ( isset ( $ options [ 'map' ] ) && $ options [ 'map' ] ) ? $ this -> toXML ( $ ... | Get the body of the request |
17,803 | public function info ( $ title , $ content , $ icon = true , $ iconSmall = true ) { $ this -> message ( 'info' , $ title , $ content , $ icon , $ iconSmall ) ; } | Flash an info notification |
17,804 | public function success ( $ title , $ content , $ icon = true , $ iconSmall = true ) { $ this -> message ( 'success' , $ title , $ content , $ icon , $ iconSmall ) ; } | Flash a success notification |
17,805 | public function error ( $ title , $ content , $ icon = true , $ iconSmall = true ) { $ this -> message ( 'danger' , $ title , $ content , $ icon , $ iconSmall ) ; } | Flash an error notification |
17,806 | public function danger ( $ title , $ content , $ icon = true , $ iconSmall = true ) { $ this -> message ( 'danger' , $ title , $ content , $ icon , $ iconSmall ) ; } | Flash an danger notification |
17,807 | public function message ( $ level = 'info' , $ title , $ content , $ icon , $ iconSmall , $ timeout = 5000 ) { $ this -> session -> flash ( 'notify.level' , $ level ) ; $ this -> session -> flash ( 'notify.title' , $ title ) ; $ this -> session -> flash ( 'notify.content' , $ content ) ; if ( ( is_bool ( $ icon ) && $ ... | Flash a notification message |
17,808 | protected function getFilesystemProperty ( $ property ) { $ path = $ property . 'Path' ; if ( ! $ this -> $ property && $ this -> $ path ) { $ this -> $ property = new Filesystem ( new Local ( Yii :: getAlias ( $ this -> $ path ) ) ) ; } return $ this -> $ property ; } | Get file system for property . |
17,809 | public function getApi ( ) { $ imageManager = new ImageManager ( [ 'driver' => extension_loaded ( 'imagick' ) ? 'imagick' : 'gd' ] ) ; $ manipulators = [ new Size ( $ this -> maxImageSize ) , new Orientation ( ) , new Crop ( ) , new Brightness ( ) , new Contrast ( ) , new Gamma ( ) , new Sharpen ( ) , new Filter ( ) , ... | Get image manipulation API . |
17,810 | protected function generateReadScalarStatement ( $ type ) { $ mapping = [ Type :: TYPE_INT32_VALUE => '$reader->readVarint($stream)' , Type :: TYPE_INT64_VALUE => '$reader->readVarint($stream)' , Type :: TYPE_UINT64_VALUE => '$reader->readVarint($stream)' , Type :: TYPE_UINT32_VALUE => '$reader->readVarint($stream)' , ... | read a scalar value . |
17,811 | public function getComputeSizeMetadata ( $ type ) { $ data = [ 'method' => null , 'size' => null ] ; $ dynamicMapping = [ Type :: TYPE_INT32_VALUE => 'computeVarintSize' , Type :: TYPE_INT64_VALUE => 'computeVarintSize' , Type :: TYPE_UINT64_VALUE => 'computeVarintSize' , Type :: TYPE_UINT32_VALUE => 'computeVarintSize... | compute value size |
17,812 | public function generateValueSizeStatement ( $ type , $ value ) { $ metadata = $ this -> getComputeSizeMetadata ( $ type ) ; $ method = $ metadata [ 'method' ] ; $ size = $ metadata [ 'size' ] ; if ( $ size !== null ) { return $ size ; } return sprintf ( '$calculator->%s(%s)' , $ method , $ value ) ; } | Compute value size |
17,813 | public function assertVersion ( ) { $ process = $ this -> createProtocVersionProcess ( ) ; $ process -> mustRun ( ) ; $ return = $ process -> getExitCode ( ) ; $ result = trim ( $ process -> getOutput ( ) ) ; if ( 0 !== $ return && 1 !== $ return ) { throw new UnexpectedValueException ( "Unable to find the protoc comma... | Assert min protoc version . |
17,814 | public static function connection ( $ name , $ definition = null ) { if ( empty ( $ definition ) ) return static :: get ( static :: $ pool , $ name ) ; if ( static :: isScalar ( $ definition ) ) list ( , $ dsn , $ username , $ password , $ options ) = func_get_args ( ) + [ null , '' , '' , '' , [ ] ] ; else extract ( s... | Get an existing database connection or initialize a new one . Database connections are managed as PDO instances . If such instance doesn t exists or could not be initialized will return NULL . |
17,815 | public static function usingConnectionAttributes ( $ connection , $ attributes , callable $ function , $ context = null ) { static :: _connection ( $ connection ) ; static :: _associate ( $ function , $ context ) ; return function ( ) use ( $ connection , $ function ) { $ previous = static :: setConnectionAttributes ( ... | Wraps the given function so the connection attributes will be set before the function execution and restored after that . The previous attribute states are restored even if an exception occurs during function execution so this function is garanteed to not tamper with the connection state . Returns the function s return... |
17,816 | public static function transaction ( $ connection , callable $ function , $ context = null ) { static :: _connection ( $ connection ) ; static :: _associate ( $ function , $ context ) ; return function ( ) use ( $ connection , $ function ) { if ( ! $ connection -> beginTransaction ( ) ) throw new \ RuntimeException ( "... | Wraps the function inside a transaction - safe function . The transaction will be rolled - back if the wrapped function returns FALSE or throws any exception otherwise it will be committed . The wrapper function returns true if the transaction was sucessfully comited false otherwise . If the transaction cannot be start... |
17,817 | protected static function _connection ( & $ connection ) { if ( static :: isString ( $ connection ) ) $ connection = static :: connection ( $ connection ) ; if ( ! $ connection instanceof \ PDO ) throw new \ InvalidArgumentException ( "invalid connection" ) ; } | Transform the connection into a PDO instance . Throw if the connection is invalid or isn t registered . |
17,818 | public function api ( $ subdomain , $ resource , array $ parameters = array ( ) , $ version = 'v2' ) { $ ch = $ this -> getCurl ( ) ; $ url = sprintf ( $ this -> domain , $ subdomain , $ version , $ resource ) ; if ( ! empty ( $ parameters ) ) $ url .= "?" . http_build_query ( $ parameters ) ; curl_setopt_array ( $ ch ... | Generic method to fire API requests at Commission Junctions servers |
17,819 | public static function eachReference ( & $ list , callable $ iterator , $ context = null ) { if ( $ list === null ) return $ list ; static :: associate ( $ iterator , $ context ) ; if ( ! static :: isTraversable ( $ list ) ) throw new \ InvalidArgumentException ( "canot iterate over " . static :: typeOf ( $ list ) ) ; ... | Does the very same job as each but provide a reference of every list item to the iterator function . |
17,820 | public static function reduceRight ( $ list , callable $ iterator , $ memo , $ context = null ) { return static :: reduce ( array_reverse ( static :: toArray ( $ list ) ) , $ iterator , $ memo , $ context ) ; } | The right - associative version of reduce . |
17,821 | public static function every ( $ list , callable $ iterator = null , $ context = null ) { static :: associate ( $ iterator , $ context ) ; ! $ iterator && $ iterator = function ( $ item ) { return static :: identity ( $ item ) ; } ; $ result = true ; static :: each ( $ list , function ( $ item , $ index ) use ( $ itera... | Returns true if all of the values in the list pass the iterator truth test . Short - circuits and stops traversing the list if a false element is found . |
17,822 | public static function some ( $ list , callable $ iterator = null , $ context = null ) { static :: associate ( $ iterator , $ context ) ; ! $ iterator && $ iterator = function ( $ item ) { return static :: identity ( $ item ) ; } ; return ! static :: every ( $ list , function ( $ item ) use ( $ iterator ) { return ! $ ... | Returns true if any of the values in the list pass the iterator truth test . Short - circuits and stops traversing the list if a true element is found . |
17,823 | public static function contains ( $ list , $ value , $ strict = false ) { return static :: some ( $ list , function ( $ item ) use ( $ value , $ strict ) { return $ strict ? $ item === $ value : $ item == $ value ; } ) ; } | Returns true if the value is present in the list . |
17,824 | public static function max ( $ list , callable $ iterator = null , $ context = null ) { static :: associate ( $ iterator , $ context ) ; ! $ iterator && $ iterator = function ( $ item ) { return static :: identity ( $ item ) ; } ; $ max = null ; $ result = null ; static :: each ( $ list , function ( $ item ) use ( $ it... | Returns the maximum value in list . If iterator is passed it will be used on each value to generate the criterion by which the value is ranked . |
17,825 | public static function groupBy ( $ list , $ iterator , $ context = null ) { static :: associate ( $ iterator , $ context ) ; $ result = [ ] ; static :: each ( $ list , function ( $ item ) use ( $ iterator , & $ result ) { static :: isScalar ( $ iterator ) ? $ result [ static :: get ( $ item , $ iterator ) ] [ ] = $ ite... | Splits a collection into sets grouped by the result of running each value through iterator . If iterator is a string instead of a function groups by the property named by iterator on each of the values . |
17,826 | public static function countBy ( $ list , $ iterator , $ context = null ) { return static :: map ( static :: groupBy ( $ list , $ iterator , $ context ) , function ( $ item ) { return static :: size ( $ item ) ; } ) ; } | Sorts a list into groups and returns a count for the number of objects in each group . Similar to groupBy but instead of returning a list of values returns a count for the number of values in that group . |
17,827 | public static function sample ( $ list , $ n = 1 ) { return $ n == 1 ? static :: get ( $ list , static :: keys ( $ list ) [ static :: random ( static :: size ( $ list ) - 1 ) ] ) : array_slice ( static :: shuffle ( $ list ) , 0 , $ n ) ; } | Produce a random sample from the list . Pass a number to return n random elements from the list . Otherwise a single random item will be returned . |
17,828 | public static function size ( $ list ) { if ( $ list === null ) return 0 ; if ( is_scalar ( $ list ) || is_resource ( $ list ) ) return 1 ; if ( is_array ( $ list ) || $ list instanceof \ Countable ) return count ( $ list ) ; if ( $ list instanceof \ Traversable ) return iterator_count ( $ list ) ; $ count = 0 ; static... | Return the number of values in the list . This method will also accept scalars such as string number and even null or resources but will return 1 in that case . |
17,829 | public static function first ( $ array , $ n = 1 , $ guard = false ) { if ( empty ( $ array ) ) return ; if ( $ n <= 0 ) throw new \ UnexpectedValueException ( "invalid number of items $n" ) ; $ result = [ ] ; static :: each ( $ array , function ( $ item ) use ( & $ n , & $ result ) { $ result [ ] = $ item ; if ( -- $ ... | Returns the first element of an array . Passing n will return the first n elements of the array . Passing guard will force the returned value to be an array . |
17,830 | public static function last ( $ array , $ n = 1 , $ guard = false ) { $ array = static :: toArray ( $ array ) ; $ result = array_values ( array_slice ( $ array , - $ n ) ) ; return $ guard || isset ( $ result [ 1 ] ) ? $ result : $ result [ 0 ] ; } | Returns the last element of an array . Passing n will return the last n elements of the array . Passing guard will force the returned value to be an array . |
17,831 | public static function intersection ( $ array ) { if ( $ array == null ) return [ ] ; $ args = func_get_args ( ) ; $ argsLength = func_num_args ( ) ; if ( $ argsLength == 1 ) return $ array ; if ( static :: every ( $ args , 'is_array' ) ) return array_values ( call_user_func_array ( 'array_intersect' , $ args ) ) ; $ a... | Computes the list of values that are the intersection of all the arrays . Each value in the result is present in each of the arrays . |
17,832 | public static function difference ( $ array ) { if ( empty ( $ array ) ) return [ ] ; if ( func_num_args ( ) == 1 ) return $ array ; $ args = func_get_args ( ) ; if ( static :: every ( $ args , 'is_array' ) ) return array_values ( call_user_func_array ( 'array_diff' , $ args ) ) ; $ rest = static :: flatten ( array_sli... | Similar to without but returns the values from array that are not present in the other arrays . |
17,833 | public static function zip ( ) { $ arguments = func_get_args ( ) ; $ length = func_num_args ( ) ; $ result = [ ] ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) $ result [ $ i ] = static :: pluck ( $ arguments , $ i ) ; return $ result ; } | Merges together the values of each of the arrays with the values at the corresponding position . Useful when you have separate data sources that are coordinated through matching array indexes . |
17,834 | public static function indexOf ( $ array , $ item ) { if ( is_array ( $ array ) ) return ( $ key = array_search ( $ item , $ array ) ) !== false ? $ key : - 1 ; $ found = - 1 ; $ search = $ item ; static :: each ( $ array , function ( $ item , $ key ) use ( $ search , & $ found ) { if ( $ item == $ search ) { $ found =... | Returns the index at which value can be found in the array or - 1 if value is not present in the array . This method uses array_search internally and is not optimized for long array binary search . |
17,835 | public static function lastIndexOf ( $ array , $ item ) { if ( is_array ( $ array ) ) return ( $ keys = array_keys ( $ array , $ item , false ) ) ? array_pop ( $ keys ) : - 1 ; $ found = - 1 ; $ search = $ item ; static :: each ( $ array , function ( $ item , $ key ) use ( $ search , & $ found ) { if ( $ item == $ sear... | Returns the index of the last occurrence of value in the array or - 1 if value is not present . This method uses array_keys internally and is not optimized for long array binary search . |
17,836 | public static function partial ( callable $ function , $ arguments ) { if ( ! is_array ( $ arguments ) ) $ arguments = array_slice ( func_get_args ( ) , 1 ) ; return function ( ) use ( $ function , $ arguments ) { return call_user_func_array ( $ function , array_merge ( func_get_args ( ) , $ arguments ) ) ; } ; } | Partially apply a function by filling in any number of its arguments . Not all the arguments have to be present on the partial construction . |
17,837 | public static function bindClass ( \ Closure $ function , $ class ) { if ( ! class_exists ( $ class ) ) throw new \ InvalidArgumentException ( "no such class $class" ) ; $ function = \ Closure :: bind ( $ function , null , $ class ) ; if ( func_num_args ( ) <= 2 ) return $ function ; $ args = func_get_args ( ) ; return... | Bind a function to a class meaning that whenever the function is called the value of self or static will be the class . Optionally pass arguments to the function to pre - fill them also known as partial application . |
17,838 | public static function throttle ( callable $ function , $ wait ) { return function ( ) use ( $ function , $ wait ) { static $ pretime ; $ curtime = microtime ( true ) ; if ( ! $ pretime || ( $ curtime - $ pretime ) >= ( $ wait / 1000 ) ) { $ pretime = $ curtime ; $ function ( ) ; } } ; } | Creates and returns a new throttled version of the passed function that when invoked repeatedly will only actually call the original function at most once per every wait milliseconds . Useful for rate - limiting events that occur faster than you can keep up with . |
17,839 | public static function keys ( $ object ) { if ( $ object instanceof \ stdClass ) $ object = ( array ) $ object ; if ( is_array ( $ object ) ) return array_keys ( $ object ) ; $ result = [ ] ; static :: each ( $ object , function ( $ item , $ key ) use ( & $ result ) { $ result [ ] = $ key ; } ) ; return $ result ; } | Retrieve all the names of the object s properties . |
17,840 | public static function values ( $ object ) { if ( $ object instanceof \ stdClass ) $ object = ( array ) $ object ; if ( is_array ( $ object ) ) return array_values ( $ object ) ; $ result = [ ] ; static :: each ( $ object , function ( $ item ) use ( & $ result ) { $ result [ ] = $ item ; } ) ; return $ result ; } | Return all of the values of the object s properties . |
17,841 | public static function invert ( $ object ) { if ( ! is_array ( $ object ) ) $ castDown = ( boolean ) $ object = static :: toArray ( $ object ) ; return ! empty ( $ castDown ) ? ( object ) array_flip ( $ object ) : array_flip ( $ object ) ; } | Returns a copy of the object where the keys have become the values and the values the keys . For this to work all of your object s values should be unique and string serializable . |
17,842 | public static function extend ( $ destination , $ sources ) { $ sources = array_slice ( func_get_args ( ) , 1 ) ; static :: each ( $ sources , function ( $ source ) use ( & $ destination ) { static :: each ( $ source , function ( $ value , $ name ) use ( & $ destination ) { static :: set ( $ destination , $ name , $ va... | Copy all of the properties in the source objects over to the destination object and return the destination object . It s in - order so the last source will override properties of the same name in previous arguments . |
17,843 | public static function defaults ( $ object , $ defaults ) { $ defaults = array_slice ( func_get_args ( ) , 1 ) ; if ( $ object instanceof \ stdClass ) { $ object = ( array ) $ object ; $ castDown = true ; } $ result = $ object ; $ isArray = is_array ( $ object ) ; static :: each ( $ defaults , function ( $ default ) us... | Fill in null properties in object with values from the defaults objects and return the object . As soon as the property is filled further defaults will have no effect . |
17,844 | public static function get ( $ object , $ key , $ default = null ) { if ( ! static :: has ( $ object , $ key ) ) return $ default ; if ( static :: isArray ( $ object ) ) return $ object [ $ key ] ; if ( static :: isObject ( $ object ) ) return $ object -> $ key ; return $ object ; } | Get the object s key value . If such keys doesn t exists the default value is returned . If object is neither Array nor an Object the object itself is returned . |
17,845 | public static function set ( & $ object , $ key , $ value ) { if ( static :: isArray ( $ object ) ) $ object [ $ key ] = $ value ; if ( static :: isObject ( $ object ) ) $ object -> $ key = $ value ; return $ object ; } | Set object s key value . If object is neither Array nor an Object the object itself is returned . |
17,846 | public static function isArray ( $ object , $ native = false ) { return $ native ? is_array ( $ object ) : is_array ( $ object ) || $ object instanceof \ ArrayAccess ; } | Returns true if object is an array or usable like an array . If the optionnal native parameter is set to true it will only return true if object is a native array . |
17,847 | public static function isInteger ( $ object , $ native = false ) { return $ native ? is_int ( $ object ) : is_int ( $ object ) || $ object instanceof \ SplInt ; } | Returns true if the object is an integer . If the optional native parameter is set to true it will only return true if object is a native int . |
17,848 | public static function isFloat ( $ object , $ native = false ) { return $ native ? is_float ( $ object ) : is_float ( $ object ) || $ object instanceof \ SplFloat ; } | Returns true if the object is a float . If the optional native parameter is set to true it will only return true if object is a native float . |
17,849 | public static function isDate ( $ object ) { return $ object instanceof \ DateTime || ( static :: isString ( $ object ) && strtotime ( ( string ) $ object ) !== false ) ; } | Returns true if object is a DateTime instance . Everything the strtotime function can understand is also considered a date . |
17,850 | public static function isBoolean ( $ object , $ native = false ) { return $ native ? is_bool ( $ object ) : is_bool ( $ object ) || $ object instanceof \ SplBool ; } | Returns true if object is a Boolean . If the optionnal native parameter is set to true it will only return true if object is a native boolean . |
17,851 | public static function times ( $ n , callable $ iterator , $ context = null ) { static :: associate ( $ iterator , $ context ) ; $ n = max ( 0 , $ n ) ; $ accum = [ ] ; for ( $ i = 0 ; $ i < $ n ; $ i ++ ) $ accum [ ] = $ iterator ( $ i ) ; return $ accum ; } | Invokes the given iterator function n times . Each invocation of iterator is called with an index argument . Produces an array of the returned values . |
17,852 | public static function random ( $ min , $ max = null ) { if ( $ max === null ) list ( $ min , $ max ) = [ 0 , $ min ] ; return mt_rand ( $ min , $ max ) ; } | Returns a random integer between min and max inclusive . If you only pass one argument it will return a number between 0 and that number . |
17,853 | public static function result ( $ object , $ property ) { $ value = static :: get ( $ object , $ property ) ; if ( static :: isFunction ( $ value ) ) { static :: associate ( $ value , $ object ) ; return $ value ( ) ; } return $ value ; } | If the value of the named property is a function then invoke it with the object as context ; otherwise return it . |
17,854 | protected static function getListfilter ( $ properties ) { return function ( $ item ) use ( $ properties ) { foreach ( $ properties as $ property => $ value ) if ( static :: get ( $ item , $ property ) != $ value ) return false ; return true ; } ; } | Returns an iterator that matches a list item against properties . |
17,855 | protected static function getLookupIterator ( $ value ) { return is_callable ( $ value ) ? $ value : function ( $ object ) use ( $ value ) { return static :: get ( $ object , $ value ) ; } ; } | An internal function to generate lookup iterators . |
17,856 | protected static function equal ( $ a , $ b , $ aStack , $ bStack ) { $ a instanceof self && $ a = $ a -> _wrapped ; $ b instanceof self && $ b = $ b -> _wrapped ; if ( $ a === null && $ b === null ) return true ; if ( is_resource ( $ a ) && is_resource ( $ b ) ) return false ; if ( is_scalar ( $ a ) && is_scalar ( $ b... | Tells if two objects are equals . |
17,857 | private function connect ( ) { if ( $ this -> driver ) { return ; } $ pool = $ this -> options [ 'memcache.pool' ] ; if ( $ pool ) { $ this -> driver = new \ Memcached ( $ pool ) ; } else { $ this -> driver = new \ Memcached ; } $ this -> driver -> setOption ( \ Memcached :: OPT_COMPRESSION , $ this -> options [ 'memca... | Connect to the Memcached servers if the connection does not already exist . |
17,858 | public function delete ( $ match = '*' ) { if ( $ this -> isAuthenticated ( ) ) { $ url = $ this -> getLink ( ) ; if ( $ match === true ) { $ match = $ this -> xml -> xpath ( './@gd:etag' ) ; $ match = $ match [ 0 ] ; } try { $ jdata = $ this -> query ( $ url , null , array ( 'GData-Version' => 2 , 'If-Match' => $ matc... | Method to delete a Picasa photo |
17,859 | public function getLink ( $ type = 'edit' ) { $ links = $ this -> xml -> link ; foreach ( $ links as $ link ) { if ( $ link -> attributes ( ) -> rel == $ type ) { return ( string ) $ link -> attributes ( ) -> href ; } } return false ; } | Method to get the photo link |
17,860 | public function getThumbnails ( ) { $ thumbs = array ( ) ; foreach ( $ this -> xml -> children ( 'media' , true ) -> group -> thumbnail as $ item ) { $ url = ( string ) $ item -> attributes ( ) -> url ; $ width = ( int ) $ item -> attributes ( ) -> width ; $ height = ( int ) $ item -> attributes ( ) -> height ; $ thumb... | Method to get the photo s thumbnails |
17,861 | public function getList ( $ user , $ repo , $ sha = '' , $ path = '' , $ author = '' , Date $ since = null , Date $ until = null ) { $ rPath = '/repos/' . $ user . '/' . $ repo . '/commits?' ; $ rPath .= ( $ sha ) ? '&sha=' . $ sha : '' ; $ rPath .= ( $ path ) ? '&path=' . $ path : '' ; $ rPath .= ( $ author ) ? '&auth... | Method to list commits for a repository . |
17,862 | public function compare ( $ user , $ repo , $ base , $ head ) { $ path = '/repos/' . $ user . '/' . $ repo . '/compare/' . $ base . '...' . $ head ; return $ this -> processResponse ( $ this -> client -> get ( $ this -> fetchUrl ( $ path ) ) ) ; } | Method to get a diff for two commits . |
17,863 | public function toString ( array $ parts = array ( 'scheme' , 'user' , 'pass' , 'host' , 'port' , 'path' , 'query' , 'fragment' ) ) { $ query = $ this -> getQuery ( ) ; $ uri = '' ; $ uri .= in_array ( 'scheme' , $ parts ) ? ( ! empty ( $ this -> scheme ) ? $ this -> scheme . '://' : '' ) : '' ; $ uri .= in_array ( 'us... | Returns full uri string . |
17,864 | public function sendMessage ( $ recipient , $ subject , $ body ) { $ token = $ this -> oauth -> getToken ( ) ; $ parameters = array ( 'oauth_token' => $ token [ 'key' ] ) ; $ this -> oauth -> setOption ( 'success_code' , 201 ) ; $ base = '/v1/people/~/mailbox' ; $ xml = '<mailbox-item> <recipients>' ; if ( is_arra... | Method used to send messages via LinkedIn between two or more individuals connected to the member sending the message . |
17,865 | public function getMeta ( ) { $ path = '/meta' ; return $ this -> processResponse ( $ this -> client -> get ( $ this -> fetchUrl ( $ path ) ) , 200 ) ; } | Method to get the authorized IP addresses for services |
17,866 | protected function generateFileHeader ( ) { $ head = array ( ) ; if ( empty ( $ this -> options [ 'text_file_no_php' ] ) ) { $ head [ ] = '#' ; $ head [ ] = '#<?php die(\'Forbidden.\'); ?>' ; } $ head [ ] = '#Date: ' . gmdate ( 'Y-m-d H:i:s' ) . ' UTC' ; $ head [ ] = '' ; $ head [ ] = '#Fields: ' . strtolower ( str_rep... | Method to generate the log file header . |
17,867 | protected function initFile ( ) { if ( ! is_file ( $ this -> path ) ) { Folder :: create ( dirname ( $ this -> path ) ) ; $ head = $ this -> generateFileHeader ( ) ; } else { $ head = false ; } if ( ! $ this -> file = fopen ( $ this -> path , 'a' ) ) { throw new \ RuntimeException ( 'Cannot open file for writing log' )... | Method to initialise the log file . This will create the folder path to the file if it doesn t already exist and also get a new file header if the file doesn t already exist . If the file already exists it will simply open it for writing . |
17,868 | protected function getTableConstraints ( $ tableName ) { $ this -> connect ( ) ; $ this -> setQuery ( 'SELECT CONSTRAINT_NAME FROM' . ' INFORMATION_SCHEMA.TABLE_CONSTRAINTS' . ' WHERE TABLE_NAME = ' . $ this -> quote ( $ tableName ) ) ; return $ this -> loadColumn ( ) ; } | Get table constraints |
17,869 | public function dump ( $ depth = 3 , \ SplObjectStorage $ dumped = null ) { if ( $ dumped === null ) { $ dumped = new \ SplObjectStorage ; } $ dumped -> attach ( $ this ) ; $ dump = new \ stdClass ; foreach ( array_keys ( $ this -> properties ) as $ property ) { $ dump -> $ property = $ this -> dumpProperty ( $ propert... | Dumps the data properties into a stdClass object recursively if appropriate . |
17,870 | protected function getProperty ( $ property ) { $ value = array_key_exists ( $ property , $ this -> properties ) ? $ this -> properties [ $ property ] : null ; return $ value ; } | Gets a data property . |
17,871 | public function create ( $ user , $ repo , $ title , $ base , $ head , $ body = '' ) { $ path = '/repos/' . $ user . '/' . $ repo . '/pulls' ; $ data = json_encode ( array ( 'title' => $ title , 'base' => $ base , 'head' => $ head , 'body' => $ body ) ) ; $ response = $ this -> client -> post ( $ this -> fetchUrl ( $ p... | Method to create a pull request . |
17,872 | public function edit ( $ user , $ repo , $ pullId , $ title = null , $ body = null , $ state = null ) { $ path = '/repos/' . $ user . '/' . $ repo . '/pulls/' . ( int ) $ pullId ; $ data = new \ stdClass ; if ( isset ( $ title ) ) { $ data -> title = $ title ; } if ( isset ( $ body ) ) { $ data -> body = $ body ; } if ... | Method to update a pull request . |
17,873 | public function merge ( $ user , $ repo , $ pullId , $ message = '' ) { $ path = '/repos/' . $ user . '/' . $ repo . '/pulls/' . ( int ) $ pullId . '/merge' ; $ data = json_encode ( array ( 'commit_message' => $ message ) ) ; $ response = $ this -> client -> put ( $ this -> fetchUrl ( $ path ) , $ data ) ; if ( $ respo... | Method to merge a pull request . |
17,874 | private function connect ( ) { if ( isset ( $ this -> driver ) ) { return ; } $ host = isset ( $ this -> options [ 'redis.host' ] ) ? $ this -> options [ 'redis.host' ] : self :: REDIS_HOST ; $ port = isset ( $ this -> options [ 'redis.port' ] ) ? $ this -> options [ 'redis.port' ] : self :: REDIS_PORT ; $ this -> driv... | Connect to the Redis servers if the connection does not already exist . |
17,875 | public function addVarAttr ( $ name , $ value ) { if ( ! in_array ( $ name , $ this -> varAttr ) ) { $ this -> varAttr [ $ name ] = $ value ; } return $ this ; } | Add new var class to element |
17,876 | public function addAttr ( $ name , $ value ) { if ( ! in_array ( $ name , $ this -> attributes ) ) { $ this -> attributes [ $ name ] = $ value ; } return $ this ; } | Add new attribute to table header column or rowset |
17,877 | public function getClassName ( ) { $ className = '' ; if ( count ( $ this -> class ) ) { $ className = implode ( ' ' , array_values ( $ this -> class ) ) ; } if ( count ( $ this -> varClass ) ) { $ className .= ' ' ; $ className .= implode ( ' ' , array_values ( $ this -> varClass ) ) ; } return $ className ; } | Get string class from array |
17,878 | public function getAttributes ( ) { $ ret = array ( ) ; if ( count ( $ this -> attributes ) ) { foreach ( $ this -> attributes as $ name => $ value ) { $ ret [ ] = sprintf ( $ name . '="%s"' , $ value ) ; } } if ( count ( $ this -> varAttr ) ) { foreach ( $ this -> varAttr as $ name => $ value ) { $ ret [ ] = sprintf (... | Get attributes as a string |
17,879 | public function email ( $ email ) { $ path = '/legacy/user/email/' . $ email ; return $ this -> processResponse ( $ this -> client -> get ( $ this -> fetchUrl ( $ path ) ) ) ; } | Email search . |
17,880 | public function getHome ( $ user , $ filter = null , $ location = false , $ limit = 0 , $ offset = 0 , $ until = null , $ since = null ) { $ extra_fields = '' ; if ( $ filter != null ) { $ extra_fields = '?filter=' . $ filter ; } if ( $ location == true ) { $ extra_fields .= ( strpos ( $ extra_fields , '?' ) === false ... | Method to get the user s news feed . Requires authentication and read_stream permission . |
17,881 | public function getNotifications ( $ user , $ read = null , $ limit = 0 , $ offset = 0 , $ until = null , $ since = null ) { if ( $ read == true ) { $ read = '?include_read=1' ; } return $ this -> getConnection ( $ user , 'notifications' , $ read , $ limit , $ offset , $ until , $ since ) ; } | Method to get the user s notifications . Requires authentication and manage_notifications permission . |
17,882 | public function createAlbum ( $ user , $ name , $ description = null , $ privacy = null ) { $ data = array ( ) ; $ data [ 'name' ] = $ name ; $ data [ 'description' ] = $ description ; $ data [ 'privacy' ] = $ privacy ; return $ this -> createConnection ( $ user , 'albums' , $ data ) ; } | Method to create an album for a user . Requires authentication and publish_stream permission . |
17,883 | public function createCheckin ( $ user , $ place , $ coordinates , $ tags = null , $ message = null , $ link = null , $ picture = null ) { $ data = array ( ) ; $ data [ 'place' ] = $ place ; $ data [ 'coordinates' ] = $ coordinates ; $ data [ 'tags' ] = $ tags ; $ data [ 'message' ] = $ message ; $ data [ 'link' ] = $ ... | Method to create a checkin for a user . Requires authentication and publish_checkins permission . |
17,884 | public function createLink ( $ user , $ link , $ message = null ) { $ data = array ( ) ; $ data [ 'link' ] = $ link ; $ data [ 'message' ] = $ message ; return $ this -> createConnection ( $ user , 'feed' , $ data ) ; } | Method to post a link on user s feed . Requires authentication and publish_stream permission . |
17,885 | public function createNote ( $ user , $ subject , $ message ) { $ data = array ( ) ; $ data [ 'subject' ] = $ subject ; $ data [ 'message' ] = $ message ; return $ this -> createConnection ( $ user , 'notes' , $ data ) ; } | Method to create a note on the behalf of the user . Requires authentication and publish_stream permission user_groups or friends_groups permission . |
17,886 | public function getPosts ( $ user , $ location = false , $ limit = 0 , $ offset = 0 , $ until = null , $ since = null ) { if ( $ location == true ) { $ location = '?with=location' ; } return $ this -> getConnection ( $ user , 'posts' , $ location , $ limit , $ offset , $ until , $ since ) ; } | Method to get the user s posts . Requires authentication and read_stream permission for non - public posts . |
17,887 | public function createPost ( $ user , $ message = null , $ link = null , $ picture = null , $ name = null , $ caption = null , $ description = null , $ actions = null , $ place = null , $ tags = null , $ privacy = null , $ object_attachment = null ) { $ data = array ( ) ; $ data [ 'message' ] = $ message ; $ data [ 'li... | Method to post on a user s wall . Message or link parameter is required . Requires authentication and publish_stream permission . |
17,888 | public function createStatus ( $ user , $ message ) { $ data = array ( ) ; $ data [ 'message' ] = $ message ; return $ this -> createConnection ( $ user , 'feed' , $ data ) ; } | Method to post a status message on behalf of the user . Requires authentication publish_stream permission . |
17,889 | public function create ( $ user , $ repo , $ ref , $ sha ) { $ path = '/repos/' . $ user . '/' . $ repo . '/git/refs' ; $ data = json_encode ( array ( 'ref' => $ ref , 'sha' => $ sha ) ) ; $ response = $ this -> client -> post ( $ this -> fetchUrl ( $ path ) , $ data ) ; if ( $ response -> code != 201 ) { $ error = jso... | Method to create a ref . |
17,890 | public function edit ( $ user , $ repo , $ ref , $ sha , $ force = false ) { $ path = '/repos/' . $ user . '/' . $ repo . '/git/refs/' . $ ref ; $ data = new \ stdClass ; if ( $ force ) { $ data -> force = true ; } $ data -> sha = $ sha ; $ data = json_encode ( $ data ) ; $ response = $ this -> client -> patch ( $ this... | Method to update a reference . |
17,891 | private function _generateAccessToken ( ) { $ parameters = array ( 'oauth_token' => $ this -> token [ 'key' ] ) ; if ( strcmp ( $ this -> version , '1.0a' ) === 0 ) { $ parameters = array_merge ( $ parameters , array ( 'oauth_verifier' => $ this -> token [ 'verifier' ] ) ) ; } $ response = $ this -> oauthRequest ( $ th... | Method used to get an access token . |
17,892 | public function insertid ( ) { $ this -> connect ( ) ; $ insertQuery = $ this -> getQuery ( false , true ) ; $ table = $ insertQuery -> __get ( 'insert' ) -> getElements ( ) ; $ colNameQuery = $ this -> getQuery ( true ) ; $ colNameQuery -> select ( 'column_default' ) -> from ( 'information_schema.columns' ) -> where (... | Method to get the auto - incremented value from the last INSERT statement . To be called after the INSERT statement it s MANDATORY to have a sequence on every primary key table . |
17,893 | public function help ( ) { $ this -> out ( ) ; $ this -> out ( 'Joomla Framework Changelog' ) ; $ this -> out ( '-------------------------' ) ; $ this -> out ( ) ; $ this -> out ( 'Usage: ./changelog [-l]' ) ; $ this -> out ( ) ; $ this -> out ( ' -l Build the changelog for the latest version only.' ) ; $ this -> out... | Display the help text for the app . |
17,894 | protected function getIssues ( $ page ) { $ this -> out ( sprintf ( 'Getting issues page #%02d.' , $ page ) ) ; $ this -> out ( str_pad ( '' , 40 , '-' ) ) ; $ issues = $ this -> api -> issues -> getListByRepository ( 'joomla' , 'joomla-framework' , null , 'closed' , null , null , null , 'updated' , 'desc' , null , $ p... | Get a page of issue data . |
17,895 | protected function getPull ( $ id ) { $ this -> out ( sprintf ( 'Getting info for pull %6d' , $ id ) , false ) ; return $ this -> api -> pulls -> get ( 'joomla' , 'joomla-framework' , $ id ) ; } | Get information about a specific pull request . |
17,896 | protected function render ( array $ versions ) { $ html = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Joomla Framework pull request log</title> </head> <body... | Renders the output . |
17,897 | protected function setBuffer ( $ name , $ text , $ append = true ) { if ( ! isset ( $ this -> buffers [ $ name ] ) ) { $ this -> buffers [ $ name ] = array ( ) ; } if ( is_array ( $ text ) || ! $ append ) { $ this -> buffers [ $ name ] = $ text ; } else { $ this -> buffers [ $ name ] [ ] = $ text ; } } | Sets a named buffer . |
17,898 | public static function input ( $ name , $ type = 'text' ) { $ elem = static :: createElement ( $ name , 'input' ) ; $ elem -> attributes [ 'type' ] = $ type ; return $ elem ; } | only for select element |
17,899 | public function getFeed ( $ group , $ limit = 0 , $ offset = 0 , $ until = null , $ since = null ) { return $ this -> getConnection ( $ group , 'feed' , '' , $ limit , $ offset , $ until , $ since ) ; } | Method to get the group s wall . Requires authentication and user_groups or friends_groups permission for non - public groups . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.