idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
9,300 | public function write ( $ data ) { if ( $ this -> closed ) { return ; } $ all = $ this -> tail . $ data ; $ messages = $ this -> getParser ( ) -> consumeAll ( $ all ) ; $ this -> tail = $ all ; foreach ( $ messages as $ message ) { if ( isset ( $ message [ 'message' ] ) ) { $ this -> emit ( 'data' , array ( $ message [... | Parses messages from data piped to this stream and emits them as events . |
9,301 | public function clean ( ) { $ dba = $ this -> dba ; $ key = dba_firstkey ( $ dba ) ; while ( $ key !== false && $ key !== null ) { $ this -> retrieve ( $ key ) ; $ key = dba_nextkey ( $ dba ) ; } return dba_optimize ( $ dba ) ; } | Cleans and optimizes the cache from all expired entries . |
9,302 | public function flush ( ) { if ( file_exists ( $ this -> file ) ) { $ this -> __destruct ( ) ; unlink ( $ this -> file ) ; clearstatcache ( ) ; return true ; } return false ; } | Flush the whole storage . |
9,303 | public static function isModified ( $ mtime , $ etag = '' ) { $ modifiedSince = strtotime ( preg_replace ( '/;.*$/' , '' , self :: $ IfModifiedSince ) ) ; return ! ( $ modifiedSince >= $ mtime || self :: $ IfNoneMatch == $ etag ) ; } | Actual HTTP caching validation . |
9,304 | public static function sendDownloadDialog ( $ fileOrString , $ fileName , $ exit = true ) { $ disposition = ( false !== strpos ( self :: $ userAgent , 'MSIE 5.5' ) ) ? '' : 'attachment; ' ; header ( "Pragma: public" ) ; header ( "Expires: 0" ) ; header ( "Cache-Control: must-revalidate, post-check=0, pre-check=0" ) ; h... | Sends file as download - header through any firewall to the browsers like > = IE6 > = FF3 . 6 Safari Chrome Opera . |
9,305 | public function run ( bool $ clear = false ) { $ profile = $ this -> registry -> get ( $ this -> getProfile ( ) ) ; $ this -> executor -> backup ( $ profile , $ clear ) ; } | Execute the backup . |
9,306 | public static function factory ( string $ alphabet , string $ ph , string $ text ) : Phoneme { $ instance = new static ( ) ; $ instance -> alphabet = $ alphabet ; $ instance -> ph = $ ph ; $ instance -> text = $ text ; return $ instance ; } | Creates a phoneme element with the given data as attributes . |
9,307 | public static function tarjan_scc ( Digraph $ graph , TarjanSCCVisitor $ visitor = NULL ) { $ visitor = $ visitor ? : new TarjanSCCVisitor ( ) ; $ counter = 0 ; $ stack = array ( ) ; $ indices = new \ SplObjectStorage ( ) ; $ lowlimits = new \ SplObjectStorage ( ) ; $ visit = function ( $ vertex ) use ( & $ visit , & $... | Finds connected components in the provided directed graph . |
9,308 | protected function generateParameter ( $ requestTypeName , $ requestType ) { if ( $ requestNamespace = $ this -> getRequestNamespace ( ) ) { $ requestType = Soap :: REQUEST_NAMESPACE_ALIAS . '\\' . $ requestType ; } $ parameter = new SoapParameter ; $ parameter -> generate ( $ requestTypeName , $ requestType ) ; return... | Generate a parameter generator from a SOAP function description s parameter name and type . |
9,309 | public function DeleteLabel ( Request \ DeleteLabel $ DeleteLabel = null ) { $ uri = $ this -> getUri ( '/label' , array ( ) ) ; return $ this -> delete ( $ uri , $ DeleteLabel ) ; } | Removes a label from all labeled objects and deletes it |
9,310 | public function QueryLabels ( Request \ QueryLabels $ QueryLabels = null ) { $ uri = $ this -> getUri ( '/label' , array ( ) ) ; return $ this -> get ( $ uri , $ QueryLabels ) ; } | Returns all defined labels |
9,311 | public function LabelBroadcast ( $ Id , Request \ LabelBroadcast $ LabelBroadcast ) { $ uri = $ this -> getUri ( '/label/broadcast/%s' , array ( $ Id ) ) ; return $ this -> post ( $ uri , $ LabelBroadcast ) ; } | Adds a label to a broadcast creating the label if it doesn t already exist |
9,312 | public function UnlabelBroadcast ( $ Id , Request \ UnlabelBroadcast $ UnlabelBroadcast ) { $ uri = $ this -> getUri ( '/label/broadcast/%s' , array ( $ Id ) ) ; return $ this -> delete ( $ uri , $ UnlabelBroadcast ) ; } | Removes a label from a single broadcast |
9,313 | public function LabelNumber ( $ Number , Request \ LabelNumber $ LabelNumber ) { $ uri = $ this -> getUri ( '/label/number/%s' , array ( $ Number ) ) ; return $ this -> post ( $ uri , $ LabelNumber ) ; } | Adds a label to a single number |
9,314 | public function UnlabelNumber ( $ Number , Request \ UnlabelNumber $ UnlabelNumber ) { $ uri = $ this -> getUri ( '/label/number/%s' , array ( $ Number ) ) ; return $ this -> delete ( $ uri , $ UnlabelNumber ) ; } | Removes a label from a single number |
9,315 | public function format ( ) { if ( $ this -> getMessage ( ) == '' || ! $ this -> getMessage ( ) ) { return '' ; } if ( count ( $ this -> bindings ) > 0 ) { foreach ( $ this -> bindings as $ token => $ value ) { $ this -> message = str_replace ( $ this -> delimiter . $ token , $ value , $ this -> message ) ; } } return $... | Retuns formated message . |
9,316 | private function updateUriQuery ( ) : void { $ sort = [ ] ; foreach ( $ this -> order as $ field => $ direction ) { if ( $ direction === self :: ORDER_ASC ) { $ sort [ ] = $ field ; } elseif ( $ direction === self :: ORDER_DESC ) { $ sort [ ] = '-' . $ field ; } } $ fields = [ ] ; foreach ( $ this -> fields as $ type =... | Updates the uri query |
9,317 | public function requestField ( string $ type , string $ name ) : void { $ this -> fields [ $ type ] [ ] = $ name ; $ this -> updateUriQuery ( ) ; } | Define a field as requested . This method will manipulate the uri of the request . |
9,318 | public function requestInclude ( string $ relationship ) : void { $ this -> includes [ ] = $ relationship ; $ this -> currentLevelIncludes [ ] = explode ( '.' , $ relationship ) [ 0 ] ; $ this -> updateUriQuery ( ) ; } | Define a relationship as included . This method will manipulate the uri of the request . |
9,319 | public function addFilter ( string $ name , $ value ) : void { $ this -> filter [ $ name ] = $ value ; $ this -> updateUriQuery ( ) ; } | Define a filter value . This method will manipulate the uri of the request . |
9,320 | public function addOrderBy ( string $ name , string $ direction = self :: ORDER_ASC ) : void { $ this -> order [ $ name ] = $ direction ; $ this -> updateUriQuery ( ) ; } | Define a sort parameter . This method will manipulate the uri of the request . |
9,321 | public function addPagination ( string $ key , $ value ) : void { $ this -> pagination [ $ key ] = $ value ; $ this -> updateUriQuery ( ) ; } | Define a pagination parameter . This method will manipulate the uri of the request . |
9,322 | public function createSubRequest ( string $ relationship , ? ResourceInterface $ resource = null , bool $ keepFilters = false ) : RequestInterface { $ requestKey = $ relationship . ( $ keepFilters ? '-filtered' : '-not-filtered' ) ; if ( ! \ array_key_exists ( $ requestKey , $ this -> subRequests ) ) { $ includes = [ ]... | Creates a request for the given relationship . If called twice the call will return the already created sub request . A sub request does not contain pagination and sorting from its parent . |
9,323 | public static function setupPDO ( $ connectionString , $ user , $ password ) { try { self :: $ pdoInstance = new PDO ( $ connectionString , $ user , $ password ) ; } catch ( PDOException $ e ) { trigger_error ( $ e -> getMessage ( ) , E_USER_ERROR ) ; } } | Initialize PDO connection . |
9,324 | public static function storage ( $ storage = null ) { if ( $ storage === null ) { $ storage = Config :: get ( 'cache.storage' ) ? : 'memory' ; } if ( ! isset ( static :: $ storages [ $ storage ] ) ) { static :: $ storages [ $ storage ] = static :: factory ( $ storage ) ; } return static :: $ storages [ $ storage ] ; } | Get a cache storage instance . |
9,325 | protected static function factory ( $ storage ) { $ cache = Config :: get ( 'cache' ) ; switch ( $ storage ) { case 'apc' : return new CS \ Apc ( $ cache [ 'key' ] ) ; case 'file' : return new CS \ File ( $ cache [ 'storage_path' ] ) ; case 'pdo' : return new CS \ Pdo ( Pdo \ Factory :: get ( $ cache [ 'database' ] ) ,... | Create a new cache storage instance . |
9,326 | private function getClassMetadata ( \ ReflectionClass $ reflectionClass ) { $ classMetadata = $ this -> getMetadataDriver ( ) -> loadMetadataForClass ( $ reflectionClass ) ; if ( null === $ classMetadata -> encryptionMode ) { $ classMetadata -> encryptionMode = $ this -> settings [ 'default_mode' ] ; } return $ classMe... | Returns the metadata for a given class |
9,327 | private function getMetadataDirs ( ) { if ( null === $ this -> metadataDirs ) { $ this -> metadataDirs = array ( ) ; $ bundles = $ this -> kernel -> getBundles ( ) ; $ fs = new Filesystem ( ) ; foreach ( $ bundles as $ bundleName => $ bundle ) { $ directory = $ this -> kernel -> locateResource ( "@$bundleName/Resources... | Returns the directories in which to look for the encryption metadata |
9,328 | private function getMetadataDriver ( ) { if ( null === $ this -> driver ) { $ metadataDirs = $ this -> getMetadataDirs ( ) ; $ annotationDriver = new AnnotationDriver ( $ this -> reader ) ; if ( ! empty ( $ metadataDirs ) ) { $ fileLocator = new FileLocator ( $ metadataDirs ) ; $ ymlDriver = new YamlDriver ( $ fileLoca... | Returns the metadata driver |
9,329 | public function CreateBroadcast ( Request \ CreateBroadcast $ CreateBroadcast = null ) { $ uri = $ this -> getUri ( '/broadcast' , array ( ) ) ; return $ this -> post ( $ uri , $ CreateBroadcast ) ; } | Creates a new Broadcast |
9,330 | public function QueryBroadcasts ( Request \ QueryBroadcasts $ QueryBroadcasts = null ) { $ uri = $ this -> getUri ( '/broadcast' , array ( ) ) ; return $ this -> get ( $ uri , $ QueryBroadcasts ) ; } | Lists existing Broadcasts |
9,331 | public function GetBroadcastStats ( $ Id , Request \ GetBroadcastStats $ GetBroadcastStats ) { $ uri = $ this -> getUri ( '/broadcast/%s/stats' , array ( $ Id ) ) ; return $ this -> get ( $ uri , $ GetBroadcastStats ) ; } | Gets performance and result statistics for a Broadcast |
9,332 | public function ControlBroadcast ( $ Id , Request \ ControlBroadcast $ ControlBroadcast ) { $ uri = $ this -> getUri ( '/broadcast/%s/control' , array ( $ Id ) ) ; return $ this -> put ( $ uri , $ ControlBroadcast ) ; } | Starts Stops or Archives a Broadcast |
9,333 | public function CreateContactBatch ( $ BroadcastId , Request \ CreateContactBatch $ CreateContactBatch ) { $ uri = $ this -> getUri ( '/broadcast/%s/batch' , array ( $ BroadcastId ) ) ; return $ this -> post ( $ uri , $ CreateContactBatch ) ; } | Creates a new ContactBatch |
9,334 | public function QueryContactBatches ( $ BroadcastId , Request \ QueryContactBatches $ QueryContactBatches ) { $ uri = $ this -> getUri ( '/broadcast/%s/batch' , array ( $ BroadcastId ) ) ; return $ this -> get ( $ uri , $ QueryContactBatches ) ; } | Lists a Broadcast s ContactBatch |
9,335 | public function ControlContactBatch ( $ Id , Request \ ControlContactBatch $ ControlContactBatch ) { $ uri = $ this -> getUri ( '/broadcast/batch/%s/control' , array ( $ Id ) ) ; return $ this -> put ( $ uri , $ ControlContactBatch ) ; } | Enables or Disables a Broadcast s ContactBatch |
9,336 | public function CreateBroadcastSchedule ( $ BroadcastId , Request \ CreateBroadcastSchedule $ CreateBroadcastSchedule ) { $ uri = $ this -> getUri ( '/broadcast/%s/schedule' , array ( $ BroadcastId ) ) ; return $ this -> post ( $ uri , $ CreateBroadcastSchedule ) ; } | Creates a new Schedule for a Broadcast |
9,337 | public function QueryBroadcastSchedule ( $ BroadcastId , Request \ QueryBroadcastSchedule $ QueryBroadcastSchedule ) { $ uri = $ this -> getUri ( '/broadcast/%s/schedule' , array ( $ BroadcastId ) ) ; return $ this -> get ( $ uri , $ QueryBroadcastSchedule ) ; } | Lists existing BroadcastSchedules |
9,338 | public function UpdateBroadcast ( $ id , Request \ UpdateBroadcast $ UpdateBroadcast = null ) { $ uri = $ this -> getUri ( '/broadcast/%s' , array ( $ id ) ) ; return $ this -> put ( $ uri , $ UpdateBroadcast ) ; } | Updates an existing Broadcast s configuration |
9,339 | public static function checkUtf8Encoding ( $ string ) { if ( ! mb_check_encoding ( $ string , 'UTF-8' ) || ! $ string == mb_convert_encoding ( mb_convert_encoding ( $ string , 'UTF-32' , 'UTF-8' ) , 'UTF-8' , 'UTF-32' ) ) { return false ; } return true ; } | Check for invalid UTF8 encoding and invalid byte . |
9,340 | public static function ensureTrailing ( $ needle , $ haystack ) { $ needleLength = strlen ( $ needle ) ; $ needlePart = substr ( $ haystack , - 1 * $ needleLength ) ; if ( $ needlePart !== $ needle ) { $ haystack .= $ needle ; } return $ haystack ; } | Ensure that a string is ends with a special string . |
9,341 | public static function ensureLeading ( $ needle , $ haystack ) { $ needleLength = strlen ( $ needle ) ; $ needlePart = substr ( $ haystack , 0 , $ needleLength ) ; if ( $ needlePart !== $ needle ) { $ haystack = $ needle . $ haystack ; } return $ haystack ; } | Ensure that a string is starts with a special string . |
9,342 | public static function deleteTrailing ( $ needle , $ haystack ) { $ pattern = '#(' . self :: pregQuote ( $ needle , '#' ) . ')+$#' ; $ result = preg_replace ( $ pattern , '' , $ haystack ) ; return $ result ; } | Delete trailing characters . |
9,343 | public static function deleteLeading ( $ needle , $ haystack ) { $ pattern = '#^(' . self :: pregQuote ( $ needle , '#' ) . ')+#' ; $ result = preg_replace ( $ pattern , '' , $ haystack ) ; return $ result ; } | Delete leading characters . |
9,344 | public static function pregQuote ( $ values , $ delimiter = null ) { if ( ! is_array ( $ values ) ) { return preg_quote ( $ values , $ delimiter ) ; } foreach ( $ values as $ key => $ value ) { $ values [ $ key ] = preg_quote ( $ value , $ delimiter ) ; } return implode ( '|' , $ values ) ; } | Wrapper for preg_quote supporting strings and array of strings . |
9,345 | public static function contains ( $ haystack , $ needle ) { foreach ( ( array ) $ needle as $ n ) { if ( strpos ( $ haystack , $ n ) !== false ) { return true ; } } return false ; } | Determine if a given string contains a given sub - string . |
9,346 | public static function endsWith ( $ haystack , $ needle ) { return $ needle == substr ( $ haystack , strlen ( $ haystack ) - strlen ( $ needle ) ) ; } | Determine if a given string ends with a given value . |
9,347 | public function resize ( $ pathToImage ) { $ file = $ this -> storage -> get ( $ pathToImage ) ; $ this -> sizes -> each ( function ( $ size , $ key ) use ( $ pathToImage , $ file ) { $ img = app ( ImageManager :: class ) -> make ( $ file ) ; $ path = $ this -> createThumbPath ( $ pathToImage , $ key ) ; switch ( $ siz... | Resize image to all configured sizes |
9,348 | public function rename ( $ pathToImage , $ newName ) { $ this -> sizes -> keys ( ) -> each ( function ( $ size ) use ( $ pathToImage , $ newName ) { $ existing = $ this -> createThumbPath ( $ pathToImage , $ size ) ; list ( $ path ) = $ this -> getThumbPath ( $ pathToImage , $ size ) ; if ( $ this -> storage -> exists ... | Rename thumbs for a image . |
9,349 | public function delete ( $ pathToImage , $ isDir = false ) { $ this -> sizes -> keys ( ) -> each ( function ( $ size ) use ( $ pathToImage , $ isDir ) { list ( $ path , $ name ) = $ this -> getThumbPath ( $ pathToImage , $ size ) ; $ file = $ path . '/' . $ name ; if ( $ this -> storage -> exists ( $ file ) ) { if ( ! ... | Delete all thumbs of an image . |
9,350 | public function createThumbPath ( $ originalFilePath , $ thumbSizeIdentifier ) { list ( $ path , $ file ) = $ this -> getThumbPath ( $ originalFilePath , $ thumbSizeIdentifier ) ; $ this -> storage -> makeDirectory ( $ path , 0777 , true , true ) ; return $ path . '/' . $ file ; } | Create dir for thumb and return file path with this thumb prefix |
9,351 | public function call ( ) { $ defaultOptions = array ( 'name' => 'BSESS' , 'lifetime' => 0 , 'path' => \ URL :: base ( '' , false ) , 'domain' => '' , 'secure' => false , 'httpOnly' => false , ) ; if ( is_array ( $ this -> options ) ) { $ this -> options = array_merge ( $ defaultOptions , $ this -> options ) ; } else { ... | Call method of SessionMiddleware |
9,352 | public function execute ( $ script ) { $ args = func_get_args ( ) ; $ cmd = escapeshellcmd ( "{$this->bin} " . implode ( ' ' , $ args ) ) ; if ( $ this -> debug ) $ cmd .= ' 2>&1' ; $ result = shell_exec ( $ cmd ) ; if ( $ this -> debug ) return $ result ; if ( $ result === null ) return false ; if ( substr ( $ result ... | Execute a given JS file |
9,353 | public function getResponseByKey ( $ key ) { return isset ( $ this -> responses [ $ key ] ) ? $ this -> responses [ $ key ] : null ; } | Get a response by array key |
9,354 | public function getCount ( ) { if ( isset ( $ this -> meta -> count ) ) { return $ this -> meta -> count ; } return $ this -> meta -> count = count ( $ this -> responses ) ; } | Get the count of responses Count the responses if not already set |
9,355 | protected function getResponseDescription ( $ code ) { $ codes = array ( 100 => 'Continue' , 101 => 'Switching Protocols' , 200 => 'OK' , 201 => 'Created' , 202 => 'Accepted' , 203 => 'Non-Authoritative Information' , 204 => 'No Content' , 205 => 'Reset Content' , 206 => 'Partial Content' , 300 => 'Multiple Choices' , ... | todo make use of this |
9,356 | public function write ( $ data ) { $ content = $ this -> file -> data ( ) ; $ content = substr ( $ content , 0 , $ this -> position ( ) ) ; $ content .= $ data ; $ this -> file -> setData ( $ content ) ; $ written = strlen ( $ data ) ; $ this -> offsetPosition ( $ written ) ; $ this -> file -> setModificationTime ( tim... | Writes data to file . Will return the number of bytes written . Will advance pointer by number of bytes written . |
9,357 | public function position ( $ position = null ) { return is_null ( $ position ) ? $ this -> position : $ this -> position = $ position ; } | Returns current pointer position . |
9,358 | public function truncate ( $ newSize = 0 ) { $ this -> position ( 0 ) ; $ newData = substr ( $ this -> file -> data ( ) , 0 , $ newSize ) ; $ newData = false === $ newData ? '' : $ newData ; $ this -> file -> setData ( $ newData ) ; $ this -> file -> setModificationTime ( time ( ) ) ; $ this -> file -> setChangeTime ( ... | Removed all data from file and sets pointer to 0 |
9,359 | public function build ( ) { if ( $ this -> currentDate === null ) { return null ; } return new Week ( $ this -> currentDate , $ this -> startDay ) ; } | Returns the data for this view . Could be anything! |
9,360 | public function getAttributes ( ) { $ this -> result = DB :: select ( DB :: raw ( 'show columns from `' . $ this -> table . '`;' ) ) ; unset ( $ this -> result [ 0 ] ) ; return $ this -> result ; } | Get attributes from table . |
9,361 | protected function _parseConfig ( array $ options = [ ] ) { if ( ! class_exists ( 'SoapClient' ) ) { $ this -> handleError ( 'Class SoapClient not found, please enable Soap extensions' ) ; } $ opts = [ 'http' => [ 'user_agent' => $ this -> getConfig ( 'userAgent' ) ] ] ; $ opts += $ options ; $ context = stream_context... | Setup Configuration options |
9,362 | public function connect ( array $ options = [ ] ) { $ config = $ this -> _parseConfig ( $ options ) ; try { $ this -> client = new SoapClient ( $ this -> getConfig ( 'wsdl' ) , $ config ) ; } catch ( SoapFault $ fault ) { $ this -> handleError ( $ fault -> faultstring ) ; } if ( $ this -> client ) { $ this -> connected... | Connects to the SOAP server using the WSDL in the configuration |
9,363 | public function sendRequest ( $ action , $ data ) { if ( ! $ this -> connected ) { $ this -> connect ( ) ; } try { $ result = $ this -> client -> __soapCall ( $ action , $ data ) ; } catch ( SoapFault $ fault ) { $ this -> handleError ( $ fault -> faultstring ) ; } return $ result ; } | Query the SOAP server with the given method and parameters |
9,364 | public function handleError ( $ error = null ) { if ( $ this -> logErrors === true ) { $ this -> log ( $ error ) ; if ( $ this -> client ) { $ this -> log ( $ this -> client -> __getLastRequest ( ) ) ; } } throw new Exception ( $ error ) ; } | Shows an error message and outputs the SOAP result if passed |
9,365 | public function days ( ) { if ( ! isset ( $ this -> days ) ) { $ clonedStart = clone $ this -> weekStart ; $ this -> days = array ( ) ; for ( $ i = 0 ; $ i < 7 ; $ i ++ ) { $ thisDay = new Day ( $ clonedStart ) ; if ( $ this -> containingMonth && $ this -> containingMonth -> firstDay ( ) -> format ( 'm' ) != $ clonedSt... | Returns the days in this week . |
9,366 | public function __soapCall ( $ functionName , $ arguments , $ options = null , $ inputHeaders = null , & $ outputHeaders = null ) { if ( Configure :: read ( 'debug' ) === true ) { $ this -> log ( $ functionName , LogLevel :: INFO ) ; $ this -> log ( $ arguments , LogLevel :: INFO ) ; $ this -> log ( $ options , LogLeve... | Calls a SOAP function |
9,367 | public function intersects ( TimeframeInterface $ frame ) { return ( $ this -> contains ( $ frame -> start ( ) ) || $ this -> contains ( $ frame -> end ( ) ) ) || ( $ frame -> start ( ) <= $ this -> start && $ frame -> end ( ) >= $ this -> end ) ; } | Returns whether this timeframe intersects with another timeframe ; some part of this timeframe overlaps with the given timeframe . |
9,368 | public function partial ( $ template , array $ data = array ( ) ) { $ app = App :: getInstance ( ) ; $ Clazz = $ app -> config ( 'bono.partial.view' ) ; $ view = new $ Clazz ( ) ; $ t = $ this -> resolve ( $ template , $ view ) ; if ( empty ( $ t ) ) { throw new \ Exception ( 'Cant resolve template "' . $ template . '"... | Partial generate view |
9,369 | public function clearAll ( ) { $ settings = FastcgiCacheBust :: $ plugin -> getSettings ( ) ; if ( ! empty ( $ settings ) && ! empty ( $ settings -> cachePath ) ) { $ cacheDirs = explode ( ',' , $ settings -> cachePath ) ; foreach ( $ cacheDirs as $ cacheDir ) { $ cacheDir = trim ( $ cacheDir ) ; try { FileHelper :: cl... | Clears the entirety of the FastCGI Cache |
9,370 | public function setStart ( DateTime $ start ) { if ( $ this -> end && $ start > $ this -> end ) { throw new EventException ( 'New start comes after the end!' , EventException :: INVALID_DATES ) ; } $ this -> start = clone $ start ; return $ this ; } | Sets the start date of the event |
9,371 | public function setEnd ( DateTime $ end ) { if ( $ this -> start && $ end < $ this -> start ) { throw new EventException ( 'New end comes after the start!' , EventException :: INVALID_DATES ) ; } $ this -> end = clone $ end ; return $ this ; } | Sets the end date of the event |
9,372 | public function build ( ) { if ( ! isset ( $ this -> currentDate ) ) { return array ( ) ; } $ monthsToDisplay = array ( ) ; $ thisMonth = new Month ( $ this -> currentDate ) ; for ( $ i = $ this -> monthOverflow [ 'left' ] ; $ i != 0 ; $ i -- ) { $ monthsToDisplay [ ] = $ thisMonth -> prev ( $ i ) ; } $ monthsToDisplay... | Returns the month objects to display |
9,373 | public function setResolution ( ResolutionInterface $ res ) { $ this -> resolution = $ res ; $ this -> resolution -> setDateTime ( $ this -> currentDate ( ) ) ; return $ this ; } | Sets the Resolution of the Calendar . Resolutions decide how many months to show either side or whether to show a week or work week . |
9,374 | public function addEvents ( array $ events ) { foreach ( $ events as $ event ) { if ( $ event instanceof EventInterface ) { $ this -> addEvent ( $ event ) ; } } return $ this ; } | Add an array of EventInterface objects at once |
9,375 | public function nodeAt ( $ path ) { $ pathParts = array_filter ( explode ( '/' , str_replace ( '\\' , '/' , $ path ) ) , 'strlen' ) ; $ node = $ this -> root ( ) ; foreach ( $ pathParts as $ level ) { if ( $ node instanceof File ) { throw new NotFoundException ( ) ; } $ node = $ node -> childAt ( $ level ) ; } return $... | Returns filesystem Node|Directory|File|Root at given path . |
9,376 | public function directoryAt ( $ path ) { $ file = $ this -> nodeAt ( $ path ) ; if ( ! $ file instanceof Directory ) { throw new NotDirectoryException ( ) ; } return $ file ; } | Returns directory at given path |
9,377 | public function fileAt ( $ path ) { $ file = $ this -> nodeAt ( $ path ) ; if ( ! $ file instanceof File ) { throw new NotFileException ( ) ; } return $ file ; } | Returns file at given path |
9,378 | public function createDir ( $ path , $ recursive = false , $ mode = null ) { $ parentPath = dirname ( $ path ) ; $ name = basename ( $ path ) ; try { $ parent = $ this -> directoryAt ( $ parentPath ) ; } catch ( NotFoundException $ e ) { if ( ! $ recursive ) { throw new NotFoundException ( sprintf ( 'createDir: %s: No ... | Creates Directory at given path . |
9,379 | public function createLink ( $ path , $ destination ) { $ destination = $ this -> nodeAt ( $ destination ) ; if ( $ this -> hasNodeAt ( $ path ) ) { throw new \ RuntimeException ( sprintf ( '%s already exists' , $ path ) ) ; } $ parent = $ this -> directoryAt ( dirname ( $ path ) ) ; $ parent -> addLink ( $ newLink = $... | Creates link at given path |
9,380 | public function createFile ( $ path , $ data = null ) { if ( $ this -> hasNodeAt ( $ path ) ) { throw new \ RuntimeException ( sprintf ( '%s already exists' , $ path ) ) ; } $ parent = $ this -> directoryAt ( dirname ( $ path ) ) ; $ parent -> addFile ( $ newFile = $ this -> factory ( ) -> getFile ( basename ( $ path )... | Creates file at given path |
9,381 | public function move ( $ fromPath , $ toPath ) { $ fromNode = $ this -> nodeAt ( $ fromPath ) ; try { $ nodeToOverride = $ this -> nodeAt ( $ toPath ) ; if ( ! is_a ( $ nodeToOverride , get_class ( $ fromNode ) ) ) { throw new \ RuntimeException ( 'Can\'t move.' ) ; } if ( $ nodeToOverride instanceof Directory ) { if (... | Moves Node from source to destination |
9,382 | public function getToken ( ) { if ( $ this -> has ( 'token' ) ) { return $ this -> get ( 'token' ) ; } if ( $ this -> has ( 'access_token' ) ) { return $ this -> get ( 'access_token' ) ; } if ( $ this -> has ( 'accessToken' ) ) { return $ this -> get ( 'accessToken' ) ; } if ( $ authorization = $ this -> getHeader ( 'A... | Get oAuth access token todo tidy up standardize |
9,383 | public function call ( ) { if ( empty ( $ this -> options ) ) { $ this -> options = $ this -> app -> config ( 'bono.controllers' ) ; } if ( empty ( $ this -> options [ 'mapping' ] ) ) { return $ this -> next -> call ( ) ; } $ mapping = $ this -> options [ 'mapping' ] ; $ resourceUri = $ this -> app -> request -> getRes... | Instantiating controllers from configuration |
9,384 | public function path ( ) { $ dirname = $ this -> dirname ( ) ; if ( $ this -> parent instanceof Root ) { return $ dirname . $ this -> basename ( ) ; } return sprintf ( '%s/%s' , $ dirname , $ this -> basename ( ) ) ; } | Returns node path . |
9,385 | public function url ( ) { $ dirname = $ this -> parent -> url ( ) ; if ( $ this -> parent instanceof Root ) { return $ dirname . $ this -> basename ( ) ; } return sprintf ( '%s/%s' , $ dirname , $ this -> basename ( ) ) ; } | Returns node URL . |
9,386 | public function post ( $ endpoint , $ data , $ options = [ ] ) { if ( ! is_array ( $ data ) ) { $ options [ 'body' ] = $ data ; } else { $ options [ 'form_params' ] = $ data ; } return $ this -> request ( 'post' , $ endpoint , $ options ) ; } | Send a POST request . |
9,387 | public function getOptions ( ) { return array_merge ( [ 'base_uri' => property_exists ( $ this , 'baseUri' ) ? $ this -> baseUri : '' , 'timeout' => property_exists ( $ this , 'timeout' ) ? $ this -> timeout : 5.0 , 'connect_timeout' => property_exists ( $ this , 'connectTimeout' ) ? $ this -> connectTimeout : 5.0 , ] ... | Get default options . |
9,388 | public function getHttpClient ( ) { if ( is_null ( $ this -> httpClient ) ) { $ this -> httpClient = $ this -> getDefaultHttpClient ( ) ; } return $ this -> httpClient ; } | Return http client . |
9,389 | public function unwrapResponse ( ResponseInterface $ response ) { $ contentType = $ response -> getHeaderLine ( 'Content-Type' ) ; $ contents = $ response -> getBody ( ) -> getContents ( ) ; if ( false !== stripos ( $ contentType , 'json' ) || stripos ( $ contentType , 'javascript' ) ) { return json_decode ( $ contents... | Convert response . |
9,390 | public function setStatusCode ( $ code , $ message ) { $ this -> meta -> statusCode = $ code ; $ this -> meta -> statusMessage = $ message ; } | Set the status code |
9,391 | public function addMessage ( $ text , $ type = ResponseMessage :: TYPE_SUCCESS ) { $ this -> messages [ ] = new ResponseMessage ( $ text , $ type ) ; return $ this ; } | Add a message to the response object |
9,392 | public static function getDefaultSettings ( ) { $ settings = parent :: getDefaultSettings ( ) ; $ settings [ 'templates.path' ] = '' ; $ settings [ 'bono.base.path' ] = '..' ; $ settings [ 'bono.theme' ] = 'Bono\\Theme\\DefaultTheme' ; $ settings [ 'config.path' ] = '../config' ; $ settings [ 'debug' ] = true ; $ setti... | Override default settings |
9,393 | public function run ( ) { require_once dirname ( __FILE__ ) . '/../functions.php' ; if ( $ this -> isRunning ) { return ; } $ this -> isRunning = true ; $ this -> add ( new \ Bono \ Middleware \ CommonHandlerMiddleware ( ) ) ; $ this -> slimRun ( ) ; } | Override run method |
9,394 | public function has ( $ Clazz ) { if ( $ Clazz [ 0 ] == '\\' ) { $ Clazz = substr ( $ Clazz , 1 ) ; } foreach ( $ this -> middleware as $ middleware ) { if ( get_class ( $ middleware ) === $ Clazz ) { return true ; } } return false ; } | Check whether application has middleware with class name |
9,395 | protected function configure ( ) { if ( is_readable ( $ configFile = $ this -> config ( 'config.path' ) . '/config.php' ) ) { $ config = include $ configFile ; if ( ! is_array ( $ config ) ) { $ config = ( array ) $ config ; } $ this -> config ( $ config ) ; } if ( is_readable ( $ configFile = $ this -> config ( 'confi... | Configure life cycle |
9,396 | protected function configureAliases ( ) { $ this -> aliases = array_merge ( $ this -> aliases , $ this -> config ( 'bono.aliases' ) ? : array ( ) ) ; foreach ( $ this -> aliases as $ key => $ value ) { if ( ! class_exists ( $ key ) ) { class_alias ( $ value , $ key ) ; } } } | Configure the alias class name |
9,397 | public function getFilters ( $ name = null ) { if ( ! is_null ( $ name ) ) { return isset ( $ this -> filters [ ( string ) $ name ] ) ? $ this -> filters [ ( string ) $ name ] : null ; } else { return $ this -> filters ; } } | Get filter listeners |
9,398 | public function clearFilters ( $ name = null ) { if ( ! is_null ( $ name ) && isset ( $ this -> filters [ ( string ) $ name ] ) ) { $ this -> filters [ ( string ) $ name ] = array ( array ( ) ) ; } else { foreach ( $ this -> filters as $ key => $ value ) { $ this -> filters [ $ key ] = array ( array ( ) ) ; } } } | Clear filter listeners |
9,399 | public function build ( $ title , $ action , $ input , $ link , ModalInterface $ modal ) { $ modal -> buildHead ( $ title , $ link ) ; if ( is_array ( $ input ) ) { if ( array_key_exists ( 'name' , $ input [ 0 ] ) ) { foreach ( $ input as $ val ) { $ modal -> buildBody ( $ val [ 'key' ] , $ val [ 'name' ] , $ val [ 'va... | build modal . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.