idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
56,000 | private function writeLabels ( ) { $ this -> beginBatch ( ) ; foreach ( $ this -> nodeEntities as $ node ) { $ meta = $ this -> getMeta ( $ node ) ; $ label = $ this -> client -> makeLabel ( $ meta -> getName ( ) ) ; $ this -> everymanNodeCache [ $ this -> getHash ( $ node ) ] -> addLabels ( array ( $ label ) ) ; } $ t... | Writes labels for every node that was saved or updated . |
56,001 | public function createIndex ( $ className ) { $ meta = $ this -> metaRepository -> fromClass ( $ className ) ; if ( $ meta instanceof NodeMeta ) { return new NodeIndex ( $ this -> client , $ className ) ; } else { return new RelationshipIndex ( $ this -> client , $ className ) ; } } | Creates a Everyman index based on the class name supplied . |
56,002 | private function index ( $ entity ) { $ meta = $ this -> getMeta ( $ entity ) ; $ class = $ meta -> getName ( ) ; $ index = $ this -> getRepository ( $ class ) -> getIndex ( ) ; if ( $ meta instanceof NodeMeta ) { $ en = $ this -> getEverymanNode ( $ entity ) ; } else { $ en = $ this -> getEverymanRelation ( $ entity )... | Adds indexes for the entity to the indexes stored in the classes repository . |
56,003 | private function writeIndexes ( ) { $ this -> beginBatch ( ) ; foreach ( $ this -> nodeEntities as $ entity ) { $ this -> index ( $ entity ) ; } foreach ( $ this -> relationEntities as $ entity ) { $ this -> index ( $ entity ) ; } foreach ( $ this -> repositories as $ repository ) { $ repository -> writeIndex ( ) ; } $... | Writes index information to the database . |
56,004 | public function getRepository ( $ class ) { if ( ! isset ( $ this -> repositories [ $ class ] ) ) { $ meta = $ this -> metaRepository -> fromClass ( $ class ) ; $ repositoryClass = $ meta -> getRepositoryClass ( ) ; $ repository = new $ repositoryClass ( $ this , $ meta ) ; if ( ! ( $ repository instanceof Repository )... | Obtain the entity repository for the specified class . |
56,005 | public function loadNode ( $ node ) { if ( ! isset ( $ this -> nodeProxyCache [ $ node -> getId ( ) ] ) ) { $ labels = $ this -> client -> getLabels ( $ node ) ; $ class = $ labels [ 0 ] -> getName ( ) ; $ entity = $ this -> proxyFactory -> fromNode ( $ node , $ this -> metaRepository , $ class ) ; $ this -> nodeProxyC... | Loads a node using a proxy . |
56,006 | public function loadRelation ( $ relation ) { if ( ! isset ( $ this -> relationProxyCache [ $ relation -> getId ( ) ] ) ) { $ em = $ this ; $ entity = $ this -> proxyFactory -> fromRelation ( $ relation , $ this -> metaRepository , function ( $ node ) use ( $ em ) { return $ em -> loadNode ( $ node ) ; } ) ; $ this -> ... | Loads a relation using a proxy . |
56,007 | public function reload ( $ entity ) { $ hash = $ this -> getHash ( $ entity ) ; $ meta = $ this -> getMeta ( $ entity ) ; $ id = $ meta -> getPrimaryKey ( ) -> getValue ( $ entity ) ; if ( $ meta instanceof NodeMeta ) { if ( isset ( $ this -> everymanNodeCache [ $ hash ] ) ) { return $ this -> loadNode ( $ this -> ever... | Reload an entity . Exchanges an raw entity or an invalid proxy with an initialized proxy . |
56,008 | private function triggerEvent ( $ eventName , $ data ) { if ( isset ( $ this -> eventHandlers [ $ eventName ] ) ) { $ args = func_get_args ( ) ; array_shift ( $ args ) ; foreach ( $ this -> eventHandlers [ $ eventName ] as $ callback ) { $ clone = $ args ; call_user_func_array ( $ callback , $ clone ) ; } } } | Triggers an event held in the evertHandlers array . |
56,009 | public function cypherQuery ( $ string , $ parameters ) { try { $ start = microtime ( true ) ; $ query = new InternalCypherQuery ( $ this -> client , $ string , $ parameters ) ; $ rs = $ query -> getResultSet ( ) ; $ time = microtime ( true ) - $ start ; $ this -> triggerEvent ( self :: QUERY_RUN , $ query , $ paramete... | Raw cypher query execution . |
56,010 | private function commitBatch ( ) { if ( count ( $ this -> batch -> getOperations ( ) ) ) { $ this -> client -> commitBatch ( ) ; } else { $ this -> client -> endBatch ( ) ; } $ this -> batch = null ; } | Commits a database batch . |
56,011 | protected function checkProperties ( ) { if ( ! $ this -> getRequestReader ( ) instanceof RequestReader ) { $ this -> throwException ( 'Class for RequestReader should be inherit from "%baseClass%" ' . '(see SmartLoad option/property "%option%")' , array ( '%baseClass%' => RequestReader :: className ( ) , '%option%' => ... | Checks properties values |
56,012 | protected function shouldBeLoaded ( $ resource , array $ excludeList ) { if ( in_array ( '*' , $ excludeList ) ) { return false ; } $ possibleEntries = array ( $ resource , $ this -> hashString ( $ resource ) ) ; if ( $ baseName = basename ( $ resource ) ) { $ possibleEntries [ ] = $ baseName ; } return ( count ( array... | Checks should be loaded given resource |
56,013 | protected function _cancelOrder ( ) { if ( $ this -> _order -> getId ( ) ) { $ this -> _order -> cancel ( ) -> save ( ) ; } else { $ this -> _order -> setState ( Mage_Sales_Model_Order :: STATE_CANCELED ) ; } return $ this ; } | Cancel the order if is in the current Magento store otherwise simply set the state of the order to a state of canceled . |
56,014 | protected function _logResponse ( ) { $ logMessage = "Order could not be canceled ROM order cancel response return this status '{$this->_response->getResponseStatus()}'." ; $ this -> _logger -> warning ( $ logMessage , $ this -> _logContext -> getMetaData ( __CLASS__ ) ) ; return $ this ; } | Log order cancel response status . |
56,015 | protected function displayInner ( ) { if ( $ this -> _template ) { extract ( $ this -> _vars ) ; include ( $ this -> _template ) ; } else { foreach ( $ this -> _vars as & $ child ) if ( $ child instanceof Component ) $ child -> display ( ) ; else echo $ child ; } } | This mechanism allows two stage display |
56,016 | public function getNestedGraph ( ) : NestedGraph { return $ this -> nestedGraph !== null ? $ this -> nestedGraph : ( $ this -> nestedGraph = $ this -> getRootGraph ( ) -> createNestedGraph ( $ this ) ) ; } | Get nested graph of this node . The graph is created if the node does not have any . |
56,017 | public function onKernelController ( FilterControllerEvent $ event ) { $ controller = $ event -> getController ( ) ; if ( ! is_array ( $ controller ) ) { return ; } if ( $ controller [ 0 ] instanceof ResourceControllerInterface || $ controller [ 0 ] instanceof DashboardController ) { $ this -> aclOperator -> loadAcls (... | Kernel controller event handler . |
56,018 | public function current ( $ file = null ) { $ splFileInfo = $ file ? : parent :: current ( ) ; return $ this -> transformer -> transform ( $ splFileInfo ) ; } | Return the transformed file |
56,019 | public function getIterator ( ) { if ( is_null ( $ this -> iterator ) ) { $ finder = $ this -> finderFactory -> createFinder ( ) ; $ finder -> files ( ) -> in ( $ this -> path ) ; if ( false === empty ( $ this -> extensions ) ) { $ finder -> name ( $ this -> getExtensionsRegex ( ) ) ; } $ this -> iterator = $ finder ->... | Returns the iterator to be used as the inner iterator |
56,020 | protected function getExtensionsRegex ( ) { $ regex = '' ; $ last = count ( $ this -> extensions ) - 1 ; foreach ( $ this -> extensions as $ index => $ ext ) { $ regex .= '\.' . $ ext . '$' ; $ regex .= $ index !== $ last ? '|' : '' ; } return '(' . $ regex . ')' ; } | Returns regex used to filter files |
56,021 | public function isEmptyChanges ( ) { foreach ( $ this -> originals as $ name => $ orignial ) { if ( $ this -> hasChange ( $ name ) ) { return false ; } } return true ; } | Check if there are any changes |
56,022 | protected function logError ( $ message , $ severity = 0 , $ name = '' ) { if ( '' == $ name ) { $ this -> error [ ] = $ message ; } else { $ this -> error [ $ name ] = $ message ; } if ( $ severity > 0 ) { $ this -> logger -> log ( $ severity , $ message ) ; } } | Add an error to the array of errors . If a severity is entered the error will also be logged through the logging mechanism . |
56,023 | public function mimeType ( ) { if ( ! is_null ( $ this -> type ) ) { return $ this -> type ; } $ this -> downloadFile ( ) ; $ finfo = finfo_open ( FILEINFO_MIME_TYPE ) ; $ mime = finfo_file ( $ finfo , $ this -> downloadFilePath ( ) ) ; finfo_close ( $ finfo ) ; return $ this -> type = $ mime ; } | Method that returns the MIME type of the download file . |
56,024 | public function setName ( $ name ) { $ pathinfo = pathinfo ( $ name ) ; $ filename = $ pathinfo [ 'filename' ] ; $ this -> name = $ filename . '.' . $ this -> extension ( ) ; return $ this ; } | Set the name for the download file |
56,025 | public function setDownloadDir ( $ dir ) { if ( is_null ( $ dir ) ) { return $ this ; } if ( ! is_dir ( $ dir ) ) { throw new \ Th \ FileDownloader \ Exceptions \ DownloadException ( \ Th \ FileDownloader :: INVALID_DOWNLOAD_DIR ) ; } $ this -> downloadDir = $ dir ; return $ this ; } | Method that sets the destination download directory . It checks if the requested directory is a valid directory if not it throws a new DownloadException . |
56,026 | public function validateFileType ( ) { if ( is_null ( $ this -> allowedTypes ( ) ) ) { return true ; } if ( ! is_array ( $ this -> allowedTypes ( ) ) || ! in_array ( $ this -> mimeType ( ) , $ this -> allowedTypes ( ) ) ) { throw new \ Th \ FileDownloader \ Exceptions \ DownloadException ( \ Th \ FileDownloader :: FILE... | Method that checks if the download file is of the allowed MIME type . |
56,027 | public function validateExtension ( ) { if ( is_null ( $ this -> allowedExtensions ( ) ) ) { return true ; } if ( ! is_array ( $ this -> allowedExtensions ( ) ) || ! in_array ( $ this -> extension ( ) , $ this -> allowedExtensions ( ) ) ) { throw new \ Th \ FileDownloader \ Exceptions \ DownloadException ( \ Th \ FileD... | Method that checks if the download file is of the allowed extension . |
56,028 | public function download ( ) { $ this -> validateExtension ( ) ; $ this -> downloadFile ( ) ; try { $ this -> validateFileType ( ) ; } catch ( Exception $ exception ) { unlink ( $ this -> downloadFilePath ( ) ) ; throw $ exception ; } return true ; } | Method that downloads the file |
56,029 | protected function parse ( $ url ) { $ this -> url = $ url ; $ urlParsed = parse_url ( $ url ) ; $ pathinfo = pathinfo ( $ urlParsed [ 'path' ] ) ; $ this -> nameOriginal = $ pathinfo [ 'filename' ] ; $ this -> extension = $ pathinfo [ 'extension' ] ; return $ this ; } | Set the url original name and original extension based on the download url |
56,030 | protected function downloadFile ( ) { if ( file_exists ( $ this -> downloadFilePath ( ) ) ) { return ; } $ file = file_get_contents ( $ this -> url ( ) ) ; if ( $ file === false ) { throw new \ Th \ FileDownloader \ Exceptions \ DownloadException ( 99 ) ; } $ downloadResult = file_put_contents ( $ this -> downloadFileP... | Helper function to download the file |
56,031 | public function setHeader ( $ name , $ value , $ override = true ) { if ( $ override == false ) { if ( array_key_exists ( $ name , $ this -> headers ) ) { return $ this ; } } $ this -> headers [ $ name ] = $ value ; } | Set a single response header |
56,032 | public function sendHeaders ( ) { $ codes = $ this -> getHttpResponseCodes ( ) ; if ( ! array_key_exists ( $ this -> status , $ codes ) ) { $ this -> status = 500 ; $ string = 'HTTP/1.0 500 ' . $ codes [ 500 ] ; } else { if ( $ this -> isValidRedirectStatus ( ) ) { throw new \ Exception ( 'You cannot send a redirect us... | Send the HTTP Response Headers |
56,033 | public function hasAllRequiredModules ( ) { $ required = $ this -> getRequiredModules ( ) ; $ available = array_keys ( $ this -> module -> getList ( ) ) ; $ difference = array_diff ( $ required , array_intersect ( $ required , $ available ) ) ; return empty ( $ difference ) ; } | Whether the current distribution contains all the required modules |
56,034 | public function installModules ( ) { foreach ( $ this -> getRequiredModules ( ) as $ module_id ) { if ( $ this -> getModuleModel ( ) -> install ( $ module_id ) !== true ) { $ error = $ this -> translation -> text ( 'Failed to install module @module_id' , array ( '@module_id' => $ module_id ) ) ; throw new RuntimeExcept... | Install all required modules |
56,035 | public function setBaseService ( $ response , $ dbService , $ request ) { $ this -> response = $ response ; ini_set ( "log_errors_max_len" , 0 ) ; if ( $ dbService != null ) { $ this -> entityManager = $ dbService -> getEntityManager ( ) ; } $ this -> request = $ request ; } | We use this method to let user set their own constructor with injection |
56,036 | public static function register ( $ debug = false ) { if ( $ debug && class_exists ( '\Whoops\Run' ) ) { $ whoops = new \ Whoops \ Run ( ) ; $ whoops -> pushHandler ( new \ Whoops \ Handler \ PrettyPageHandler ( ) ) ; $ whoops -> register ( ) ; return ; } set_error_handler ( [ static :: class , 'errorHandler' ] , - 1 )... | Registers error handling functions . |
56,037 | public static function exceptionHandler ( \ Throwable $ throwable ) { self :: showError ( $ throwable ) ; Log :: error ( ( string ) $ throwable ) ; } | Exception handler . Shows error & log it . |
56,038 | private function createStringToSign ( $ self_key , $ client_id , $ scope , $ context ) { $ s2s = sprintf ( "SIGNER-HMAC-%s\n%s\n%s\n%s\n%s" , strtoupper ( $ this -> hash_algo ) , $ self_key , $ client_id , hash ( $ this -> hash_algo , $ scope ) , hash ( $ this -> hash_algo , $ context ) ) ; $ this -> logger -> debug ( ... | Creates the string - to - sign based on a variety of factors . |
56,039 | private function createContext ( array $ payload ) { $ canonical_payload = [ ] ; foreach ( $ payload as $ k => $ v ) { $ k = strtolower ( $ k ) ; $ v = strtolower ( $ v ) ; $ canonical_payload [ $ k ] = sprintf ( '%s=%s' , $ k , $ v ) ; } ksort ( $ canonical_payload ) ; $ signed_headers_string = implode ( ';' , array_k... | An array of key - value pairs representing the data that you want to sign . All values must be scalar . |
56,040 | private function getSigningSalt ( $ self_key , $ client_id , $ client_secret ) { $ self_key_sign = hash_hmac ( $ this -> hash_algo , $ self_key , $ client_secret , true ) ; $ client_id_sign = hash_hmac ( $ this -> hash_algo , $ client_id , $ self_key_sign , true ) ; $ salt = hash_hmac ( $ this -> hash_algo , 'signer' ,... | Gets the salt value that should be used for signing . |
56,041 | private function createScope ( $ self_key , $ client_id ) { $ scope = sprintf ( '%s/%s/signer' , $ self_key , $ client_id ) ; $ this -> logger -> debug ( __FUNCTION__ , [ 'scope' => $ scope , ] ) ; return $ scope ; } | Creates the scope in which the signature is valid . |
56,042 | public function makePath ( Node \ File $ node , ? string $ dir = null , string $ ext = '.php' ) : array { if ( is_null ( $ node -> class ) ) { throw new UnexpectedValueException ( 'File without class cannot be saved' ) ; } $ dir = $ dir ?? $ this -> baseDir ; $ path = str_replace ( '\\' , '/' , $ node -> namespace ) ; ... | Makes path of file for save compiled file node |
56,043 | public function compile ( Node \ File $ node ) : array { if ( is_null ( $ node -> class ) ) { throw new UnexpectedValueException ( 'File without class cannot be saved' ) ; } $ result = $ node -> uses ; if ( is_a ( $ node -> class , Node \ Class_ :: class ) ) { $ result [ ] = $ this -> compileClass ( $ node -> class ) ;... | Compiles file node to PHP AST |
56,044 | private function constructPathNameLexer ( ) { if ( $ this -> originalTwigLexer == null ) { $ this -> originalTwigLexer = $ this -> templateRenderer -> getStringEnvironment ( ) -> getLexer ( ) ; } if ( $ this -> pathLexer == null ) { $ this -> pathLexer = new \ Twig_Lexer ( $ this -> templateRenderer -> getStringEnviron... | Makes a new Twig Lexer just for the path name stuff . |
56,045 | private function restoreOriginalLexer ( ) { if ( $ this -> originalTwigLexer != null ) { $ this -> templateRenderer -> getStringEnvironment ( ) -> setLexer ( $ this -> originalTwigLexer ) ; } } | Restores the original Twig lexer . |
56,046 | public function processPath ( $ path ) { $ path = $ this -> replaceDoubleOpeningBrackets ( $ path ) ; $ path = $ this -> convertSingleOpeningSquareBracketsToPipes ( $ path ) ; $ path = $ this -> replaceBracketEscapeSequenceWithSingleOpeningBrackets ( $ path ) ; $ this -> constructPathNameLexer ( ) ; $ path = $ this -> ... | Processes the provided path . |
56,047 | public function update ( Request $ request ) { $ this -> authorize ( 'update' , Settings :: class ) ; $ this -> validate ( $ request , [ 'text_editor' => 'required|in:plain-text,markdown,wysiwyg' , 'public_url' => 'required|max:255' , ] ) ; Settings :: first ( ) -> update ( [ 'text_editor' => $ request -> input ( 'text... | Update tickets settings . |
56,048 | public function getValidatorFor ( $ entity ) { $ rules = $ this -> getEntityRulesFor ( $ entity ) ; return $ this -> validator -> make ( $ this -> extract ( $ entity ) , $ rules -> rules ( $ entity ) , $ rules -> messages ( ) ) ; } | Creates a validator for the entity using any configured rules |
56,049 | protected function alterAction ( $ destination , $ action ) { if ( ! $ this -> exists ( ) || ! $ this -> isFilesystemWritable ( $ this -> full ) ) { return false ; } if ( $ this -> isDir ( $ destination ) ) { $ destination = rtrim ( $ destination , '/' ) . '/' . basename ( $ this -> path ) ; } $ res = $ this -> getDriv... | Do copy or rename in same filesystem |
56,050 | public function assertIsTrue ( $ value , $ message = '%s must be True' , $ exception = 'Asserts' ) { if ( is_bool ( $ value ) === false || $ value !== true ) { $ this -> throwException ( $ exception , $ message , $ value ) ; } } | Verifies that the specified condition is true . The assertion fails if the condition is false . |
56,051 | public static function create ( $ uri , $ method = 'GET' , $ parameters = array ( ) , $ cookies = array ( ) , $ files = array ( ) , $ server = array ( ) , $ content = null ) { $ defaults = array ( 'SERVER_NAME' => 'localhost' , 'SERVER_PORT' => 80 , 'HTTP_HOST' => 'localhost' , 'HTTP_USER_AGENT' => 'PhpAlchemy/1.0' , '... | Creates a Request based on a given URI and configuration . |
56,052 | protected function getFieldOneColumnValue ( ) { return function ( $ row ) { $ value = is_null ( $ row -> value ) ? null : array_get ( $ row -> value , 'field_1' ) ; if ( is_null ( $ value ) ) { return '---' ; } return array_get ( ModuleProcessor :: getOptions ( ) , $ value , '---' ) ; } ; } | Gets field 1 colum value |
56,053 | protected function getFieldRow ( $ label ) { return function ( $ row ) use ( $ label ) { if ( is_null ( $ row -> value ) ) { return '---' ; } $ value = array_get ( $ row -> value , $ label ) ; $ class = ( $ value ) ? 'success' : 'danger' ; $ label = ( $ value ) ? 'yes' : 'no' ; return '<span class = "label-basic label-... | Gets field row decorator |
56,054 | protected function users ( ) { $ rows = \ Antares \ Modules \ SampleModule \ Model \ ModuleRow :: query ( ) -> groupBy ( 'user_id' ) -> with ( 'user' ) -> get ( ) ; $ return = [ '' => trans ( 'antares/users::messages.statuses.all' ) ] ; foreach ( $ rows as $ row ) { $ return [ $ row -> user_id ] = $ row -> user -> full... | Creates select for statuses |
56,055 | public function addMany ( array $ attributes ) { if ( count ( $ attributes ) > 0 ) { foreach ( $ attributes as $ name => $ value ) { $ this -> add ( $ name , $ value ) ; } } return $ this ; } | Add many attributes to collection |
56,056 | private function makeAttribute ( $ name , $ value ) { $ attribute = Attribute :: make ( $ name , $ value ) ; $ this -> put ( $ attribute -> getName ( ) , $ attribute ) ; return $ this ; } | Adding a new attribute to collection |
56,057 | private function updateAttribute ( $ name , $ value ) { $ attribute = $ this -> getAttr ( $ name ) ; if ( ! is_null ( $ attribute ) ) { $ attribute -> addContent ( $ value ) ; $ this -> put ( $ name , $ attribute ) ; } return $ this ; } | Updating existing attribute |
56,058 | public function forgetValue ( $ name , $ value ) { if ( $ this -> has ( $ name ) ) { $ attr = $ this -> getAttr ( $ name ) ; $ attr -> forgetValue ( $ value ) ; } return $ this ; } | Forget an attribute value |
56,059 | public static function exists ( $ bundle ) { return $ bundle == DEFAULT_BUNDLE or Arrays :: in ( Inflector :: lower ( $ bundle ) , static :: names ( ) ) ; } | Determine if a bundle exists within the bundles directory . |
56,060 | public function findUser ( array $ params ) { $ userProvider = $ this -> container [ UserProvider :: class ] ; try { $ user = $ userProvider -> loadUserByUsername ( $ params [ 'username' ] ) ; } catch ( \ Exception $ e ) { return false ; } return $ user ; } | Find a specific user based on a set of parameters |
56,061 | public function authenticate ( User $ user , array $ params = [ ] ) { if ( $ user -> isEnabled ( ) && password_verify ( $ params [ 'password' ] , $ user -> getPassword ( ) ) ) { return $ user -> getId ( ) ; } return false ; } | Returns user id or false if unable to authenticate |
56,062 | public function bind ( $ name , Closure $ bind ) { $ app = $ this ; $ this -> container [ $ name ] = function ( $ c ) use ( $ app , $ bind ) { return $ bind ( $ app ) ; } ; return $ this ; } | Bind a service into the container . |
56,063 | protected function bootstrap ( ) { foreach ( $ this -> bootstraps as $ bClass ) { $ b = new $ bClass ; if ( $ b instanceof BootstrapperInterface ) { $ b -> bootstrap ( $ this ) ; } } return $ this ; } | Bootstrap default services into the container . |
56,064 | public function setTotalCountByQueryBuilder ( QueryBuilder $ queryBuilder ) { $ queryBuilder -> select ( sprintf ( 'COUNT(%s)' , $ queryBuilder -> getRootAliases ( ) [ 0 ] ) ) -> setMaxResults ( 1 ) ; return $ this -> setTotalCount ( intval ( $ queryBuilder -> getQuery ( ) -> getSingleScalarResult ( ) ) ) ; } | Set Total Count |
56,065 | public function getItemsArray ( ) { $ items = [ ] ; foreach ( $ this -> getItems ( ) as $ item ) { $ items [ ] = [ 'id' => $ item -> getId ( ) , 'text' => $ item -> getText ( ) , ] ; } return $ items ; } | Items as Array |
56,066 | public function init ( $ keepalive = false ) { $ this -> handshake ( ) ; $ this -> connect ( ) ; if ( $ keepalive ) { $ this -> keepAlive ( ) ; } else { return $ this ; } } | Initialize a new connection |
56,067 | public function keepAlive ( ) { while ( is_resource ( $ this -> fd ) ) { if ( $ this -> session [ 'heartbeat_timeout' ] > 0 && $ this -> session [ 'heartbeat_timeout' ] + $ this -> heartbeatStamp - 5 < time ( ) ) { $ this -> send ( self :: TYPE_HEARTBEAT ) ; $ this -> heartbeatStamp = time ( ) ; } $ r = array ( $ this ... | Keep the connection alive and dispatch events |
56,068 | public function on ( $ event , $ callback ) { if ( ! is_callable ( $ callback ) ) { throw new Exception ( 'Socketio::on() type callback must be callable.' ) ; } if ( ! isset ( $ this -> callbacks [ $ event ] ) ) { $ this -> callbacks [ $ event ] = array ( ) ; } if ( in_array ( $ callback , $ this -> callbacks [ $ event... | Attach an event handler function for a given event |
56,069 | public function close ( ) { if ( is_resource ( $ this -> fd ) ) { $ this -> send ( self :: TYPE_DISCONNECT ) ; fclose ( $ this -> fd ) ; return true ; } return false ; } | Close the socket |
56,070 | private function stdout ( $ type , $ message ) { if ( ! defined ( 'STDOUT' ) || ! $ this -> debug ) { return false ; } $ typeMap = array ( 'debug' => array ( 36 , '- debug -' ) , 'info' => array ( 37 , '- info -' ) , 'error' => array ( 31 , '- error -' ) , 'ok' => array ( 32 , '- ok -' ) , ) ; if ( ! Arrays :: exis... | Send ANSI formatted message to stdout . First parameter must be either debug info error or ok |
56,071 | private function handshake ( ) { $ url = $ this -> socketIOUrl ; if ( ! empty ( $ this -> handshakeQuery ) ) { $ url .= $ this -> handshakeQuery ; } $ ch = curl_init ( $ url ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , true ) ; if ( ! $ this -> checkSslPeer ) { curl_setopt ( $ ch , CURLOPT_SSL_VERIFYPEER , false )... | Handshake with socket . io server |
56,072 | public function setChannelIds ( array $ channelIds ) { foreach ( $ channelIds as $ channelId ) { if ( ! is_numeric ( $ channelId ) ) { throw new \ Exception ( 'Channel ID should be numeric.' ) ; } } $ this -> channels = $ channelIds ; return $ this ; } | Filter video list by one or multiple channel IDs . |
56,073 | public static function create ( $ path , $ code = null , BaseException $ previous = null ) { $ class = get_called_class ( ) ; return new $ class ( sprintf ( "The path '%s' doesn't exist." , $ path ) , is_int ( $ code ) ? $ code : null , $ previous ) ; } | Create a new InvalidPathException |
56,074 | public function getRemaining ( ) { $ speed = $ this -> getSpeed ( ) ; $ notHandledCount = $ this -> all - $ this -> handled ; $ remainingSeconds = $ speed != 0 ? $ notHandledCount / $ speed : $ notHandledCount ; return round ( $ remainingSeconds ) ; } | Get remaining seconds |
56,075 | public function getStatus ( ) { $ speed = round ( $ this -> getSpeed ( ) , 2 ) ; $ remaining = $ this -> getRemaining ( ) ; $ remainingTime = $ this -> getFormatTime ( $ remaining ) ; $ handled = str_pad ( $ this -> handled , $ this -> allCountLength , ' ' , STR_PAD_LEFT ) ; return "Handled: $handled/$this->all\tRemain... | Get status message |
56,076 | protected function getFormatTime ( $ time ) { $ hours = str_pad ( floor ( $ time / 60 / 60 ) , 2 , '0' , STR_PAD_LEFT ) ; $ minutes = str_pad ( floor ( ( $ time - ( ( int ) $ hours * 60 * 60 ) ) / 60 ) , 2 , '0' , STR_PAD_LEFT ) ; $ seconds = str_pad ( floor ( ( $ time - ( ( int ) $ hours * 60 * 60 ) - ( ( int ) $ minu... | Get formatted time |
56,077 | public function showStatus ( $ frequency = null ) { if ( $ frequency !== null && $ this -> handled % $ frequency !== 0 ) { return ; } $ this -> stdout ( $ this -> getStatus ( ) . PHP_EOL , static :: FG_YELLOW ) ; } | Output status message |
56,078 | public function showFinish ( ) { $ processingTime = $ this -> getFormatTime ( $ this -> diffBetweenStart ( ) ) ; $ message = "Finished after $processingTime\tHandled: $this->handled items" ; $ this -> stdout ( PHP_EOL . $ message . PHP_EOL , static :: FG_GREEN ) ; } | Output finih message |
56,079 | public function reset ( $ newAllCount = null ) { if ( $ newAllCount !== null ) { $ this -> all = $ newAllCount ; $ this -> allCountLength = strlen ( "$newAllCount" ) ; } $ this -> start = microtime ( true ) ; $ this -> handled = 0 ; } | Reset current time log |
56,080 | public function presentParent ( ) { if ( ( int ) $ this -> post_parent === 0 ) { return null ; } $ parent = get_post ( $ this -> post_parent ) ; return new self ( $ parent , false ) ; } | Return the parent page as PagePresenter instance |
56,081 | public function presentChildren ( ) { $ childrenPages = new \ WP_Query ( array ( 'post_type' => 'page' , 'post_parent' => $ this -> ID , 'post_status' => 'publish' , 'orderby' => 'menu_order' , 'order' => 'ASC' , 'posts_per_page' => - 1 ) ) ; if ( count ( $ childrenPages -> posts ) == 0 || ! $ childrenPages ) { return ... | Return direct children of the page as PagePresenter instances |
56,082 | private function buildQuery ( array $ parameters ) { if ( empty ( $ parameters ) ) { return '' ; } $ keys = self :: urlencode_rfc3986 ( array_keys ( $ parameters ) ) ; $ values = self :: urlencode_rfc3986 ( array_values ( $ parameters ) ) ; $ parameters = array_combine ( $ keys , $ values ) ; uksort ( $ parameters , 's... | Format the parameters as a querystring |
56,083 | private function calculateHeader ( array $ parameters , $ url ) { $ parts = parse_url ( ( string ) $ url ) ; $ chunks = array ( ) ; foreach ( $ parameters as $ key => $ value ) { $ chunks [ ] = str_replace ( '%25' , '%' , self :: urlencode_rfc3986 ( $ key ) . '="' . self :: urlencode_rfc3986 ( $ value ) . '"' ) ; } $ r... | Build the Authorization header |
56,084 | private function doOAuthCall ( $ url , array $ parameters = null , $ method = 'POST' , $ expectJSON = true ) { $ url = ( string ) $ url ; $ parameters [ 'oauth_consumer_key' ] = $ this -> getApplicationKey ( ) ; $ parameters [ 'oauth_signature_method' ] = 'PLAINTEXT' ; $ parameters [ 'oauth_version' ] = '1.0' ; $ param... | Make an call to the oAuth |
56,085 | private static function urlencode_rfc3986 ( $ value ) { if ( Arrays :: is ( $ value ) ) { return array_map ( array ( __CLASS__ , 'urlencode_rfc3986' ) , $ value ) ; } else { return str_replace ( '%7E' , '~' , rawurlencode ( $ value ) ) ; } } | URL - encode method for internal use |
56,086 | public function metadata ( $ path = '' , $ fileLimit = 10000 , $ hash = false , $ list = true , $ includeDeleted = false , $ rev = null , $ locale = null , $ sandbox = false ) { $ url = '1/metadata/' ; $ url .= ( $ sandbox ) ? 'sandbox/' : 'dropbox/' ; $ url .= trim ( ( string ) $ path , '/' ) ; $ parameters = null ; $... | Retrieves file and folder metadata . |
56,087 | public function restore ( $ path , $ rev , $ locale = null , $ sandbox = false ) { $ url = '1/restore/' ; $ url .= ( $ sandbox ) ? 'sandbox/' : 'dropbox/' ; $ url .= trim ( ( string ) $ path , '/' ) ; $ parameters [ 'rev' ] = ( string ) $ rev ; if ( $ locale !== null ) $ parameters [ 'locale' ] = ( string ) $ locale ; ... | Restores a file path to a previous revision . Unlike downloading a file at a given revision and then re - uploading it this call is atomic . It also saves a bunch of bandwidth . |
56,088 | public function search ( $ path , $ query , $ fileLimit = 1000 , $ includeDeleted = null , $ locale = null , $ sandbox = false ) { $ url = '1/search/' ; $ url .= ( $ sandbox ) ? 'sandbox/' : 'dropbox/' ; $ url .= trim ( ( string ) $ path , '/' ) ; $ parameters [ 'query' ] = ( string ) $ query ; $ parameters [ 'file_lim... | Returns metadata for all files and folders whose filename contains the given search string as a substring . Searches are limited to the folder path and its sub - folder hierarchy provided in the call . |
56,089 | public function shares ( $ path , $ shortUrl = true , $ locale = null , $ sandbox = false ) { $ url = '1/shares/' ; $ url .= ( $ sandbox ) ? 'sandbox/' : 'dropbox/' ; $ url .= trim ( ( string ) $ path , '/' ) ; $ parameters [ 'short_url' ] = ( ( bool ) $ shortUrl ) ? 'true' : 'false' ; if ( $ locale !== null ) $ parame... | Creates and returns a Dropbox link to files or folders users can use to view a preview of the file in a web browser . |
56,090 | public function copyRef ( $ path , $ sandbox = false ) { $ url = '1/copy_ref/' ; $ url .= ( $ sandbox ) ? 'sandbox/' : 'dropbox/' ; $ url .= trim ( ( string ) $ path , '/' ) ; return ( array ) $ this -> doCall ( $ url ) ; } | Creates and returns a copy_ref to a file . This reference string can be used to copy that file to another user s Dropbox by passing it in as the fromCopyRef parameter on fileopsCopy . |
56,091 | public function thumbnails ( $ path , $ size = 'small' , $ format = 'jpeg' , $ sandbox = false ) { $ url = '1/thumbnails/' ; $ url .= ( $ sandbox ) ? 'sandbox/' : 'dropbox/' ; $ url .= trim ( ( string ) $ path , '/' ) ; $ parameters [ 'size' ] = ( string ) $ size ; $ parameters [ 'format' ] = ( string ) $ format ; retu... | Gets a thumbnail for an image . |
56,092 | public function fileopsCopy ( $ fromPath = null , $ toPath , $ fromCopyRef = null , $ locale = null , $ sandbox = false ) { $ url = '1/fileops/copy' ; $ parameters [ 'root' ] = ( $ sandbox ) ? 'sandbox' : 'dropbox' ; if ( $ fromPath !== null ) $ parameters [ 'from_path' ] = ( string ) $ fromPath ; $ parameters [ 'to_pa... | Copies a file or folder to a new location . |
56,093 | public function fileopsMove ( $ fromPath , $ toPath , $ locale = null , $ sandbox = false ) { $ url = '1/fileops/move' ; $ parameters [ 'from_path' ] = ( string ) $ fromPath ; $ parameters [ 'to_path' ] = ( string ) $ toPath ; $ parameters [ 'root' ] = ( $ sandbox ) ? 'sandbox' : 'dropbox' ; if ( $ locale !== null ) $ ... | Moves a file or folder to a new location . |
56,094 | public function getTokenAttribute ( $ value ) { if ( ! is_null ( $ value ) ) { $ value = json_decode ( $ value , true ) ; } return new Token ( $ value ) ; } | Get token attribute using accessor . |
56,095 | public function setTokenAttribute ( Token $ token ) { $ value = null ; if ( ! $ token -> isValid ( ) ) { $ value = $ token -> toJson ( ) ; } $ this -> attributes [ 'token' ] = $ value ; } | Set token attribute using mutator . |
56,096 | public function delete ( $ value ) { foreach ( array_keys ( $ this -> collection , $ value , true ) as $ key ) { unset ( $ this -> collection [ $ key ] ) ; } return $ this ; } | Deletes all elements containing a given value . |
56,097 | public function unserialize ( $ serialized ) { $ identifier = __CLASS__ . '@' ; if ( substr ( $ serialized , 0 , strlen ( $ identifier ) ) !== $ identifier ) { $ message = sprintf ( 'Serialized value doesn\'t represents an instance.of "%s".' , __CLASS__ ) ; throw new Exception \ InvalidArgumentException ( $ message ) ;... | Restores a serialized collection . |
56,098 | public function getUserCompnies ( $ user_id , $ status ) { $ criteria = new CDbCriteria ; $ criteria -> join .= "INNER JOIN profiles p ON p.person_id = ccuc_person_id AND ccuc_status='" . $ status . "'" ; $ criteria -> condition = 'p.user_id = ' . $ user_id ; return CcucUserCompany :: model ( ) -> findAll ( $ criteria... | get user companies by user and status |
56,099 | public function getPersonCompnies ( $ pprs_id , $ status ) { $ criteria = new CDbCriteria ; $ criteria -> condition = "t.ccuc_person_id = " . $ pprs_id . " and t.ccuc_status = '" . $ status . "'" ; return CcucUserCompany :: model ( ) -> findAll ( $ criteria ) ; } | get person companies by person and status |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.