idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
6,200
public function addIndex ( array $ columns , $ name ) { if ( ! isset ( $ this -> cm -> table [ 'indexes' ] ) ) { $ this -> cm -> table [ 'indexes' ] = array ( ) ; } $ this -> cm -> table [ 'indexes' ] [ $ name ] = array ( 'columns' => $ columns ) ; return $ this ; }
Adds Index .
6,201
public function addUniqueConstraint ( array $ columns , $ name ) { if ( ! isset ( $ this -> cm -> table [ 'uniqueConstraints' ] ) ) { $ this -> cm -> table [ 'uniqueConstraints' ] = array ( ) ; } $ this -> cm -> table [ 'uniqueConstraints' ] [ $ name ] = array ( 'columns' => $ columns ) ; return $ this ; }
Adds Unique Constraint .
6,202
public function setDiscriminatorColumn ( $ name , $ type = 'string' , $ length = 255 ) { $ this -> cm -> setDiscriminatorColumn ( array ( 'name' => $ name , 'type' => $ type , 'length' => $ length , ) ) ; return $ this ; }
Sets the discriminator column details .
6,203
public function addField ( $ name , $ type , array $ mapping = array ( ) ) { $ mapping [ 'fieldName' ] = $ name ; $ mapping [ 'type' ] = $ type ; $ this -> cm -> mapField ( $ mapping ) ; return $ this ; }
Adds Field .
6,204
public function addManyToOne ( $ name , $ targetEntity , $ inversedBy = null ) { $ builder = $ this -> createManyToOne ( $ name , $ targetEntity ) ; if ( $ inversedBy ) { $ builder -> inversedBy ( $ inversedBy ) ; } return $ builder -> build ( ) ; }
Adds a simple many to one association optionally with the inversed by field .
6,205
public function addInverseOneToOne ( $ name , $ targetEntity , $ mappedBy ) { $ builder = $ this -> createOneToOne ( $ name , $ targetEntity ) ; $ builder -> mappedBy ( $ mappedBy ) ; return $ builder -> build ( ) ; }
Adds simple inverse one - to - one association .
6,206
public function addOwningOneToOne ( $ name , $ targetEntity , $ inversedBy = null ) { $ builder = $ this -> createOneToOne ( $ name , $ targetEntity ) ; if ( $ inversedBy ) { $ builder -> inversedBy ( $ inversedBy ) ; } return $ builder -> build ( ) ; }
Adds simple owning one - to - one association .
6,207
public function addOwningManyToMany ( $ name , $ targetEntity , $ inversedBy = null ) { $ builder = $ this -> createManyToMany ( $ name , $ targetEntity ) ; if ( $ inversedBy ) { $ builder -> inversedBy ( $ inversedBy ) ; } return $ builder -> build ( ) ; }
Adds a simple owning many to many association .
6,208
public function addInverseManyToMany ( $ name , $ targetEntity , $ mappedBy ) { $ builder = $ this -> createManyToMany ( $ name , $ targetEntity ) ; $ builder -> mappedBy ( $ mappedBy ) ; return $ builder -> build ( ) ; }
Adds a simple inverse many to many association .
6,209
public function addOneToMany ( $ name , $ targetEntity , $ mappedBy ) { $ builder = $ this -> createOneToMany ( $ name , $ targetEntity ) ; $ builder -> mappedBy ( $ mappedBy ) ; return $ builder -> build ( ) ; }
Adds simple OneToMany association .
6,210
public function removeBets ( ) { $ query = \ Drupal :: entityQuery ( 'bet' ) ; $ query -> condition ( 'game' , $ this -> id ( ) ) ; $ ids = $ query -> execute ( ) ; $ bets = Bet :: loadMultiple ( $ ids ) ; foreach ( $ bets as $ bet ) { $ bet -> delete ( ) ; } \ Drupal :: logger ( 'mespronos' ) -> notice ( t ( 'Bets rem...
Remove bets on current day
6,211
public static function getPlacementCoordinates ( $ resourceSize = [ ] , $ size = [ ] , $ place_constant = Imanee :: IM_POS_TOP_LEFT ) { $ x = 0 ; $ y = 0 ; switch ( $ place_constant ) { case Imanee :: IM_POS_TOP_CENTER : $ x = ( $ size [ 'width' ] / 2 ) - ( $ resourceSize [ 'width' ] / 2 ) ; break ; case Imanee :: IM_P...
Gets the coordinates for a relative placement using the IM_POS constants .
6,212
protected function initCrawlerProcess ( ) { $ this -> createWorkingDirectory ( ) ; if ( $ this -> url_cache_type == PHPCrawlerUrlCacheTypes :: URLCACHE_SQLITE ) $ this -> LinkCache = new PHPCrawlerSQLiteURLCache ( $ this -> working_directory . "urlcache.db3" , true ) ; else $ this -> LinkCache = new PHPCrawlerMemoryURL...
Initiates a crawler - process
6,213
protected function setupCrawlerStatusHandler ( ) { if ( $ this -> multiprocess_mode == PHPCrawlerMultiProcessModes :: MPMODE_CHILDS_EXECUTES_USERCODE || $ this -> resumtion_enabled == true ) { $ this -> CrawlerStatusHandler -> write_status_to_file = true ; } if ( $ this -> request_delay_time != null && $ this -> multip...
Setups the CrawlerStatusHandler dependent on the crawler - settings
6,214
protected function cleanup ( ) { $ this -> CookieCache -> cleanup ( ) ; $ this -> LinkCache -> cleanup ( ) ; PHPCrawlerUtils :: rmDir ( $ this -> working_directory ) ; if ( $ this -> multiprocess_mode != PHPCrawlerMultiProcessModes :: MPMODE_NONE ) { $ sem_key = sem_get ( $ this -> crawler_uniqid ) ; sem_remove ( $ sem...
Cleans up the crawler after it has finished .
6,215
public function getProcessReport ( ) { $ CrawlerStatus = $ this -> crawlerStatus ; $ Report = new PHPCrawlerProcessReport ( ) ; $ Report -> links_followed = $ CrawlerStatus -> links_followed ; $ Report -> files_received = $ CrawlerStatus -> documents_received ; $ Report -> bytes_received = $ CrawlerStatus -> bytes_rece...
Retruns summarizing report - information about the crawling - process after it has finished .
6,216
public function obeyRobotsTxt ( $ mode , $ robots_txt_uri = null ) { if ( ! is_bool ( $ mode ) ) return false ; $ this -> obey_robots_txt = $ mode ; if ( $ mode == true ) $ this -> robots_txt_uri = $ robots_txt_uri ; else $ this -> robots_txt_uri = null ; return true ; }
Defines whether the crawler should parse and obey robots . txt - files .
6,217
public function setRequestLimit ( $ limit , $ only_count_received_documents = false ) { if ( ! preg_match ( "/^[0-9]*$/" , $ limit ) ) return false ; $ this -> request_limit = $ limit ; $ this -> only_count_received_documents = $ only_count_received_documents ; return true ; }
Sets a limit to the total number of requests the crawler should execute .
6,218
public function setRequestDelay ( $ time ) { if ( is_float ( $ time ) || is_int ( $ time ) ) { $ this -> request_delay_time = $ time ; return true ; } return false ; }
Sets a delay for every HTTP - requests the crawler executes .
6,219
public function setCrawlingDepthLimit ( $ depth ) { if ( is_int ( $ depth ) && $ depth >= 0 ) { $ this -> UrlFilter -> max_crawling_depth = $ depth ; return true ; } return false ; }
Sets the maximum crawling depth
6,220
public function setUrl ( PHPCrawlerURLDescriptor $ UrlDescriptor ) { $ this -> UrlDescriptor = $ UrlDescriptor ; $ this -> url_parts = PHPCrawlerUtils :: splitURL ( $ UrlDescriptor -> url_rebuild ) ; }
Sets the URL for the request .
6,221
public function addCookieDescriptors ( $ cookies ) { $ cnt = count ( $ cookies ) ; for ( $ x = 0 ; $ x < $ cnt ; $ x ++ ) { $ this -> addCookieDescriptor ( $ cookies [ $ x ] ) ; } }
Adds a bunch of cookies to send with the request
6,222
public function setFindRedirectURLs ( $ mode ) { if ( ! is_bool ( $ mode ) ) return false ; $ this -> LinkFinder -> find_redirect_urls = $ mode ; return true ; }
Specifies whether redirect - links set in http - headers should get searched for .
6,223
protected function calulateDataTransferRateValues ( ) { $ vals = array ( ) ; if ( $ this -> data_transfer_time > 0 && $ this -> content_bytes_received > 4 * $ this -> socket_prefill_size ) { $ vals [ "unbuffered_bytes_read" ] = $ this -> content_bytes_received + $ this -> header_bytes_received - $ this -> socket_prefil...
Calculates data tranfer rate values
6,224
protected function openSocket ( & $ error_code , & $ error_string ) { PHPCrawlerBenchmark :: reset ( "connecting_server" ) ; PHPCrawlerBenchmark :: start ( "connecting_server" ) ; if ( $ this -> url_parts [ "protocol" ] == "https://" ) $ protocol_prefix = "ssl://" ; else $ protocol_prefix = "" ; if ( $ protocol_prefix ...
Opens the socket to the host .
6,225
protected function sendRequestHeader ( $ request_header_lines ) { $ cnt = count ( $ request_header_lines ) ; for ( $ x = 0 ; $ x < $ cnt ; $ x ++ ) { fputs ( $ this -> socket , $ request_header_lines [ $ x ] ) ; } }
Send the request - header .
6,226
protected function readResponseHeader ( & $ error_code , & $ error_string ) { PHPCrawlerBenchmark :: reset ( "server_response_time" ) ; PHPCrawlerBenchmark :: start ( "server_response_time" ) ; $ status = socket_get_status ( $ this -> socket ) ; $ source_read = "" ; $ header = "" ; $ server_responded = false ; while ( ...
Reads the response - header .
6,227
protected function readResponseContent ( $ stream_to_file = false , & $ error_code , & $ error_string , & $ document_received_completely ) { $ this -> content_bytes_received = 0 ; if ( $ stream_to_file == true ) { $ fp = @ fopen ( $ this -> tmpFile , "w" ) ; if ( $ fp == false ) { $ error_code = PHPCrawlerRequestErrors...
Reads the response - content .
6,228
protected function readResponseContentChunk ( & $ document_completed , & $ error_code , & $ error_string , & $ document_received_completely ) { $ source_chunk = "" ; $ stop_receiving = false ; $ bytes_received = 0 ; $ document_completed = false ; if ( $ this -> http_protocol_version == PHPCrawlerHTTPProtocols :: HTTP_1...
Reads a chunk from the response - content
6,229
protected function buildRequestHeader ( ) { $ headerlines = array ( ) ; if ( count ( $ this -> post_data ) > 0 ) $ request_type = "POST" ; else $ request_type = "GET" ; if ( $ this -> http_protocol_version == PHPCrawlerHTTPProtocols :: HTTP_1_1 ) $ http_protocol_verison = "1.1" ; else $ http_protocol_verison = "1.0" ; ...
Builds the request - header from the given settings .
6,230
protected function prepareHTTPRequestQuery ( $ query ) { if ( PHPCrawlerUtils :: isValidUrlString ( $ query ) ) { return $ query ; } $ query = rawurldecode ( $ query ) ; if ( PHPCrawlerEncodingUtils :: isUTF8String ( $ query ) == true ) { $ query = rawurlencode ( $ query ) ; } else { $ query = rawurlencode ( utf8_encod...
Prepares the given HTTP - query - string for the HTTP - request .
6,231
protected function buildCookieHeader ( ) { $ cookie_string = "" ; @ reset ( $ this -> cookie_array ) ; while ( list ( $ key , $ value ) = @ each ( $ this -> cookie_array ) ) { $ cookie_string .= "; " . $ key . "=" . $ value . "" ; } if ( $ cookie_string != "" ) { return "Cookie: " . substr ( $ cookie_string , 2 ) . "\r...
Builds the cookie - header - part for the header to send .
6,232
public function addReceiveContentType ( $ regex ) { $ check = PHPCrawlerUtils :: checkRegexPattern ( $ regex ) ; if ( $ check == true ) { $ this -> receive_content_types [ ] = trim ( strtolower ( $ regex ) ) ; } return $ check ; }
Adds a rule to the list of rules that decides which pages or files - regarding their content - type - should be received
6,233
public function addStreamToFileContentType ( $ regex ) { $ check = PHPCrawlerUtils :: checkRegexPattern ( $ regex ) ; if ( $ check == true ) { $ this -> receive_to_file_content_types [ ] = trim ( $ regex ) ; } return $ check ; }
Adds a rule to the list of rules that decides what types of content should be streamed diretly to the temporary file .
6,234
public function setTmpFile ( $ tmp_file ) { $ fp = @ fopen ( $ tmp_file , "w" ) ; if ( ! $ fp ) { return false ; } else { fclose ( $ fp ) ; $ this -> tmpFile = $ tmp_file ; return true ; } }
Sets the temporary file to use when content of found documents should be streamed directly into a temporary file .
6,235
public function setBufferSizes ( $ content_buffer_size = null , $ chunk_buffer_size = null , $ socket_read_buffer_size = null , $ source_overlap_size = null ) { if ( $ content_buffer_size !== null ) $ this -> content_buffer_size = $ content_buffer_size ; if ( $ chunk_buffer_size !== null ) $ this -> chunk_buffer_size =...
Adjusts some internal buffer - sizes of the HTTPRequest - class
6,236
public static function fromAMQPMessage ( AMQPMessage $ AMQPMessage ) { $ msg = new Message ( json_decode ( $ AMQPMessage -> body , true ) , $ AMQPMessage -> delivery_info [ 'routing_key' ] , $ AMQPMessage -> get_properties ( ) ) ; $ msg -> setAMQPMessage ( $ AMQPMessage ) ; return $ msg ; }
Creates a message given the AMQP message and the queue it was received from
6,237
public function sendNack ( $ requeue = false ) { $ this -> amqpMessage -> delivery_info [ 'channel' ] -> basic_nack ( $ this -> getDeliveryTag ( ) , true , $ requeue ) ; }
Sends a negative acknowledgment
6,238
public function republish ( ) { $ this -> amqpMessage -> delivery_info [ 'channel' ] -> basic_publish ( $ this -> getAMQPMessage ( ) , $ this -> amqpMessage -> delivery_info [ 'exchange' ] , $ this -> routingKey ) ; }
Re - publishes the message to the queue .
6,239
private function validate ( SelectStatement $ AST ) { $ queryComponents = $ this -> getQueryComponents ( ) ; $ query = $ this -> _getQuery ( ) ; $ from = $ AST -> fromClause -> identificationVariableDeclarations ; $ fromRoot = reset ( $ from ) ; if ( $ query instanceof Query && $ query -> getMaxResults ( ) && $ AST -> ...
Validate the AST to ensure that this walker is able to properly manipulate it .
6,240
public function setSequenceGenerator ( $ sequenceName , $ allocationSize = 1 , $ initialValue = 1 ) { $ this -> sequenceDef = array ( 'sequenceName' => $ sequenceName , 'allocationSize' => $ allocationSize , 'initialValue' => $ initialValue , ) ; return $ this ; }
Sets Sequence Generator .
6,241
public function build ( ) { $ cm = $ this -> builder -> getClassMetadata ( ) ; if ( $ this -> generatedValue ) { $ cm -> setIdGeneratorType ( constant ( 'Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_' . $ this -> generatedValue ) ) ; } if ( $ this -> version ) { $ cm -> setVersionMapping ( $ this -> mapping ) ; }...
Finalizes this field and attach it to the ClassMetadata .
6,242
private function joinColumnToArray ( $ joinColumnElement ) { $ joinColumn = array ( ) ; if ( isset ( $ joinColumnElement [ 'referencedColumnName' ] ) ) { $ joinColumn [ 'referencedColumnName' ] = ( string ) $ joinColumnElement [ 'referencedColumnName' ] ; } if ( isset ( $ joinColumnElement [ 'name' ] ) ) { $ joinColumn...
Constructs a joinColumn mapping array based on the information found in the given join column element .
6,243
private function columnToArray ( $ fieldName , $ column ) { $ mapping = array ( 'fieldName' => $ fieldName ) ; if ( isset ( $ column [ 'type' ] ) ) { $ params = explode ( '(' , $ column [ 'type' ] ) ; $ column [ 'type' ] = $ params [ 0 ] ; $ mapping [ 'type' ] = $ column [ 'type' ] ; if ( isset ( $ params [ 1 ] ) ) { $...
Parses the given column as array .
6,244
public function addJoinColumn ( $ columnName , $ referencedColumnName , $ nullable = true , $ unique = false , $ onDelete = null , $ columnDef = null ) { $ this -> joinColumns [ ] = array ( 'name' => $ columnName , 'referencedColumnName' => $ referencedColumnName , 'nullable' => $ nullable , 'unique' => $ unique , 'onD...
Add Join Columns .
6,245
public function link ( $ icon , $ title , $ url = null , $ options = [ ] , $ confirmMessage = false ) { $ escapeTitle = true ; if ( isset ( $ options [ 'escapeTitle' ] ) ) { $ escapeTitle = $ options [ 'escapeTitle' ] ; unset ( $ options [ 'escapeTitle' ] ) ; } elseif ( isset ( $ options [ 'escape' ] ) ) { $ escapeTitl...
Create link containing a Font Awesome icon .
6,246
public function generate ( array $ metadatas , $ outputDirectory ) { foreach ( $ metadatas as $ metadata ) { $ this -> writeEntityClass ( $ metadata , $ outputDirectory ) ; } }
Generates and writes entity classes for the given array of ClassMetadataInfo instances .
6,247
public function writeEntityClass ( ClassMetadataInfo $ metadata , $ outputDirectory ) { $ path = $ outputDirectory . '/' . str_replace ( '\\' , DIRECTORY_SEPARATOR , $ metadata -> name ) . $ this -> extension ; $ dir = dirname ( $ path ) ; if ( ! is_dir ( $ dir ) ) { mkdir ( $ dir , 0775 , true ) ; } $ this -> isNew = ...
Generates and writes entity class to disk for the given ClassMetadataInfo instance .
6,248
public function generateEntityClass ( ClassMetadataInfo $ metadata ) { $ placeHolders = array ( '<namespace>' , '<useStatement>' , '<entityAnnotation>' , '<entityClassName>' , '<entityBody>' ) ; $ replacements = array ( $ this -> generateEntityNamespace ( $ metadata ) , $ this -> generateEntityUse ( ) , $ this -> gener...
Generates a PHP5 Doctrine 2 entity class from the given ClassMetadataInfo instance .
6,249
public function generateUpdatedEntityClass ( ClassMetadataInfo $ metadata , $ path ) { $ currentCode = file_get_contents ( $ path ) ; $ body = $ this -> generateEntityBody ( $ metadata ) ; $ body = str_replace ( '<spaces>' , $ this -> spaces , $ body ) ; $ last = strrpos ( $ currentCode , '}' ) ; return substr ( $ curr...
Generates the updated code for the given ClassMetadataInfo and entity at path .
6,250
public function addDocumentInfo ( PHPCrawlerDocumentInfo $ DocInfo ) { while ( $ this -> getDocumentInfoCount ( ) >= $ this -> queue_max_size ) { usleep ( 500000 ) ; } $ this -> createPreparedStatements ( ) ; $ ser = serialize ( $ DocInfo ) ; $ this -> PDO -> exec ( "BEGIN EXCLUSIVE TRANSACTION" ) ; $ this -> preparedI...
Adds a PHPCrawlerDocumentInfo - object to the queue
6,251
protected function createPreparedStatements ( ) { if ( $ this -> prepared_statements_created == false ) { $ this -> preparedInsertStatement = $ this -> PDO -> prepare ( "INSERT INTO document_infos (document_info) VALUES (?);" ) ; $ this -> preparedSelectStatement = $ this -> PDO -> prepare ( "SELECT * FROM document_inf...
Creates all prepared statemenst
6,252
public function getUsers ( $ opt_fields = null ) { $ url = $ opt_fields ? 'users?opt_fields=' . $ opt_fields : 'users' ; return $ this -> curl -> get ( $ url ) ; }
Returns the user records for all users in all workspaces you have access .
6,253
public function createTask ( $ data ) { $ data = array_merge ( [ 'workspace' => $ this -> defaultWorkspaceId , 'projects' => $ this -> defaultProjectId ] , $ data ) ; return $ this -> curl -> post ( 'tasks' , [ 'data' => $ data ] ) ; }
Function to create a task .
6,254
public function addProjectToTask ( $ taskId , $ projectId = null ) { $ data = [ 'project' => $ projectId ? : $ this -> defaultProjectId ] ; return $ this -> curl -> post ( "tasks/{$taskId}/addProject" , [ 'data' => $ data ] ) ; }
Adds a project to task . If successful will return success and an empty data block .
6,255
public function getTasksByFilter ( $ filter = [ "assignee" => "" , "project" => "" , "workspace" => "" ] ) { $ filter = array_filter ( array_merge ( [ "assignee" => "" , "project" => "" , "workspace" => "" ] , $ filter ) ) ; $ url = '?' . join ( '&' , array_map ( function ( $ k , $ v ) { return "{$k}={$v}" ; } , array_...
Returns task by a given filter .
6,256
public function getProject ( $ projectId = null ) { $ projectId = $ projectId ? : $ this -> defaultProjectId ; return $ this -> curl -> get ( "projects/{$projectId}" ) ; }
Returns the full record for a single project .
6,257
public function getProjects ( $ archived = false , $ opt_fields = "" ) { $ archived = $ archived ? "true" : "false" ; $ opt_fields = ( $ opt_fields != "" ) ? "&opt_fields={$opt_fields}" : "" ; return $ this -> curl -> get ( "projects?archived={$archived}{$opt_fields}" ) ; }
Returns the projects in all workspaces containing archived ones or not .
6,258
public function getProjectsInWorkspace ( $ workspaceId = null , $ archived = false ) { $ archived = $ archived ? 1 : 0 ; $ workspaceId = $ workspaceId ? : $ this -> defaultWorkspaceId ; return $ this -> curl -> get ( "projects?archived={$archived}&workspace={$workspaceId}" ) ; }
Returns the projects in provided workspace containing archived ones or not .
6,259
public function updateProject ( $ projectId = null , $ data ) { $ projectId = $ projectId ? : $ this -> defaultProjectId ; return $ this -> curl -> put ( "projects/{$projectId}" , [ 'data' => $ data ] ) ; }
This method modifies the fields of a project provided in the request then returns the full updated record .
6,260
public function getProjectTasks ( $ projectId = null ) { $ projectId = $ projectId ? : $ this -> defaultProjectId ; return $ this -> curl -> get ( "tasks?project={$projectId}" ) ; }
Returns all unarchived tasks of a given project
6,261
public function getProjectStories ( $ projectId = null ) { $ projectId = $ projectId ? : $ this -> defaultProjectId ; return $ this -> curl -> get ( "projects/{$projectId}/stories" ) ; }
Returns the list of stories associated with the object . As usual with queries stories are returned in compact form . However the compact form for stories contains more information by default than just the ID . There is presently no way to get a filtered set of stories .
6,262
public function commentOnProject ( $ projectId = null , $ text = "" ) { $ projectId = $ projectId ? : $ this -> defaultProjectId ; $ data = [ "text" => $ text ] ; return $ this -> curl -> post ( "projects/{$projectId}/stories" , [ 'data' => $ data ] ) ; }
Adds a comment to a project
6,263
public function getWorkspaceTasks ( $ workspaceId = null , $ assignee = "me" ) { $ workspaceId = $ workspaceId ? : $ this -> defaultWorkspaceId ; return $ this -> curl -> get ( "tasks?workspace={$workspaceId}&assignee={$assignee}" ) ; }
Returns tasks of all workspace assigned to someone .
6,264
public function getWorkspaceTags ( $ workspaceId = null ) { $ workspaceId = $ workspaceId ? : $ this -> defaultWorkspaceId ; return $ this -> curl -> get ( "workspaces/{$workspaceId}/tags" ) ; }
Returns tags of all workspace .
6,265
public function getWorkspaceUsers ( $ workspaceId = null ) { $ workspaceId = $ workspaceId ? : $ this -> defaultWorkspaceId ; return $ this -> curl -> get ( "workspaces/{$workspaceId}/users" ) ; }
Returns users of all workspace .
6,266
public function getProjectEvents ( $ projectId = null ) { $ projectId = $ projectId ? : $ this -> defaultProjectId ; return $ this -> curl -> get ( "projects/{$projectId}/events" ) ; }
Returns events of a given project
6,267
protected function setup_item ( $ post = false , $ max = 10 ) { if ( ! empty ( $ this -> item_start ) ) { $ start_day = date_i18n ( 'j' , $ this -> item_start ) ; $ start_hour = date_i18n ( 'G' , $ this -> item_start ) ; } else { $ start_day = 0 ; $ start_hour = 0 ; } if ( ! empty ( $ this -> item_end ) ) { $ end_day =...
Add a post to the items array keyed by day
6,268
protected function pagination ( $ args = array ( ) ) { $ r = wp_parse_args ( $ args , array ( 'small' => '1 day' , 'large' => '1 week' , 'labels' => array ( 'next_small' => esc_html__ ( 'Tomorrow' , 'wp-event-calendar' ) , 'next_large' => esc_html__ ( 'Next Week' , 'wp-event-calendar' ) , 'prev_small' => esc_html__ ( '...
Paginate through days & weeks
6,269
protected function display_mode ( ) { $ timestamp = mktime ( 0 , 0 , 0 , $ this -> month , $ this -> day , $ this -> year ) ; $ this_month = getdate ( $ timestamp ) ; $ start_day = $ this_month [ 'wday' ] ; echo $ this -> get_all_day_row ( ) ; echo $ this -> get_multi_day_row ( ) ; for ( $ i = 0 ; $ i <= ( 24 - 1 ) ; $...
Display a calendar by mode & range
6,270
public function isRunning ( ) { $ process = $ this -> getProcess ( [ '--lines=0' , 'status' , $ this -> name , ] ) ; $ process -> run ( ) ; if ( $ process -> isSuccessful ( ) ) { return true ; } if ( self :: STATUS_STOPPED === $ process -> getExitCode ( ) ) { return false ; } throw new CommandFailedException ( $ proces...
Checks whether or not the service is running .
6,271
public function stop ( ) { if ( ! $ this -> isRunning ( ) ) { return ; } $ process = $ this -> getProcess ( [ 'stop' , $ this -> name , ] ) ; $ process -> run ( ) ; if ( ! $ process -> isSuccessful ( ) ) { throw new CommandFailedException ( $ process ) ; } }
Stops the service .
6,272
public function restart ( ) { $ process = $ this -> getProcess ( [ 'restart' , $ this -> name , ] ) ; $ process -> run ( ) ; if ( ! $ process -> isSuccessful ( ) ) { throw new CommandFailedException ( $ process ) ; } }
Restarts the service .
6,273
private function getProcess ( array $ arguments ) { $ command = explode ( ' ' , self :: $ command ) ; if ( self :: $ sudo ) { array_unshift ( $ command , 'sudo' ) ; } $ command = array_merge ( $ command , $ arguments ) ; $ process = new Process ( $ command ) ; $ process -> setTimeout ( self :: $ timeout ) ; return $ pr...
Creates and prepares a process .
6,274
public function getSingleIdReflectionProperty ( ) { if ( $ this -> isIdentifierComposite ) { throw new BadMethodCallException ( "Class " . $ this -> name . " has a composite identifier." ) ; } return $ this -> reflFields [ $ this -> identifier [ 0 ] ] ; }
Gets the ReflectionProperty for the single identifier field .
6,275
public function getIdentifierValues ( $ entity ) { if ( $ this -> isIdentifierComposite ) { $ id = array ( ) ; foreach ( $ this -> identifier as $ idField ) { $ value = $ this -> reflFields [ $ idField ] -> getValue ( $ entity ) ; if ( $ value !== null ) { $ id [ $ idField ] = $ value ; } } return $ id ; } $ id = $ thi...
Extracts the identifier values of an entity of this class .
6,276
public function isNullable ( $ fieldName ) { $ mapping = $ this -> getFieldMapping ( $ fieldName ) ; if ( $ mapping !== false ) { return isset ( $ mapping [ 'nullable' ] ) && $ mapping [ 'nullable' ] == true ; } return false ; }
Checks if the field is not null .
6,277
public function getColumnName ( $ fieldName ) { return isset ( $ this -> columnNames [ $ fieldName ] ) ? $ this -> columnNames [ $ fieldName ] : $ fieldName ; }
Gets a column name for a field name . If the column name for the field cannot be found the given field name is returned .
6,278
public function getAssociationMapping ( $ fieldName ) { if ( ! isset ( $ this -> associationMappings [ $ fieldName ] ) ) { throw MappingException :: mappingNotFound ( $ this -> name , $ fieldName ) ; } return $ this -> associationMappings [ $ fieldName ] ; }
Gets the mapping of an association .
6,279
public function getFieldName ( $ columnName ) { return isset ( $ this -> fieldNames [ $ columnName ] ) ? $ this -> fieldNames [ $ columnName ] : $ columnName ; }
Gets the field name for a column name . If no field name can be found the column name is returned .
6,280
public function getNamedQuery ( $ queryName ) { if ( ! isset ( $ this -> namedQueries [ $ queryName ] ) ) { throw MappingException :: queryNotFound ( $ this -> name , $ queryName ) ; } return $ this -> namedQueries [ $ queryName ] [ 'dql' ] ; }
Gets the named query .
6,281
public function getNamedNativeQuery ( $ queryName ) { if ( ! isset ( $ this -> namedNativeQueries [ $ queryName ] ) ) { throw MappingException :: queryNotFound ( $ this -> name , $ queryName ) ; } return $ this -> namedNativeQueries [ $ queryName ] ; }
Gets the named native query .
6,282
public function getSqlResultSetMapping ( $ name ) { if ( ! isset ( $ this -> sqlResultSetMappings [ $ name ] ) ) { throw MappingException :: resultMappingNotFound ( $ this -> name , $ name ) ; } return $ this -> sqlResultSetMappings [ $ name ] ; }
Gets the result set mapping .
6,283
protected function _validateAndCompleteFieldMapping ( array & $ mapping ) { if ( ! isset ( $ mapping [ 'fieldName' ] ) || strlen ( $ mapping [ 'fieldName' ] ) == 0 ) { throw MappingException :: missingFieldName ( $ this -> name ) ; } if ( ! isset ( $ mapping [ 'type' ] ) ) { $ mapping [ 'type' ] = 'string' ; } if ( ! i...
Validates & completes the given field mapping .
6,284
public function getColumnNames ( array $ fieldNames = null ) { if ( $ fieldNames === null ) { return array_keys ( $ this -> fieldNames ) ; } else { $ columnNames = array ( ) ; foreach ( $ fieldNames as $ fieldName ) { $ columnNames [ ] = $ this -> getColumnName ( $ fieldName ) ; } return $ columnNames ; } }
Gets an array containing all the column names .
6,285
public function getIdentifierColumnNames ( ) { $ columnNames = array ( ) ; foreach ( $ this -> identifier as $ idProperty ) { if ( isset ( $ this -> fieldMappings [ $ idProperty ] ) ) { $ columnNames [ ] = $ this -> fieldMappings [ $ idProperty ] [ 'columnName' ] ; continue ; } $ joinColumns = $ this -> associationMapp...
Returns an array with all the identifier column names .
6,286
public function setAssociationOverride ( $ fieldName , array $ overrideMapping ) { if ( ! isset ( $ this -> associationMappings [ $ fieldName ] ) ) { throw MappingException :: invalidOverrideFieldName ( $ this -> name , $ fieldName ) ; } $ mapping = $ this -> associationMappings [ $ fieldName ] ; if ( isset ( $ overrid...
Sets the association to override association mapping of property for an entity relationship .
6,287
public function setAttributeOverride ( $ fieldName , array $ overrideMapping ) { if ( ! isset ( $ this -> fieldMappings [ $ fieldName ] ) ) { throw MappingException :: invalidOverrideFieldName ( $ this -> name , $ fieldName ) ; } $ mapping = $ this -> fieldMappings [ $ fieldName ] ; if ( isset ( $ mapping [ 'id' ] ) ) ...
Sets the override for a mapped field .
6,288
public function mapOneToOne ( array $ mapping ) { $ mapping [ 'type' ] = self :: ONE_TO_ONE ; $ mapping = $ this -> _validateAndCompleteOneToOneMapping ( $ mapping ) ; $ this -> _storeAssociationMapping ( $ mapping ) ; }
Adds a one - to - one mapping .
6,289
public function mapOneToMany ( array $ mapping ) { $ mapping [ 'type' ] = self :: ONE_TO_MANY ; $ mapping = $ this -> _validateAndCompleteOneToManyMapping ( $ mapping ) ; $ this -> _storeAssociationMapping ( $ mapping ) ; }
Adds a one - to - many mapping .
6,290
public function mapManyToOne ( array $ mapping ) { $ mapping [ 'type' ] = self :: MANY_TO_ONE ; $ mapping = $ this -> _validateAndCompleteOneToOneMapping ( $ mapping ) ; $ this -> _storeAssociationMapping ( $ mapping ) ; }
Adds a many - to - one mapping .
6,291
public function mapManyToMany ( array $ mapping ) { $ mapping [ 'type' ] = self :: MANY_TO_MANY ; $ mapping = $ this -> _validateAndCompleteManyToManyMapping ( $ mapping ) ; $ this -> _storeAssociationMapping ( $ mapping ) ; }
Adds a many - to - many mapping .
6,292
protected function _storeAssociationMapping ( array $ assocMapping ) { $ sourceFieldName = $ assocMapping [ 'fieldName' ] ; $ this -> assertFieldNotMapped ( $ sourceFieldName ) ; $ this -> associationMappings [ $ sourceFieldName ] = $ assocMapping ; }
Stores the association mapping .
6,293
public function invokeLifecycleCallbacks ( $ lifecycleEvent , $ entity ) { foreach ( $ this -> lifecycleCallbacks [ $ lifecycleEvent ] as $ callback ) { $ entity -> $ callback ( ) ; } }
Dispatches the lifecycle event of the given entity to the registered lifecycle callbacks and lifecycle listeners .
6,294
public function isAssociationWithSingleJoinColumn ( $ fieldName ) { return ( isset ( $ this -> associationMappings [ $ fieldName ] ) && isset ( $ this -> associationMappings [ $ fieldName ] [ 'joinColumns' ] [ 0 ] ) && ! isset ( $ this -> associationMappings [ $ fieldName ] [ 'joinColumns' ] [ 1 ] ) ) ; }
Is this an association that only has a single join column?
6,295
public function getFieldForColumn ( $ columnName ) { if ( isset ( $ this -> fieldNames [ $ columnName ] ) ) { return $ this -> fieldNames [ $ columnName ] ; } else { foreach ( $ this -> associationMappings as $ assocName => $ mapping ) { if ( $ this -> isAssociationWithSingleJoinColumn ( $ assocName ) && $ this -> asso...
Used to retrieve a fieldname for either field or association from a given column .
6,296
public function setSequenceGeneratorDefinition ( array $ definition ) { if ( ! isset ( $ definition [ 'sequenceName' ] ) ) { throw MappingException :: missingSequenceName ( $ this -> name ) ; } if ( $ definition [ 'sequenceName' ] [ 0 ] == '`' ) { $ definition [ 'sequenceName' ] = trim ( $ definition [ 'sequenceName' ]...
Sets the definition of the sequence ID generator for this class .
6,297
public function mapEmbedded ( array $ mapping ) { $ this -> assertFieldNotMapped ( $ mapping [ 'fieldName' ] ) ; $ this -> embeddedClasses [ $ mapping [ 'fieldName' ] ] = array ( 'class' => $ this -> fullyQualifiedClassName ( $ mapping [ 'class' ] ) , 'columnPrefix' => $ mapping [ 'columnPrefix' ] , 'declaredField' => ...
Map Embedded Class
6,298
public function inlineEmbeddable ( $ property , ClassMetadataInfo $ embeddable ) { foreach ( $ embeddable -> fieldMappings as $ fieldMapping ) { $ fieldMapping [ 'originalClass' ] = isset ( $ fieldMapping [ 'originalClass' ] ) ? $ fieldMapping [ 'originalClass' ] : $ embeddable -> name ; $ fieldMapping [ 'declaredField...
Inline the embeddable class
6,299
public function getSequenceName ( AbstractPlatform $ platform ) { $ sequencePrefix = $ this -> getSequencePrefix ( $ platform ) ; $ columnName = $ this -> getSingleIdentifierColumnName ( ) ; $ sequenceName = $ sequencePrefix . '_' . $ columnName . '_seq' ; return $ sequenceName ; }
Gets the sequence name based on class metadata .