repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
39
1.84M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
sabre-io/dav
lib/CalDAV/Subscriptions/Plugin.php
Plugin.initialize
public function initialize(Server $server) { $server->resourceTypeMapping['Sabre\\CalDAV\\Subscriptions\\ISubscription'] = '{http://calendarserver.org/ns/}subscribed'; $server->xml->elementMap['{http://calendarserver.org/ns/}source'] = 'Sabre\\DAV\\Xml\\Property\\Href'; ...
php
public function initialize(Server $server) { $server->resourceTypeMapping['Sabre\\CalDAV\\Subscriptions\\ISubscription'] = '{http: $server->xml->elementMap['{http: 'Sabre\\DAV\\Xml\\Property\\Href'; $server->on('propFind', [$this, 'propFind'], 150); }
[ "public", "function", "initialize", "(", "Server", "$", "server", ")", "{", "$", "server", "->", "resourceTypeMapping", "[", "'Sabre\\\\CalDAV\\\\Subscriptions\\\\ISubscription'", "]", "=", "'{http://calendarserver.org/ns/}subscribed'", ";", "$", "server", "->", "xml", ...
This initializes the plugin. This function is called by Sabre\DAV\Server, after addPlugin is called. This method should set up the required event subscriptions. @param Server $server
[ "This", "initializes", "the", "plugin", "." ]
train
https://github.com/sabre-io/dav/blob/44b0f2d07fd9e6e44b65f7edf2238d3bf0b428e0/lib/CalDAV/Subscriptions/Plugin.php#L34-L43
sabre-io/dav
lib/CalDAV/Subscriptions/Plugin.php
Plugin.propFind
public function propFind(PropFind $propFind, INode $node) { // There's a bunch of properties that must appear as a self-closing // xml-element. This event handler ensures that this will be the case. $props = [ '{http://calendarserver.org/ns/}subscribed-strip-alarms', ...
php
public function propFind(PropFind $propFind, INode $node) { $props = [ '{http: '{http: '{http: ]; foreach ($props as $prop) { if (200 === $propFind->getStatus($prop)) { $propFind->set($prop, '', 200); ...
[ "public", "function", "propFind", "(", "PropFind", "$", "propFind", ",", "INode", "$", "node", ")", "{", "// There's a bunch of properties that must appear as a self-closing", "// xml-element. This event handler ensures that this will be the case.", "$", "props", "=", "[", "'{h...
Triggered after properties have been fetched. @param PropFind $propFind @param INode $node
[ "Triggered", "after", "properties", "have", "been", "fetched", "." ]
train
https://github.com/sabre-io/dav/blob/44b0f2d07fd9e6e44b65f7edf2238d3bf0b428e0/lib/CalDAV/Subscriptions/Plugin.php#L64-L79
sabre-io/dav
lib/CalDAV/Xml/Property/EmailAddressSet.php
EmailAddressSet.xmlSerialize
public function xmlSerialize(Writer $writer) { foreach ($this->emails as $email) { $writer->writeElement('{http://calendarserver.org/ns/}email-address', $email); } }
php
public function xmlSerialize(Writer $writer) { foreach ($this->emails as $email) { $writer->writeElement('{http: } }
[ "public", "function", "xmlSerialize", "(", "Writer", "$", "writer", ")", "{", "foreach", "(", "$", "this", "->", "emails", "as", "$", "email", ")", "{", "$", "writer", "->", "writeElement", "(", "'{http://calendarserver.org/ns/}email-address'", ",", "$", "emai...
The xmlSerialize method is called during xml writing. Use the $writer argument to write its own xml serialization. An important note: do _not_ create a parent element. Any element implementing XmlSerializable should only ever write what's considered its 'inner xml'. The parent of the current element is responsible f...
[ "The", "xmlSerialize", "method", "is", "called", "during", "xml", "writing", "." ]
train
https://github.com/sabre-io/dav/blob/44b0f2d07fd9e6e44b65f7edf2238d3bf0b428e0/lib/CalDAV/Xml/Property/EmailAddressSet.php#L69-L74
sabre-io/dav
lib/CalDAV/Schedule/Plugin.php
Plugin.initialize
public function initialize(Server $server) { $this->server = $server; $server->on('method:POST', [$this, 'httpPost']); $server->on('propFind', [$this, 'propFind']); $server->on('propPatch', [$this, 'propPatch']); $server->on('calendarObjectChange', [$this, 'calendarObjectChan...
php
public function initialize(Server $server) { $this->server = $server; $server->on('method:POST', [$this, 'httpPost']); $server->on('propFind', [$this, 'propFind']); $server->on('propPatch', [$this, 'propPatch']); $server->on('calendarObjectChange', [$this, 'calendarObjectChan...
[ "public", "function", "initialize", "(", "Server", "$", "server", ")", "{", "$", "this", "->", "server", "=", "$", "server", ";", "$", "server", "->", "on", "(", "'method:POST'", ",", "[", "$", "this", ",", "'httpPost'", "]", ")", ";", "$", "server",...
Initializes the plugin. @param Server $server
[ "Initializes", "the", "plugin", "." ]
train
https://github.com/sabre-io/dav/blob/44b0f2d07fd9e6e44b65f7edf2238d3bf0b428e0/lib/CalDAV/Schedule/Plugin.php#L100-L130
sabre-io/dav
lib/CalDAV/Schedule/Plugin.php
Plugin.getHTTPMethods
public function getHTTPMethods($uri) { try { $node = $this->server->tree->getNodeForPath($uri); } catch (NotFound $e) { return []; } if ($node instanceof IOutbox) { return ['POST']; } return []; }
php
public function getHTTPMethods($uri) { try { $node = $this->server->tree->getNodeForPath($uri); } catch (NotFound $e) { return []; } if ($node instanceof IOutbox) { return ['POST']; } return []; }
[ "public", "function", "getHTTPMethods", "(", "$", "uri", ")", "{", "try", "{", "$", "node", "=", "$", "this", "->", "server", "->", "tree", "->", "getNodeForPath", "(", "$", "uri", ")", ";", "}", "catch", "(", "NotFound", "$", "e", ")", "{", "retur...
Use this method to tell the server this plugin defines additional HTTP methods. This method is passed a uri. It should only return HTTP methods that are available for the specified uri. @param string $uri @return array
[ "Use", "this", "method", "to", "tell", "the", "server", "this", "plugin", "defines", "additional", "HTTP", "methods", "." ]
train
https://github.com/sabre-io/dav/blob/44b0f2d07fd9e6e44b65f7edf2238d3bf0b428e0/lib/CalDAV/Schedule/Plugin.php#L143-L156
sabre-io/dav
lib/CalDAV/Schedule/Plugin.php
Plugin.httpPost
public function httpPost(RequestInterface $request, ResponseInterface $response) { // Checking if this is a text/calendar content type $contentType = $request->getHeader('Content-Type'); if (!$contentType || 0 !== strpos($contentType, 'text/calendar')) { return; } ...
php
public function httpPost(RequestInterface $request, ResponseInterface $response) { $contentType = $request->getHeader('Content-Type'); if (!$contentType || 0 !== strpos($contentType, 'text/calendar')) { return; } $path = $request->getPath(); tr...
[ "public", "function", "httpPost", "(", "RequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", ")", "{", "// Checking if this is a text/calendar content type", "$", "contentType", "=", "$", "request", "->", "getHeader", "(", "'Content-Type'", ")",...
This method handles POST request for the outbox. @param RequestInterface $request @param ResponseInterface $response @return bool
[ "This", "method", "handles", "POST", "request", "for", "the", "outbox", "." ]
train
https://github.com/sabre-io/dav/blob/44b0f2d07fd9e6e44b65f7edf2238d3bf0b428e0/lib/CalDAV/Schedule/Plugin.php#L166-L192
sabre-io/dav
lib/CalDAV/Schedule/Plugin.php
Plugin.propFind
public function propFind(PropFind $propFind, INode $node) { if ($node instanceof DAVACL\IPrincipal) { $caldavPlugin = $this->server->getPlugin('caldav'); $principalUrl = $node->getPrincipalUrl(); // schedule-outbox-URL property $propFind->handle('{'.self::NS_...
php
public function propFind(PropFind $propFind, INode $node) { if ($node instanceof DAVACL\IPrincipal) { $caldavPlugin = $this->server->getPlugin('caldav'); $principalUrl = $node->getPrincipalUrl(); $propFind->handle('{'.self::NS_CALDAV.'}schedule-outbox-URL', ...
[ "public", "function", "propFind", "(", "PropFind", "$", "propFind", ",", "INode", "$", "node", ")", "{", "if", "(", "$", "node", "instanceof", "DAVACL", "\\", "IPrincipal", ")", "{", "$", "caldavPlugin", "=", "$", "this", "->", "server", "->", "getPlugin...
This method handler is invoked during fetching of properties. We use this event to add calendar-auto-schedule-specific properties. @param PropFind $propFind @param INode $node
[ "This", "method", "handler", "is", "invoked", "during", "fetching", "of", "properties", "." ]
train
https://github.com/sabre-io/dav/blob/44b0f2d07fd9e6e44b65f7edf2238d3bf0b428e0/lib/CalDAV/Schedule/Plugin.php#L202-L295
sabre-io/dav
lib/CalDAV/Schedule/Plugin.php
Plugin.propPatch
public function propPatch($path, PropPatch $propPatch) { // Mapping the old property to the new property. $propPatch->handle('{http://calendarserver.org/ns/}calendar-availability', function ($value) use ($path) { $availProp = '{'.self::NS_CALDAV.'}calendar-availability'; $sub...
php
public function propPatch($path, PropPatch $propPatch) { $propPatch->handle('{http: $availProp = '{'.self::NS_CALDAV.'}calendar-availability'; $subPropPatch = new PropPatch([$availProp => $value]); $this->server->emit('propPatch', [$path, $subPropPatch]); ...
[ "public", "function", "propPatch", "(", "$", "path", ",", "PropPatch", "$", "propPatch", ")", "{", "// Mapping the old property to the new property.", "$", "propPatch", "->", "handle", "(", "'{http://calendarserver.org/ns/}calendar-availability'", ",", "function", "(", "$...
This method is called during property updates. @param string $path @param PropPatch $propPatch
[ "This", "method", "is", "called", "during", "property", "updates", "." ]
train
https://github.com/sabre-io/dav/blob/44b0f2d07fd9e6e44b65f7edf2238d3bf0b428e0/lib/CalDAV/Schedule/Plugin.php#L303-L314
sabre-io/dav
lib/CalDAV/Schedule/Plugin.php
Plugin.calendarObjectChange
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...
php
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...
[ "public", "function", "calendarObjectChange", "(", "RequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", ",", "VCalendar", "$", "vCal", ",", "$", "calendarPath", ",", "&", "$", "modified", ",", "$", "isNew", ")", "{", "if", "(", "!",...
This method is triggered whenever there was a calendar object gets created or updated. @param RequestInterface $request HTTP request @param ResponseInterface $response HTTP Response @param VCalendar $vCal Parsed iCalendar object @param mixed $calendarPath Path to calendar collecti...
[ "This", "method", "is", "triggered", "whenever", "there", "was", "a", "calendar", "object", "gets", "created", "or", "updated", "." ]
train
https://github.com/sabre-io/dav/blob/44b0f2d07fd9e6e44b65f7edf2238d3bf0b428e0/lib/CalDAV/Schedule/Plugin.php#L327-L352
sabre-io/dav
lib/CalDAV/Schedule/Plugin.php
Plugin.deliver
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'; } // In case the change was co...
php
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($base...
[ "public", "function", "deliver", "(", "ITip", "\\", "Message", "$", "iTipMessage", ")", "{", "$", "this", "->", "server", "->", "emit", "(", "'schedule'", ",", "[", "$", "iTipMessage", "]", ")", ";", "if", "(", "!", "$", "iTipMessage", "->", "scheduleS...
This method is responsible for delivering the ITip message. @param ITip\Message $iTipMessage
[ "This", "method", "is", "responsible", "for", "delivering", "the", "ITip", "message", "." ]
train
https://github.com/sabre-io/dav/blob/44b0f2d07fd9e6e44b65f7edf2238d3bf0b428e0/lib/CalDAV/Schedule/Plugin.php#L359-L371
sabre-io/dav
lib/CalDAV/Schedule/Plugin.php
Plugin.beforeUnbind
public function beforeUnbind($path) { // FIXME: We shouldn't trigger this functionality when we're issuing a // MOVE. This is a hack. if ('MOVE' === $this->server->httpRequest->getMethod()) { return; } $node = $this->server->tree->getNodeForPath($path); ...
php
public function beforeUnbind($path) { if ('MOVE' === $this->server->httpRequest->getMethod()) { return; } $node = $this->server->tree->getNodeForPath($path); if (!$node instanceof ICalendarObject || $node instanceof ISchedulingObject) { ret...
[ "public", "function", "beforeUnbind", "(", "$", "path", ")", "{", "// FIXME: We shouldn't trigger this functionality when we're issuing a", "// MOVE. This is a hack.", "if", "(", "'MOVE'", "===", "$", "this", "->", "server", "->", "httpRequest", "->", "getMethod", "(", ...
This method is triggered before a file gets deleted. We use this event to make sure that when this happens, attendees get cancellations, and organizers get 'DECLINED' statuses. @param string $path
[ "This", "method", "is", "triggered", "before", "a", "file", "gets", "deleted", "." ]
train
https://github.com/sabre-io/dav/blob/44b0f2d07fd9e6e44b65f7edf2238d3bf0b428e0/lib/CalDAV/Schedule/Plugin.php#L381-L409
sabre-io/dav
lib/CalDAV/Schedule/Plugin.php
Plugin.scheduleLocalDelivery
public function scheduleLocalDelivery(ITip\Message $iTipMessage) { $aclPlugin = $this->server->getPlugin('acl'); // Local delivery is not available if the ACL plugin is not loaded. if (!$aclPlugin) { return; } $caldavNS = '{'.self::NS_CALDAV.'}'; $princ...
php
public function scheduleLocalDelivery(ITip\Message $iTipMessage) { $aclPlugin = $this->server->getPlugin('acl'); if (!$aclPlugin) { return; } $caldavNS = '{'.self::NS_CALDAV.'}'; $principalUri = $aclPlugin->getPrincipalByUri($iTipMessage->recipient); ...
[ "public", "function", "scheduleLocalDelivery", "(", "ITip", "\\", "Message", "$", "iTipMessage", ")", "{", "$", "aclPlugin", "=", "$", "this", "->", "server", "->", "getPlugin", "(", "'acl'", ")", ";", "// Local delivery is not available if the ACL plugin is not loade...
Event handler for the 'schedule' event. This handler attempts to look at local accounts to deliver the scheduling object. @param ITip\Message $iTipMessage
[ "Event", "handler", "for", "the", "schedule", "event", "." ]
train
https://github.com/sabre-io/dav/blob/44b0f2d07fd9e6e44b65f7edf2238d3bf0b428e0/lib/CalDAV/Schedule/Plugin.php#L419-L553
sabre-io/dav
lib/CalDAV/Schedule/Plugin.php
Plugin.getSupportedPrivilegeSet
public function getSupportedPrivilegeSet(INode $node, array &$supportedPrivilegeSet) { $ns = '{'.self::NS_CALDAV.'}'; if ($node instanceof IOutbox) { $supportedPrivilegeSet[$ns.'schedule-send'] = [ 'abstract' => false, 'aggregates' => [ ...
php
public function getSupportedPrivilegeSet(INode $node, array &$supportedPrivilegeSet) { $ns = '{'.self::NS_CALDAV.'}'; if ($node instanceof IOutbox) { $supportedPrivilegeSet[$ns.'schedule-send'] = [ 'abstract' => false, 'aggregates' => [ ...
[ "public", "function", "getSupportedPrivilegeSet", "(", "INode", "$", "node", ",", "array", "&", "$", "supportedPrivilegeSet", ")", "{", "$", "ns", "=", "'{'", ".", "self", "::", "NS_CALDAV", ".", "'}'", ";", "if", "(", "$", "node", "instanceof", "IOutbox",...
This method is triggered whenever a subsystem requests the privileges that are supported on a particular node. We need to add a number of privileges for scheduling purposes. @param INode $node @param array $supportedPrivilegeSet
[ "This", "method", "is", "triggered", "whenever", "a", "subsystem", "requests", "the", "privileges", "that", "are", "supported", "on", "a", "particular", "node", "." ]
train
https://github.com/sabre-io/dav/blob/44b0f2d07fd9e6e44b65f7edf2238d3bf0b428e0/lib/CalDAV/Schedule/Plugin.php#L564-L611
sabre-io/dav
lib/CalDAV/Schedule/Plugin.php
Plugin.processICalendarChange
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; ...
php
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; ...
[ "protected", "function", "processICalendarChange", "(", "$", "oldObject", "=", "null", ",", "VCalendar", "$", "newObject", ",", "array", "$", "addresses", ",", "array", "$", "ignore", "=", "[", "]", ",", "&", "$", "modified", "=", "false", ")", "{", "$",...
This method looks at an old iCalendar object, a new iCalendar object and starts sending scheduling messages based on the changes. A list of addresses needs to be specified, so the system knows who made the update, because the behavior may be different based on if it's an attendee or an organizer. This method may upda...
[ "This", "method", "looks", "at", "an", "old", "iCalendar", "object", "a", "new", "iCalendar", "object", "and", "starts", "sending", "scheduling", "messages", "based", "on", "the", "changes", "." ]
train
https://github.com/sabre-io/dav/blob/44b0f2d07fd9e6e44b65f7edf2238d3bf0b428e0/lib/CalDAV/Schedule/Plugin.php#L630-L665
sabre-io/dav
lib/CalDAV/Schedule/Plugin.php
Plugin.getAddressesForPrincipal
protected function getAddressesForPrincipal($principal) { $CUAS = '{'.self::NS_CALDAV.'}calendar-user-address-set'; $properties = $this->server->getProperties( $principal, [$CUAS] ); // If we can't find this information, we'll stop processing if (!is...
php
protected function getAddressesForPrincipal($principal) { $CUAS = '{'.self::NS_CALDAV.'}calendar-user-address-set'; $properties = $this->server->getProperties( $principal, [$CUAS] ); if (!isset($properties[$CUAS])) { return []; }...
[ "protected", "function", "getAddressesForPrincipal", "(", "$", "principal", ")", "{", "$", "CUAS", "=", "'{'", ".", "self", "::", "NS_CALDAV", ".", "'}calendar-user-address-set'", ";", "$", "properties", "=", "$", "this", "->", "server", "->", "getProperties", ...
Returns a list of addresses that are associated with a principal. @param string $principal @return array
[ "Returns", "a", "list", "of", "addresses", "that", "are", "associated", "with", "a", "principal", "." ]
train
https://github.com/sabre-io/dav/blob/44b0f2d07fd9e6e44b65f7edf2238d3bf0b428e0/lib/CalDAV/Schedule/Plugin.php#L674-L691
sabre-io/dav
lib/CalDAV/Schedule/Plugin.php
Plugin.outboxRequest
public function outboxRequest(IOutbox $outboxNode, RequestInterface $request, ResponseInterface $response) { $outboxPath = $request->getPath(); // Parsing the request body try { $vObject = VObject\Reader::read($request->getBody()); } catch (VObject\ParseException $e) { ...
php
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 BadReq...
[ "public", "function", "outboxRequest", "(", "IOutbox", "$", "outboxNode", ",", "RequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", ")", "{", "$", "outboxPath", "=", "$", "request", "->", "getPath", "(", ")", ";", "// Parsing the reques...
This method handles POST requests to the schedule-outbox. Currently, two types of requests are supported: * FREEBUSY requests from RFC 6638 * Simple iTIP messages from draft-desruisseaux-caldav-sched-04 The latter is from an expired early draft of the CalDAV scheduling extensions, but iCal depends on a feature from t...
[ "This", "method", "handles", "POST", "requests", "to", "the", "schedule", "-", "outbox", "." ]
train
https://github.com/sabre-io/dav/blob/44b0f2d07fd9e6e44b65f7edf2238d3bf0b428e0/lib/CalDAV/Schedule/Plugin.php#L708-L755
sabre-io/dav
lib/CalDAV/Schedule/Plugin.php
Plugin.handleFreeBusyRequest
protected function handleFreeBusyRequest(IOutbox $outbox, VObject\Component $vObject, RequestInterface $request, ResponseInterface $response) { $vFreeBusy = $vObject->VFREEBUSY; $organizer = $vFreeBusy->ORGANIZER; $organizer = (string) $organizer; // Validating if the organizer mat...
php
protected function handleFreeBusyRequest(IOutbox $outbox, VObject\Component $vObject, RequestInterface $request, ResponseInterface $response) { $vFreeBusy = $vObject->VFREEBUSY; $organizer = $vFreeBusy->ORGANIZER; $organizer = (string) $organizer; $owner = $outbox->getOwne...
[ "protected", "function", "handleFreeBusyRequest", "(", "IOutbox", "$", "outbox", ",", "VObject", "\\", "Component", "$", "vObject", ",", "RequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", ")", "{", "$", "vFreeBusy", "=", "$", "vObject...
This method is responsible for parsing a free-busy query request and returning it's result. @param IOutbox $outbox @param VObject\Component $vObject @param RequestInterface $request @param ResponseInterface $response @return string
[ "This", "method", "is", "responsible", "for", "parsing", "a", "free", "-", "busy", "query", "request", "and", "returning", "it", "s", "result", "." ]
train
https://github.com/sabre-io/dav/blob/44b0f2d07fd9e6e44b65f7edf2238d3bf0b428e0/lib/CalDAV/Schedule/Plugin.php#L768-L841
sabre-io/dav
lib/CalDAV/Schedule/Plugin.php
Plugin.getFreeBusyForEmail
protected function getFreeBusyForEmail($email, \DateTimeInterface $start, \DateTimeInterface $end, VObject\Component $request) { $caldavNS = '{'.self::NS_CALDAV.'}'; $aclPlugin = $this->server->getPlugin('acl'); if ('mailto:' === substr($email, 0, 7)) { $email = substr($email, 7...
php
protected function getFreeBusyForEmail($email, \DateTimeInterface $start, \DateTimeInterface $end, VObject\Component $request) { $caldavNS = '{'.self::NS_CALDAV.'}'; $aclPlugin = $this->server->getPlugin('acl'); if ('mailto:' === substr($email, 0, 7)) { $email = substr($email, 7...
[ "protected", "function", "getFreeBusyForEmail", "(", "$", "email", ",", "\\", "DateTimeInterface", "$", "start", ",", "\\", "DateTimeInterface", "$", "end", ",", "VObject", "\\", "Component", "$", "request", ")", "{", "$", "caldavNS", "=", "'{'", ".", "self"...
Returns free-busy information for a specific address. The returned data is an array containing the following properties:. calendar-data : A VFREEBUSY VObject request-status : an iTip status code. href: The principal's email address, as requested The following request status codes may be returned: * 2.0;description * ...
[ "Returns", "free", "-", "busy", "information", "for", "a", "specific", "address", ".", "The", "returned", "data", "is", "an", "array", "containing", "the", "following", "properties", ":", "." ]
train
https://github.com/sabre-io/dav/blob/44b0f2d07fd9e6e44b65f7edf2238d3bf0b428e0/lib/CalDAV/Schedule/Plugin.php#L862-L995
sabre-io/dav
lib/DAV/PropFind.php
PropFind.handle
public function handle($propertyName, $valueOrCallBack) { if ($this->itemsLeft && isset($this->result[$propertyName]) && 404 === $this->result[$propertyName][0]) { if (is_callable($valueOrCallBack)) { $value = $valueOrCallBack(); } else { $value = $val...
php
public function handle($propertyName, $valueOrCallBack) { if ($this->itemsLeft && isset($this->result[$propertyName]) && 404 === $this->result[$propertyName][0]) { if (is_callable($valueOrCallBack)) { $value = $valueOrCallBack(); } else { $value = $val...
[ "public", "function", "handle", "(", "$", "propertyName", ",", "$", "valueOrCallBack", ")", "{", "if", "(", "$", "this", "->", "itemsLeft", "&&", "isset", "(", "$", "this", "->", "result", "[", "$", "propertyName", "]", ")", "&&", "404", "===", "$", ...
Handles a specific property. This method checks whether the specified property was requested in this PROPFIND request, and if so, it will call the callback and use the return value for it's value. Example: $propFind->handle('{DAV:}displayname', function() { return 'hello'; }); Note that handle will only work the fi...
[ "Handles", "a", "specific", "property", "." ]
train
https://github.com/sabre-io/dav/blob/44b0f2d07fd9e6e44b65f7edf2238d3bf0b428e0/lib/DAV/PropFind.php#L92-L105
sabre-io/dav
lib/DAV/PropFind.php
PropFind.set
public function set($propertyName, $value, $status = null) { if (is_null($status)) { $status = is_null($value) ? 404 : 200; } // If this is an ALLPROPS request and the property is // unknown, add it to the result; else ignore it: if (!isset($this->result[$property...
php
public function set($propertyName, $value, $status = null) { if (is_null($status)) { $status = is_null($value) ? 404 : 200; } if (!isset($this->result[$propertyName])) { if (self::ALLPROPS === $this->requestType) { $this->result[$prop...
[ "public", "function", "set", "(", "$", "propertyName", ",", "$", "value", ",", "$", "status", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "status", ")", ")", "{", "$", "status", "=", "is_null", "(", "$", "value", ")", "?", "404", ":", ...
Sets the value of the property. If status is not supplied, the status will default to 200 for non-null properties, and 404 for null properties. @param string $propertyName @param mixed $value @param int $status
[ "Sets", "the", "value", "of", "the", "property", "." ]
train
https://github.com/sabre-io/dav/blob/44b0f2d07fd9e6e44b65f7edf2238d3bf0b428e0/lib/DAV/PropFind.php#L117-L137
sabre-io/dav
lib/DAV/PropFind.php
PropFind.getStatus
public function getStatus($propertyName) { return isset($this->result[$propertyName]) ? $this->result[$propertyName][0] : null; }
php
public function getStatus($propertyName) { return isset($this->result[$propertyName]) ? $this->result[$propertyName][0] : null; }
[ "public", "function", "getStatus", "(", "$", "propertyName", ")", "{", "return", "isset", "(", "$", "this", "->", "result", "[", "$", "propertyName", "]", ")", "?", "$", "this", "->", "result", "[", "$", "propertyName", "]", "[", "0", "]", ":", "null...
Returns the current status code for a property name. If the property does not appear in the list of requested properties, null will be returned. @param string $propertyName @return int|null
[ "Returns", "the", "current", "status", "code", "for", "a", "property", "name", "." ]
train
https://github.com/sabre-io/dav/blob/44b0f2d07fd9e6e44b65f7edf2238d3bf0b428e0/lib/DAV/PropFind.php#L161-L164
sabre-io/dav
lib/DAV/PropFind.php
PropFind.getResultForMultiStatus
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[...
php
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[...
[ "public", "function", "getResultForMultiStatus", "(", ")", "{", "$", "r", "=", "[", "200", "=>", "[", "]", ",", "404", "=>", "[", "]", ",", "]", ";", "foreach", "(", "$", "this", "->", "result", "as", "$", "propertyName", "=>", "$", "info", ")", ...
Returns a result array that's often used in multistatus responses. The array uses status codes as keys, and property names and value pairs as the value of the top array.. such as : [ 200 => [ '{DAV:}displayname' => 'foo' ], ] @return array
[ "Returns", "a", "result", "array", "that", "s", "often", "used", "in", "multistatus", "responses", "." ]
train
https://github.com/sabre-io/dav/blob/44b0f2d07fd9e6e44b65f7edf2238d3bf0b428e0/lib/DAV/PropFind.php#L261-L280
sabre-io/dav
lib/CalDAV/Schedule/Outbox.php
Outbox.getACL
public function getACL() { return [ [ 'privilege' => '{'.CalDAV\Plugin::NS_CALDAV.'}schedule-send', 'principal' => $this->getOwner(), 'protected' => true, ], [ 'privilege' => '{DAV:}read', 'pr...
php
public function getACL() { return [ [ 'privilege' => '{'.CalDAV\Plugin::NS_CALDAV.'}schedule-send', 'principal' => $this->getOwner(), 'protected' => true, ], [ 'privilege' => '{DAV:}read', 'pr...
[ "public", "function", "getACL", "(", ")", "{", "return", "[", "[", "'privilege'", "=>", "'{'", ".", "CalDAV", "\\", "Plugin", "::", "NS_CALDAV", ".", "'}schedule-send'", ",", "'principal'", "=>", "$", "this", "->", "getOwner", "(", ")", ",", "'protected'",...
Returns a list of ACE's for this node. Each ACE has the following properties: * 'privilege', a string such as {DAV:}read or {DAV:}write. These are currently the only supported privileges * 'principal', a url to the principal who owns the node * 'protected' (optional), indicating that this ACE is not allowed to be upda...
[ "Returns", "a", "list", "of", "ACE", "s", "for", "this", "node", "." ]
train
https://github.com/sabre-io/dav/blob/44b0f2d07fd9e6e44b65f7edf2238d3bf0b428e0/lib/CalDAV/Schedule/Outbox.php#L89-L118
sabre-io/dav
lib/DAV/PartialUpdate/Plugin.php
Plugin.getHTTPMethods
public function getHTTPMethods($uri) { $tree = $this->server->tree; if ($tree->nodeExists($uri)) { $node = $tree->getNodeForPath($uri); if ($node instanceof IPatchSupport) { return ['PATCH']; } } return []; }
php
public function getHTTPMethods($uri) { $tree = $this->server->tree; if ($tree->nodeExists($uri)) { $node = $tree->getNodeForPath($uri); if ($node instanceof IPatchSupport) { return ['PATCH']; } } return []; }
[ "public", "function", "getHTTPMethods", "(", "$", "uri", ")", "{", "$", "tree", "=", "$", "this", "->", "server", "->", "tree", ";", "if", "(", "$", "tree", "->", "nodeExists", "(", "$", "uri", ")", ")", "{", "$", "node", "=", "$", "tree", "->", ...
Use this method to tell the server this plugin defines additional HTTP methods. This method is passed a uri. It should only return HTTP methods that are available for the specified uri. We claim to support PATCH method (partirl update) if and only if - the node exist - the node implements our partial update interface...
[ "Use", "this", "method", "to", "tell", "the", "server", "this", "plugin", "defines", "additional", "HTTP", "methods", "." ]
train
https://github.com/sabre-io/dav/blob/44b0f2d07fd9e6e44b65f7edf2238d3bf0b428e0/lib/DAV/PartialUpdate/Plugin.php#L79-L91
sabre-io/dav
lib/DAV/PartialUpdate/Plugin.php
Plugin.httpPatch
public function httpPatch(RequestInterface $request, ResponseInterface $response) { $path = $request->getPath(); // Get the node. Will throw a 404 if not found $node = $this->server->tree->getNodeForPath($path); if (!$node instanceof IPatchSupport) { throw new DAV\Except...
php
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...
[ "public", "function", "httpPatch", "(", "RequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", ")", "{", "$", "path", "=", "$", "request", "->", "getPath", "(", ")", ";", "// Get the node. Will throw a 404 if not found", "$", "node", "=", ...
Patch an uri. The WebDAV patch request can be used to modify only a part of an existing resource. If the resource does not exist yet and the first offset is not 0, the request fails @param RequestInterface $request @param ResponseInterface $response
[ "Patch", "an", "uri", "." ]
train
https://github.com/sabre-io/dav/blob/44b0f2d07fd9e6e44b65f7edf2238d3bf0b428e0/lib/DAV/PartialUpdate/Plugin.php#L113-L175
sabre-io/dav
lib/DAV/PartialUpdate/Plugin.php
Plugin.getHTTPUpdateRange
public function getHTTPUpdateRange(RequestInterface $request) { $range = $request->getHeader('X-Update-Range'); if (is_null($range)) { return null; } // Matching "Range: bytes=1234-5678: both numbers are optional if (!preg_match('/^(append)|(?:bytes=([0-9]+)-([0...
php
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)) { ...
[ "public", "function", "getHTTPUpdateRange", "(", "RequestInterface", "$", "request", ")", "{", "$", "range", "=", "$", "request", "->", "getHeader", "(", "'X-Update-Range'", ")", ";", "if", "(", "is_null", "(", "$", "range", ")", ")", "{", "return", "null"...
Returns the HTTP custom range update header. This method returns null if there is no well-formed HTTP range request header. It returns array(1) if it was an append request, array(2, $start, $end) if it's a start and end range, lastly it's array(3, $endoffset) if the offset was negative, and should be calculated from t...
[ "Returns", "the", "HTTP", "custom", "range", "update", "header", "." ]
train
https://github.com/sabre-io/dav/blob/44b0f2d07fd9e6e44b65f7edf2238d3bf0b428e0/lib/DAV/PartialUpdate/Plugin.php#L198-L218
phpDocumentor/ReflectionDocBlock
src/DocBlock/Tags/Method.php
Method.create
public static function create( string $body, ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null ): ?self { Assert::stringNotEmpty($body); Assert::allNotNull([$typeResolver, $descriptionFactory]); /...
php
public static function create( string $body, ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null ): ?self { Assert::stringNotEmpty($body); Assert::allNotNull([$typeResolver, $descriptionFactory]); ...
[ "public", "static", "function", "create", "(", "string", "$", "body", ",", "?", "TypeResolver", "$", "typeResolver", "=", "null", ",", "?", "DescriptionFactory", "$", "descriptionFactory", "=", "null", ",", "?", "TypeContext", "$", "context", "=", "null", ")...
{@inheritdoc}
[ "{" ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/src/DocBlock/Tags/Method.php#L67-L160
phpDocumentor/ReflectionDocBlock
src/DocBlock/Description.php
Description.render
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...
php
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...
[ "public", "function", "render", "(", "?", "Formatter", "$", "formatter", "=", "null", ")", ":", "string", "{", "if", "(", "$", "formatter", "===", "null", ")", "{", "$", "formatter", "=", "new", "PassthroughFormatter", "(", ")", ";", "}", "$", "tags", ...
Renders this description as a string where the provided formatter will format the tags in the expected string format.
[ "Renders", "this", "description", "as", "a", "string", "where", "the", "provided", "formatter", "will", "format", "the", "tags", "in", "the", "expected", "string", "format", "." ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/src/DocBlock/Description.php#L84-L96
phpDocumentor/ReflectionDocBlock
examples/04-adding-your-own-tag.php
MyTag.create
public static function create(string $body, DescriptionFactory $descriptionFactory = null, Context $context = null): MyTag { Assert::notNull($descriptionFactory); return new static($descriptionFactory->create($body, $context)); }
php
public static function create(string $body, DescriptionFactory $descriptionFactory = null, Context $context = null): MyTag { Assert::notNull($descriptionFactory); return new static($descriptionFactory->create($body, $context)); }
[ "public", "static", "function", "create", "(", "string", "$", "body", ",", "DescriptionFactory", "$", "descriptionFactory", "=", "null", ",", "Context", "$", "context", "=", "null", ")", ":", "MyTag", "{", "Assert", "::", "notNull", "(", "$", "descriptionFac...
A static Factory that creates a new instance of the current Tag. In this example the MyTag tag can be created by passing a description text as $body. Because we have added a $descriptionFactory that is type-hinted as DescriptionFactory we can now construct a new Description object and pass that to the constructor. > ...
[ "A", "static", "Factory", "that", "creates", "a", "new", "instance", "of", "the", "current", "Tag", "." ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/examples/04-adding-your-own-tag.php#L87-L92
phpDocumentor/ReflectionDocBlock
src/DocBlock.php
DocBlock.getTagsByName
public function getTagsByName(string $name): array { $result = []; /** @var Tag $tag */ foreach ($this->getTags() as $tag) { if ($tag->getName() !== $name) { continue; } $result[] = $tag; } return $result; }
php
public function getTagsByName(string $name): array { $result = []; foreach ($this->getTags() as $tag) { if ($tag->getName() !== $name) { continue; } $result[] = $tag; } return $result; }
[ "public", "function", "getTagsByName", "(", "string", "$", "name", ")", ":", "array", "{", "$", "result", "=", "[", "]", ";", "/** @var Tag $tag */", "foreach", "(", "$", "this", "->", "getTags", "(", ")", "as", "$", "tag", ")", "{", "if", "(", "$", ...
Returns an array of tags matching the given name. If no tags are found an empty array is returned. @param string $name String to search by. @return Tag[]
[ "Returns", "an", "array", "of", "tags", "matching", "the", "given", "name", ".", "If", "no", "tags", "are", "found", "an", "empty", "array", "is", "returned", "." ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/src/DocBlock.php#L149-L163
phpDocumentor/ReflectionDocBlock
src/DocBlock.php
DocBlock.hasTag
public function hasTag(string $name): bool { /** @var Tag $tag */ foreach ($this->getTags() as $tag) { if ($tag->getName() === $name) { return true; } } return false; }
php
public function hasTag(string $name): bool { foreach ($this->getTags() as $tag) { if ($tag->getName() === $name) { return true; } } return false; }
[ "public", "function", "hasTag", "(", "string", "$", "name", ")", ":", "bool", "{", "/** @var Tag $tag */", "foreach", "(", "$", "this", "->", "getTags", "(", ")", "as", "$", "tag", ")", "{", "if", "(", "$", "tag", "->", "getName", "(", ")", "===", ...
Checks if a tag of a certain type is present in this DocBlock. @param string $name Tag name to check for.
[ "Checks", "if", "a", "tag", "of", "a", "certain", "type", "is", "present", "in", "this", "DocBlock", "." ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/src/DocBlock.php#L170-L180
phpDocumentor/ReflectionDocBlock
src/DocBlock.php
DocBlock.removeTag
public function removeTag(Tag $tagToRemove): void { foreach ($this->tags as $key => $tag) { if ($tag === $tagToRemove) { unset($this->tags[$key]); break; } } }
php
public function removeTag(Tag $tagToRemove): void { foreach ($this->tags as $key => $tag) { if ($tag === $tagToRemove) { unset($this->tags[$key]); break; } } }
[ "public", "function", "removeTag", "(", "Tag", "$", "tagToRemove", ")", ":", "void", "{", "foreach", "(", "$", "this", "->", "tags", "as", "$", "key", "=>", "$", "tag", ")", "{", "if", "(", "$", "tag", "===", "$", "tagToRemove", ")", "{", "unset", ...
Remove a tag from this DocBlock. @param Tag $tagToRemove The tag to remove.
[ "Remove", "a", "tag", "from", "this", "DocBlock", "." ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/src/DocBlock.php#L187-L195
phpDocumentor/ReflectionDocBlock
src/DocBlock/Tags/Generic.php
Generic.create
public static function create( string $body, string $name = '', ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null ): self { Assert::stringNotEmpty($name); Assert::notNull($descriptionFactory); $description = $descriptionFactory && $...
php
public static function create( string $body, string $name = '', ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null ): self { Assert::stringNotEmpty($name); Assert::notNull($descriptionFactory); $description = $descriptionFactory && $...
[ "public", "static", "function", "create", "(", "string", "$", "body", ",", "string", "$", "name", "=", "''", ",", "?", "DescriptionFactory", "$", "descriptionFactory", "=", "null", ",", "?", "TypeContext", "$", "context", "=", "null", ")", ":", "self", "...
Creates a new tag that represents any unknown tag type. @return static
[ "Creates", "a", "new", "tag", "that", "represents", "any", "unknown", "tag", "type", "." ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/src/DocBlock/Tags/Generic.php#L47-L59
phpDocumentor/ReflectionDocBlock
src/DocBlock/Tags/Generic.php
Generic.validateTagName
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, ' ...
php
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, ' ...
[ "private", "function", "validateTagName", "(", "string", "$", "name", ")", ":", "void", "{", "if", "(", "!", "preg_match", "(", "'/^'", ".", "StandardTagFactory", "::", "REGEX_TAGNAME", ".", "'$/u'", ",", "$", "name", ")", ")", "{", "throw", "new", "\\",...
Validates if the tag name matches the expected format, otherwise throws an exception.
[ "Validates", "if", "the", "tag", "name", "matches", "the", "expected", "format", "otherwise", "throws", "an", "exception", "." ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/src/DocBlock/Tags/Generic.php#L72-L80
phpDocumentor/ReflectionDocBlock
src/DocBlock/Tags/Var_.php
Var_.create
public static function create( string $body, ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null ): self { Assert::stringNotEmpty($body); Assert::allNotNull([$typeResolver, $descriptionFactory]); $p...
php
public static function create( string $body, ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null ): self { Assert::stringNotEmpty($body); Assert::allNotNull([$typeResolver, $descriptionFactory]); $p...
[ "public", "static", "function", "create", "(", "string", "$", "body", ",", "?", "TypeResolver", "$", "typeResolver", "=", "null", ",", "?", "DescriptionFactory", "$", "descriptionFactory", "=", "null", ",", "?", "TypeContext", "$", "context", "=", "null", ")...
{@inheritdoc}
[ "{" ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/src/DocBlock/Tags/Var_.php#L47-L79
phpDocumentor/ReflectionDocBlock
src/DocBlock/DescriptionFactory.php
DescriptionFactory.create
public function create(string $contents, ?TypeContext $context = null): Description { [$text, $tags] = $this->parse($this->lex($contents), $context); return new Description($text, $tags); }
php
public function create(string $contents, ?TypeContext $context = null): Description { [$text, $tags] = $this->parse($this->lex($contents), $context); return new Description($text, $tags); }
[ "public", "function", "create", "(", "string", "$", "contents", ",", "?", "TypeContext", "$", "context", "=", "null", ")", ":", "Description", "{", "[", "$", "text", ",", "$", "tags", "]", "=", "$", "this", "->", "parse", "(", "$", "this", "->", "l...
Returns the parsed text of this description.
[ "Returns", "the", "parsed", "text", "of", "this", "description", "." ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/src/DocBlock/DescriptionFactory.php#L51-L56
phpDocumentor/ReflectionDocBlock
src/DocBlock/DescriptionFactory.php
DescriptionFactory.lex
private function lex(string $contents): array { $contents = $this->removeSuperfluousStartingWhitespace($contents); // performance optimalization; if there is no inline tag, don't bother splitting it up. if (strpos($contents, '{@') === false) { return [$contents]; } ...
php
private function lex(string $contents): array { $contents = $this->removeSuperfluousStartingWhitespace($contents); if (strpos($contents, '{@') === false) { return [$contents]; } return preg_split( '/\{ (?!@\}) ...
[ "private", "function", "lex", "(", "string", "$", "contents", ")", ":", "array", "{", "$", "contents", "=", "$", "this", "->", "removeSuperfluousStartingWhitespace", "(", "$", "contents", ")", ";", "// performance optimalization; if there is no inline tag, don't bother ...
Strips the contents from superfluous whitespace and splits the description into a series of tokens. @return string[] A series of tokens of which the description text is composed.
[ "Strips", "the", "contents", "from", "superfluous", "whitespace", "and", "splits", "the", "description", "into", "a", "series", "of", "tokens", "." ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/src/DocBlock/DescriptionFactory.php#L64-L102
phpDocumentor/ReflectionDocBlock
src/DocBlock/DescriptionFactory.php
DescriptionFactory.parse
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';...
php
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';...
[ "private", "function", "parse", "(", "$", "tokens", ",", "?", "TypeContext", "$", "context", "=", "null", ")", ":", "array", "{", "$", "count", "=", "count", "(", "$", "tokens", ")", ";", "$", "tagCount", "=", "0", ";", "$", "tags", "=", "[", "]"...
Parses the stream of tokens in to a new set of tokens containing Tags. @param string[] $tokens @return string[]|Tag[]
[ "Parses", "the", "stream", "of", "tokens", "in", "to", "a", "new", "set", "of", "tokens", "containing", "Tags", "." ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/src/DocBlock/DescriptionFactory.php#L111-L131
phpDocumentor/ReflectionDocBlock
src/DocBlock/DescriptionFactory.php
DescriptionFactory.removeSuperfluousStartingWhitespace
private function removeSuperfluousStartingWhitespace(string $contents): string { $lines = explode("\n", $contents); // if there is only one line then we don't have lines with superfluous whitespace and // can use the contents as-is if (count($lines) <= 1) { return $conte...
php
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) { ...
[ "private", "function", "removeSuperfluousStartingWhitespace", "(", "string", "$", "contents", ")", ":", "string", "{", "$", "lines", "=", "explode", "(", "\"\\n\"", ",", "$", "contents", ")", ";", "// if there is only one line then we don't have lines with superfluous whi...
Removes the superfluous from a multi-line description. When a description has more than one line then it can happen that the second and subsequent lines have an additional indentation. This is commonly in use with tags like this: {@}since 1.1.0 This is an example description where we have an indentation in the second...
[ "Removes", "the", "superfluous", "from", "a", "multi", "-", "line", "description", "." ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/src/DocBlock/DescriptionFactory.php#L147-L178
phpDocumentor/ReflectionDocBlock
src/DocBlock/Serializer.php
Serializer.getDocComment
public function getDocComment(DocBlock $docblock): string { $indent = str_repeat($this->indentString, $this->indent); $firstIndent = $this->isFirstLineIndented ? $indent : ''; // 3 === strlen(' * ') $wrapLength = $this->lineLength ? $this->lineLength - strlen($indent) - 3 : null; ...
php
public function getDocComment(DocBlock $docblock): string { $indent = str_repeat($this->indentString, $this->indent); $firstIndent = $this->isFirstLineIndented ? $indent : ''; $wrapLength = $this->lineLength ? $this->lineLength - strlen($indent) - 3 : null; $text = $this->r...
[ "public", "function", "getDocComment", "(", "DocBlock", "$", "docblock", ")", ":", "string", "{", "$", "indent", "=", "str_repeat", "(", "$", "this", "->", "indentString", ",", "$", "this", "->", "indent", ")", ";", "$", "firstIndent", "=", "$", "this", ...
Generate a DocBlock comment. @param DocBlock $docblock The DocBlock to serialize. @return string The serialized doc block.
[ "Generate", "a", "DocBlock", "comment", "." ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/src/DocBlock/Serializer.php#L63-L88
phpDocumentor/ReflectionDocBlock
src/DocBlock/Tags/Source.php
Source.create
public static function create( string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null ): self { Assert::stringNotEmpty($body); Assert::notNull($descriptionFactory); $startingLine = 1; $lineCount = null; $description...
php
public static function create( string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null ): self { Assert::stringNotEmpty($body); Assert::notNull($descriptionFactory); $startingLine = 1; $lineCount = null; $description...
[ "public", "static", "function", "create", "(", "string", "$", "body", ",", "?", "DescriptionFactory", "$", "descriptionFactory", "=", "null", ",", "?", "TypeContext", "$", "context", "=", "null", ")", ":", "self", "{", "Assert", "::", "stringNotEmpty", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/src/DocBlock/Tags/Source.php#L48-L71
phpDocumentor/ReflectionDocBlock
src/DocBlock/Tags/See.php
See.create
public static function create( string $body, ?FqsenResolver $resolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null ): self { Assert::allNotNull([$resolver, $descriptionFactory]); $parts = preg_split('/\s+/Su', $body, 2); ...
php
public static function create( string $body, ?FqsenResolver $resolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null ): self { Assert::allNotNull([$resolver, $descriptionFactory]); $parts = preg_split('/\s+/Su', $body, 2); ...
[ "public", "static", "function", "create", "(", "string", "$", "body", ",", "?", "FqsenResolver", "$", "resolver", "=", "null", ",", "?", "DescriptionFactory", "$", "descriptionFactory", "=", "null", ",", "?", "TypeContext", "$", "context", "=", "null", ")", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/src/DocBlock/Tags/See.php#L47-L64
phpDocumentor/ReflectionDocBlock
src/DocBlock/Tags/Link.php
Link.create
public static function create(string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null): self { Assert::notNull($descriptionFactory); $parts = preg_split('/\s+/Su', $body, 2); $description = isset($parts[1]) ? $descriptionFactory->create($parts[1], $context...
php
public static function create(string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null): self { Assert::notNull($descriptionFactory); $parts = preg_split('/\s+/Su', $body, 2); $description = isset($parts[1]) ? $descriptionFactory->create($parts[1], $context...
[ "public", "static", "function", "create", "(", "string", "$", "body", ",", "?", "DescriptionFactory", "$", "descriptionFactory", "=", "null", ",", "?", "TypeContext", "$", "context", "=", "null", ")", ":", "self", "{", "Assert", "::", "notNull", "(", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/src/DocBlock/Tags/Link.php#L43-L51
phpDocumentor/ReflectionDocBlock
src/DocBlock/Tags/Throws.php
Throws.create
public static function create( string $body, ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null ): self { Assert::allNotNull([$typeResolver, $descriptionFactory]); $parts = preg_split('/\s+/Su', $body, 2);...
php
public static function create( string $body, ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null ): self { Assert::allNotNull([$typeResolver, $descriptionFactory]); $parts = preg_split('/\s+/Su', $body, 2);...
[ "public", "static", "function", "create", "(", "string", "$", "body", ",", "?", "TypeResolver", "$", "typeResolver", "=", "null", ",", "?", "DescriptionFactory", "$", "descriptionFactory", "=", "null", ",", "?", "TypeContext", "$", "context", "=", "null", ")...
{@inheritdoc}
[ "{" ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/src/DocBlock/Tags/Throws.php#L42-L56
phpDocumentor/ReflectionDocBlock
src/DocBlock/Tags/Covers.php
Covers.create
public static function create( string $body, ?DescriptionFactory $descriptionFactory = null, ?FqsenResolver $resolver = null, ?TypeContext $context = null ): self { Assert::notEmpty($body); $parts = preg_split('/\s+/Su', $body, 2); return new static( ...
php
public static function create( string $body, ?DescriptionFactory $descriptionFactory = null, ?FqsenResolver $resolver = null, ?TypeContext $context = null ): self { Assert::notEmpty($body); $parts = preg_split('/\s+/Su', $body, 2); return new static( ...
[ "public", "static", "function", "create", "(", "string", "$", "body", ",", "?", "DescriptionFactory", "$", "descriptionFactory", "=", "null", ",", "?", "FqsenResolver", "$", "resolver", "=", "null", ",", "?", "TypeContext", "$", "context", "=", "null", ")", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/src/DocBlock/Tags/Covers.php#L45-L59
phpDocumentor/ReflectionDocBlock
src/DocBlock/ExampleFinder.php
ExampleFinder.find
public function find(Example $example): string { $filename = $example->getFilePath(); $file = $this->getExampleFileContents($filename); if (!$file) { return "** File not found : {$filename} **"; } return implode('', array_slice($file, $example->getStartingLine()...
php
public function find(Example $example): string { $filename = $example->getFilePath(); $file = $this->getExampleFileContents($filename); if (!$file) { return "** File not found : {$filename} **"; } return implode('', array_slice($file, $example->getStartingLine()...
[ "public", "function", "find", "(", "Example", "$", "example", ")", ":", "string", "{", "$", "filename", "=", "$", "example", "->", "getFilePath", "(", ")", ";", "$", "file", "=", "$", "this", "->", "getExampleFileContents", "(", "$", "filename", ")", "...
Attempts to find the example contents for the given descriptor.
[ "Attempts", "to", "find", "the", "example", "contents", "for", "the", "given", "descriptor", "." ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/src/DocBlock/ExampleFinder.php#L32-L42
phpDocumentor/ReflectionDocBlock
src/DocBlockFactory.php
DocBlockFactory.createInstance
public static function createInstance(array $additionalTags = []): self { $fqsenResolver = new FqsenResolver(); $tagFactory = new StandardTagFactory($fqsenResolver); $descriptionFactory = new DescriptionFactory($tagFactory); $tagFactory->addService($descriptionFactory); $tag...
php
public static function createInstance(array $additionalTags = []): self { $fqsenResolver = new FqsenResolver(); $tagFactory = new StandardTagFactory($fqsenResolver); $descriptionFactory = new DescriptionFactory($tagFactory); $tagFactory->addService($descriptionFactory); $tag...
[ "public", "static", "function", "createInstance", "(", "array", "$", "additionalTags", "=", "[", "]", ")", ":", "self", "{", "$", "fqsenResolver", "=", "new", "FqsenResolver", "(", ")", ";", "$", "tagFactory", "=", "new", "StandardTagFactory", "(", "$", "f...
Factory method for easy instantiation. @param string[] $additionalTags
[ "Factory", "method", "for", "easy", "instantiation", "." ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/src/DocBlockFactory.php#L44-L59
phpDocumentor/ReflectionDocBlock
src/DocBlockFactory.php
DocBlockFactory.stripDocComment
private function stripDocComment(string $comment): string { $comment = trim(preg_replace('#[ \t]*(?:\/\*\*|\*\/|\*)?[ \t]{0,1}(.*)?#u', '$1', $comment)); // reg ex above is not able to remove */ from a single line docblock if (substr($comment, -2) === '*/') { $comment = trim(sub...
php
private function stripDocComment(string $comment): string { $comment = trim(preg_replace(' if (substr($comment, -2) === '*/') { $comment = trim(substr($comment, 0, -2)); } return str_replace(["\r\n", "\r"], "\n", $comment); }
[ "private", "function", "stripDocComment", "(", "string", "$", "comment", ")", ":", "string", "{", "$", "comment", "=", "trim", "(", "preg_replace", "(", "'#[ \\t]*(?:\\/\\*\\*|\\*\\/|\\*)?[ \\t]{0,1}(.*)?#u'", ",", "'$1'", ",", "$", "comment", ")", ")", ";", "//...
Strips the asterisks from the DocBlock comment. @param string $comment String containing the comment text.
[ "Strips", "the", "asterisks", "from", "the", "DocBlock", "comment", "." ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/src/DocBlockFactory.php#L108-L118
phpDocumentor/ReflectionDocBlock
src/DocBlockFactory.php
DocBlockFactory.splitDocBlock
private function splitDocBlock(string $comment): array { // Performance improvement cheat: if the first character is an @ then only tags are in this DocBlock. This // method does not split tags so we return this verbatim as the fourth result (tags). This saves us the // performance impact of...
php
private function splitDocBlock(string $comment): array { if (strpos($comment, '@') === 0) { return ['', '', '', $comment]; } $comment = preg_replace('/\h*$/Sum', '', $comment); preg_match( '/ \A ...
[ "private", "function", "splitDocBlock", "(", "string", "$", "comment", ")", ":", "array", "{", "// Performance improvement cheat: if the first character is an @ then only tags are in this DocBlock. This", "// method does not split tags so we return this verbatim as the fourth result (tags). ...
Splits the DocBlock into a template marker, summary, description and block of tags. @param string $comment Comment to split into the sub-parts. @author Richard van Velzen (@_richardJ) Special thanks to Richard for the regex responsible for the split. @author Mike van Riel <me@mikevanriel.com> for extending the regex ...
[ "Splits", "the", "DocBlock", "into", "a", "template", "marker", "summary", "description", "and", "block", "of", "tags", "." ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/src/DocBlockFactory.php#L130-L202
phpDocumentor/ReflectionDocBlock
src/DocBlockFactory.php
DocBlockFactory.parseTagBlock
private function parseTagBlock(string $tags, Types\Context $context): array { $tags = $this->filterTagBlock($tags); if (!$tags) { return []; } $result = $this->splitTagBlockIntoTagLines($tags); foreach ($result as $key => $tagLine) { $result[$key] = $...
php
private function parseTagBlock(string $tags, Types\Context $context): array { $tags = $this->filterTagBlock($tags); if (!$tags) { return []; } $result = $this->splitTagBlockIntoTagLines($tags); foreach ($result as $key => $tagLine) { $result[$key] = $...
[ "private", "function", "parseTagBlock", "(", "string", "$", "tags", ",", "Types", "\\", "Context", "$", "context", ")", ":", "array", "{", "$", "tags", "=", "$", "this", "->", "filterTagBlock", "(", "$", "tags", ")", ";", "if", "(", "!", "$", "tags",...
Creates the tag objects. @param string $tags Tag block to parse. @param Types\Context $context Context of the parsed Tag @return DocBlock\Tag[]|string[]|null[]
[ "Creates", "the", "tag", "objects", "." ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/src/DocBlockFactory.php#L212-L225
phpDocumentor/ReflectionDocBlock
src/DocBlock/Tags/Example.php
Example.getContent
public function getContent() { if (null === $this->description) { $filePath = '"' . $this->filePath . '"'; if ($this->isURI) { $filePath = $this->isUriRelative($this->filePath) ? str_replace('%2F', '/', rawurlencode($this->filePath)) ...
php
public function getContent() { if (null === $this->description) { $filePath = '"' . $this->filePath . '"'; if ($this->isURI) { $filePath = $this->isUriRelative($this->filePath) ? str_replace('%2F', '/', rawurlencode($this->filePath)) ...
[ "public", "function", "getContent", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "description", ")", "{", "$", "filePath", "=", "'\"'", ".", "$", "this", "->", "filePath", ".", "'\"'", ";", "if", "(", "$", "this", "->", "isURI", ")",...
{@inheritdoc}
[ "{" ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/src/DocBlock/Tags/Example.php#L65-L79
phpDocumentor/ReflectionDocBlock
src/DocBlock/Tags/Example.php
Example.create
public static function create(string $body): ?Tag { // File component: File path in quotes or File URI / Source information if (! preg_match('/^(?:\"([^\"]+)\"|(\S+))(?:\s+(.*))?$/sux', $body, $matches)) { return null; } $filePath = null; $fileUri = null; ...
php
public static function create(string $body): ?Tag { if (! preg_match('/^(?:\"([^\"]+)\"|(\S+))(?:\s+(.*))?$/sux', $body, $matches)) { return null; } $filePath = null; $fileUri = null; if ('' !== $matches[1]) { $filePath = $matches[1]; ...
[ "public", "static", "function", "create", "(", "string", "$", "body", ")", ":", "?", "Tag", "{", "// File component: File path in quotes or File URI / Source information", "if", "(", "!", "preg_match", "(", "'/^(?:\\\"([^\\\"]+)\\\"|(\\S+))(?:\\s+(.*))?$/sux'", ",", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/src/DocBlock/Tags/Example.php#L84-L126
phpDocumentor/ReflectionDocBlock
src/DocBlock/Tags/Formatter/AlignFormatter.php
AlignFormatter.format
public function format(Tag $tag): string { return '@' . $tag->getName() . str_repeat(' ', $this->maxLen - strlen($tag->getName()) + 1) . (string) $tag; }
php
public function format(Tag $tag): string { return '@' . $tag->getName() . str_repeat(' ', $this->maxLen - strlen($tag->getName()) + 1) . (string) $tag; }
[ "public", "function", "format", "(", "Tag", "$", "tag", ")", ":", "string", "{", "return", "'@'", ".", "$", "tag", "->", "getName", "(", ")", ".", "str_repeat", "(", "' '", ",", "$", "this", "->", "maxLen", "-", "strlen", "(", "$", "tag", "->", "...
Formats the given tag to return a simple plain text version.
[ "Formats", "the", "given", "tag", "to", "return", "a", "simple", "plain", "text", "version", "." ]
train
https://github.com/phpDocumentor/ReflectionDocBlock/blob/48351665a881883231add24fbb7ef869adca2316/src/DocBlock/Tags/Formatter/AlignFormatter.php#L40-L43