idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
13,800
public function getCurrentUserPrincipals ( ) { $ currentUser = $ this -> getCurrentUserPrincipal ( ) ; if ( is_null ( $ currentUser ) ) { return [ ] ; } return array_merge ( [ $ currentUser ] , $ this -> getPrincipalMembership ( $ currentUser ) ) ; }
Returns a list of principals that s associated to the current user either directly or through group membership .
13,801
public function getPrincipalMembership ( $ mainPrincipal ) { if ( isset ( $ this -> principalMembershipCache [ $ mainPrincipal ] ) ) { return $ this -> principalMembershipCache [ $ mainPrincipal ] ; } $ check = [ $ mainPrincipal ] ; $ principals = [ ] ; while ( count ( $ check ) ) { $ principal = array_shift ( $ check ...
Returns all the principal groups the specified principal is a member of .
13,802
public function principalMatchesPrincipal ( $ checkPrincipal , $ currentPrincipal = null ) { if ( is_null ( $ currentPrincipal ) ) { $ currentPrincipal = $ this -> getCurrentUserPrincipal ( ) ; } if ( $ currentPrincipal === $ checkPrincipal ) { return true ; } if ( is_null ( $ currentPrincipal ) ) { return false ; } re...
Find out of a principal equals another principal .
13,803
public function getSupportedPrivilegeSet ( $ node ) { if ( is_string ( $ node ) ) { $ node = $ this -> server -> tree -> getNodeForPath ( $ node ) ; } $ supportedPrivileges = null ; if ( $ node instanceof IACL ) { $ supportedPrivileges = $ node -> getSupportedPrivilegeSet ( ) ; } if ( is_null ( $ supportedPrivileges ) ...
Returns a tree of supported privileges for a resource .
13,804
final public function getFlatPrivilegeSet ( $ node ) { $ privs = [ 'abstract' => false , 'aggregates' => $ this -> getSupportedPrivilegeSet ( $ node ) , ] ; $ fpsTraverse = null ; $ fpsTraverse = function ( $ privName , $ privInfo , $ concrete , & $ flat ) use ( & $ fpsTraverse ) { $ myPriv = [ 'privilege' => $ privNam...
Returns the supported privilege set as a flat list .
13,805
public function getAcl ( $ node ) { if ( is_string ( $ node ) ) { $ node = $ this -> server -> tree -> getNodeForPath ( $ node ) ; } if ( ! $ node instanceof IACL ) { return $ this -> getDefaultAcl ( ) ; } $ acl = $ node -> getACL ( ) ; foreach ( $ this -> adminPrincipals as $ adminPrincipal ) { $ acl [ ] = [ 'principa...
Returns the full ACL list .
13,806
public function getCurrentUserPrivilegeSet ( $ node ) { if ( is_string ( $ node ) ) { $ node = $ this -> server -> tree -> getNodeForPath ( $ node ) ; } $ acl = $ this -> getACL ( $ node ) ; $ collected = [ ] ; $ isAuthenticated = null !== $ this -> getCurrentUserPrincipal ( ) ; foreach ( $ acl as $ ace ) { $ principal...
Returns a list of privileges the current user has on a particular node .
13,807
public function getPrincipalByUri ( $ uri ) { $ result = null ; $ collections = $ this -> principalCollectionSet ; foreach ( $ collections as $ collection ) { try { $ principalCollection = $ this -> server -> tree -> getNodeForPath ( $ collection ) ; } catch ( NotFound $ e ) { continue ; } if ( ! $ principalCollection ...
Returns a principal based on its uri .
13,808
public function principalSearch ( array $ searchProperties , array $ requestedProperties , $ collectionUri = null , $ test = 'allof' ) { if ( ! is_null ( $ collectionUri ) ) { $ uris = [ $ collectionUri ] ; } else { $ uris = $ this -> principalCollectionSet ; } $ lookupResults = [ ] ; foreach ( $ uris as $ uri ) { $ pr...
Principal property search .
13,809
public function beforeMethod ( RequestInterface $ request , ResponseInterface $ response ) { $ method = $ request -> getMethod ( ) ; $ path = $ request -> getPath ( ) ; $ exists = $ this -> server -> tree -> nodeExists ( $ path ) ; if ( ! $ exists ) { return ; } switch ( $ method ) { case 'GET' : case 'HEAD' : case 'OP...
Triggered before any method is handled .
13,810
public function beforeBind ( $ uri ) { list ( $ parentUri ) = Uri \ split ( $ uri ) ; $ this -> checkPrivileges ( $ parentUri , '{DAV:}bind' ) ; }
Triggered before a new node is created .
13,811
public function beforeUnbind ( $ uri ) { list ( $ parentUri ) = Uri \ split ( $ uri ) ; $ this -> checkPrivileges ( $ parentUri , '{DAV:}unbind' , self :: R_RECURSIVEPARENTS ) ; }
Triggered before a node is deleted .
13,812
public function propPatch ( $ path , DAV \ PropPatch $ propPatch ) { $ propPatch -> handle ( '{DAV:}group-member-set' , function ( $ value ) use ( $ path ) { if ( is_null ( $ value ) ) { $ memberSet = [ ] ; } elseif ( $ value instanceof Href ) { $ memberSet = array_map ( [ $ this -> server , 'calculateUri' ] , $ value ...
This method intercepts PROPPATCH methods and make sure the group - member - set is updated correctly .
13,813
public function report ( $ reportName , $ report , $ path ) { switch ( $ reportName ) { case '{DAV:}principal-property-search' : $ this -> server -> transactionType = 'report-principal-property-search' ; $ this -> principalPropertySearchReport ( $ path , $ report ) ; return false ; case '{DAV:}principal-search-property...
This method handles HTTP REPORT requests .
13,814
protected function principalMatchReport ( $ path , Xml \ Request \ PrincipalMatchReport $ report ) { $ depth = $ this -> server -> getHTTPDepth ( 0 ) ; if ( 0 !== $ depth ) { throw new BadRequest ( 'The principal-match report is only defined on Depth: 0' ) ; } $ currentPrincipals = $ this -> getCurrentUserPrincipals ( ...
The principal - match report is defined in RFC3744 section 9 . 3 .
13,815
protected function expandPropertyReport ( $ path , $ report ) { $ depth = $ this -> server -> getHTTPDepth ( 0 ) ; $ result = $ this -> expandProperties ( $ path , $ report -> properties , $ depth ) ; $ xml = $ this -> server -> xml -> write ( '{DAV:}multistatus' , new DAV \ Xml \ Response \ MultiStatus ( $ result ) , ...
The expand - property report is defined in RFC3253 section 3 . 8 .
13,816
protected function expandProperties ( $ path , array $ requestedProperties , $ depth ) { $ foundProperties = $ this -> server -> getPropertiesForPath ( $ path , array_keys ( $ requestedProperties ) , $ depth ) ; $ result = [ ] ; foreach ( $ foundProperties as $ node ) { foreach ( $ requestedProperties as $ propertyName...
This method expands all the properties and returns a list with property values .
13,817
protected function aclPrincipalPropSetReport ( $ path , Xml \ Request \ AclPrincipalPropSetReport $ report ) { if ( 0 !== $ this -> server -> getHTTPDepth ( 0 ) ) { throw new BadRequest ( 'The {DAV:}acl-principal-prop-set REPORT only supports Depth 0' ) ; } $ acl = $ this -> server -> getProperties ( $ path , '{DAV:}ac...
aclPrincipalPropSet REPORT .
13,818
public function getHTTPHeaders ( \ Sabre \ DAV \ Server $ server ) { $ methods = $ server -> getAllowedMethods ( $ server -> getRequestUri ( ) ) ; return [ 'Allow' => strtoupper ( implode ( ', ' , $ methods ) ) , ] ; }
This method allows the exception to return any extra HTTP response headers .
13,819
public function propFind ( PropFind $ propFind , INode $ node ) { $ path = $ propFind -> getPath ( ) ; $ pathFilter = $ this -> pathFilter ; if ( $ pathFilter && ! $ pathFilter ( $ path ) ) { return ; } $ this -> backend -> propFind ( $ propFind -> getPath ( ) , $ propFind ) ; }
Called during PROPFIND operations .
13,820
public function propPatch ( $ path , PropPatch $ propPatch ) { $ pathFilter = $ this -> pathFilter ; if ( $ pathFilter && ! $ pathFilter ( $ path ) ) { return ; } $ this -> backend -> propPatch ( $ path , $ propPatch ) ; }
Called during PROPPATCH operations .
13,821
public function afterUnbind ( $ path ) { $ pathFilter = $ this -> pathFilter ; if ( $ pathFilter && ! $ pathFilter ( $ path ) ) { return ; } $ this -> backend -> delete ( $ path ) ; }
Called after a node is deleted .
13,822
public function afterMove ( $ source , $ destination ) { $ pathFilter = $ this -> pathFilter ; if ( $ pathFilter && ! $ pathFilter ( $ source ) ) { return ; } if ( $ pathFilter && ! $ pathFilter ( $ destination ) ) { return ; } $ this -> backend -> move ( $ source , $ destination ) ; }
Called after a node is moved .
13,823
public function getProperties ( $ requestedProperties ) { $ response = [ ] ; foreach ( $ this -> calendarInfo as $ propName => $ propValue ) { if ( ! is_null ( $ propValue ) && '{' === $ propName [ 0 ] ) { $ response [ $ propName ] = $ this -> calendarInfo [ $ propName ] ; } } return $ response ; }
Returns the list of properties .
13,824
public function getChild ( $ name ) { $ obj = $ this -> caldavBackend -> getCalendarObject ( $ this -> calendarInfo [ 'id' ] , $ name ) ; if ( ! $ obj ) { throw new DAV \ Exception \ NotFound ( 'Calendar object not found' ) ; } $ obj [ 'acl' ] = $ this -> getChildACL ( ) ; return new CalendarObject ( $ this -> caldavBa...
Returns a calendar object .
13,825
public function getChildren ( ) { $ objs = $ this -> caldavBackend -> getCalendarObjects ( $ this -> calendarInfo [ 'id' ] ) ; $ children = [ ] ; foreach ( $ objs as $ obj ) { $ obj [ 'acl' ] = $ this -> getChildACL ( ) ; $ children [ ] = new CalendarObject ( $ this -> caldavBackend , $ this -> calendarInfo , $ obj ) ;...
Returns the full list of calendar objects .
13,826
public function childExists ( $ name ) { $ obj = $ this -> caldavBackend -> getCalendarObject ( $ this -> calendarInfo [ 'id' ] , $ name ) ; if ( ! $ obj ) { return false ; } else { return true ; } }
Checks if a child - node exists .
13,827
protected function imapOpen ( $ username , $ password ) { $ success = false ; try { $ imap = imap_open ( $ this -> mailbox , $ username , $ password , OP_HALFOPEN | OP_READONLY , 1 ) ; if ( $ imap ) { $ success = true ; } } catch ( \ ErrorException $ e ) { error_log ( $ e -> getMessage ( ) ) ; } $ errors = imap_errors ...
Connects to an IMAP server and tries to authenticate .
13,828
public static function getUUID ( ) { return sprintf ( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x' , mt_rand ( 0 , 0xffff ) , mt_rand ( 0 , 0xffff ) , mt_rand ( 0 , 0xffff ) , mt_rand ( 0 , 0x0fff ) | 0x4000 , mt_rand ( 0 , 0x3fff ) | 0x8000 , mt_rand ( 0 , 0xffff ) , mt_rand ( 0 , 0xffff ) , mt_rand ( 0 , 0xffff ) ) ; }
Returns a pseudo - random v4 UUID .
13,829
public function initialize ( DAV \ Server $ server ) { $ this -> server = $ server ; $ this -> server -> on ( 'method:GET' , [ $ this , 'httpGet' ] , 90 ) ; $ server -> on ( 'browserButtonActions' , function ( $ path , $ node , & $ actions ) { if ( $ node instanceof IAddressBook ) { $ actions .= '<a href="' . htmlspeci...
Initializes the plugin and registers event handlers .
13,830
public function httpGet ( RequestInterface $ request , ResponseInterface $ response ) { $ queryParams = $ request -> getQueryParameters ( ) ; if ( ! array_key_exists ( 'export' , $ queryParams ) ) { return ; } $ path = $ request -> getPath ( ) ; $ node = $ this -> server -> tree -> getNodeForPath ( $ path ) ; if ( ! ( ...
Intercepts GET requests on addressbook urls ending with ?export .
13,831
public function generateVCF ( array $ nodes ) { $ output = '' ; foreach ( $ nodes as $ node ) { if ( ! isset ( $ node [ 200 ] [ '{' . Plugin :: NS_CARDDAV . '}address-data' ] ) ) { continue ; } $ nodeData = $ node [ 200 ] [ '{' . Plugin :: NS_CARDDAV . '}address-data' ] ; $ vcard = VObject \ Reader :: read ( $ nodeData...
Merges all vcard objects and builds one big vcf export .
13,832
public function propFind ( PropFind $ propFind , INode $ node ) { $ props = [ '{http://calendarserver.org/ns/}subscribed-strip-alarms' , '{http://calendarserver.org/ns/}subscribed-strip-attachments' , '{http://calendarserver.org/ns/}subscribed-strip-todos' , ] ; foreach ( $ props as $ prop ) { if ( 200 === $ propFind -...
Triggered after properties have been fetched .
13,833
public function httpPost ( RequestInterface $ request , ResponseInterface $ response ) { $ contentType = $ request -> getHeader ( 'Content-Type' ) ; if ( ! $ contentType || 0 !== strpos ( $ contentType , 'text/calendar' ) ) { return ; } $ path = $ request -> getPath ( ) ; try { $ node = $ this -> server -> tree -> getN...
This method handles POST request for the outbox .
13,834
public function calendarObjectChange ( RequestInterface $ request , ResponseInterface $ response , VCalendar $ vCal , $ calendarPath , & $ modified , $ isNew ) { if ( ! $ this -> scheduleReply ( $ this -> server -> httpRequest ) ) { return ; } $ calendarNode = $ this -> server -> tree -> getNodeForPath ( $ calendarPath...
This method is triggered whenever there was a calendar object gets created or updated .
13,835
public function deliver ( ITip \ Message $ iTipMessage ) { $ this -> server -> emit ( 'schedule' , [ $ iTipMessage ] ) ; if ( ! $ iTipMessage -> scheduleStatus ) { $ iTipMessage -> scheduleStatus = '5.2;There was no system capable of delivering the scheduling message' ; } list ( $ baseCode ) = explode ( '.' , $ iTipMes...
This method is responsible for delivering the ITip message .
13,836
public function beforeUnbind ( $ path ) { if ( 'MOVE' === $ this -> server -> httpRequest -> getMethod ( ) ) { return ; } $ node = $ this -> server -> tree -> getNodeForPath ( $ path ) ; if ( ! $ node instanceof ICalendarObject || $ node instanceof ISchedulingObject ) { return ; } if ( ! $ this -> scheduleReply ( $ thi...
This method is triggered before a file gets deleted .
13,837
public function getSupportedPrivilegeSet ( INode $ node , array & $ supportedPrivilegeSet ) { $ ns = '{' . self :: NS_CALDAV . '}' ; if ( $ node instanceof IOutbox ) { $ supportedPrivilegeSet [ $ ns . 'schedule-send' ] = [ 'abstract' => false , 'aggregates' => [ $ ns . 'schedule-send-invite' => [ 'abstract' => false , ...
This method is triggered whenever a subsystem requests the privileges that are supported on a particular node .
13,838
protected function processICalendarChange ( $ oldObject = null , VCalendar $ newObject , array $ addresses , array $ ignore = [ ] , & $ modified = false ) { $ broker = new ITip \ Broker ( ) ; $ messages = $ broker -> parseEvent ( $ newObject , $ addresses , $ oldObject ) ; if ( $ messages ) { $ modified = true ; } fore...
This method looks at an old iCalendar object a new iCalendar object and starts sending scheduling messages based on the changes .
13,839
protected function getAddressesForPrincipal ( $ principal ) { $ CUAS = '{' . self :: NS_CALDAV . '}calendar-user-address-set' ; $ properties = $ this -> server -> getProperties ( $ principal , [ $ CUAS ] ) ; if ( ! isset ( $ properties [ $ CUAS ] ) ) { return [ ] ; } $ addresses = $ properties [ $ CUAS ] -> getHrefs ( ...
Returns a list of addresses that are associated with a principal .
13,840
public function outboxRequest ( IOutbox $ outboxNode , RequestInterface $ request , ResponseInterface $ response ) { $ outboxPath = $ request -> getPath ( ) ; try { $ vObject = VObject \ Reader :: read ( $ request -> getBody ( ) ) ; } catch ( VObject \ ParseException $ e ) { throw new BadRequest ( 'The request body mus...
This method handles POST requests to the schedule - outbox .
13,841
public function getStatus ( $ propertyName ) { return isset ( $ this -> result [ $ propertyName ] ) ? $ this -> result [ $ propertyName ] [ 0 ] : null ; }
Returns the current status code for a property name .
13,842
public function getResultForMultiStatus ( ) { $ r = [ 200 => [ ] , 404 => [ ] , ] ; foreach ( $ this -> result as $ propertyName => $ info ) { if ( ! isset ( $ r [ $ info [ 0 ] ] ) ) { $ r [ $ info [ 0 ] ] = [ $ propertyName => $ info [ 1 ] ] ; } else { $ r [ $ info [ 0 ] ] [ $ propertyName ] = $ info [ 1 ] ; } } if ( ...
Returns a result array that s often used in multistatus responses .
13,843
public function httpPatch ( RequestInterface $ request , ResponseInterface $ response ) { $ path = $ request -> getPath ( ) ; $ node = $ this -> server -> tree -> getNodeForPath ( $ path ) ; if ( ! $ node instanceof IPatchSupport ) { throw new DAV \ Exception \ MethodNotAllowed ( 'The target resource does not support t...
Patch an uri .
13,844
public function getHTTPUpdateRange ( RequestInterface $ request ) { $ range = $ request -> getHeader ( 'X-Update-Range' ) ; if ( is_null ( $ range ) ) { return null ; } if ( ! preg_match ( '/^(append)|(?:bytes=([0-9]+)-([0-9]*))|(?:bytes=(-[0-9]+))$/i' , $ range , $ matches ) ) { return null ; } if ( 'append' === $ mat...
Returns the HTTP custom range update header .
13,845
public function render ( ? Formatter $ formatter = null ) : string { if ( $ formatter === null ) { $ formatter = new PassthroughFormatter ( ) ; } $ tags = [ ] ; foreach ( $ this -> tags as $ tag ) { $ tags [ ] = '{' . $ formatter -> format ( $ tag ) . '}' ; } return vsprintf ( $ this -> bodyTemplate , $ tags ) ; }
Renders this description as a string where the provided formatter will format the tags in the expected string format .
13,846
public static function create ( string $ body , DescriptionFactory $ descriptionFactory = null , Context $ context = null ) : MyTag { Assert :: notNull ( $ descriptionFactory ) ; return new static ( $ descriptionFactory -> create ( $ body , $ context ) ) ; }
A static Factory that creates a new instance of the current Tag .
13,847
public function getTagsByName ( string $ name ) : array { $ result = [ ] ; foreach ( $ this -> getTags ( ) as $ tag ) { if ( $ tag -> getName ( ) !== $ name ) { continue ; } $ result [ ] = $ tag ; } return $ result ; }
Returns an array of tags matching the given name . If no tags are found an empty array is returned .
13,848
public function hasTag ( string $ name ) : bool { foreach ( $ this -> getTags ( ) as $ tag ) { if ( $ tag -> getName ( ) === $ name ) { return true ; } } return false ; }
Checks if a tag of a certain type is present in this DocBlock .
13,849
public function removeTag ( Tag $ tagToRemove ) : void { foreach ( $ this -> tags as $ key => $ tag ) { if ( $ tag === $ tagToRemove ) { unset ( $ this -> tags [ $ key ] ) ; break ; } } }
Remove a tag from this DocBlock .
13,850
public static function create ( string $ body , string $ name = '' , ? DescriptionFactory $ descriptionFactory = null , ? TypeContext $ context = null ) : self { Assert :: stringNotEmpty ( $ name ) ; Assert :: notNull ( $ descriptionFactory ) ; $ description = $ descriptionFactory && $ body !== "" ? $ descriptionFactor...
Creates a new tag that represents any unknown tag type .
13,851
private function validateTagName ( string $ name ) : void { if ( ! preg_match ( '/^' . StandardTagFactory :: REGEX_TAGNAME . '$/u' , $ name ) ) { throw new \ InvalidArgumentException ( 'The tag name "' . $ name . '" is not wellformed. Tags may only consist of letters, underscores, ' . 'hyphens and backslashes.' ) ; } }
Validates if the tag name matches the expected format otherwise throws an exception .
13,852
private function lex ( string $ contents ) : array { $ contents = $ this -> removeSuperfluousStartingWhitespace ( $ contents ) ; if ( strpos ( $ contents , '{@' ) === false ) { return [ $ contents ] ; } return preg_split ( '/\{ # "{@}" is not a valid inline tag. This ensures that we do not treat it as on...
Strips the contents from superfluous whitespace and splits the description into a series of tokens .
13,853
private function parse ( $ tokens , ? TypeContext $ context = null ) : array { $ count = count ( $ tokens ) ; $ tagCount = 0 ; $ tags = [ ] ; for ( $ i = 1 ; $ i < $ count ; $ i += 2 ) { $ tags [ ] = $ this -> tagFactory -> create ( $ tokens [ $ i ] , $ context ) ; $ tokens [ $ i ] = '%' . ++ $ tagCount . '$s' ; } for ...
Parses the stream of tokens in to a new set of tokens containing Tags .
13,854
private function removeSuperfluousStartingWhitespace ( string $ contents ) : string { $ lines = explode ( "\n" , $ contents ) ; if ( count ( $ lines ) <= 1 ) { return $ contents ; } $ startingSpaceCount = 9999999 ; for ( $ i = 1 ; $ i < count ( $ lines ) ; ++ $ i ) { if ( strlen ( trim ( $ lines [ $ i ] ) ) === 0 ) { c...
Removes the superfluous from a multi - line description .
13,855
public static function createInstance ( array $ additionalTags = [ ] ) : self { $ fqsenResolver = new FqsenResolver ( ) ; $ tagFactory = new StandardTagFactory ( $ fqsenResolver ) ; $ descriptionFactory = new DescriptionFactory ( $ tagFactory ) ; $ tagFactory -> addService ( $ descriptionFactory ) ; $ tagFactory -> add...
Factory method for easy instantiation .
13,856
private function splitDocBlock ( string $ comment ) : array { if ( strpos ( $ comment , '@' ) === 0 ) { return [ '' , '' , '' , $ comment ] ; } $ comment = preg_replace ( '/\h*$/Sum' , '' , $ comment ) ; preg_match ( '/ \A # 1. Extract the template marker (?:(\#\@\+|\#\@\-)\n?)? ...
Splits the DocBlock into a template marker summary description and block of tags .
13,857
public function format ( Tag $ tag ) : string { return '@' . $ tag -> getName ( ) . str_repeat ( ' ' , $ this -> maxLen - strlen ( $ tag -> getName ( ) ) + 1 ) . ( string ) $ tag ; }
Formats the given tag to return a simple plain text version .
13,858
public function addOne ( $ title , $ url , array $ data = [ ] ) { return $ this -> addBreadcrumb ( BreadcrumbItem :: make ( $ title , $ url , $ data ) ) ; }
Add a breadcrumb item to collection .
13,859
private function order ( ) { $ count = $ this -> count ( ) ; $ this -> map ( function ( BreadcrumbItem $ crumb , $ key ) use ( $ count ) { $ crumb -> resetPosition ( ) ; if ( $ key === 0 ) $ crumb -> setFirst ( ) ; if ( $ key === ( $ count - 1 ) ) $ crumb -> setLast ( ) ; return $ crumb ; } ) ; return $ this ; }
Order all breadcrumbs items .
13,860
public function parse ( $ text = '' , $ options = [ ] ) { $ options = array_merge ( [ 'config' => [ ] , 'purifier' => true ] , $ options ) ; $ markdown = parent :: text ( $ text ) ; if ( config ( 'parsedownextra.purifier.enabled' ) && $ options [ 'purifier' ] ) { $ purifier = app ( HTMLPurifierLaravel :: class ) ; $ ma...
Convert Markdown text to HTML and sanitize the output .
13,861
private function makeQuery ( $ pageNumber = 1 ) { $ params = array ( 'page_size' => $ this -> pageSize , 'page' => $ pageNumber ) ; $ params = array_merge ( $ params , $ this -> filter ) ; $ params = array_merge ( $ params , $ this -> order ) ; $ response = $ this -> api -> get ( $ this -> typeClass -> url ( ) , $ para...
Makes a GET request to the API with parameters for page size page number filtering and order values . Returns the API response .
13,862
public function count ( ) { if ( $ this -> countCached === null ) { $ pageSize = $ this -> pageSize ; $ this -> pageSize = 1 ; $ this -> makeQuery ( 1 ) ; $ this -> pageSize = $ pageSize ; } return $ this -> countCached ; }
Total amount of objects matched by the current query reading this may cause a remote request .
13,863
public function makeFilter ( $ filterType = null , $ filterField = null , $ filterValue = null ) { if ( $ filterType === null && $ filterField === null && $ filterValue === null ) $ this -> filter = array ( ) ; else $ this -> filter = array ( 'filter_type' => $ filterType , 'filter_field' => $ filterField , 'filter_val...
Sets up filtering rules for the query .
13,864
public function getPage ( $ pageNumber ) { $ response = $ this -> makeQuery ( $ pageNumber ) ; $ className = $ this -> typeClass -> objectClass ; $ objects = array ( ) ; if ( ! isset ( $ response -> data ) || ! $ response -> data ) return array ( ) ; foreach ( $ response -> data as $ object ) { $ objects [ ] = new $ cl...
Fetch objects for the one - based page number .
13,865
private function initSession ( ) { $ transport = $ this -> transportRegistry -> getTransport ( $ this -> profile -> get ( 'transport' , 'name' ) ) ; $ repository = $ transport -> getRepository ( $ this -> profile -> get ( 'transport' ) ) ; $ credentials = new SimpleCredentials ( $ this -> profile -> get ( 'phpcr' , 'us...
Initialize the PHPCR session .
13,866
public function changeWorkspace ( $ workspaceName ) { $ this -> init ( ) ; $ this -> session -> logout ( ) ; $ this -> profile -> set ( 'phpcr' , 'workspace' , $ workspaceName ) ; $ this -> initSession ( $ this -> profile ) ; }
Change the current workspace .
13,867
protected function loadFile ( $ file ) { if ( ! stream_is_local ( $ file ) ) { throw new InvalidArgumentException ( sprintf ( 'This is not a local file "%s".' , $ file ) ) ; } if ( ! file_exists ( $ file ) ) { throw new InvalidArgumentException ( sprintf ( 'The service file "%s" is not valid.' , $ file ) ) ; } return T...
Loads the Toml File
13,868
public static function get_palette ( $ numColors = 50 , $ type = 'hsv' ) { $ s = CalendarConfig :: subpackage_settings ( 'colors' ) ; $ arr = $ s [ 'basepalette' ] ; return $ arr ; if ( $ type == 'hsv' ) { $ s = 1 ; $ v = 1 ; $ arr = array ( ) ; for ( $ i = 0 ; $ i <= $ numColors ; $ i ++ ) { $ c = new Color ( ) ; $ h ...
Getting a color palette For now we only have a hsv palette could be extended with more options
13,869
protected function sendSignal ( $ signalNumber ) { if ( ! $ this -> context -> isRunning || ! $ this -> context -> processId ) { return false ; } $ result = $ this -> control -> signal ( ) -> send ( $ signalNumber , $ this -> context -> processId ) ; if ( in_array ( $ signalNumber , [ SIGTERM , SIGKILL ] ) ) { $ this -...
Sends a signal to the current process and returns its results .
13,870
protected function setHandlerAlarm ( ) { $ handler = new SignalAlarm ( $ this -> control , $ this -> action , $ this -> context ) ; $ this -> control -> signal ( ) -> setHandler ( 'alarm' , $ handler ) ; $ this -> control -> signal ( ) -> alarm ( $ this -> context -> timeout ) ; }
Define the timeout handler .
13,871
protected function silentRunActionTrigger ( $ event ) { try { $ this -> action -> trigger ( $ event , $ this -> control , $ this -> context ) ; } catch ( Exception $ exception ) { } }
Runs action trigger by the given event ignoring all exception .
13,872
protected function run ( ) { $ this -> silentRunActionTrigger ( Action :: EVENT_START ) ; try { $ event = $ this -> action -> execute ( $ this -> control , $ this -> context ) ? : Action :: EVENT_SUCCESS ; $ this -> context -> exitCode = 0 ; } catch ( ErrorException $ errorException ) { $ event = Action :: EVENT_ERROR ...
Execute the action triggers the events and then exit the program .
13,873
private function doParse ( $ sql2 ) { $ this -> implicitSelectorName = null ; $ this -> sql2 = $ sql2 ; $ source = null ; $ constraint = null ; $ updates = [ ] ; $ applies = [ ] ; while ( $ this -> scanner -> lookupNextToken ( ) !== '' ) { switch ( strtoupper ( $ this -> scanner -> lookupNextToken ( ) ) ) { case 'UPDAT...
Parse an SQL2 UPDATE statement and construct a query builder for selecting the rows and build a field = > value mapping for the update .
13,874
public function handleAlias ( CommandPreRunEvent $ event ) { $ input = $ event -> getInput ( ) ; $ commandName = $ input -> getFirstArgument ( ) ; $ aliasConfig = $ this -> configManager -> getConfig ( 'alias' ) ; if ( ! isset ( $ aliasConfig [ $ commandName ] ) ) { return ; } $ command = $ aliasConfig [ $ commandName ...
Check for an alias and replace the input with a new string command if the alias exists .
13,875
public function getStateLabel ( ) { $ list = self :: getStateList ( ) ; return isset ( $ list [ $ this -> getState ( ) ] ) ? $ list [ $ this -> getState ( ) ] : null ; }
Returns comment state label .
13,876
public function tag ( $ tag , $ content , array $ attributes = [ ] ) { return $ this -> htmlBuilder -> tag ( $ tag , $ content , $ attributes ) ; }
Generate an html tag .
13,877
protected function normalize ( $ value ) { if ( $ value instanceof Exception ) { $ value = [ 'class' => get_class ( $ value ) , 'message' => $ value -> getMessage ( ) , 'code' => $ value -> getCode ( ) , 'file' => $ value -> getFile ( ) , 'line' => $ value -> getLine ( ) , ] ; } return $ value ; }
Normalizes the given value .
13,878
private function configureFormatter ( OutputFormatter $ formatter ) { $ style = new OutputFormatterStyle ( 'yellow' , null , [ 'bold' ] ) ; $ formatter -> setStyle ( 'pathbold' , $ style ) ; $ style = new OutputFormatterStyle ( 'green' ) ; $ formatter -> setStyle ( 'localname' , $ style ) ; $ style = new OutputFormatte...
Configure the output formatter .
13,879
public function add ( Command $ command ) { if ( $ command instanceof ContainerAwareInterface ) { $ command -> setContainer ( $ this -> container ) ; } if ( $ command instanceof BasePhpcrCommand ) { if ( $ this -> showUnsupported || $ command -> isSupported ( ) ) { parent :: add ( $ command ) ; } } else { parent :: add...
Wrap the add method and do not register commands which are unsupported by the current transport .
13,880
protected function prepareSettings ( $ mass , $ makeResources , $ makeMountPoint , $ extensionKey , $ author , $ title , $ description , $ useVhs , $ useFluidcontentCore , $ pages , $ content , $ backend , $ controllers ) { return [ $ mass , ( boolean ) $ makeResources , ( boolean ) $ makeMountPoint , false === is_null...
Prepare values to avoid problems
13,881
private function gatherInformation ( ) { $ objectManager = \ TYPO3 \ CMS \ Core \ Utility \ GeneralUtility :: makeInstance ( ObjectManager :: class ) ; $ service = $ objectManager -> get ( 'TYPO3\\CMS\\Extensionmanager\\Utility\\ListUtility' ) ; $ extensionInformation = $ service -> getAvailableExtensions ( ) ; foreach...
Gathers Extension Information
13,882
public static function fromHexString ( $ color ) { $ color = rtrim ( $ color , '#' ) ; preg_match_all ( '([0-9a-f][0-9a-f])' , $ color , $ rgb ) ; $ c = new self ( ) ; list ( $ c -> r , $ c -> g , $ c -> b ) = array_map ( 'hexdec' , $ rgb [ 0 ] ) ; return $ c ; }
Construct a Color from hex string
13,883
public static function fromRGBString ( $ color ) { $ color = rtrim ( $ color , "rgb (\t)" ) ; $ rgb = preg_split ( '\s+,\s+' , $ color ) ; $ c = new self ( ) ; list ( $ c -> r , $ c -> g , $ c -> b ) = array_map ( 'intval' , $ rgb ) ; return $ c ; }
Construct Color object from an rgb string
13,884
public function toHexString ( ) { return '#' . $ this -> decToHex ( $ this -> r ) . $ this -> decToHex ( $ this -> g ) . $ this -> decToHex ( $ this -> b ) ; }
Convert color object to hex string
13,885
public static function fromHSL ( $ h , $ s , $ l ) { $ h -= floor ( $ h ) ; $ c = new self ( ) ; if ( $ s == 0 ) { $ c -> r = $ c -> g = $ c -> b = $ l * 255 ; return $ c ; } $ chroma = floatval ( 1 - abs ( 2 * $ l - 1 ) ) * $ s ; $ h_ = $ h * 6 ; $ k = intval ( $ h_ ) ; $ h_mod2 = $ k % 2 + $ h_ - floor ( $ h_ ) ; $ x...
Construct a Color object from H S L values
13,886
public static function fromHSV ( $ h , $ s , $ v ) { $ h -= floor ( $ h ) ; $ c = new self ( ) ; if ( $ s == 0 ) { $ c -> r = $ c -> g = $ c -> b = $ v * 255 ; return $ c ; } $ chroma = $ v * $ s ; $ h_ = $ h * 6 ; $ k = intval ( $ h_ ) ; $ h_mod2 = $ k % 2 + $ h_ - floor ( $ h_ ) ; $ x = $ chroma * abs ( 1 - abs ( $ h...
Construct a Color object from HSV values
13,887
public function darken ( $ fraction = 0.1 ) { $ hsl = $ this -> toHSL ( ) ; $ l = $ hsl [ 2 ] ; $ dl = - $ l * $ fraction ; return $ this -> changeHSL ( 0 , 0 , $ dl ) ; }
Darken the current color by a fraction
13,888
public function lighten ( $ fraction = 0.1 ) { $ hsl = $ this -> toHSL ( ) ; $ l = $ hsl [ 2 ] ; $ dl = ( 1 - $ l ) * $ fraction ; return $ this -> changeHSL ( 0 , 0 , $ dl ) ; }
Lighten the current color by a fraction
13,889
public function changeHSL ( $ dh = 0 , $ ds = 0 , $ dl = 0 ) { list ( $ h , $ s , $ l ) = $ this -> toHSL ( ) ; $ h += $ dh ; $ s += $ ds ; $ l += $ dl ; $ c = self :: fromHSL ( $ h , $ s , $ l ) ; $ this -> r = $ c -> r ; $ this -> g = $ c -> g ; $ this -> b = $ c -> b ; return $ this ; }
Change HSL values by given deltas
13,890
public function toHSL ( ) { $ r = $ this -> r / 255.0 ; $ g = $ this -> g / 255.0 ; $ b = $ this -> b / 255.0 ; $ max = max ( $ r , $ g , $ b ) ; $ min = min ( $ r , $ g , $ b ) ; $ dmax = $ max - $ min ; $ l = ( $ min + $ max ) / 2 ; if ( $ dmax == 0 ) { $ h = 0 ; $ s = 0 ; } else { $ s = ( $ l < 0.5 ) ? $ dmax / ( $ ...
Convert the current color to HSL values
13,891
public function toHSV ( ) { $ r = $ this -> r / 255.0 ; $ g = $ this -> g / 255.0 ; $ b = $ this -> b / 255.0 ; $ max = max ( $ r , $ g , $ b ) ; $ min = min ( $ r , $ g , $ b ) ; $ dmax = $ max - $ min ; $ v = $ max ; if ( $ dmax == 0 ) { $ h = 0 ; $ s = 0 ; } else { $ s = $ dmax / $ max ; $ dr = ( ( ( $ max - $ r ) /...
Convert the current color to HSV values
13,892
public function getAbsTargetPath ( $ srcPath , $ targetPath ) { $ targetPath = $ this -> getAbsPath ( $ targetPath ) ; try { $ this -> getNode ( $ targetPath ) ; } catch ( PathNotFoundException $ e ) { return $ targetPath ; } $ basename = basename ( $ this -> getAbsPath ( $ srcPath ) ) ; return $ this -> getAbsPath ( s...
Infer the absolute target path for a given source path .
13,893
public function getNodeByPathOrIdentifier ( $ pathOrId ) { if ( true === UUIDHelper :: isUUID ( $ pathOrId ) ) { return $ this -> getNodeByIdentifier ( $ pathOrId ) ; } $ pathOrId = $ this -> getAbsPath ( $ pathOrId ) ; return $ this -> getNode ( $ pathOrId ) ; }
If the given parameter looks like a UUID retrieve by Identifier otherwise by path .
13,894
private function normalizeTokens ( array $ tokens ) { $ nTokens = array ( ) ; for ( $ i = 0 , $ c = count ( $ tokens ) ; $ i < $ c ; $ i ++ ) { $ token = $ tokens [ $ i ] ; if ( is_string ( $ token ) ) { $ nTokens [ ] = new LiteralToken ( $ token , end ( $ nTokens ) -> getEndLine ( ) ) ; continue ; } switch ( $ token [...
Normalizes the original PHP token stream into a format which is more usable for analysis .
13,895
public function insertBefore ( AbstractToken $ token , $ type , $ value = null ) { $ this -> insertAllTokensBefore ( $ token , array ( array ( $ type , $ value , $ token -> getLine ( ) ) ) ) ; }
Inserts a new token before the passed token .
13,896
private function httpRequest ( $ url , $ request , $ data = array ( ) , $ sendHeaders = array ( ) , $ timeout = 10 ) { $ streamParams = array ( 'http' => array ( 'method' => $ request , 'ignore_errors' => true , 'timeout' => $ timeout , 'header' => "User-Agent: " . $ this -> userAgent . "\r\n" ) ) ; foreach ( $ sendHea...
Opens a socket and makes a request to the url of choice . Returns an object with statusCode status content and the received headers .
13,897
public function get ( $ objectUrl , $ data = null , $ expectContentType = null ) { $ url = $ this -> apiBase . '/' . $ objectUrl ; return $ this -> checkApiResponse ( $ this -> httpRequest ( $ url , 'GET' , $ data , $ this -> authHeader ( ) ) , $ expectContentType ) ; }
Makes a GET request to an API object . Used for receiving an existing object or a list of resources .
13,898
public function put ( $ objectUrl , $ data ) { $ url = $ this -> apiBase . '/' . $ objectUrl ; return $ this -> checkApiResponse ( $ this -> httpRequest ( $ url , 'PUT' , json_encode ( $ data ) , array_merge ( $ this -> authHeader ( ) , array ( 'Content-type' => 'application/json' ) ) ) ) ; }
Makes a PUT request to an API object . Used for updating a single existing object .
13,899
public function delete ( $ objectUrl ) { $ url = $ this -> apiBase . '/' . $ objectUrl ; return $ this -> checkApiResponse ( $ this -> httpRequest ( $ url , 'DELETE' , null , $ this -> authHeader ( ) ) ) ; }
Makes a DELETE request to an API object . Used to delete a single existing object .