idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
226,300
public function search ( & $ total = null ) { $ expr = array_merge ( $ this -> conditions , [ $ this -> filter -> compare ( '==' , 'attribute.domain' , $ this -> domain ) ] ) ; $ this -> filter -> setConditions ( $ this -> filter -> combine ( '&&' , $ expr ) ) ; return $ this -> manager -> searchItems ( $ this -> filte...
Returns the attributes filtered by the previously assigned conditions
226,301
public function getIterator ( ) { $ array = $ this -> getArrayCopy ( ) ; if ( isset ( $ this -> collectionProperty ) ) { $ collectionFound = false ; $ property = NULL ; foreach ( ( array ) $ this -> collectionProperty as $ property ) { if ( isset ( $ array [ $ property ] ) ) { $ collectionFound = true ; break ; } } if ...
Keys the array of objects by their identifier constructs and returns and array object .
226,302
public function add ( array $ values ) { $ this -> baskets [ $ this -> type ] = $ this -> get ( ) -> fromArray ( $ values ) ; return $ this ; }
Adds values like comments to the basket
226,303
public function get ( ) { if ( ! isset ( $ this -> baskets [ $ this -> type ] ) ) { $ this -> baskets [ $ this -> type ] = $ this -> manager -> getSession ( $ this -> type ) ; $ this -> checkLocale ( $ this -> baskets [ $ this -> type ] -> getLocale ( ) , $ this -> type ) ; } return $ this -> baskets [ $ this -> type ]...
Returns the basket object .
226,304
public function save ( ) { if ( isset ( $ this -> baskets [ $ this -> type ] ) && $ this -> baskets [ $ this -> type ] -> isModified ( ) ) { $ this -> manager -> setSession ( $ this -> baskets [ $ this -> type ] , $ this -> type ) ; } return $ this ; }
Explicitely persists the basket content
226,305
public function store ( ) { $ total = 0 ; $ context = $ this -> getContext ( ) ; $ config = $ context -> getConfig ( ) ; $ count = $ config -> get ( 'controller/frontend/basket/limit-count' , 5 ) ; $ seconds = $ config -> get ( 'controller/frontend/basket/limit-seconds' , 300 ) ; $ search = $ this -> manager -> createS...
Creates a new order base object from the current basket
226,306
public function dsn ( ) { if ( ! isset ( $ this [ 'name' ] ) ) { throw new \ OutOfBoundsException ( 'Malformed response: expecting "name" property' ) ; } if ( ! isset ( $ this [ 'host' ] ) ) { throw new \ OutOfBoundsException ( 'Malformed response: expecting "host" property' ) ; } if ( ! isset ( $ this [ 'port' ] ) ) {...
Returns the DSN for the active host .
226,307
public function getPath ( $ id ) { $ list = $ this -> manager -> getPath ( $ id , $ this -> domains ) ; if ( $ this -> root ) { foreach ( $ list as $ key => $ item ) { if ( $ key == $ this -> root ) { break ; } unset ( $ list [ $ key ] ) ; } } return $ list ; }
Returns the list of categories up to the root node including the node given by its ID
226,308
public function visible ( array $ catIds ) { if ( empty ( $ catIds ) ) { return $ this ; } $ config = $ this -> getContext ( ) -> getConfig ( ) ; $ expr = [ $ this -> filter -> compare ( '==' , 'catalog.parentid' , $ catIds ) , $ this -> filter -> compare ( '==' , 'catalog.id' , $ catIds ) ] ; if ( ( $ levels = $ confi...
Limits categories returned to only visible ones depending on the given category IDs
226,309
public static function parseFile ( $ filepath ) { if ( ! is_file ( $ filepath ) ) { throw new \ RuntimeException ( 'File not found: ' . $ filepath ) ; } if ( ! $ filedata = static :: readFiledata ( $ filepath ) ) { throw new \ RuntimeException ( 'Error reading file: ' . $ filepath ) ; } if ( ! $ json = self :: decode (...
Parses a file into a PHP array .
226,310
public function add ( $ view , RuleCollection $ collection ) { $ name = FormHelper :: getFormName ( $ view ) ; if ( isset ( $ this -> rules [ $ name ] ) ) { $ this -> rules [ $ name ] -> addCollection ( $ collection ) ; } else { $ this -> rules [ $ name ] = $ collection ; } }
Adds a rule collection .
226,311
public function save ( $ overwrite = false ) { foreach ( $ this as $ group => $ builder ) { $ this -> saveServiceGroup ( $ group , $ overwrite ) ; } }
Writes all service group configurations to the backend .
226,312
public function cancel ( $ id ) { $ item = $ this -> manager -> getItem ( $ id ) ; $ item = $ item -> setDateEnd ( $ item -> getDateNext ( ) ) -> setReason ( \ Aimeos \ MShop \ Subscription \ Item \ Iface :: REASON_CANCEL ) ; return $ this -> manager -> saveItem ( $ item ) ; }
Cancels an active subscription
226,313
public function get ( $ id ) { $ context = $ this -> getContext ( ) ; $ filter = $ this -> manager -> createSearch ( true ) ; $ expr = [ $ filter -> compare ( '==' , 'subscription.id' , $ id ) , $ filter -> compare ( '==' , 'order.base.customerid' , $ context -> getUserId ( ) ) , $ filter -> getConditions ( ) , ] ; $ f...
Returns the subscription item for the given ID
226,314
public function getIntervals ( ) { $ manager = \ Aimeos \ MShop :: create ( $ this -> getContext ( ) , 'attribute' ) ; $ search = $ manager -> createSearch ( true ) ; $ expr = array ( $ search -> compare ( '==' , 'attribute.domain' , 'product' ) , $ search -> compare ( '==' , 'attribute.type' , 'interval' ) , $ search ...
Returns the available interval attribute items
226,315
public function getProvider ( $ serviceId ) { $ item = $ this -> manager -> getItem ( $ serviceId , $ this -> domains , true ) ; return $ this -> manager -> getProvider ( $ item , $ item -> getType ( ) ) ; }
Returns the service item for the given ID
226,316
public function getProviders ( ) { $ list = [ ] ; $ this -> filter -> setConditions ( $ this -> filter -> combine ( '&&' , $ this -> conditions ) ) ; foreach ( $ this -> manager -> searchItems ( $ this -> filter , $ this -> domains ) as $ id => $ item ) { $ list [ $ id ] = $ this -> manager -> getProvider ( $ item , $ ...
Returns the service providers of the given type
226,317
protected function read ( ) { $ contents = $ this -> filesystem ( ) -> get ( $ this -> path ) ; $ data = json_decode ( $ contents , true ) ; if ( is_null ( $ data ) ) { throw new RuntimeException ( "Invalid JSON file in [{$this->path}]" ) ; } return ( array ) $ data ; }
Read the data from the store .
226,318
public static function create ( \ Aimeos \ MShop \ Context \ Item \ Iface $ context , $ path ) { if ( empty ( $ path ) ) { throw new \ Aimeos \ Controller \ Frontend \ Exception ( sprintf ( 'Controller path is empty' ) ) ; } if ( self :: $ cache === false || ! isset ( self :: $ objects [ $ path ] ) ) { if ( ctype_alnum...
Creates the required controller specified by the given path of controller names
226,319
public static function inject ( $ path , \ Aimeos \ Controller \ Frontend \ Iface $ object = null ) { self :: $ objects [ $ path ] = $ object ; }
Injects a manager object for the given path of manager names
226,320
public function parseLines ( array $ lines , string $ vcsType = '' ) : Changeset { $ parser = $ this -> getParser ( $ vcsType ) ; return $ parser -> parse ( $ lines ) ; }
Accepts an array of diff lines & returns a Changeset instance .
226,321
public function parseFile ( string $ filename , string $ vcsType = '' ) : Changeset { $ parser = $ this -> getParser ( $ vcsType ) ; if ( ! file_exists ( $ filename ) ) { throw new \ RuntimeException ( 'File "' . $ filename . '" not found.' ) ; } return $ parser -> parse ( file ( $ filename , FILE_IGNORE_NEW_LINES ) ) ...
Accepts an filename for a diff & returns a Changeset instance .
226,322
private function getNormalizer ( string $ vcsType ) : DiffNormalizerInterface { $ normalizer = new GitDiffNormalizer ( ) ; if ( self :: VCS_SVN === $ vcsType ) { $ normalizer = new SvnDiffNormalizer ( ) ; } return $ normalizer ; }
Returns an appropriate normalizer for the VCS type .
226,323
public function getFilename ( string $ fileStartLine ) : string { if ( ! preg_match ( static :: FILENAME_REGEX , $ fileStartLine , $ matches ) ) { return substr ( $ fileStartLine , 4 ) ; } return $ matches [ 'filename' ] ; }
Accepts a raw file start line from a unified diff & returns a normalized version of the filename .
226,324
public function tokenize ( array $ diffLineList ) { $ tokenList = [ ] ; $ hasStarted = false ; $ lineCount = count ( $ diffLineList ) ; for ( $ i = 0 ; $ i < $ lineCount ; $ i ++ ) { if ( $ this -> isFileStart ( $ diffLineList , $ i ) ) { $ hasStarted = true ; $ tokenList = array_merge ( $ tokenList , $ this -> getFile...
Tokenize a unified diff
226,325
private function getHunkTokens ( array $ diffLineList , int & $ currentLine ) : array { $ tokenList = [ ] ; $ hunkTokens = $ this -> getHunkStartTokens ( $ diffLineList [ $ currentLine ] ) ; if ( $ this -> isHunkStart ( $ hunkTokens ) ) { $ currentLine ++ ; [ $ originalLineCount , $ newLineCount ] = $ this -> getHunkLi...
Process a hunk .
226,326
private function isFileStart ( array $ diffLineList , int $ currentLine ) : bool { return $ currentLine + 1 < count ( $ diffLineList ) && '---' === substr ( $ diffLineList [ $ currentLine ] , 0 , 3 ) && '+++' === substr ( $ diffLineList [ $ currentLine + 1 ] , 0 , 3 ) ; }
Returns true if the current line is the beginning of a file section .
226,327
private function getHunkStartTokens ( string $ diffLine ) : array { $ tokenList = [ ] ; if ( preg_match ( self :: HUNK_START_REGEX , $ diffLine , $ matches ) ) { if ( $ this -> hasToken ( $ matches , Token :: FILE_DELETION_LINE_COUNT ) ) { $ tokenList = [ new Token ( Token :: FILE_DELETION_LINE_COUNT , $ matches [ Toke...
Parses the hunk start into appropriate tokens .
226,328
private function getFilenameTokens ( array $ diffLineList , int $ currentLine ) : array { $ filenameTokens = [ ] ; $ hunkTokens = $ this -> getHunkStartTokens ( $ diffLineList [ $ currentLine + 2 ] ) ; if ( count ( $ hunkTokens ) ) { if ( 4 == count ( $ hunkTokens ) ) { $ originalFilename = $ this -> diffNormalizer -> ...
Get tokens for original & new filenames .
226,329
private function getHunkLineToken ( int & $ addedCount , int & $ removedCount , int & $ unchangedCount , string $ diffLine ) : Token { if ( '+' === substr ( $ diffLine , 0 , 1 ) ) { $ tokenType = Token :: SOURCE_LINE_ADDED ; $ addedCount ++ ; } elseif ( '-' === substr ( $ diffLine , 0 , 1 ) ) { $ tokenType = Token :: S...
Get a single line for a hunk .
226,330
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 .
226,331
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 .
226,332
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 .
226,333
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 .
226,334
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 .
226,335
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 .
226,336
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 .
226,337
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 .
226,338
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 .
226,339
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 .
226,340
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 .
226,341
public function applyEventDeleted ( EventDeleted $ eventDeleted ) { $ this -> repository -> deleteIndex ( $ eventDeleted -> getItemId ( ) , EntityType :: EVENT ( ) ) ; }
Remove the index for events
226,342
public function applyPlaceDeleted ( PlaceDeleted $ placeDeleted ) { $ this -> repository -> deleteIndex ( $ placeDeleted -> getItemId ( ) , EntityType :: PLACE ( ) ) ; }
Remove the index for places
226,343
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 .
226,344
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 .
226,345
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 .
226,346
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 .
226,347
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 .
226,348
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 .
226,349
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 .
226,350
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 .
226,351
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 .
226,352
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 .
226,353
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 .
226,354
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 .
226,355
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 .
226,356
protected function applyOrganizerUpdated ( OrganizerUpdated $ organizerUpdated ) { $ this -> repository -> storeOrganizer ( $ organizerUpdated -> getItemId ( ) , $ organizerUpdated -> getOrganizerId ( ) ) ; }
Store the relation when the organizer was changed
226,357
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 .
226,358
public function rename ( UUID $ uuid , StringLiteral $ name ) { $ this -> apply ( new RoleRenamed ( $ uuid , $ name ) ) ; }
Rename the role .
226,359
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 .
226,360
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 .
226,361
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 .
226,362
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 .
226,363
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 .
226,364
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 .
226,365
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 .
226,366
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 .
226,367
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 .
226,368
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 .
226,369
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 .
226,370
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 .
226,371
protected function applyPlaceImportedFromUDB2 ( PlaceImportedFromUDB2 $ place ) { $ placeId = $ place -> getActorId ( ) ; $ this -> storeRelations ( $ placeId , null ) ; }
Store the relation for places imported from UDB2 .
226,372
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 .
226,373
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 .
226,374
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 .
226,375
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 .
226,376
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 .
226,377
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 .
226,378
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 .
226,379
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 .
226,380
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 .
226,381
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 .
226,382
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 .
226,383
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 .
226,384
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 .
226,385
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 .
226,386
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 .
226,387
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 .
226,388
public function deleteOrganizer ( $ organizerId ) { if ( $ this -> organizerId === $ organizerId ) { $ this -> apply ( $ this -> createOrganizerDeletedEvent ( $ organizerId ) ) ; } }
Delete the given organizer .
226,389
public function deleteCurrentOrganizer ( ) { if ( ! is_null ( $ this -> organizerId ) ) { $ this -> apply ( $ this -> createOrganizerDeletedEvent ( $ this -> organizerId ) ) ; } }
Delete the current organizer regardless of the id .
226,390
public function updateContactPoint ( ContactPoint $ contactPoint ) { if ( is_null ( $ this -> contactPoint ) || ! $ this -> contactPoint -> sameAs ( $ contactPoint ) ) { $ this -> apply ( $ this -> createContactPointUpdatedEvent ( $ contactPoint ) ) ; } }
Updated the contact info .
226,391
public function updateBookingInfo ( BookingInfo $ bookingInfo ) { if ( is_null ( $ this -> bookingInfo ) || ! $ this -> bookingInfo -> sameAs ( $ bookingInfo ) ) { $ this -> apply ( $ this -> createBookingInfoUpdatedEvent ( $ bookingInfo ) ) ; } }
Updated the booking info .
226,392
public function addImage ( Image $ image ) { $ existingImage = $ this -> images -> findImageByUUID ( $ image -> getMediaObjectId ( ) ) ; if ( $ existingImage === null ) { $ this -> apply ( $ this -> createImageAddedEvent ( $ image ) ) ; } }
Add a new image .
226,393
public function removeImage ( Image $ image ) { $ existingImage = $ this -> images -> findImageByUUID ( $ image -> getMediaObjectId ( ) ) ; if ( $ existingImage ) { $ this -> apply ( $ this -> createImageRemovedEvent ( $ existingImage ) ) ; } }
Remove an image .
226,394
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 .
226,395
public function publish ( \ DateTimeInterface $ publicationDate ) { $ this -> guardPublish ( ) ? : $ this -> apply ( $ this -> createPublishedEvent ( $ publicationDate ) ) ; }
Publish the offer when it has workflowstatus draft .
226,396
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 .
226,397
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 .
226,398
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 .
226,399
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 .