idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
45,400
private function normalizeChangedLine ( string $ line ) : string { $ normalized = substr ( $ line , 1 ) ; return false === $ normalized ? $ line : $ normalized ; }
Remove the prefixed + - or from a changed line of code .
45,401
private function hasToken ( array $ matchList , string $ tokenKey ) : bool { return array_key_exists ( $ tokenKey , $ matchList ) && strlen ( $ matchList [ $ tokenKey ] ) ; }
Returns true if the token key was found in the list .
45,402
public function parse ( array $ diffLineList ) : Changeset { $ tokenList = $ this -> tokenizer -> tokenize ( $ diffLineList ) ; $ fileList = [ ] ; $ startIndex = 0 ; $ tokenCount = count ( $ tokenList ) ; for ( $ i = 0 ; $ i < $ tokenCount ; $ i ++ ) { if ( Token :: ORIGINAL_FILENAME === $ tokenList [ $ i ] -> getType ...
Parse an array of tokens out into an object graph .
45,403
private function parseFile ( array $ fileTokenList ) : File { $ originalName = $ fileTokenList [ 0 ] -> getValue ( ) ; $ newName = $ fileTokenList [ 1 ] -> getValue ( ) ; $ hunkList = [ ] ; $ startIndex = 0 ; $ tokenCount = count ( $ fileTokenList ) ; for ( $ i = 2 ; $ i < $ tokenCount ; $ i ++ ) { if ( $ this -> hunkS...
Process the tokens for a single file returning a File instance on success .
45,404
private function parseHunk ( array $ hunkTokenList ) : Hunk { [ $ originalStart , $ originalCount , $ newStart , $ newCount , $ tokensReadCount ] = $ this -> getHunkMeta ( $ hunkTokenList ) ; $ originalLineNo = $ originalStart ; $ newLineNo = $ newStart ; $ lineList = [ ] ; $ tokenCount = count ( $ hunkTokenList ) ; fo...
Parse out the contents of a hunk .
45,405
private function getHunkMeta ( array $ hunkTokenList ) : array { switch ( true ) { case Token :: FILE_DELETION_LINE_COUNT === $ hunkTokenList [ 0 ] -> getType ( ) : $ originalStart = 1 ; $ originalCount = intval ( $ hunkTokenList [ 0 ] -> getValue ( ) ) ; $ newStart = intval ( $ hunkTokenList [ 1 ] -> getValue ( ) ) ; ...
Parse out hunk meta .
45,406
private function fileEnd ( array $ tokenList , int $ nextLine , string $ delimiterToken ) : bool { return $ nextLine == count ( $ tokenList ) || $ delimiterToken === $ tokenList [ $ nextLine ] -> getType ( ) ; }
Determine if we re at the end of a section of tokens .
45,407
private function hunkStart ( Token $ token ) : bool { return Token :: HUNK_ORIGINAL_START === $ token -> getType ( ) || Token :: FILE_DELETION_LINE_COUNT === $ token -> getType ( ) ; }
Returns true if the token indicates the start of a hunk .
45,408
private function mapLineOperation ( Token $ token ) : string { if ( Token :: SOURCE_LINE_ADDED === $ token -> getType ( ) ) { $ operation = Line :: ADDED ; } elseif ( Token :: SOURCE_LINE_REMOVED === $ token -> getType ( ) ) { $ operation = Line :: REMOVED ; } else { $ operation = Line :: UNCHANGED ; } return $ operati...
Maps between token representation of line operations and the correct const from the Line class .
45,409
protected function applyEventCreated ( EventCreated $ eventCreated , DomainMessage $ domainMessage ) { $ eventId = $ eventCreated -> getEventId ( ) ; $ location = $ eventCreated -> getLocation ( ) ; $ this -> addNewItemToIndex ( $ domainMessage , $ eventId , EntityType :: EVENT ( ) , $ eventCreated -> getTitle ( ) , $ ...
Listener for event created commands .
45,410
protected function applyPlaceCreated ( PlaceCreated $ placeCreated , DomainMessage $ domainMessage ) { $ placeId = $ placeCreated -> getPlaceId ( ) ; $ address = $ placeCreated -> getAddress ( ) ; $ this -> addNewItemToIndex ( $ domainMessage , $ placeId , EntityType :: PLACE ( ) , $ placeCreated -> getTitle ( ) , $ ad...
Listener for place created commands .
45,411
public function applyEventDeleted ( EventDeleted $ eventDeleted ) { $ this -> repository -> deleteIndex ( $ eventDeleted -> getItemId ( ) , EntityType :: EVENT ( ) ) ; }
Remove the index for events
45,412
public function applyPlaceDeleted ( PlaceDeleted $ placeDeleted ) { $ this -> repository -> deleteIndex ( $ placeDeleted -> getItemId ( ) , EntityType :: PLACE ( ) ) ; }
Remove the index for places
45,413
protected function applyImageAdded ( AbstractImageAdded $ imageAdded ) { $ document = $ this -> loadDocumentFromRepository ( $ imageAdded ) ; $ offerLd = $ document -> getBody ( ) ; $ offerLd -> mediaObject = isset ( $ offerLd -> mediaObject ) ? $ offerLd -> mediaObject : [ ] ; $ imageData = $ this -> mediaObjectSerial...
Apply the imageAdded event to the item repository .
45,414
protected function applyImageUpdated ( AbstractImageUpdated $ imageUpdated ) { $ document = $ this -> loadDocumentFromRepository ( $ imageUpdated ) ; $ offerLd = $ document -> getBody ( ) ; if ( ! isset ( $ offerLd -> mediaObject ) ) { throw new \ Exception ( 'The image to update could not be found.' ) ; } $ updatedMed...
Apply the ImageUpdated event to the item repository .
45,415
protected function applyOrganizerUpdated ( AbstractOrganizerUpdated $ organizerUpdated ) { $ document = $ this -> loadDocumentFromRepository ( $ organizerUpdated ) ; $ offerLd = $ document -> getBody ( ) ; $ offerLd -> organizer = array ( '@type' => 'Organizer' , ) + ( array ) $ this -> organizerJSONLD ( $ organizerUpd...
Apply the organizer updated event to the offer repository .
45,416
protected function applyOrganizerDeleted ( AbstractOrganizerDeleted $ organizerDeleted ) { $ document = $ this -> loadDocumentFromRepository ( $ organizerDeleted ) ; $ offerLd = $ document -> getBody ( ) ; unset ( $ offerLd -> organizer ) ; return $ document -> withBody ( $ offerLd ) ; }
Apply the organizer delete event to the offer repository .
45,417
protected function applyBookingInfoUpdated ( AbstractBookingInfoUpdated $ bookingInfoUpdated ) { $ document = $ this -> loadDocumentFromRepository ( $ bookingInfoUpdated ) ; $ offerLd = $ document -> getBody ( ) ; $ offerLd -> bookingInfo = $ bookingInfoUpdated -> getBookingInfo ( ) -> toJsonLd ( ) ; return $ document ...
Apply the booking info updated event to the offer repository .
45,418
protected function applyContactPointUpdated ( AbstractContactPointUpdated $ contactPointUpdated ) { $ document = $ this -> loadDocumentFromRepository ( $ contactPointUpdated ) ; $ offerLd = $ document -> getBody ( ) ; $ offerLd -> contactPoint = $ contactPointUpdated -> getContactPoint ( ) -> toJsonLd ( ) ; return $ do...
Apply the contact point updated event to the offer repository .
45,419
protected function applyDescriptionUpdated ( AbstractDescriptionUpdated $ descriptionUpdated ) { $ document = $ this -> loadDocumentFromRepository ( $ descriptionUpdated ) ; $ offerLd = $ document -> getBody ( ) ; if ( empty ( $ offerLd -> description ) ) { $ offerLd -> description = new \ stdClass ( ) ; } $ mainLangua...
Apply the description updated event to the offer repository .
45,420
protected function applyTypicalAgeRangeUpdated ( AbstractTypicalAgeRangeUpdated $ typicalAgeRangeUpdated ) { $ document = $ this -> loadDocumentFromRepository ( $ typicalAgeRangeUpdated ) ; $ offerLd = $ document -> getBody ( ) ; $ offerLd -> typicalAgeRange = ( string ) $ typicalAgeRangeUpdated -> getTypicalAgeRange (...
Apply the typical age range updated event to the offer repository .
45,421
protected function applyTypicalAgeRangeDeleted ( AbstractTypicalAgeRangeDeleted $ typicalAgeRangeDeleted ) { $ document = $ this -> loadDocumentFromRepository ( $ typicalAgeRangeDeleted ) ; $ offerLd = $ document -> getBody ( ) ; unset ( $ offerLd -> typicalAgeRange ) ; return $ document -> withBody ( $ offerLd ) ; }
Apply the typical age range deleted event to the offer repository .
45,422
private static function deserializeDateTime ( $ dateTimeData ) { $ dateTime = DateTime :: createFromFormat ( DateTime :: ATOM , $ dateTimeData ) ; if ( $ dateTime === false ) { $ dateTime = DateTime :: createFromFormat ( 'Y-m-d\TH:i:s' , $ dateTimeData , new DateTimeZone ( 'Europe/Brussels' ) ) ; if ( ! $ dateTime ) { ...
This deserialization function takes into account old data that might be missing a timezone . It will fall back to creating a DateTime object and assume Brussels . If this still fails an error will be thrown .
45,423
public function toJsonLd ( ) { $ jsonLd = [ ] ; $ jsonLd [ 'calendarType' ] = $ this -> getType ( ) -> toNative ( ) ; empty ( $ this -> startDate ) ? : $ jsonLd [ 'startDate' ] = $ this -> getStartDate ( ) -> format ( DateTime :: ATOM ) ; empty ( $ this -> endDate ) ? : $ jsonLd [ 'endDate' ] = $ this -> getEndDate ( )...
Return the jsonLD version of a calendar .
45,424
public function getResultSet ( $ cdbxml ) { $ items = new OfferIdentifierCollection ( ) ; $ totalItems = $ cdbId = $ elementName = $ offerType = $ resultXmlString = null ; $ resetCurrentResultValues = function ( ) use ( & $ cdbId , & $ elementName , & $ offerType , & $ resultXmlString ) { $ cdbId = null ; $ elementName...
Creates a result set .
45,425
public function addDayOfWeek ( DayOfWeek $ dayOfWeek ) { $ this -> daysOfWeek = array_unique ( array_merge ( $ this -> daysOfWeek , [ $ dayOfWeek -> toNative ( ) , ] ) ) ; return $ this ; }
Keeps the collection of days of week unique . Makes sure that the objects are stored as strings to allow PHP serialize method .
45,426
protected function applyOrganizerUpdated ( OrganizerUpdated $ organizerUpdated ) { $ this -> repository -> storeOrganizer ( $ organizerUpdated -> getItemId ( ) , $ organizerUpdated -> getOrganizerId ( ) ) ; }
Store the relation when the organizer was changed
45,427
private function matchesIdAndEntityType ( ) { $ expr = $ this -> connection -> getExpressionBuilder ( ) ; return $ expr -> andX ( $ expr -> eq ( 'entity_id' , ':entity_id' ) , $ expr -> eq ( 'entity_type' , ':entity_type' ) ) ; }
Returns the WHERE predicates for matching the id and entity_type columns .
45,428
public function rename ( UUID $ uuid , StringLiteral $ name ) { $ this -> apply ( new RoleRenamed ( $ uuid , $ name ) ) ; }
Rename the role .
45,429
public function addPermission ( UUID $ uuid , Permission $ permission ) { if ( ! in_array ( $ permission , $ this -> permissions ) ) { $ this -> apply ( new PermissionAdded ( $ uuid , $ permission ) ) ; } }
Add a permission to the role .
45,430
public function removePermission ( UUID $ uuid , Permission $ permission ) { if ( in_array ( $ permission , $ this -> permissions ) ) { $ this -> apply ( new PermissionRemoved ( $ uuid , $ permission ) ) ; } }
Remove a permission from the role .
45,431
protected function applyEventCdbXmlFromUDB2 ( $ eventId , $ cdbXmlNamespaceUri , $ cdbXml ) { $ document = $ this -> newDocument ( $ eventId ) ; $ eventLd = $ this -> projectEventCdbXmlToObject ( $ document -> getBody ( ) , $ eventId , $ cdbXmlNamespaceUri , $ cdbXml ) ; return $ document -> withBody ( $ eventLd ) ; }
Helper function to save a JSON - LD document from cdbxml coming from UDB2 .
45,432
private function UDB3Media ( $ document ) { $ media = [ ] ; if ( $ document ) { $ item = $ document -> getBody ( ) ; $ item -> mediaObject = isset ( $ item -> mediaObject ) ? $ item -> mediaObject : [ ] ; } return $ media ; }
Return the media of an event if it already exists .
45,433
private function UDB3Location ( $ document ) { $ location = null ; if ( $ document ) { $ item = $ document -> getBody ( ) ; $ location = isset ( $ item -> location ) ? $ item -> location : null ; } return $ location ; }
Return the location of an event if it already exists .
45,434
private function guardStream ( DomainEventStreamInterface $ eventStream ) { foreach ( $ eventStream as $ domainMessage ) { $ id = ( string ) $ domainMessage -> getId ( ) ; } }
Ensure that an error will be thrown if the ID in the domain messages is not something that can be converted to a string .
45,435
public function deferredDispatch ( $ jobId , $ command ) { $ exception = null ; $ currentCommandLogger = null ; if ( $ this -> logger ) { $ jobMetadata = array ( 'job_id' => $ jobId , ) ; $ currentCommandLogger = new ContextEnrichingLogger ( $ this -> logger , $ jobMetadata ) ; } if ( $ currentCommandLogger ) { $ curre...
Really dispatches the command to the proper handler to be executed .
45,436
public static function create ( $ eventId , Language $ mainLanguage , Title $ title , EventType $ eventType , Location $ location , CalendarInterface $ calendar , Theme $ theme = null , \ DateTimeImmutable $ publicationDate = null ) { $ event = new self ( ) ; $ event -> apply ( new EventCreated ( $ eventId , $ mainLang...
Factory method to create a new event .
45,437
private function hasUncommittedEvents ( ) { $ reflector = new \ ReflectionClass ( EventSourcedAggregateRoot :: class ) ; $ property = $ reflector -> getProperty ( 'uncommittedEvents' ) ; $ property -> setAccessible ( true ) ; $ uncommittedEvents = $ property -> getValue ( $ this ) ; return ! empty ( $ uncommittedEvents...
Use reflection to get check if the aggregate has uncommitted events .
45,438
public function documentWithCdbXML ( $ base , \ CultureFeed_Cdb_Item_Event $ event , PlaceServiceInterface $ placeManager , OrganizerServiceInterface $ organizerManager , SluggerInterface $ slugger ) { $ jsonLD = clone $ base ; $ detail = null ; $ details = $ event -> getDetails ( ) ; foreach ( $ details as $ languageD...
Imports a UDB2 event into a UDB3 JSON - LD document .
45,439
public static function create ( $ id , Language $ mainLanguage , Url $ website , Title $ title ) { $ organizer = new self ( ) ; $ organizer -> apply ( new OrganizerCreatedWithUniqueWebsite ( $ id , $ mainLanguage , $ website , $ title ) ) ; return $ organizer ; }
Factory method to create a new Organizer .
45,440
public static function fromJSONLDEvent ( $ eventString ) { $ event = json_decode ( $ eventString ) ; foreach ( $ event -> terms as $ term ) { if ( $ term -> domain == self :: DOMAIN ) { return new self ( $ term -> id , $ term -> label ) ; } } return null ; }
Creates a new EventType object from a JSON - LD encoded event .
45,441
protected function applyPlaceImportedFromUDB2 ( PlaceImportedFromUDB2 $ place ) { $ placeId = $ place -> getActorId ( ) ; $ this -> storeRelations ( $ placeId , null ) ; }
Store the relation for places imported from UDB2 .
45,442
public function handleAddImage ( AbstractAddImage $ addImage ) { $ offer = $ this -> load ( $ addImage -> getItemId ( ) ) ; $ image = $ this -> mediaManager -> getImage ( $ addImage -> getImageId ( ) ) ; $ offer -> addImage ( $ image ) ; $ this -> offerRepository -> save ( $ offer ) ; }
Handle an add image command .
45,443
public function handleUpdateDescription ( AbstractUpdateDescription $ updateDescription ) { $ offer = $ this -> load ( $ updateDescription -> getItemId ( ) ) ; $ offer -> updateDescription ( $ updateDescription -> getDescription ( ) , $ updateDescription -> getLanguage ( ) ) ; $ this -> offerRepository -> save ( $ offe...
Handle the update of description on a place .
45,444
public function handleUpdateTypicalAgeRange ( AbstractUpdateTypicalAgeRange $ updateTypicalAgeRange ) { $ offer = $ this -> load ( $ updateTypicalAgeRange -> getItemId ( ) ) ; $ offer -> updateTypicalAgeRange ( $ updateTypicalAgeRange -> getTypicalAgeRange ( ) ) ; $ this -> offerRepository -> save ( $ offer ) ; }
Handle the update of typical age range on a place .
45,445
public function handleDeleteTypicalAgeRange ( AbstractDeleteTypicalAgeRange $ deleteTypicalAgeRange ) { $ offer = $ this -> load ( $ deleteTypicalAgeRange -> getItemId ( ) ) ; $ offer -> deleteTypicalAgeRange ( ) ; $ this -> offerRepository -> save ( $ offer ) ; }
Handle the deletion of typical age range on a place .
45,446
public function handleUpdateOrganizer ( AbstractUpdateOrganizer $ updateOrganizer ) { $ offer = $ this -> load ( $ updateOrganizer -> getItemId ( ) ) ; $ this -> loadOrganizer ( $ updateOrganizer -> getOrganizerId ( ) ) ; $ offer -> updateOrganizer ( $ updateOrganizer -> getOrganizerId ( ) ) ; $ this -> offerRepository...
Handle an update command to update organizer of a place .
45,447
public function handleDeleteOrganizer ( AbstractDeleteOrganizer $ deleteOrganizer ) { $ offer = $ this -> load ( $ deleteOrganizer -> getItemId ( ) ) ; $ offer -> deleteOrganizer ( $ deleteOrganizer -> getOrganizerId ( ) ) ; $ this -> offerRepository -> save ( $ offer ) ; }
Handle an update command to delete the organizer .
45,448
public function handleUpdateContactPoint ( AbstractUpdateContactPoint $ updateContactPoint ) { $ offer = $ this -> load ( $ updateContactPoint -> getItemId ( ) ) ; $ offer -> updateContactPoint ( $ updateContactPoint -> getContactPoint ( ) ) ; $ this -> offerRepository -> save ( $ offer ) ; }
Handle an update command to updated the contact point .
45,449
public function handleUpdateBookingInfo ( AbstractUpdateBookingInfo $ updateBookingInfo ) { $ offer = $ this -> load ( $ updateBookingInfo -> getItemId ( ) ) ; $ offer -> updateBookingInfo ( $ updateBookingInfo -> getBookingInfo ( ) ) ; $ this -> offerRepository -> save ( $ offer ) ; }
Handle an update command to updated the booking info .
45,450
protected function prepareLoadStatement ( ) { $ queryBuilder = $ this -> connection -> createQueryBuilder ( ) ; $ queryBuilder -> select ( 'id' , 'uuid' , 'playhead' , 'metadata' , 'payload' , 'recorded_on' ) -> from ( $ this -> tableName ) -> where ( 'id >= :startid' ) -> setParameter ( 'startid' , $ this -> startId )...
The load statement can no longer be cached because of using the query builder . The query builder requires all parameters to be set before using the execute command . The previous solution used the prepare statement on the connection this did not require all parameters to be set up front .
45,451
public static function createPlace ( $ id , Language $ mainLanguage , Title $ title , EventType $ eventType , Address $ address , CalendarInterface $ calendar , Theme $ theme = null , DateTimeImmutable $ publicationDate = null ) { $ place = new self ( ) ; $ place -> apply ( new PlaceCreated ( $ id , $ mainLanguage , $ ...
Factory method to create a new Place .
45,452
protected function applyPlaceCreated ( PlaceCreated $ placeCreated ) { $ this -> mainLanguage = $ placeCreated -> getMainLanguage ( ) ; $ this -> titles [ $ this -> mainLanguage -> getCode ( ) ] = $ placeCreated -> getTitle ( ) ; $ this -> calendar = $ placeCreated -> getCalendar ( ) ; $ this -> contactPoint = new Cont...
Apply the place created event .
45,453
protected function setNewlinesAfterClosingTags ( $ string , $ tag , $ newlineCount = 1 , $ selfClosing = false ) { $ pattern = '/' ; if ( $ selfClosing ) { $ pattern .= '(<' . $ tag . '.*?[\\/]?>)' ; } else { $ pattern .= '(<\\/' . $ tag . '>)' ; } $ pattern .= '([\\n]*)' ; $ pattern .= '/i' ; $ newlines = '' ; for ( $...
Sets a specific amount of newlines after each occurrence of a specific closing HTML tag .
45,454
protected function limitConsecutiveNewlines ( $ string , $ limit = 2 ) { $ exceeded = $ limit + 1 ; $ pattern = '/((\\n){' . $ exceeded . ',})/' ; $ newlines = '' ; for ( $ i = 0 ; $ i < $ limit ; $ i ++ ) { $ newlines .= PHP_EOL ; } return preg_replace ( $ pattern , $ newlines , $ string ) ; }
Restricts the number of consecutive newlines in a specific string .
45,455
private function getUiTIDSavedSearchRepository ( ) { $ metadata = $ this -> metadata -> serialize ( ) ; $ tokenCredentials = $ metadata [ 'uitid_token_credentials' ] ; $ savedSearchesService = $ this -> savedSearchesServiceFactory -> withTokenCredentials ( $ tokenCredentials ) ; $ repository = new UiTIDSavedSearchRepos...
Should be called inside the handle methods and not inside the constructor because the metadata property is set or overwritten right before a handle method is called .
45,456
public function search ( string $ query , $ limit = 30 , $ start = 0 , $ sort = null ) { if ( $ query == '*.*' && $ limit == 30 && $ start == 0 && $ sort == 'lastupdated desc' ) { $ result = $ this -> fetchFromCache ( ) ; if ( null === $ result ) { $ result = $ this -> search -> search ( $ query , $ limit , $ start , $...
Find UDB3 data based on an arbitrary query .
45,457
protected function getMainImageId ( ) { $ mainImage = $ this -> images -> getMain ( ) ; return isset ( $ mainImage ) ? $ mainImage -> getMediaObjectId ( ) : null ; }
Get the id of the main image if one is selected for this offer .
45,458
public function deleteOrganizer ( $ organizerId ) { if ( $ this -> organizerId === $ organizerId ) { $ this -> apply ( $ this -> createOrganizerDeletedEvent ( $ organizerId ) ) ; } }
Delete the given organizer .
45,459
public function deleteCurrentOrganizer ( ) { if ( ! is_null ( $ this -> organizerId ) ) { $ this -> apply ( $ this -> createOrganizerDeletedEvent ( $ this -> organizerId ) ) ; } }
Delete the current organizer regardless of the id .
45,460
public function updateContactPoint ( ContactPoint $ contactPoint ) { if ( is_null ( $ this -> contactPoint ) || ! $ this -> contactPoint -> sameAs ( $ contactPoint ) ) { $ this -> apply ( $ this -> createContactPointUpdatedEvent ( $ contactPoint ) ) ; } }
Updated the contact info .
45,461
public function updateBookingInfo ( BookingInfo $ bookingInfo ) { if ( is_null ( $ this -> bookingInfo ) || ! $ this -> bookingInfo -> sameAs ( $ bookingInfo ) ) { $ this -> apply ( $ this -> createBookingInfoUpdatedEvent ( $ bookingInfo ) ) ; } }
Updated the booking info .
45,462
public function addImage ( Image $ image ) { $ existingImage = $ this -> images -> findImageByUUID ( $ image -> getMediaObjectId ( ) ) ; if ( $ existingImage === null ) { $ this -> apply ( $ this -> createImageAddedEvent ( $ image ) ) ; } }
Add a new image .
45,463
public function removeImage ( Image $ image ) { $ existingImage = $ this -> images -> findImageByUUID ( $ image -> getMediaObjectId ( ) ) ; if ( $ existingImage ) { $ this -> apply ( $ this -> createImageRemovedEvent ( $ existingImage ) ) ; } }
Remove an image .
45,464
public function selectMainImage ( Image $ image ) { if ( ! $ this -> images -> findImageByUUID ( $ image -> getMediaObjectId ( ) ) ) { throw new \ InvalidArgumentException ( 'You can not select a random image to be main, it has to be added to the item.' ) ; } $ oldMainImage = $ this -> images -> getMain ( ) ; if ( ! is...
Make an existing image of the item the main image .
45,465
public function publish ( \ DateTimeInterface $ publicationDate ) { $ this -> guardPublish ( ) ? : $ this -> apply ( $ this -> createPublishedEvent ( $ publicationDate ) ) ; }
Publish the offer when it has workflowstatus draft .
45,466
public function reject ( StringLiteral $ reason ) { $ this -> guardRejection ( $ reason ) ? : $ this -> apply ( $ this -> createRejectedEvent ( $ reason ) ) ; }
Reject an offer that is waiting for validation with a given reason .
45,467
private static function splitKeywordTagOnSemiColon ( CultureFeed_Cdb_Item_Event $ event ) { $ event = clone $ event ; $ keywords = $ event -> getKeywords ( true ) ; foreach ( $ keywords as $ keyword ) { $ individualKeywords = explode ( ';' , $ keyword -> getValue ( ) ) ; if ( count ( $ individualKeywords ) > 1 ) { $ ev...
UDB2 contained a bug that allowed for a keyword to have a semicolon .
45,468
private function executeSearch ( $ query , $ limit , $ start , $ sort = null ) { $ qParam = new Parameter \ Query ( $ query ) ; $ groupParam = new Parameter \ Group ( ) ; $ startParam = new Parameter \ Start ( $ start ) ; $ limitParam = new Parameter \ Rows ( $ limit ) ; $ typeParam = new Parameter \ FilterQuery ( 'typ...
Finds items matching an arbitrary query .
45,469
public function stats ( $ ip = null ) : Response { $ url = $ this -> api . 'app/stats' ; $ params = $ this -> params + [ 'query' => [ 'user_ip' => $ ip ] ] ; return new Response ( $ this -> http -> get ( $ url , $ params ) ) ; }
Return application stats .
45,470
protected function isSuccess ( $ result ) : bool { return ! is_null ( $ result ) ? ( is_string ( $ result ) && $ result === 'true' ) || ( is_bool ( $ result ) && $ result ) : false ; }
Determine if the given result is success .
45,471
public function send ( $ authyId , $ method = 'sms' , $ force = false , $ action = null , $ actionMessage = null ) : Response { $ url = $ this -> api . $ method . "/{$authyId}" ; $ params = $ this -> params + [ 'query' => [ 'force' => $ force ? 'true' : 'false' , 'action' => $ action , 'actionMessage' => $ actionMessag...
Send verification token to the given Authy user .
45,472
public function verify ( $ token , $ authyId , $ force = false , $ action = null ) : Response { $ url = $ this -> api . "verify/{$token}/{$authyId}" ; $ params = $ this -> params + [ 'query' => [ 'force' => $ force ? 'true' : 'false' , 'action' => $ action ] ] ; return new Response ( $ this -> http -> get ( $ url , $ p...
Verify the given token for the given Authy user .
45,473
public function register ( $ email , $ cellphone , $ countryCode , $ sendInstallLink = true ) : Response { $ url = $ this -> api . 'users/new' ; $ params = $ this -> params + [ 'form_params' => [ 'send_install_link_via_sms' => ( bool ) $ sendInstallLink , 'user' => [ 'email' => $ email , 'cellphone' => preg_replace ( '...
Register a new Authy user .
45,474
public function registerActivity ( $ authyId , $ type , $ data , $ ip = null ) : Response { $ url = $ this -> api . "users/{$authyId}/register_activity" ; $ params = $ this -> params + [ 'form_params' => [ 'type' => $ type , 'data' => $ data , 'user_ip' => $ ip ] ] ; return new Response ( $ this -> http -> post ( $ url...
Register the given user activity .
45,475
public function status ( $ authyId , $ ip = null ) : Response { $ url = $ this -> api . "users/{$authyId}/status" ; $ params = $ this -> params + [ 'query' => [ 'user_ip' => $ ip ] ] ; return new Response ( $ this -> http -> get ( $ url , $ params ) ) ; }
Get status of the given user .
45,476
public function delete ( $ authyId , $ ip = null ) : Response { $ url = $ this -> api . "users/{$authyId}/delete" ; $ params = $ this -> params + [ 'form_params' => [ 'ip' => $ ip ] ] ; return new Response ( $ this -> http -> post ( $ url , $ params ) ) ; }
Delete the given Authy user .
45,477
protected function getDetail ( $ detail ) { $ fromDetails = $ this -> docvertDetails [ $ detail ] ; if ( $ fromDetails ) { return $ fromDetails ; } $ fromConfig = $ this -> config ( ) -> get ( $ detail ) ; if ( $ fromConfig ) { return $ fromConfig ; } $ fromEnv = Environment :: getEnv ( 'DOCVERT_' . strtoupper ( $ deta...
Retrieves detail in priority order from 1 . local instance field 2 . Config 3 . Environment
45,478
public function upload ( HTTPRequest $ request ) { if ( $ this -> isDisabled ( ) || $ this -> isReadonly ( ) ) { return $ this -> httpError ( 403 ) ; } $ token = $ this -> getForm ( ) -> getSecurityToken ( ) ; if ( ! $ token -> checkRequest ( $ request ) ) { return $ this -> httpError ( 400 ) ; } $ tmpfile = $ request ...
Process the document immediately upon upload .
45,479
protected function preserveSourceDocument ( $ tmpfile , $ chosenFolderID = null ) { $ upload = Upload :: create ( ) ; $ file = File :: create ( ) ; $ upload -> loadIntoFile ( $ tmpfile , $ file , $ chosenFolderID ) ; $ page = $ this -> form -> getRecord ( ) ; $ page -> ImportedFromFileID = $ file -> ID ; $ page -> writ...
Preserves the source file by copying it to a specified folder .
45,480
protected function writeTOC ( $ publishPages = false , $ preservedDocument = null ) { $ page = $ this -> form -> getRecord ( ) ; $ content = '<ul>' ; if ( $ page ) { if ( $ page -> Children ( ) -> Count ( ) > 0 ) { foreach ( $ page -> Children ( ) as $ child ) { $ content .= '<li><a href="' . $ child -> Link ( ) . '">'...
Builds and writes the table of contents for the document .
45,481
protected function writeContent ( $ subtitle , $ subdoc , $ subnode , $ sort = null , $ publishPages = false ) { $ record = $ this -> form -> getRecord ( ) ; if ( $ subtitle ) { $ page = DataObject :: get_one ( 'Page' , sprintf ( '"Title" = \'%s\' AND "ParentID" = %d' , $ subtitle , $ record -> ID ) ) ; if ( ! $ page )...
Used only when writing the document that has been split by headers . Can write both to the chapter pages as well as the master page .
45,482
public function regenerate ( ) { $ this -> init ( ) ; session_start ( ) ; session_regenerate_id ( ) ; $ this -> id = session_id ( ) ; session_write_close ( ) ; return $ this -> id ; }
Update the current session id with a newly generated one .
45,483
public function destroy ( ) : SessionInterface { $ this -> init ( ) ; @ session_start ( ) ; session_destroy ( ) ; setcookie ( $ this -> name , "" , time ( ) - 86400 , $ this -> cookie -> getPath ( ) , $ this -> cookie -> getDomain ( ) , $ this -> cookie -> isSecure ( ) , $ this -> cookie -> isHttpOnly ( ) ) ; $ this ->...
Tear down the session and wipe all its data .
45,484
public static function formatOn ( $ on , $ r = '' ) { if ( isset ( $ on [ 0 ] ) && is_array ( $ on [ 0 ] ) ) { foreach ( $ on as $ on2 ) { $ r = self :: formatOn ( $ on2 , $ r ) ; } } else { $ on2 = array_keys ( $ on ) ; $ r .= ( ! empty ( $ r ) ? ' AND ' : '' ) . '`' . key ( $ on ) . '`.`' . current ( $ on ) . '` = `'...
SQL rendering for JOIN ON
45,485
public static function arrayToCsv ( $ array , $ header_row = true , $ col_sep = "," , $ row_sep = "\n" , $ qut = '"' ) { if ( ! is_array ( $ array ) || ! isset ( $ array [ 0 ] ) || ! is_array ( $ array [ 0 ] ) ) { return false ; } $ output = '' ; if ( $ header_row ) { foreach ( $ array [ 0 ] as $ key => $ val ) { $ key...
Convert an array in a string CSV
45,486
public static function fromRuleSet ( RuleSet $ ruleSet , array $ overrideRules = [ ] ) { if ( \ PHP_VERSION_ID < $ ruleSet -> targetPhpVersion ( ) ) { throw new \ RuntimeException ( \ sprintf ( 'Current PHP version "%s is less than targeted PHP version "%s".' , \ PHP_VERSION_ID , $ ruleSet -> targetPhpVersion ( ) ) ) ;...
Creates a configuration based on a rule set .
45,487
public static function createFromIni ( ) : CookieInterface { $ params = session_get_cookie_params ( ) ; return ( new static ( ) ) -> withLifetime ( $ params [ "lifetime" ] ) -> withPath ( $ params [ "path" ] ) -> withDomain ( $ params [ "domain" ] ) -> withSecure ( $ params [ "secure" ] ) -> withHttpOnly ( $ params [ "...
Create a new instance from the current environment settings .
45,488
public function clear ( ) : SessionInterface { $ values = $ this -> getAll ( ) ; $ values = array_map ( function ( $ value ) { return null ; } , $ values ) ; $ this -> set ( $ values ) ; return $ this ; }
Clear all previously set values .
45,489
public function getFlash ( string $ key ) { $ key = $ this -> flashKey ( $ key ) ; $ value = $ this -> get ( $ key ) ; $ this -> delete ( $ key ) ; return $ value ; }
Retrieve a one - time value from the session data .
45,490
public function setFlash ( string $ key , $ value ) : SessionInterface { $ key = $ this -> flashKey ( $ key ) ; return $ this -> set ( $ key , $ value ) ; }
Set a one - time value within session data .
45,491
public function handle ( ServerRequestInterface $ request ) : ResponseInterface { $ storageless = $ request -> getAttribute ( SessionMiddleware :: SESSION_ATTRIBUTE ) ; $ session = new Session ( $ storageless ) ; $ request = $ request -> withAttribute ( SessionInterface :: class , $ session ) ; return $ this -> handler...
Wrap the storageless session from the request in our session interface .
45,492
public static function instance ( $ id = 'datatable' ) { $ cls = get_called_class ( ) ; if ( ! isset ( self :: $ instance [ $ id ] ) ) { self :: $ instance [ $ id ] = new $ cls ( $ id ) ; } return self :: $ instance [ $ id ] ; }
Get a table initialized if exist else initialize one
45,493
public function setJsInitParams ( $ params ) { foreach ( $ params as $ k => $ v ) { $ this -> setJsInitParam ( $ k , $ v ) ; } return $ this ; }
Add dataTables . js Init Params
45,494
protected function setTHead ( & $ params ) { $ k = $ this -> getColumnIndex ( $ params ) ; if ( isset ( $ params [ 'parent' ] ) ) { $ this -> theadChild [ ] = [ 'title' => $ params [ 'title' ] , 'class' => isset ( $ params [ 'className' ] ) ? $ params [ 'className' ] : null , 'colspan' => 1 , ] ; $ this -> thead [ $ k ...
Add a new column header
45,495
protected function setTFoot ( & $ params ) { if ( isset ( $ params [ 'sFilter' ] ) ) { if ( isset ( $ params [ 'sFilter' ] [ 'type' ] ) && in_array ( $ params [ 'sFilter' ] [ 'type' ] , self :: $ columFilteringParams [ 'type' ] ) ) { $ params [ 'sFilter' ] = array_merge ( self :: $ columFilteringParams , $ params [ 'sF...
Manage the column tfoot Normalize sFilter params if exist
45,496
public function setColumn ( $ params , $ show = true ) { if ( $ show ) { $ this -> setTHead ( $ params ) ; $ this -> setTFoot ( $ params ) ; $ this -> columns [ ] = $ params ; } else { $ this -> unsetColumns [ ] = $ params ; } return $ this ; }
Add a column to the table
45,497
public function setColumns ( $ columns ) { foreach ( $ columns as $ c ) { $ this -> setColumn ( $ c , isset ( $ c [ 'show' ] ) ? $ c [ 'show' ] : true ) ; } return $ this ; }
Add columns to the table
45,498
public function getJavascript ( ) { if ( ! empty ( $ this -> columns ) ) { $ this -> setJsInitParam ( 'columns' , $ this -> getColumnsForJs ( ) ) ; } $ js = 'var ' . $ this -> tableName . ' = $("#' . $ this -> tableName . '").dataTable(' . "\n" . ( ! empty ( $ this -> jsInitParameters ) ? PHPToJS :: render ( ( object )...
Return javascript string to activate table
45,499
protected function getJavascriptSearchPart ( ) { if ( ! $ this -> individualColumnFiltering ) { return '' ; } $ js = 'var ' . $ this -> tableName . 'Api = ' . $ this -> tableName . '.api(true);' . "\n" . '$("#' . $ this -> tableName . ' tfoot th").each( function(colI) {' . "\n" . '$(".sSearch", this).on("keyup change",...
Generate the javascript relative to the individual column filtering