idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
24,800
public function byParent ( $ id , $ databaseConnectionName = null ) { if ( empty ( $ databaseConnectionName ) ) { $ databaseConnectionName = $ this -> databaseConnectionName ; } return $ this -> Account -> setConnection ( $ databaseConnectionName ) -> where ( 'parent_account_id' , '=' , $ id ) -> orderBy ( 'key' , 'asc' ) -> get ( ) ; }
Retrieve accounts by parent
24,801
public function beforePayeeBankgiro ( Node $ node ) : void { if ( ! $ this -> payeeBg ) { $ this -> payeeBg = ( string ) $ node -> getValueFrom ( 'Number' ) ; } if ( $ node -> getValueFrom ( 'Number' ) != $ this -> payeeBg ) { $ this -> getErrorObject ( ) -> addError ( "Non-matching payee bankgiro numbers (expecting: %s, found: %s) on line %s" , $ this -> payeeBg , ( string ) $ node -> getValueFrom ( 'Number' ) , ( string ) $ node -> getLineNr ( ) ) ; } }
Validate payee bankgiro number
24,802
public function beforePayeeBgcNumber ( Node $ node ) : void { if ( ! $ this -> payeeBgcNr ) { $ this -> payeeBgcNr = ( string ) $ node -> getValue ( ) ; } if ( $ node -> getValue ( ) != $ this -> payeeBgcNr ) { $ this -> getErrorObject ( ) -> addError ( "Non-matching payee BGC customer numbers (expecting: %s, found: %s) on line %s" , $ this -> payeeBgcNr , ( string ) $ node -> getValue ( ) , ( string ) $ node -> getLineNr ( ) ) ; } }
Validate payee BGC customer number
24,803
public static function all ( array $ arg_params ) { $ data = self :: getParams ( $ arg_params ) ; $ url = '/ecommerce/transactions' ; $ filters = '' ; if ( ! empty ( $ data [ 'page' ] ) && ctype_digit ( $ data [ 'page' ] ) ) { $ filters .= 'page=' . $ data [ 'page' ] ; } if ( ! empty ( $ filters ) ) $ filters = '?' . $ filters ; $ transactions_data = APIRequests :: request ( $ url . $ filters , APIRequests :: METHOD_GET ) ; return self :: toListObj ( $ transactions_data [ 'body' ] ) ; }
Get Transactions Data
24,804
private static function httpDigestParse ( $ txt ) { $ needed_parts = array ( 'nonce' => 1 , 'nc' => 1 , 'cnonce' => 1 , 'qop' => 1 , 'username' => 1 , 'uri' => 1 , 'response' => 1 ) ; $ data = array ( ) ; $ keys = implode ( '|' , array_keys ( $ needed_parts ) ) ; preg_match_all ( '@(' . $ keys . ')=(?:([\'"])([^\2]+?)\2|([^\s,]+))@' , $ txt , $ matches , PREG_SET_ORDER ) ; foreach ( $ matches as $ m ) { $ data [ $ m [ 1 ] ] = $ m [ 3 ] ? $ m [ 3 ] : $ m [ 4 ] ; unset ( $ needed_parts [ $ m [ 1 ] ] ) ; } return $ needed_parts ? false : $ data ; }
function to parse the http auth header
24,805
public function setOption ( $ name , $ value ) { $ this -> jsWriter -> setSeriesOption ( $ this -> getTitle ( ) , $ name , $ value ) ; return $ this ; }
Sets an option for this specific series within the JsWriter
24,806
public function setLineWidth ( $ val ) { if ( $ this -> jsWriter instanceof \ Altamira \ JsWriter \ Ability \ Lineable ) { $ this -> jsWriter -> setSeriesLineWidth ( $ this -> getTitle ( ) , $ val ) ; } return $ this ; }
Sets the line width for the series
24,807
public function Field ( $ properties = array ( ) ) { $ context = $ this ; $ properties [ 'Editable' ] = $ this -> editable ; $ properties [ 'Reservation' ] = $ this -> getReservation ( ) ; $ properties [ 'Attendees' ] = $ this -> editable ? $ this -> getEditableAttendees ( ) : $ this -> getReservation ( ) -> Attendees ( ) ; if ( count ( $ properties ) ) { $ context = $ context -> customise ( $ properties ) ; } $ this -> extend ( 'onBeforeRender' , $ context ) ; $ result = $ context -> renderWith ( $ this -> getTemplates ( ) ) ; if ( is_string ( $ result ) ) { $ result = trim ( $ result ) ; } else { if ( $ result instanceof DBField ) { $ result -> setValue ( trim ( $ result -> getValue ( ) ) ) ; } } return $ result ; }
Get the field customized with tickets and reservation
24,808
public function create ( array $ options = array ( ) ) { $ reflClass = $ this -> getReflectionClass ( $ options ) ; $ options = array_merge ( array ( 'orientation' => 'P' , 'unit' => 'mm' , 'format' => 'USLETTER' , 'unicode' => true , 'encoding' => 'UTF-8' , 'diskcache' => true , 'pdfa' => false , 'printHeader' => false , 'printFooter' => false , 'margins' => array ( 15 , 27 , 15 ) , 'autoPageBreak' => array ( true , 25 ) , ) , $ options ) ; $ pdf = $ reflClass -> newInstanceArgs ( $ this -> getConstructorOptions ( $ options ) ) ; foreach ( $ options as $ option => $ arguments ) { if ( is_callable ( array ( $ pdf , 'set' . $ option ) ) ) { if ( ! is_array ( $ arguments ) ) { if ( null === $ arguments ) { $ arguments = array ( ) ; } else { $ arguments = array ( $ arguments ) ; } } call_user_func_array ( array ( $ pdf , 'set' . $ option ) , $ arguments ) ; } } return new TcPdf ( $ pdf ) ; }
Create a new TcPdf
24,809
protected function getConstructorOptions ( array & $ options ) { $ ctorOptions = array ( 'orientation' => isset ( $ options [ 'orientation' ] ) ? $ options [ 'orientation' ] : 'P' , 'unit' => isset ( $ options [ 'unit' ] ) ? $ options [ 'unit' ] : 'mm' , 'format' => isset ( $ options [ 'format' ] ) ? $ options [ 'format' ] : 'A4' , 'unicode' => isset ( $ options [ 'unicode' ] ) ? $ options [ 'unicode' ] : true , 'encoding' => isset ( $ options [ 'encoding' ] ) ? $ options [ 'encoding' ] : 'UTF-8' , 'diskcache' => isset ( $ options [ 'diskcache' ] ) ? $ options [ 'diskcache' ] : true , 'pdfa' => isset ( $ options [ 'pdfa' ] ) ? $ options [ 'pdfa' ] : false ) ; unset ( $ options [ 'orientation' ] , $ options [ 'unit' ] , $ options [ 'format' ] , $ options [ 'unicode' ] , $ options [ 'encoding' ] , $ options [ 'diskcache' ] , $ options [ 'pdfa' ] ) ; return array_values ( $ ctorOptions ) ; }
Returns an array of constructor arguments
24,810
public static function start ( CalendarEvent $ event ) { $ reservation = Reservation :: create ( ) ; $ reservation -> EventID = $ event -> ID ; $ reservation -> write ( ) ; self :: set ( $ reservation ) ; return $ reservation ; }
Start the ticket session
24,811
public static function end ( ) { if ( in_array ( self :: get ( ) -> Status , array ( 'CART' , 'PENDING' ) ) ) { self :: get ( ) -> delete ( ) ; } Session :: set ( self :: KEY , null ) ; Session :: clear ( self :: KEY ) ; }
End the Ticket session
24,812
public function setPlayer ( Player $ v = null ) { if ( $ v === null ) { $ this -> setPlayerId ( NULL ) ; } else { $ this -> setPlayerId ( $ v -> getId ( ) ) ; } $ this -> aPlayer = $ v ; if ( $ v !== null ) { $ v -> addRecord ( $ this ) ; } return $ this ; }
Declares an association between this object and a Player object .
24,813
public function getPlayer ( ConnectionInterface $ con = null ) { if ( $ this -> aPlayer === null && ( $ this -> player_id !== null ) ) { $ this -> aPlayer = PlayerQuery :: create ( ) -> findPk ( $ this -> player_id , $ con ) ; } return $ this -> aPlayer ; }
Get the associated Player object
24,814
public function createDefaultFields ( ) { $ fields = Attendee :: config ( ) -> get ( 'default_fields' ) ; if ( ! $ this -> owner -> Fields ( ) -> exists ( ) ) { foreach ( $ fields as $ fieldName => $ config ) { $ field = UserField :: createDefaultField ( $ fieldName , $ config ) ; $ this -> owner -> Fields ( ) -> add ( $ field ) ; } } }
Creates and sets up the default fields
24,815
public function updateCMSActions ( FieldList $ actions ) { $ checkInButton = new LiteralField ( 'StartCheckIn' , "<a class='action ss-ui-button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only' id='Edit_StartCheckIn' role='button' href='{$this->owner->Link('checkin')}' target='_blank'> Start check in </a>" ) ; if ( $ this -> owner -> Attendees ( ) -> exists ( ) ) { $ actions -> push ( $ checkInButton ) ; } }
Extend the page actions with an start check in action
24,816
public function getTicketSaleStartDate ( ) { $ saleStart = null ; if ( ( $ tickets = $ this -> owner -> Tickets ( ) ) ) { foreach ( $ tickets as $ ticket ) { if ( ( $ date = $ ticket -> getAvailableFrom ( ) ) && strtotime ( $ date ) < strtotime ( $ saleStart ) || $ saleStart === null ) { $ saleStart = $ date ; } } } return $ saleStart ; }
get The sale start date
24,817
public function getEventExpired ( ) { $ expired = false ; if ( ( $ tickets = $ this -> owner -> Tickets ( ) ) && $ expired = $ tickets -> exists ( ) ) { foreach ( $ tickets as $ ticket ) { $ expired = ( ! $ ticket -> validateDate ( ) && $ expired ) ; } } return $ expired ; }
Check if the event is expired either by unavailable tickets or because the date has passed
24,818
public function getGuestList ( ) { $ reservationClass = Reservation :: singleton ( ) -> getClassName ( ) ; $ attendeeClass = Attendee :: singleton ( ) -> getClassName ( ) ; return Attendee :: get ( ) -> leftJoin ( $ reservationClass , "`$attendeeClass`.`ReservationID` = `$reservationClass`.`ID`" ) -> filter ( array ( 'EventID' => $ this -> owner -> ID ) ) -> filterAny ( array ( 'ReservationID' => 0 , 'Status' => Reservation :: STATUS_PAID ) ) ; }
Get only the attendees who are certain to attend Also includes attendees without any reservation these are manually added
24,819
public function getSuccessContent ( ) { if ( ! empty ( $ this -> owner -> SuccessMessage ) ) { return $ this -> owner -> dbObject ( 'SuccessMessage' ) ; } else { return SiteConfig :: current_site_config ( ) -> dbObject ( 'SuccessMessage' ) ; } }
Get the success message
24,820
public function getMailContent ( ) { if ( ! empty ( $ this -> owner -> SuccessMessageMail ) ) { return $ this -> owner -> dbObject ( 'SuccessMessageMail' ) ; } else { return SiteConfig :: current_site_config ( ) -> dbObject ( 'SuccessMessageMail' ) ; } }
Get the mail message
24,821
public function canCreateTickets ( ) { $ currentDate = $ this -> owner -> getController ( ) -> CurrentDate ( ) ; if ( $ currentDate && $ currentDate -> exists ( ) ) { return $ currentDate -> dbObject ( 'StartDate' ) -> InFuture ( ) ; } return false ; }
Check if the current event can have tickets
24,822
public function getController ( ) { return $ this -> controller ? $ this -> controller : $ this -> controller = CalendarEvent_Controller :: create ( $ this -> owner ) ; }
Get the calendar controller
24,823
public static function getDataCacheKey ( $ data , Context $ context ) { $ group = $ context -> hasAttribute ( 'groups' ) ? $ context -> getAttribute ( 'groups' ) : '*' ; $ version = $ context -> hasAttribute ( 'version' ) ? $ context -> getAttribute ( 'version' ) : '*' ; $ dataArray = [ 'data' => $ data , 'serializationFormat' => $ context -> getFormat ( ) , 'serializationGroups' => $ group , 'serializationVersion' => $ version , ] ; try { return \ sha1 ( \ serialize ( $ dataArray ) ) ; } catch ( \ Exception $ e ) { return ; } }
Returns the caching key of the given data or null if it can not be cached .
24,824
public function filterByFilename ( $ filename = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ filename ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MapTableMap :: COL_FILENAME , $ filename , $ comparison ) ; }
Filter the query on the fileName column
24,825
public function filterByEnvironment ( $ environment = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ environment ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MapTableMap :: COL_ENVIRONMENT , $ environment , $ comparison ) ; }
Filter the query on the environment column
24,826
public function filterByMood ( $ mood = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ mood ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MapTableMap :: COL_MOOD , $ mood , $ comparison ) ; }
Filter the query on the mood column
24,827
public function filterByBronzetime ( $ bronzetime = null , $ comparison = null ) { if ( is_array ( $ bronzetime ) ) { $ useMinMax = false ; if ( isset ( $ bronzetime [ 'min' ] ) ) { $ this -> addUsingAlias ( MapTableMap :: COL_BRONZETIME , $ bronzetime [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ bronzetime [ 'max' ] ) ) { $ this -> addUsingAlias ( MapTableMap :: COL_BRONZETIME , $ bronzetime [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MapTableMap :: COL_BRONZETIME , $ bronzetime , $ comparison ) ; }
Filter the query on the bronzeTime column
24,828
public function filterBySilvertime ( $ silvertime = null , $ comparison = null ) { if ( is_array ( $ silvertime ) ) { $ useMinMax = false ; if ( isset ( $ silvertime [ 'min' ] ) ) { $ this -> addUsingAlias ( MapTableMap :: COL_SILVERTIME , $ silvertime [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ silvertime [ 'max' ] ) ) { $ this -> addUsingAlias ( MapTableMap :: COL_SILVERTIME , $ silvertime [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MapTableMap :: COL_SILVERTIME , $ silvertime , $ comparison ) ; }
Filter the query on the silverTime column
24,829
public function filterByGoldtime ( $ goldtime = null , $ comparison = null ) { if ( is_array ( $ goldtime ) ) { $ useMinMax = false ; if ( isset ( $ goldtime [ 'min' ] ) ) { $ this -> addUsingAlias ( MapTableMap :: COL_GOLDTIME , $ goldtime [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ goldtime [ 'max' ] ) ) { $ this -> addUsingAlias ( MapTableMap :: COL_GOLDTIME , $ goldtime [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MapTableMap :: COL_GOLDTIME , $ goldtime , $ comparison ) ; }
Filter the query on the goldTime column
24,830
public function filterByAuthortime ( $ authortime = null , $ comparison = null ) { if ( is_array ( $ authortime ) ) { $ useMinMax = false ; if ( isset ( $ authortime [ 'min' ] ) ) { $ this -> addUsingAlias ( MapTableMap :: COL_AUTHORTIME , $ authortime [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ authortime [ 'max' ] ) ) { $ this -> addUsingAlias ( MapTableMap :: COL_AUTHORTIME , $ authortime [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MapTableMap :: COL_AUTHORTIME , $ authortime , $ comparison ) ; }
Filter the query on the authorTime column
24,831
public function filterByCopperprice ( $ copperprice = null , $ comparison = null ) { if ( is_array ( $ copperprice ) ) { $ useMinMax = false ; if ( isset ( $ copperprice [ 'min' ] ) ) { $ this -> addUsingAlias ( MapTableMap :: COL_COPPERPRICE , $ copperprice [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ copperprice [ 'max' ] ) ) { $ this -> addUsingAlias ( MapTableMap :: COL_COPPERPRICE , $ copperprice [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MapTableMap :: COL_COPPERPRICE , $ copperprice , $ comparison ) ; }
Filter the query on the copperPrice column
24,832
public function filterByLaprace ( $ laprace = null , $ comparison = null ) { if ( is_string ( $ laprace ) ) { $ laprace = in_array ( strtolower ( $ laprace ) , array ( 'false' , 'off' , '-' , 'no' , 'n' , '0' , '' ) ) ? false : true ; } return $ this -> addUsingAlias ( MapTableMap :: COL_LAPRACE , $ laprace , $ comparison ) ; }
Filter the query on the lapRace column
24,833
public function filterByNblaps ( $ nblaps = null , $ comparison = null ) { if ( is_array ( $ nblaps ) ) { $ useMinMax = false ; if ( isset ( $ nblaps [ 'min' ] ) ) { $ this -> addUsingAlias ( MapTableMap :: COL_NBLAPS , $ nblaps [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ nblaps [ 'max' ] ) ) { $ this -> addUsingAlias ( MapTableMap :: COL_NBLAPS , $ nblaps [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MapTableMap :: COL_NBLAPS , $ nblaps , $ comparison ) ; }
Filter the query on the nbLaps column
24,834
public function filterByNpcheckpoints ( $ npcheckpoints = null , $ comparison = null ) { if ( is_array ( $ npcheckpoints ) ) { $ useMinMax = false ; if ( isset ( $ npcheckpoints [ 'min' ] ) ) { $ this -> addUsingAlias ( MapTableMap :: COL_NPCHECKPOINTS , $ npcheckpoints [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ npcheckpoints [ 'max' ] ) ) { $ this -> addUsingAlias ( MapTableMap :: COL_NPCHECKPOINTS , $ npcheckpoints [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MapTableMap :: COL_NPCHECKPOINTS , $ npcheckpoints , $ comparison ) ; }
Filter the query on the npCheckpoints column
24,835
public function filterByMapstyle ( $ mapstyle = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ mapstyle ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MapTableMap :: COL_MAPSTYLE , $ mapstyle , $ comparison ) ; }
Filter the query on the mapStyle column
24,836
public function filterByMxmap ( $ mxmap , $ comparison = null ) { if ( $ mxmap instanceof \ eXpansion \ Bundle \ Maps \ Model \ Mxmap ) { return $ this -> addUsingAlias ( MapTableMap :: COL_MAPUID , $ mxmap -> getTrackuid ( ) , $ comparison ) ; } elseif ( $ mxmap instanceof ObjectCollection ) { return $ this -> useMxmapQuery ( ) -> filterByPrimaryKeys ( $ mxmap -> getPrimaryKeys ( ) ) -> endUse ( ) ; } else { throw new PropelException ( 'filterByMxmap() only accepts arguments of type \eXpansion\Bundle\Maps\Model\Mxmap or Collection' ) ; } }
Filter the query by a related \ eXpansion \ Bundle \ Maps \ Model \ Mxmap object
24,837
public function useMxmapQuery ( $ relationAlias = null , $ joinType = Criteria :: INNER_JOIN ) { return $ this -> joinMxmap ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'Mxmap' , '\eXpansion\Bundle\Maps\Model\MxmapQuery' ) ; }
Use the Mxmap relation Mxmap object
24,838
protected function resolveHandlingMethod ( $ commandType ) { $ pos = strrpos ( $ commandType , '\\' ) ; if ( $ pos !== false ) { $ commandType = substr ( $ commandType , $ pos + 1 ) ; } if ( substr ( $ commandType , - 7 ) === 'Command' ) { $ commandType = substr ( $ commandType , 0 , - 7 ) ; } return lcfirst ( $ commandType ) ; }
Derives command handling method name from event type
24,839
public static function getLogger ( $ logName = 'default' ) { $ filename = new LogConfigFilenameProcessor ( 'log4php' ) ; if ( ! $ filename -> Exists ( ) ) throw new NotFoundException ( 'Log4php config file not found.' ) ; else \ Logger :: configure ( $ filename -> FullQualifiedNameAndPath ( ) ) ; return \ Logger :: getLogger ( $ logName ) ; }
You can use this method if you want specific customizations to the log . Otherwise you can instantiate this class and use the trace warn info etc methods
24,840
public function offsetGet ( $ offset ) { return isset ( $ this -> datumData [ $ offset ] ) ? $ this -> datumData [ $ offset ] : false ; }
Returns a value for the provided offset
24,841
public function create ( array $ data = array ( ) ) { if ( ! isset ( $ data [ "configPathPrefix" ] ) ) { $ data [ "configPathPrefix" ] = $ this -> configPathPrefix ; } return $ this -> _objectManager -> create ( $ this -> _instanceName , $ data ) ; }
Create class instance with specified parameters
24,842
public function getServerOs ( ) { if ( strtoupper ( substr ( PHP_OS , 0 , 3 ) ) === 'WIN' ) { return self :: OS_WINDOWS ; } else { if ( strtoupper ( substr ( PHP_OS , 0 , 3 ) ) === 'MAC' ) { return self :: OS_MAC ; } else { return self :: OS_LINUX ; } } }
Get Operating system .
24,843
public function SummaryForm ( ) { $ summary = new SummaryForm ( $ this , 'SummaryForm' , ReservationSession :: get ( ) ) ; $ summary -> setNextStep ( CheckoutSteps :: nextStep ( $ this -> step ) ) ; return $ summary ; }
Get the summary form
24,844
public function offsetExists ( $ offset ) { if ( ! is_int ( $ offset ) && ! is_string ( $ offset ) ) { throw new RuntimeException ( 'Invalid array offset type: ' . gettype ( $ offset ) ) ; } return array_key_exists ( $ offset , $ this -> items ) ; }
Tells whether or not an offset exists .
24,845
public function getItems ( array $ keys = [ ] ) { $ items = [ ] ; foreach ( $ keys as $ key ) { $ items [ ] = $ this -> offsetGet ( $ key ) ; } if ( empty ( $ keys ) ) { $ items = $ this -> items ; } return $ items ; }
Return a list of specific items from the collection for the given keys .
24,846
public function removeItem ( $ item ) { $ key = $ this -> getKey ( $ item ) ; if ( $ key !== false ) { $ this -> offsetUnset ( $ key ) ; } }
Remove the given item from the collection .
24,847
public function addListener ( ListenerInterface $ listener ) { if ( ! in_array ( $ listener , $ this -> collection_listeners , true ) ) { $ this -> collection_listeners [ ] = $ listener ; } }
Attaches the given listener so it will be informed about all future changes .
24,848
public function removeListener ( ListenerInterface $ listener ) { if ( false !== ( $ pos = array_search ( $ listener , $ this -> collection_listeners , true ) ) ) { array_splice ( $ this -> collection_listeners , $ pos , 1 ) ; } }
Removes the given listener from our list of collection - changed listeners .
24,849
public function toArray ( ) { $ data = [ ] ; foreach ( $ this -> items as $ key => $ value ) { if ( $ value instanceof BaseObjectInterface ) { $ value = $ value -> toArray ( ) ; } $ data [ $ key ] = $ value ; } return $ data ; }
Returns the collection s underlying array .
24,850
protected function propagateCollectionChangedEvent ( CollectionChangedEvent $ event ) { foreach ( $ this -> collection_listeners as $ listener ) { $ listener -> onCollectionChanged ( $ event ) ; } }
Propagate the given collection - changed event to all currently attached listeners .
24,851
protected function numToLetter ( $ num , $ uppercase = FALSE ) { $ num -= 1 ; $ letter = chr ( ( $ num % 26 ) + 97 ) ; $ letter .= ( floor ( $ num / 26 ) > 0 ) ? str_repeat ( $ letter , floor ( $ num / 26 ) ) : '' ; return ( $ uppercase ? strtoupper ( $ letter ) : $ letter ) ; }
Takes a number and converts it to a - z aa - zz aaa - zzz etc with uppercase option
24,852
protected function utf8ize ( $ mixed ) { if ( is_array ( $ mixed ) ) { foreach ( $ mixed as $ key => $ value ) { $ mixed [ $ key ] = self :: utf8ize ( $ value ) ; } } else if ( is_string ( $ mixed ) ) { return utf8_encode ( $ mixed ) ; } return $ mixed ; }
Clean the array passed in from UTF8 chars .
24,853
public function handle ( ) { $ accessToken = $ this -> getAccessToken ( ) ; $ state = $ this -> getVar ( "state" ) ; $ to = new $ this -> _className ( ) ; if ( $ accessToken == "" ) { $ code = $ this -> _context -> get ( "code" ) ; if ( $ code == "" ) { $ state = md5 ( uniqid ( rand ( ) , TRUE ) ) ; $ this -> setVar ( "state" , $ state ) ; $ params = array ( "client_id" => $ this -> _client_id , "redirect_uri" => $ this -> _redirect_uri , "state" => $ state , "scope" => $ this -> _scope ) ; if ( count ( $ this -> _extraArgs ) > 0 ) { $ params = array_merge ( $ params , $ this -> _extraArgs ) ; } $ req = new WebRequest ( $ to -> authorizationURL ( ) ) ; $ req -> redirect ( $ params , $ this -> _window_top ) ; } if ( $ this -> _context -> get ( "state" ) == $ this -> getVar ( "state" ) ) { $ params = array ( "client_id" => $ this -> _client_id , "redirect_uri" => $ this -> _redirect_uri , "client_secret" => $ this -> _client_secret , "code" => $ code , "grant_type" => "authorization_code" ) ; $ req = new WebRequest ( $ to -> accessTokenURL ( ) ) ; $ result = $ req -> post ( $ params ) ; $ accessToken = $ to -> decodeAccessToken ( $ result ) ; $ this -> setVar ( "access_token" , $ accessToken ) ; $ to -> setAccessToken ( $ accessToken ) ; $ this -> saveAccessToken ( ) ; if ( $ this -> _app_uri != "" ) { $ req = new WebRequest ( $ this -> _app_uri ) ; $ response = $ req -> redirect ( ) ; } } } else { $ to -> setAccessToken ( $ this -> getVar ( 'access_token' ) ) ; } return $ to ; }
Handle OAuth 2 . 0 Flow
24,854
public function registerPlugin ( $ pluginId , ChatCommandPluginInterface $ pluginService ) { $ commands = $ pluginService -> getChatCommands ( ) ; foreach ( $ commands as $ command ) { $ this -> addCommand ( $ pluginId , $ command -> getCommand ( ) , $ command ) ; foreach ( $ command -> getAliases ( ) as $ alias ) { $ this -> addCommand ( $ pluginId , $ alias , $ command ) ; } } }
Registers all chat commands of a plugin .
24,855
public function deletePlugin ( $ pluginId ) { if ( ! isset ( $ this -> commandPlugin [ $ pluginId ] ) ) { return ; } foreach ( $ this -> commandPlugin [ $ pluginId ] as $ cmdTxt => $ command ) { unset ( $ this -> commands [ $ cmdTxt ] ) ; } unset ( $ this -> commandPlugin [ $ pluginId ] ) ; }
Remove all chat commands registered for a plugin .
24,856
public function getChatCommands ( ) { $ chatCommands = [ ] ; foreach ( $ this -> commands as $ chatCommand => $ data ) { $ chatCommands [ $ data -> getCommand ( ) ] = clone $ data ; } return $ chatCommands ; }
Get list of all chat commands .
24,857
protected function findChatCommand ( $ cmdAndArgs , $ depth , $ orig = null ) { if ( $ depth == 0 ) { return [ null , [ ] ] ; } if ( $ orig == null ) { $ orig = $ cmdAndArgs ; } $ cmdAndArgs = array_splice ( $ cmdAndArgs , 0 , $ depth ) ; $ parameters = array_diff ( $ orig , $ cmdAndArgs ) ; $ command = implode ( ' ' , $ cmdAndArgs ) ; return isset ( $ this -> commands [ $ command ] ) ? [ $ this -> commands [ $ command ] , $ parameters ] : $ this -> findChatCommand ( $ cmdAndArgs , $ depth - 1 , $ orig ) ; }
Find a chat command .
24,858
protected function addCommand ( $ pluginId , $ cmdTxt , ChatCommandInterface $ command ) { if ( isset ( $ this -> commands [ $ cmdTxt ] ) ) { throw new CommandExistException ( "$pluginId tries to register command '$cmdTxt' already registered" ) ; } $ this -> commands [ $ cmdTxt ] = $ command ; $ this -> commandPlugin [ $ pluginId ] [ $ cmdTxt ] = $ command ; }
Register a command .
24,859
protected function _getOptionsForElem ( $ path = null ) { if ( empty ( $ path ) ) { return null ; } $ result = Hash :: get ( $ this -> _optionsForElem , $ path ) ; return $ result ; }
Return default options by path .
24,860
protected function displayMenu ( ) { foreach ( $ this -> adminGroups -> getUserGroups ( ) as $ userGroup ) { $ this -> menuGuiFactory -> create ( $ userGroup ) ; } }
Display a menu for each user group
24,861
public function getModelName ( Model $ model , $ toLowerCase = false ) { $ modelName = $ model -> name ; if ( $ toLowerCase ) { $ modelName = mb_strtolower ( $ modelName ) ; } return $ modelName ; }
Return name of model that uses this behavior .
24,862
public function getModelNamePlural ( Model $ model , $ toLowerCase = false ) { $ modelName = $ this -> getModelName ( $ model , $ toLowerCase ) ; return Inflector :: pluralize ( $ modelName ) ; }
Return plural name of model that uses this behavior .
24,863
public function getControllerName ( Model $ model ) { $ modelNamePlural = $ this -> getModelNamePlural ( $ model , false ) ; $ controllerName = mb_strtolower ( Inflector :: underscore ( $ modelNamePlural ) ) ; return $ controllerName ; }
Return controller name .
24,864
public function getGroupName ( Model $ model ) { $ modelNamePlural = $ this -> getModelNamePlural ( $ model ) ; $ groupNameCamel = Inflector :: humanize ( Inflector :: underscore ( $ modelNamePlural ) ) ; $ groupName = mb_ucfirst ( mb_strtolower ( $ groupNameCamel ) ) ; return $ groupName ; }
Return name of group data .
24,865
public function getName ( Model $ model , $ id = null ) { if ( empty ( $ id ) || empty ( $ model -> displayField ) ) { return false ; } if ( is_array ( $ id ) ) { if ( ! isset ( $ id [ $ model -> alias ] [ $ model -> displayField ] ) ) { return false ; } $ result = $ id [ $ model -> alias ] [ $ model -> displayField ] ; } else { $ model -> id = $ id ; $ result = $ model -> field ( $ model -> displayField ) ; } return $ result ; }
Return name of data .
24,866
public function getFullName ( Model $ model , $ id = null ) { $ name = $ this -> getName ( $ model , $ id ) ; if ( empty ( $ name ) ) { return false ; } $ modelName = $ this -> getModelName ( $ model ) ; $ result = $ modelName . ' \'' . $ name . '\'' ; return $ result ; }
Return full name of data .
24,867
public function createBreadcrumb ( Model $ model , $ id = null , $ link = null , $ escape = true ) { $ result = [ ] ; if ( empty ( $ id ) ) { $ name = $ model -> getGroupName ( ) ; } else { $ name = $ model -> getName ( $ id ) ; } if ( empty ( $ name ) ) { return $ result ; } if ( $ escape ) { $ name = h ( $ name ) ; } if ( $ link === false ) { $ link = null ; } else { if ( ! is_array ( $ link ) ) { $ link = [ ] ; } $ plugin = $ model -> getPluginName ( ) ; $ controller = $ model -> getControllerName ( ) ; if ( empty ( $ id ) ) { $ action = 'index' ; } else { $ action = $ model -> getActionName ( ) ; if ( empty ( $ link ) ) { $ link [ ] = $ id ; } } $ link += compact ( 'plugin' , 'controller' , 'action' ) ; } $ name = CakeText :: truncate ( $ name , CAKE_THEME_BREADCRUMBS_TEXT_LIMIT ) ; $ result = [ $ name , $ link ] ; return $ result ; }
Return an array of information for creating a breadcrumb .
24,868
public function getBreadcrumbInfo ( Model $ model , $ id = null , $ includeRoot = null ) { if ( ! empty ( $ id ) && ( $ includeRoot === null ) ) { $ includeRoot = true ; } $ result = [ ] ; $ root = [ ] ; if ( $ includeRoot ) { $ root = $ model -> getBreadcrumbInfo ( ) ; if ( empty ( $ root ) ) { return $ result ; } } $ info = $ model -> createBreadcrumb ( $ id ) ; if ( empty ( $ info ) ) { return $ result ; } if ( ! empty ( $ root ) ) { $ result = $ root ; } $ result [ ] = $ info ; return $ result ; }
Return an array of information for creating a breadcrumbs .
24,869
public final function detectFetchType ( $ fetchType ) : int { switch ( gettype ( $ fetchType ) ) { case 'NULL' : return ResultInterface :: AS_OBJECT ; case 'integer' : if ( in_array ( $ fetchType , [ ResultInterface :: AS_OBJECT , ResultInterface :: AS_ARRAY_ASC , ResultInterface :: AS_ARRAY_NUM , ResultInterface :: AS_ARRAY_ASCNUM ] ) ) { return $ fetchType ; } break ; case 'string' : if ( $ fetchType == 'array' ) return ResultInterface :: AS_ARRAY_ASC ; if ( $ fetchType == 'object' ) return ResultInterface :: AS_OBJECT ; $ fetchTypeConst = 'Oppa\Query\Result\ResultInterface::AS_' . strtoupper ( $ fetchType ) ; if ( defined ( $ fetchTypeConst ) ) { return constant ( $ fetchTypeConst ) ; } if ( class_exists ( $ fetchType ) ) { $ this -> setFetchObject ( $ fetchType ) ; return ResultInterface :: AS_OBJECT ; } break ; } throw new InvalidValueException ( "Given '{$fetchType}' fetch type is not implemented!" ) ; }
Detect fetch type .
24,870
public final function setFetchObject ( string $ fetchObject ) : void { if ( ! class_exists ( $ fetchObject ) ) { throw new InvalidValueException ( "Fetch object class '{$fetchObject}' not found!" ) ; } $ this -> fetchObject = $ fetchObject ; }
Set fetch object .
24,871
public final function setIds ( array $ ids ) : void { foreach ( $ ids as $ id ) { $ this -> ids [ ] = ( int ) $ id ; } }
Set ids .
24,872
public final function toObject ( ) : ? array { $ data = null ; if ( ! empty ( $ this -> data ) ) { if ( is_object ( $ this -> data [ 0 ] ) ) { return $ this -> data ; } $ data = $ this -> data ; foreach ( $ data as & $ dat ) { $ dat = ( object ) $ dat ; } } return $ data ; }
To object .
24,873
public final function toClass ( string $ class ) : ? array { $ data = null ; if ( ! empty ( $ this -> data ) ) { $ data = $ this -> data ; foreach ( $ data as & $ dat ) { $ datClass = new $ class ( ) ; foreach ( ( array ) $ dat as $ key => $ value ) { $ datClass -> { $ key } = $ value ; } $ dat = $ datClass ; } } return $ data ; }
To class .
24,874
public static function copyIfKeysExist ( array $ source , array & $ dest , array $ keyMap ) { $ callable = function ( array $ source , $ key ) { return array_key_exists ( $ key , $ source ) ; } ; self :: copyValueIf ( $ source , $ dest , $ keyMap , $ callable ) ; }
Sets destination array values to be the source values if the source key exist in the source array .
24,875
public static function copyIfSet ( array $ source , array & $ dest , array $ keyMap ) { $ callable = function ( array $ source , $ key ) { return isset ( $ source [ $ key ] ) ; } ; self :: copyValueIf ( $ source , $ dest , $ keyMap , $ callable ) ; }
Sets destination array values to be the source values if the source key is set in the source array .
24,876
public static function project ( array $ input , $ key , bool $ strictKeyCheck = true ) : array { $ projection = [ ] ; foreach ( $ input as $ itemKey => $ item ) { self :: ensureIsArray ( $ item , 'a value in $input was not an array' ) ; if ( array_key_exists ( $ key , $ item ) ) { $ projection [ $ itemKey ] = $ item [ $ key ] ; } elseif ( $ strictKeyCheck ) { throw new \ InvalidArgumentException ( 'key was not in one of the $input arrays' ) ; } } return $ projection ; }
Projects values of a key into an array .
24,877
public static function embedInto ( array $ items , string $ fieldName , array $ destination = [ ] , bool $ overwrite = false ) : array { foreach ( $ items as $ key => $ item ) { if ( ! array_key_exists ( $ key , $ destination ) ) { $ destination [ $ key ] = [ $ fieldName => $ item ] ; continue ; } self :: ensureIsArray ( $ destination [ $ key ] , 'a value in $destination was not an array' ) ; if ( ! $ overwrite && array_key_exists ( $ fieldName , $ destination [ $ key ] ) ) { throw new \ Exception ( '$fieldName key already exists in a $destination array' ) ; } $ destination [ $ key ] [ $ fieldName ] = $ item ; } return $ destination ; }
Takes each item and embeds it into the destination array returning the result .
24,878
public static function extract ( array $ input , $ keyIndex , $ valueIndex , string $ duplicateBehavior = 'takeLast' ) : array { if ( ! in_array ( $ duplicateBehavior , [ 'takeFirst' , 'takeLast' , 'throw' ] ) ) { throw new \ InvalidArgumentException ( "\$duplicateBehavior was not 'takeFirst', 'takeLast', or 'throw'" ) ; } self :: ensureValidKey ( $ keyIndex , '$keyIndex was not a string or integer' ) ; self :: ensureValidKey ( $ valueIndex , '$valueIndex was not a string or integer' ) ; $ result = [ ] ; foreach ( $ input as $ index => $ array ) { self :: ensureIsArray ( $ array , '$arrays was not a multi-dimensional array' ) ; $ key = self :: get ( $ array , $ keyIndex ) ; self :: ensureValidKey ( $ key , "Value for \$arrays[{$index}][{$keyIndex}] was not a string or integer" , '\\UnexpectedValueException' ) ; $ value = self :: get ( $ array , $ valueIndex ) ; if ( ! array_key_exists ( $ key , $ result ) ) { $ result [ $ key ] = $ value ; continue ; } if ( $ duplicateBehavior === 'throw' ) { throw new \ Exception ( "Duplicate entry for '{$key}' found." ) ; } if ( $ duplicateBehavior === 'takeLast' ) { $ result [ $ key ] = $ value ; } } return $ result ; }
Extracts an associative array from the given multi - dimensional array .
24,879
public static function changeKeyCase ( array $ input , int $ case = self :: CASE_LOWER ) : array { if ( $ case & self :: CASE_UNDERSCORE ) { $ input = self :: underscoreKeys ( $ input ) ; } if ( $ case & self :: CASE_CAMEL_CAPS ) { $ input = self :: camelCaseKeys ( $ input ) ; } if ( $ case & self :: CASE_UPPER ) { $ input = array_change_key_case ( $ input , \ CASE_UPPER ) ; } if ( $ case & self :: CASE_LOWER ) { $ input = array_change_key_case ( $ input , \ CASE_LOWER ) ; } return $ input ; }
Changes the case of all keys in an array . Numbered indices are left as is .
24,880
final public static function flatten ( array $ input , string $ delimiter = '.' ) : array { $ args = func_get_args ( ) ; $ prefix = count ( $ args ) === 3 ? array_pop ( $ args ) : '' ; $ result = [ ] ; foreach ( $ input as $ key => $ value ) { $ newKey = $ prefix . ( empty ( $ prefix ) ? '' : $ delimiter ) . $ key ; if ( is_array ( $ value ) ) { $ result = array_merge ( $ result , self :: flatten ( $ value , $ delimiter , $ newKey ) ) ; continue ; } $ result [ $ newKey ] = $ value ; } return $ result ; }
Converts a multi - dimensional array into a single associative array whose keys are the concatinated keys
24,881
public function restart ( callable $ callback = null ) { if ( $ this -> isRunning ( ) ) { throw new RuntimeException ( 'Process is already running' ) ; } $ process = clone $ this ; $ process -> start ( $ callback ) ; return $ process ; }
Restarts the process .
24,882
public function getExitCode ( ) { if ( ! $ this -> enhanceSigchildCompatibility && $ this -> isSigchildEnabled ( ) ) { throw new RuntimeException ( 'This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.' ) ; } $ this -> updateStatus ( false ) ; return $ this -> exitcode ; }
Returns the exit code returned by the process .
24,883
public function hasBeenSignaled ( ) { $ this -> requireProcessIsTerminated ( __FUNCTION__ ) ; if ( ! $ this -> enhanceSigchildCompatibility && $ this -> isSigchildEnabled ( ) ) { throw new RuntimeException ( 'This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.' ) ; } return $ this -> processInformation [ 'signaled' ] ; }
Returns true if the child process has been terminated by an uncaught signal .
24,884
public function addOutput ( $ line ) { $ this -> lastOutputTime = microtime ( true ) ; fseek ( $ this -> stdout , 0 , SEEK_END ) ; fwrite ( $ this -> stdout , $ line ) ; fseek ( $ this -> stdout , $ this -> incrementalOutputOffset ) ; }
Adds a line to the STDOUT stream .
24,885
public function addErrorOutput ( $ line ) { $ this -> lastOutputTime = microtime ( true ) ; fseek ( $ this -> stderr , 0 , SEEK_END ) ; fwrite ( $ this -> stderr , $ line ) ; fseek ( $ this -> stderr , $ this -> incrementalErrorOutputOffset ) ; }
Adds a line to the STDERR stream .
24,886
private function readPipesForOutput ( $ caller , $ blocking = false ) { if ( $ this -> outputDisabled ) { throw new LogicException ( 'Output has been disabled.' ) ; } $ this -> requireProcessIsStarted ( $ caller ) ; $ this -> updateStatus ( $ blocking ) ; }
Reads pipes for the freshest output .
24,887
public function getBetterButtonsActions ( ) { $ fields = parent :: getBetterButtonsActions ( ) ; if ( $ this -> TicketFile ( ) -> exists ( ) && ! empty ( $ this -> getEmail ( ) ) ) { $ fields -> push ( BetterButtonCustomAction :: create ( 'sendTicket' , _t ( 'Attendee.SEND' , 'Send the ticket' ) ) ) ; } if ( ! empty ( $ this -> getName ( ) ) && ! empty ( $ this -> getEmail ( ) ) ) { $ fields -> push ( BetterButtonCustomAction :: create ( 'createTicketFile' , _t ( 'Attendee.CREATE_TICKET' , 'Create the ticket' ) ) ) ; } return $ fields ; }
Add utility actions to the attendee details view
24,888
public function onBeforeWrite ( ) { $ this -> Title = $ this -> getName ( ) ; if ( $ this -> exists ( ) && empty ( $ this -> TicketCode ) ) { $ this -> TicketCode = $ this -> generateTicketCode ( ) ; } if ( $ this -> getEmail ( ) && $ this -> getName ( ) && ! $ this -> TicketFile ( ) -> exists ( ) && ! $ this -> TicketQRCode ( ) -> exists ( ) ) { $ this -> createQRCode ( ) ; $ this -> createTicketFile ( ) ; } if ( $ fields = $ this -> Fields ( ) ) { foreach ( $ fields as $ field ) { if ( $ value = $ this -> { "$field->Name[$field->ID]" } ) { $ fields -> add ( $ field -> ID , array ( 'Value' => $ value ) ) ; } } } parent :: onBeforeWrite ( ) ; }
Set the title and ticket code before writing
24,889
public function onBeforeDelete ( ) { if ( $ this -> TicketQRCode ( ) -> exists ( ) ) { $ this -> TicketQRCode ( ) -> delete ( ) ; } if ( $ this -> TicketFile ( ) -> exists ( ) ) { $ this -> TicketFile ( ) -> delete ( ) ; } if ( $ this -> Fields ( ) -> exists ( ) ) { $ this -> Fields ( ) -> removeAll ( ) ; } parent :: onBeforeDelete ( ) ; }
Delete any stray files before deleting the object
24,890
public function getName ( ) { $ mainContact = $ this -> Reservation ( ) -> MainContact ( ) ; if ( $ this -> getSurname ( ) ) { return trim ( "{$this->getFirstName()} {$this->getSurname()}" ) ; } elseif ( $ mainContact -> exists ( ) && $ mainContact -> getSurname ( ) ) { return _t ( 'Attendee.GUEST_OF' , 'Guest of {name}' , null , array ( 'name' => $ mainContact -> getName ( ) ) ) ; } else { return null ; } }
Get the combined first and last nave for display on the ticket and attendee list
24,891
public function getTableFields ( ) { $ fields = new ArrayList ( ) ; foreach ( self :: config ( ) -> get ( 'table_fields' ) as $ field ) { $ data = new ViewableData ( ) ; $ data -> Header = _t ( "Attendee.$field" , $ field ) ; $ data -> Value = $ this -> { $ field } ; $ fields -> add ( $ data ) ; } return $ fields ; }
Get the table fields for this attendee
24,892
public function createQRCode ( ) { $ folder = $ this -> fileFolder ( ) ; $ relativeFilePath = "/{$folder->Filename}{$this->TicketCode}.png" ; $ absoluteFilePath = Director :: baseFolder ( ) . $ relativeFilePath ; if ( ! $ image = Image :: get ( ) -> find ( 'Filename' , $ relativeFilePath ) ) { $ renderer = new BaconQrCode \ Renderer \ Image \ Png ( ) ; $ renderer -> setHeight ( 256 ) ; $ renderer -> setWidth ( 256 ) ; $ writer = new BaconQrCode \ Writer ( $ renderer ) ; if ( self :: config ( ) -> get ( 'qr_as_link' ) ) { $ writer -> writeFile ( $ this -> getCheckInLink ( ) , $ absoluteFilePath ) ; } else { $ writer -> writeFile ( $ this -> TicketCode , $ absoluteFilePath ) ; } $ image = Image :: create ( ) ; $ image -> ParentID = $ folder -> ID ; $ image -> OwnerID = ( Member :: currentUser ( ) ) ? Member :: currentUser ( ) -> ID : 0 ; $ image -> Title = $ this -> TicketCode ; $ image -> setFilename ( $ relativeFilePath ) ; $ image -> write ( ) ; $ this -> TicketQRCodeID = $ image -> ID ; $ this -> write ( ) ; } return $ image ; }
Create a QRCode for the attendee based on the Ticket code
24,893
public function createTicketFile ( ) { $ folder = $ this -> fileFolder ( ) ; $ relativeFilePath = "/{$folder->Filename}{$this->TicketCode}.pdf" ; $ absoluteFilePath = Director :: baseFolder ( ) . $ relativeFilePath ; if ( ! $ this -> TicketQRCode ( ) -> exists ( ) ) { $ this -> createQRCode ( ) ; } if ( ! $ file = File :: get ( ) -> find ( 'Filename' , $ relativeFilePath ) ) { $ file = File :: create ( ) ; $ file -> ParentID = $ folder -> ID ; $ file -> OwnerID = ( Member :: currentUser ( ) ) ? Member :: currentUser ( ) -> ID : 0 ; $ file -> Title = $ this -> TicketCode ; $ file -> setFilename ( $ relativeFilePath ) ; $ file -> write ( ) ; } $ template = new SSViewer ( 'PrintableTicket' ) ; $ html = $ template -> process ( $ this -> data ( ) ) ; $ domPDF = new Dompdf ( ) ; $ domPDF -> loadHtml ( $ html ) ; $ domPDF -> setPaper ( 'A4' ) ; $ domPDF -> getOptions ( ) -> setDpi ( 150 ) ; $ domPDF -> render ( ) ; file_put_contents ( $ absoluteFilePath , $ domPDF -> output ( ) ) ; $ this -> TicketFileID = $ file -> ID ; $ this -> write ( ) ; return $ file ; }
Creates a printable ticket for the attendee
24,894
public function sendTicket ( ) { if ( empty ( $ from = Reservation :: config ( ) -> get ( 'mail_sender' ) ) ) { $ from = Config :: inst ( ) -> get ( 'Email' , 'admin_email' ) ; } $ email = new Email ( ) ; $ email -> setSubject ( _t ( 'AttendeeMail.TITLE' , 'Your ticket for {event}' , null , array ( 'event' => $ this -> Event ( ) -> Title ) ) ) ; $ email -> setFrom ( $ from ) ; $ email -> setTo ( $ this -> getEmail ( ) ) ; $ email -> setTemplate ( 'AttendeeMail' ) ; $ email -> populateTemplate ( $ this ) ; $ this -> extend ( 'updateTicketMail' , $ email ) ; return $ email -> send ( ) ; }
Send the attendee ticket
24,895
public function get ( $ function ) { $ this -> toDispatch [ ] = $ function ; if ( is_null ( $ this -> dataProvider ) ) { $ this -> currentData = null ; $ this -> dispatchData ( ) ; return ; } if ( is_null ( $ this -> currentData ) ) { if ( ! $ this -> callMade ) { $ this -> callMade = true ; $ this -> dataProvider -> request ( ) ; } return ; } $ this -> dispatchData ( ) ; }
Get TM . Scores or SM . Scores .
24,896
protected function dispatchData ( ) { foreach ( $ this -> toDispatch as $ callback ) { $ callback ( $ this -> currentData ) ; } $ this -> toDispatch = [ ] ; $ this -> callMade = false ; }
Dispatch data .
24,897
public function removeAction ( Request $ request , $ userClass ) { $ form = $ this -> get ( 'form.factory' ) -> createNamedBuilder ( '' , RemoveType :: class , null , [ 'csrf_protection' => false , ] ) -> getForm ( ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { try { $ this -> get ( 'bengor_user.' . $ userClass . '.api_command_bus' ) -> handle ( $ form -> getData ( ) ) ; return new JsonResponse ( ) ; } catch ( UserDoesNotExistException $ exception ) { return new JsonResponse ( sprintf ( 'The "%s" user id does not exist' , $ form -> getData ( ) -> id ( ) ) , 400 ) ; } } return new JsonResponse ( FormErrorSerializer :: errors ( $ form ) , 400 ) ; }
Remove ser password action .
24,898
protected function run ( Process $ process , $ bypassErrors = false , $ listeners = null ) { if ( null !== $ listeners ) { if ( ! is_array ( $ listeners ) ) { $ listeners = array ( $ listeners ) ; } $ listenersManager = clone $ this -> listenersManager ; foreach ( $ listeners as $ listener ) { $ listenersManager -> register ( $ listener , $ this ) ; } } else { $ listenersManager = $ this -> listenersManager ; } return $ this -> processRunner -> run ( $ process , $ listenersManager -> storage , $ bypassErrors ) ; }
Executes a process logs events
24,899
public static function parseThrowableMessage ( $ ex ) { $ message = $ ex [ 'message' ] ; if ( $ ex [ 'isError' ] && strpos ( $ message , ' in ' ) !== false ) { $ message = preg_replace ( '#([a-zA-Z0-9-_]+?)/#siU' , '' , $ message ) ; $ message = preg_replace ( '#/#si' , '' , $ message , 1 ) ; } else { $ message = trim ( $ message , '"' ) ; $ file = str_replace ( '.php' , '' , basename ( $ ex [ 'file' ] ) ) ; $ line = $ ex [ 'line' ] ; $ message = '"' . $ message . '" in ' . $ file . ':' . $ line ; } return '[' . static :: getBasename ( $ ex [ 'class' ] ) . '] ' . $ message ; }
Parse Throwable message to proper format .