idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
231,000
protected function getRequestHeader ( $ Name ) { $ headers = self :: getAllRequestHeaders ( ) ; if ( isset ( $ headers [ strtolower ( $ Name ) ] ) ) { return $ headers [ strtolower ( $ Name ) ] ; } return false ; }
Get a request header
231,001
public function jsonEncode ( $ Object , $ skipObjectEncode = false ) { if ( ! $ skipObjectEncode ) { $ Object = $ this -> encodeObject ( $ Object ) ; } if ( function_exists ( 'json_encode' ) && $ this -> options [ 'useNativeJsonEncode' ] != false ) { return json_encode ( $ Object ) ; } else { return $ this -> json_enco...
Encode an object into a JSON string
231,002
public function saveRole ( array $ values ) : int { $ result = $ this -> generalSave ( $ values , $ this -> tableRole ) ; $ this -> cache -> clean ( [ Cache :: TAGS => [ 'DibiDriver' ] ] ) ; return $ result ; }
Save role .
231,003
public function saveResource ( array $ values ) : int { $ result = $ this -> generalSave ( $ values , $ this -> tableResource ) ; $ this -> cache -> clean ( [ Cache :: TAGS => [ 'DibiDriver' ] ] ) ; return $ result ; }
Save resource .
231,004
public function savePrivilege ( array $ values ) : int { $ result = $ this -> generalSave ( $ values , $ this -> tablePrivilege ) ; $ this -> cache -> clean ( [ Cache :: TAGS => [ 'DibiDriver' ] ] ) ; return $ result ; }
Save privilege .
231,005
public function buildInQueryBindings ( $ values , $ prefix = "in_" , & $ bound_parameters = array ( ) ) { $ sql = "()" ; if ( is_array ( $ values ) && count ( $ values ) > 0 ) { $ sql = array ( ) ; $ values = array_values ( $ values ) ; foreach ( $ values as $ index => $ value ) { $ label_name = $ prefix . "_" . $ inde...
Builds a sub - query for an IN statement with bound values .
231,006
public function query ( $ sql , array $ bound_parameters = array ( ) , $ fetch = true ) { $ statement = $ this -> entity_manager -> getConnection ( ) -> prepare ( $ sql ) ; foreach ( $ bound_parameters as $ parameter => $ value ) { $ statement -> bindValue ( $ parameter , $ value ) ; } $ statement -> execute ( ) ; if (...
Performs an arbitrary SQL query .
231,007
public function queryDQL ( $ dql , array $ bound_parameters = array ( ) ) { $ statement = $ this -> entity_manager -> createQuery ( $ dql ) ; foreach ( $ bound_parameters as $ parameter => $ value ) { $ statement -> setParameter ( $ parameter , $ value ) ; } return $ statement -> getResult ( ) ; }
Performs an arbitrary DQL query .
231,008
public static function useIdentity ( $ username = null , $ password = null , $ timeout = null ) { $ httpClient = \ EasyRdf_Http :: getDefaultHttpClient ( ) ; if ( ! ( $ httpClient instanceof \ Zend_Http_Client or $ httpClient instanceof HttpClient ) ) { $ httpClient = new HttpClient ( null , array ( 'maxredirects' => 5...
Just an helper to use HttPClient as default EastRdf_default_client )
231,009
protected function hasHeader ( Part $ part , $ header ) { if ( count ( $ part -> getHeaders ( ) ) < 1 ) { return false ; } return $ part -> getHeaders ( ) -> has ( $ header ) ; }
The confusing zend API makes a custom function for header checking necessary .
231,010
protected function getContentType ( Part $ part ) { if ( ! $ this -> hasHeader ( $ part , 'Content-Type' ) ) { throw new Exception ( 'This email does not have a content type. Check for that with hasContentType()' ) ; } $ zendContentType = $ part -> getHeaders ( ) -> get ( 'Content-Type' ) ; switch ( true ) { case is_ar...
Returns the content type of the given part . Since zends API allows for four different return values we need to handle every type differently . Multiple content - type headers can t be accounted for in those cases we simply take the first one and hope for the best . If it doesn t work there s not much that could be don...
231,011
public function convertToDatabaseValue ( $ value , $ marshal = true ) { $ converted = $ value !== null ? $ this -> databaseValue ( $ value ) : null ; if ( ! $ marshal ) { return $ converted ; } return $ converted === null ? self :: getNull ( ) : [ static :: $ dynamoKey => $ converted ] ; }
Converts a value from its PHP representation of this type to its serialized DynamoDB representation optionally applying marshalling afterwards .
231,012
public function convertToPHPValue ( $ value , $ unmarshal = true ) { if ( $ unmarshal ) { $ value = $ value === self :: getNull ( ) ? null : $ value [ static :: $ dynamoKey ] ; } return $ value === null ? null : $ this -> phpValue ( $ value ) ; }
Converts a value from its serialized DynamoDB representation to its PHP representation of this type optionally unmarshalling it first .
231,013
public static function convertUnmappedToPHPValue ( $ value ) { $ type = key ( $ value ) ; $ value = current ( $ value ) ; switch ( $ type ) { case 'S' : case 'B' : case 'BOOL' : return $ value ; case 'NULL' : return null ; case 'N' : return $ value + 0 ; case 'M' : case 'L' : foreach ( $ value as $ k => $ v ) { $ value...
Child values of a list or map do not have an ODM type mapped it must be inferred from the value and DynamoDB data type .
231,014
public static function fromName ( string $ countryName ) : Country { self :: getNameMap ( ) ; if ( ! isset ( self :: $ alpha2CodeMap [ $ countryName ] ) ) { throw InvalidArgumentException :: format ( 'Invalid country short name supplied to %s: country \'%s\' is not a valid option' , __METHOD__ , $ countryName ) ; } ret...
Builds a country enum from the supplied country short name .
231,015
public static function getNameMap ( ) : array { if ( self :: $ nameMap === null ) { self :: $ nameMap = [ ] ; $ countries = self :: getLoader ( ) -> all ( ) ; foreach ( $ countries as $ country ) { self :: $ nameMap [ $ country [ 'alpha2' ] ] = $ country [ 'name' ] ; } self :: $ alpha2CodeMap = array_flip ( self :: $ n...
Returns an array the country short names indexed by their respective ISO 3166 - 1 alpha - 2 country code .
231,016
public function combine ( $ op , $ map1 ) { $ transformations = func_get_args ( ) ; array_shift ( $ transformations ) ; return function ( Expression $ expr , $ compiler ) use ( $ op , $ transformations ) { $ tree = new SpanExpression ( strtoupper ( $ op ) ) ; foreach ( $ transformations as $ transformation ) { $ tree -...
Combine many maps to a single tree one
231,017
public function regexps ( array $ regexpsMap ) { return function ( FieldExpression $ expr , $ compiler ) use ( $ regexpsMap ) { $ value = $ expr -> getValue ( ) ; foreach ( $ regexpsMap as $ regexp => $ transformation ) { if ( preg_match ( $ regexp , $ value ) ) return $ transformation ( $ expr , $ compiler ) ; } throw...
This map select the transformation with regexps on the exoression value
231,018
public function conditional ( $ condition1 , $ map1 ) { $ args = func_get_args ( ) ; return function ( Expression $ expr , $ compiler ) use ( $ args ) { $ numargs = count ( $ args ) ; for ( $ i = 0 ; $ i + 1 < $ numargs ; $ i += 2 ) { $ condition = $ args [ $ i ] ; $ map = $ args [ $ i + 1 ] ; if ( $ condition ( $ expr...
Build a map from a collection of condition and map couples . It will be used the map of the first matched condition .
231,019
public function attr ( $ map , array $ attributes ) { return function ( Expression $ expr , $ compiler ) use ( $ map , $ attributes ) { $ luceneExpr = $ map ( $ expr , $ compiler ) ; foreach ( $ attributes as $ name => $ value ) { $ luceneExpr [ $ name ] = $ value ; } return $ luceneExpr ; } ; }
Set attributes in the resulting expression .
231,020
public function middleware ( $ name = '' , $ role = '' , Closure $ next = null ) { if ( ! $ this -> accessDispatcher ) { $ this -> accessDispatcher = new AccessDispatcher ( ) ; } $ middleware = $ this -> accessDispatcher -> process ( [ 'name' => $ name , 'role' => $ role , 'next' => $ next ] ) ; if ( true !== $ middlew...
determine user authentication
231,021
public function path ( ) { $ args = func_get_args ( ) ; if ( count ( $ args ) ) { $ this -> path = $ this -> verify ( $ args [ 0 ] ) ; } return $ this -> path ; }
Get or set the path .
231,022
public function verify ( $ path ) { $ full_path = realpath ( $ path ) ; $ data = @ getimagesize ( $ full_path ) ; if ( ! $ data ) { throw new FileException ( sprintf ( 'File "%s" cannot be read.' , $ path ) , 1 ) ; } if ( $ data [ 2 ] != IMG_JPG ) { throw new FileException ( sprintf ( 'File "%s" is not a JPG.' , $ path...
Verify the file at a path .
231,023
public function renderContent ( ) { $ string = json_encode ( $ this -> getContent ( ) , $ this -> option , $ this -> depth ) ; if ( json_last_error ( ) !== JSON_ERROR_NONE ) { throw new \ RuntimeException ( 'Json encode error ! (error: ' . json_last_error_msg ( ) . ')' ) ; } return $ string ; }
Encode content into json format & display it .
231,024
protected function load ( SplFileInfo $ file ) { $ this -> filename = $ file -> getBasename ( ) ; $ this -> sourcePath = $ file -> getRelativePath ( ) ; $ data = $ file -> getContents ( ) ; list ( $ content , $ meta ) = $ this -> splitContentMeta ( $ data ) ; $ meta = Yaml :: parse ( $ meta ) ? : [ ] ; switch ( $ file ...
Load and parse content from file .
231,025
protected function splitContentMeta ( $ data ) { $ data = preg_replace ( '/\x{EF}\x{BB}\x{BF}/' , '' , $ data ) ; $ pattern = '/' . '^' . '---' . '\\s*' . '$' . '/m' ; $ data = trim ( $ data ) ; if ( ( substr ( $ data , 0 , 3 ) === '---' ) && ( preg_match ( $ pattern , $ data , $ matches , PREG_OFFSET_CAPTURE , 3 ) ) )...
Parse metadata and content
231,026
protected function setTarget ( SplFileInfo $ file ) { $ ext = $ file -> getExtension ( ) ; if ( ! $ this -> has ( 'template' ) || $ this -> get ( 'template' ) === 'none' ) { $ targetExt = $ ext ; } else { $ targetExt = 'html' ; } $ sourcePath = $ this -> getCleanPath ( $ file -> getRelativePathName ( ) ) ; $ this -> ta...
Determine the target path .
231,027
public function setMethodCalls ( array $ calls = array ( ) ) { $ this -> calls = array ( ) ; foreach ( $ calls as $ call ) { $ this -> addMethodCall ( $ call [ 0 ] , $ call [ 1 ] ) ; } return $ this ; }
Sets the methods to call after service initialization .
231,028
public function addAutowiringType ( $ type ) { @ trigger_error ( sprintf ( 'Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead for "%s".' , $ type ) , E_USER_DEPRECATED ) ; $ this -> autowiringTypes [ $ type ] = true ; return $ this ; }
Adds a type that will default to this definition .
231,029
public function hasAutowiringType ( $ type ) { @ trigger_error ( sprintf ( 'Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead for "%s".' , $ type ) , E_USER_DEPRECATED ) ; return isset ( $ this -> autowiringTypes [ $ type ] ) ; }
Will this definition default for the given type?
231,030
private function readHeader ( ) : self { if ( null !== $ this -> statusLine ) { return $ this ; } do { $ this -> parseStatusLine ( $ this -> socket -> readLine ( ) ) ; $ headers = '' ; $ line = '' ; while ( ! $ this -> socket -> eof ( ) && Http :: END_OF_LINE !== $ line ) { $ line = $ this -> socket -> readLine ( ) . H...
reads response headers
231,031
private function parseStatusLine ( string $ statusLine ) { $ matches = [ ] ; if ( preg_match ( "=^(HTTP/\d+\.\d+) (\d{3}) ([^\r]*)=" , $ statusLine , $ matches ) == false ) { throw new ProtocolViolation ( 'Received status line "' . addcslashes ( $ statusLine , "\0..\37!\177..\377" ) . '" does not match expected format ...
parses first line of response
231,032
private function readBody ( ) : self { if ( null !== $ this -> body ) { return $ this ; } if ( $ this -> headers -> get ( 'Transfer-Encoding' ) === 'chunked' ) { $ this -> body = $ this -> readChunked ( ) ; } else { $ this -> body = $ this -> readDefault ( ( int ) $ this -> headers -> get ( 'Content-Length' , 4096 ) ) ...
reads the response body
231,033
private function readChunked ( ) : string { $ readLength = 0 ; $ chunksize = null ; $ extension = null ; $ body = '' ; sscanf ( $ this -> socket -> readLine ( ) , '%x%s' , $ chunksize , $ extension ) ; while ( 0 < $ chunksize ) { $ data = $ this -> socket -> read ( $ chunksize + 4 ) ; $ body .= rtrim ( $ data ) ; $ rea...
helper method to read chunked response body
231,034
private function readDefault ( int $ readLength ) : string { $ body = $ buffer = '' ; $ read = 0 ; while ( $ read < $ readLength && ! $ this -> socket -> eof ( ) ) { $ buffer = $ this -> socket -> read ( $ readLength ) ; $ read += strlen ( $ buffer ) ; $ body .= $ buffer ; } return $ body ; }
helper method for default reading of response body
231,035
public function findReservedSchacHomeOrganizations ( ) { $ queryBuilder = $ this -> idpRepository -> createQueryBuilder ( 'role' ) -> select ( 'role.schacHomeOrganization' ) -> distinct ( ) -> orderBy ( 'role.schacHomeOrganization' ) ; $ this -> compositeFilter -> toQueryBuilder ( $ queryBuilder , $ this -> idpReposito...
Find all SchacHomeOrganizations that are reserved by Identity Providers .
231,036
public function synchronize ( array $ roles ) { $ result = new SynchronizationResult ( ) ; $ repository = $ this ; $ this -> entityManager -> transactional ( function ( EntityManager $ em ) use ( $ roles , $ repository , $ result ) { $ idpsToBeRemoved = $ repository -> findAllIdentityProviderEntityIds ( ) ; $ spsToBeRe...
Synchronize the database with the provided roles .
231,037
public function updateQuery ( string $ prependQuery = ' WHERE ' ) : self { $ whereCase = $ this -> getWhereClause ( $ prependQuery ) ; if ( $ whereCase !== '' ) { $ this -> query -> setDQL ( $ this -> query -> getDQL ( ) . $ whereCase ) ; $ this -> query -> setHint ( $ this -> conditionGenerator -> getQueryHintName ( )...
Updates the configured query object with the where - clause .
231,038
public function getQueryHintValue ( ) : SqlConversionInfo { if ( null === $ this -> whereClause ) { throw new BadMethodCallException ( 'Unable to get query-hint value for ConditionGenerator. Call getWhereClause() before calling this method.' ) ; } return new SqlConversionInfo ( $ this -> nativePlatform , $ this -> para...
Returns the Query - hint value for the final query object .
231,039
public function get ( $ message_key ) { $ this -> ensureLoaded ( ) ; $ separator = strpos ( $ message_key , '.' ) ; if ( false === $ separator ) { if ( isset ( $ this -> messages [ $ message_key ] ) ) { return $ this -> messages [ $ message_key ] ; } if ( isset ( $ this -> link ) ) { return $ this -> link -> get ( $ me...
Gets the raw value of a message .
231,040
public function format ( $ message_key , $ args ) { return \ MessageFormatter :: formatMessage ( $ this -> locale , $ this -> get ( $ message_key ) , $ args ) ; }
Gets the formatted value of a message .
231,041
public function setTemplate ( string $ template ) : self { $ this -> template = $ template ; $ this -> logger -> debug ( "Template file set to loader." , [ "template" => $ this -> template ] ) ; return $ this ; }
Set the template
231,042
public function setTemplateDir ( string $ templateDir ) : self { $ this -> templateDir = rtrim ( $ templateDir , DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR ; $ this -> logger -> debug ( "Template directory set to loader." , [ "templateDir" => $ this -> templateDir ] ) ; return $ this ; }
Set the template directory
231,043
public function set ( $ requestId , $ allowOverwrite = false ) { if ( $ this -> requestId !== null && ! $ allowOverwrite ) { throw new \ LogicException ( 'May not overwrite request ID.' ) ; } $ this -> requestId = $ requestId ; }
We allow overwriting the RequestId so that we can inject a RequestId from a header when log statements already have been made - which would cause an exception otherwise . The use - case here is the Stepup - Middleware application this application receives API - calls but by then log messages have already been written ....
231,044
private function hasTableDifference ( ) { return ! empty ( $ this -> createdTables ) || ! empty ( $ this -> alteredTables ) || ! empty ( $ this -> droppedTables ) ; }
Checks if the schema diff has table difference .
231,045
function matches ( $ entity , array $ context = null , $ attribute = null ) { foreach ( $ this -> entities as $ name ) { if ( $ name === $ entity ) { if ( $ this -> parameters !== null ) { foreach ( $ this -> parameters as $ key => $ values ) { $ match = false ; $ param_value = isset ( $ context [ $ key ] ) ? $ context...
Relays are entities or routes context is an array of values required for the match among these values owner is a special idenfication value .
231,046
public static function isSlug ( $ string , $ with_slash = true ) { if ( $ with_slash ) $ match = '/' . self :: SLUG_WITH_SLASH_MATCH . '/' ; else $ match = '/' . self :: SLUG_MATCH . '/' ; return preg_match ( $ match , $ string ) > 0 ; }
Determines if the string given is a slug or not .
231,047
public static function createSlugFromCamelCase ( $ string , $ allowSlashes = false ) { $ string = trim ( preg_replace ( '/(([A-Z]|[0-9])[^A-Z])/' , ' $1' , $ string ) ) ; return SlugUtils :: createSlug ( $ string , $ allowSlashes ) ; }
Creates a slug from the camel case text given . Adds space in between words starting with capital letters and acronyms .
231,048
public function sendEmailNotificationToSender ( $ message , $ mappedVars ) { $ data = $ this -> prepareNotificationEmailData ( $ message , $ mappedVars ) ; $ emailBladeFile = 'lasallecmsemail::email.notification_email_to_inbound_sender' ; Mail :: queue ( $ emailBladeFile , [ 'data' => $ data ] , function ( $ message ) ...
Send an email notification to sender
231,049
public function prepareNotificationEmailData ( $ message , $ mappedVars ) { $ data = [ ] ; $ data [ 'site_name' ] = config ( 'lasallecmsfrontend.site_name' ) ; $ data [ 'from_name' ] = $ data [ 'site_name' ] ; $ data [ 'from_email_address' ] = config ( 'lasallecmsusermanagement.administrator_first_among_equals_email' )...
Prepare the data needed to send out a notification email to the inbound email s sender
231,050
public function buildDataForDatabaseInsert ( $ mappedVars ) { $ data = [ ] ; $ data [ 'priority_id' ] = null ; $ data [ 'slug' ] = $ this -> genericCreateSlug ( $ mappedVars [ 'subject' ] ) ; $ data [ 'sent' ] = 1 ; $ data [ 'sent_timestamp' ] = Carbon :: now ( ) ; $ data [ 'read' ] = 0 ; $ data [ 'archived' ] = 0 ; $ ...
Build the data for the INSERT into email_messages .
231,051
public function prepareAttachmentDataForInsert ( $ emailMessageID , $ attachment , $ attachmentPath , $ data = null ) { $ data1 = [ ] ; $ data1 [ 'email_messages_id' ] = $ emailMessageID ; $ data1 [ 'attachment_path' ] = $ attachmentPath ; $ data1 [ 'attachment_filename' ] = $ data [ 'attachment-' . $ attachment ] -> g...
Prepare the data for the INSERT into the email_attachments db table .
231,052
public function manageTokenBasedLogin ( $ user_id , $ email ) { $ this -> userTokenbasedloginRepository -> createLoginToken ( $ user_id ) ; $ this -> sendLoginTokenEmail -> sendEmail ( $ user_id , $ email ) ; return ; }
Create the token for token based login ; and send out the email with the token based login link to a user
231,053
protected function setCollectorHandler ( ResultInterface $ result ) { $ status = $ result -> getStatus ( ) ; if ( is_null ( $ result -> getHandler ( ) ) && $ this -> getHandler ( $ status ) ) { $ this -> debug ( Message :: get ( Message :: DEBUG_SET_C_HANDLER , get_class ( $ this ) , $ status ) ) ; $ result -> setHandl...
Set collector level handler if result has no handler set yet
231,054
public function getContentType ( bool $ allowUnverified = false ) : string { if ( $ this -> contentType === null ) { if ( $ allowUnverified ) { return $ this -> unverifiedContentType ; } $ this -> contentType = $ this -> getContentTypeFromFile ( $ this -> tempPath ) ; } return $ this -> contentType ; }
Get the content type
231,055
public function isType ( array $ mimeTypes , bool $ allowUnverified = false ) : bool { $ contentType = $ this -> getContentType ( $ allowUnverified ) ; foreach ( $ mimeTypes as $ type ) { if ( strtolower ( $ type ) === $ contentType ) { return true ; } } return false ; }
Determine whether the file type matches any that are provided
231,056
public function getFormattedSize ( int $ precision = 0 , string $ point = "." , string $ sep = "," ) : string { return \ sndsgd \ Fs :: formatSize ( $ this -> size , $ precision , $ point , $ sep ) ; }
Retrieve a human readable version of the size
231,057
public function toArray ( ) : array { return [ "clientFilename" => $ this -> getClientFilename ( ) , "unverifiedContentType" => $ this -> error ? "" : $ this -> getContentType ( true ) , "verifiedContentType" => $ this -> error ? "" : $ this -> getContentType ( ) , "size" => $ this -> error ? 0 : $ this -> getSize ( ) ...
Get an array representation of this object
231,058
public function getDomainPart ( ) { $ parts = \ explode ( '@' , $ this -> toNative ( ) ) ; $ domain = \ trim ( $ parts [ 1 ] , '[]' ) ; return Domain :: specifyType ( $ domain ) ; }
Returns the domain part of the email address
231,059
protected function insertTextBorder ( $ xPosition , $ yPosition , $ text ) { if ( ! $ this -> getBorderColor ( ) instanceof Image \ Color ) { throw new \ RuntimeException ( 'Attempt to render text border without setting a color' ) ; } $ borderAlpha = $ this -> getBorderColor ( ) -> getAlpha ( ) ; $ this -> getBorderCol...
Renders the given text border onto the image resource using the given coordinates .
231,060
public function resolveConflictInsteadOf ( $ trait , $ method , $ insteadOfTrait ) { $ fullClass = $ this -> classFile -> getFullClassName ( $ trait ) ; if ( method_exists ( $ fullClass , $ method ) === false ) { throw \ Aviogram \ Common \ PHPClass \ Exception \ ClassTrait :: undefinedMethod ( $ trait , $ method ) ; }...
Resolve method name conflict with ignoring one trait over the other
231,061
public function resolveConflictAlias ( $ trait , $ method , $ alias ) { $ fullClass = $ this -> classFile -> getFullClassName ( $ trait ) ; if ( method_exists ( $ fullClass , $ method ) === false ) { throw \ Aviogram \ Common \ PHPClass \ Exception \ ClassTrait :: undefinedMethod ( $ trait , $ method ) ; } $ this -> co...
Resolve method name conflict with aliasing the method name
231,062
public function getPageByUid ( int $ uid , int $ languageUid = null ) { return $ this -> getPage ( $ uid , $ languageUid ) ; }
Gets a page by UID .
231,063
public function getPages ( $ uids , int $ languageUid = null ) : array { $ pages = [ ] ; if ( is_string ( $ uids ) ) { $ uids = GeneralUtility :: intExplode ( ',' , $ uids , true ) ; } if ( $ uids ) { foreach ( $ uids as $ uid ) { $ record = $ this -> getPage ( $ uid , $ languageUid ) ; if ( $ record ) { $ pages [ ] = ...
Gets pages .
231,064
public function getSubpages ( int $ pid , int $ recursion = 1 , bool $ exclude = true , int $ languageUid = null ) : array { $ subpages = [ ] ; $ subpagesUids = $ this -> getSubpagesUids ( $ pid , $ recursion , $ exclude ) ; if ( $ subpagesUids ) { foreach ( $ subpagesUids as $ subpageUid ) { $ record = $ this -> getPa...
Gets the subpages of a page .
231,065
public function getSubpagesUids ( int $ pid , int $ recursion = 1 , bool $ exclude = true ) : array { $ subpagesUids = [ ] ; $ treeList = $ this -> queryGenerator -> getTreeList ( $ pid , $ recursion , 0 , 1 ) ; $ recordUids = GeneralUtility :: intExplode ( ',' , $ treeList , true ) ; if ( $ recordUids ) { foreach ( $ ...
Gets the subpages UIDs of a page .
231,066
public function build ( ) { $ this -> profiler -> log ( 'Build started' ) ; $ this -> callbacks [ 'log' ] ( "normality entity builder start" ) ; $ this -> prepare ( ) ; $ processing = $ this -> options -> getMatchingRelations ( $ skipping ) ; $ this -> callbacks [ 'log' ] ( "skipping {$skipping->count()} " . $ skipping...
Build all entities
231,067
public function getEntityGenerator ( PgClass $ pgclass , array $ options , $ entityFileStore ) { $ tags = $ this -> getNormalityTags ( ) ; $ generators = array ( 'Entity' => '\Bond\Normality\Generate\Entity' , 'Link' => '\Bond\Normality\Generate\Entity\Link' , 'Child' => '\Bond\Normality\Generate\Entity\Child' , ) ; if...
Get the entity type . Defaults to base . Set by
231,068
public function startAvg ( $ block ) { if ( $ this -> enabled ) { if ( ! isset ( $ this -> avgs [ $ block ] ) ) { $ this -> avgs [ $ block ] = array ( ) ; $ this -> avgs [ $ block ] [ 'count' ] = 0 ; $ this -> avgs [ $ block ] [ 'total' ] = 0 ; } $ this -> avgs [ $ block ] [ 'start' ] = microtime ( true ) ; if ( ! isse...
Start average block timer
231,069
public function stopAvg ( $ block ) { if ( $ this -> enabled ) { if ( ! isset ( $ this -> avgs [ $ block ] ) ) { throw new \ Exception ( 'Average block ' . $ block . ' has not been started!' ) ; } $ this -> avgs [ $ block ] [ 'stop' ] = microtime ( true ) ; if ( ! isset ( $ this -> avgs [ $ block ] [ 'stop-line' ] ) ) ...
Stop average block and calculate average
231,070
private function printAvgBlock ( $ block ) { if ( ! array_key_exists ( $ block , $ this -> avgs ) ) { throw new \ Exception ( 'Average block ' . $ block . ' not defined' ) ; } $ this -> finishAvgBlock ( $ block ) ; $ output = "" ; $ output .= " $block" ; $ output .= " [" . $ this -> avgs [ $ block ] [ 'count' ] . "]...
Print average block
231,071
public function get ( $ block ) { if ( $ this -> enabled ) { if ( ! array_key_exists ( $ block , $ this -> blocks ) ) { throw new \ Exception ( 'Block ' . $ block . ' not defined' ) ; } $ this -> finishBlock ( $ block ) ; return $ this -> blocks [ $ block ] ; } }
Get block info
231,072
public function getAvg ( $ block ) { if ( $ this -> enabled ) { if ( ! array_key_exists ( $ block , $ this -> avgs ) ) { throw new \ Exception ( 'Average block ' . $ block . ' not defined' ) ; } $ this -> finishAvgBlock ( $ block ) ; return $ this -> avgs [ $ block ] ; } }
Get average block info
231,073
private function finishAvgBlock ( $ block ) { if ( ! array_key_exists ( $ block , $ this -> avgs ) ) { throw new \ Exception ( 'Average block ' . $ block . ' not defined' ) ; } $ this -> avgs [ $ block ] [ 'avg' ] = $ this -> avgs [ $ block ] [ 'total' ] / $ this -> avgs [ $ block ] [ 'count' ] ; return $ this -> avgs ...
Finish average block
231,074
public static function create ( $ value , $ symbol ) { $ factor = static :: factorToMeters ( $ symbol ) ; $ value = number_format ( $ value , static :: $ s , '.' , '' ) ; $ factor = number_format ( $ factor , static :: $ s , '.' , '' ) ; $ meters = bcmul ( $ value , $ factor , static :: $ s ) ; $ dist = new static ( $ ...
Creates a new distance from a value and symbol .
231,075
public function unit ( $ symbol , $ string = false ) { $ m = number_format ( $ this -> m , static :: $ s , '.' , '' ) ; $ fact = number_format ( static :: factorToMeters ( $ symbol ) , static :: $ s , '.' , '' ) ; $ unit = bcdiv ( $ m , $ fact , static :: $ s ) ; $ unit = static :: removeTrailingZeros ( $ unit ) ; retu...
Returns the value of this instance at the specified unit optionally as a string with higher precision .
231,076
public function add ( Distance $ b ) { return Distance :: m ( bcadd ( $ this -> m , $ b -> m ) , static :: $ s ) ; }
Adds another distance to this instance and returns a new instance with the sum .
231,077
public function sub ( Distance $ b ) { return Distance :: m ( bcsub ( $ this -> m , $ b -> m ) , static :: $ s ) ; }
Subtracts another distance from this instance and returns a new instance with the difference .
231,078
public function format ( $ format ) { $ pattern = '/(%(?:\d+\$)?[+-]?(?:[ 0]|\'.{1})?-?\d*(?:\.\d+)?[bcdeEufFgGosxX])(.*)/' ; if ( preg_match_all ( $ pattern , $ format , $ m ) ) { $ this -> format = $ format ; $ sprintf = $ m [ 1 ] [ 0 ] ; $ unit = $ m [ 2 ] [ 0 ] ; $ value = $ this -> { trim ( $ unit ) } ; if ( $ val...
Formats this instance in the specified strign format .
231,079
private function cleanTranslations ( MediaInterface $ media ) { foreach ( $ media -> getTranslations ( ) as $ trans ) { if ( 0 == strlen ( $ trans -> getTitle ( ) ) && 0 == strlen ( $ trans -> getDescription ( ) ) ) { $ media -> removeTranslation ( $ trans ) ; } } }
Removes empty translations
231,080
private function AddOptionalParamsField ( ) { $ name = 'OptionalParameters' ; $ field = new Textarea ( $ name , $ this -> OptionalParamsText ( ) ) ; $ this -> AddField ( $ field ) ; $ this -> SetTransAttribute ( $ name , 'placeholder' ) ; }
Adds the optional parameters textarea
231,081
private function AddFragmentField ( ) { $ name = 'Fragment' ; $ field = Input :: Text ( $ name , Request :: GetData ( $ this -> prefix . 'Fragment' ) ) ; $ this -> AddField ( $ field ) ; $ this -> SetTransAttribute ( $ name , 'placeholder' ) ; }
Adds the fragment field
231,082
private function OptionalParamsText ( ) { $ params = $ this -> params ; foreach ( $ this -> oblParams as $ name ) { unset ( $ params [ $ name ] ) ; } return $ this -> serializer -> ArrayToLines ( $ params ) ; }
The field value of the optional paramaters
231,083
protected function OnSuccess ( ) { $ allParams = array ( ) ; foreach ( $ this -> oblParams as $ param ) { if ( $ this -> Value ( $ param ) ) { $ allParams [ $ param ] = $ this -> Value ( $ param ) ; } } $ optParams = $ this -> serializer -> LinesToArray ( $ this -> Value ( 'OptionalParameters' ) ) ; foreach ( $ optPara...
Saves the page selection
231,084
private function cli_header ( ) { ob_start ( ) ; print $ this -> px -> pxcmd ( ) -> get_cli_header ( ) ; print 'publish directory(tmp): ' . $ this -> path_tmp_publish . "\n" ; print 'lockfile: ' . $ this -> path_lockfile . "\n" ; print 'publish directory: ' . $ this -> path_publish_dir . "\n" ; print 'domain: ' . $ thi...
print CLI header
231,085
private function make_list_by_sitemap ( ) { $ sitemap = $ this -> px -> site ( ) -> get_sitemap ( ) ; foreach ( $ sitemap as $ page_info ) { set_time_limit ( 30 ) ; $ href = $ this -> px -> href ( $ page_info [ 'path' ] ) ; if ( preg_match ( '/^(?:[a-zA-Z0-9]+\:)?\/\//' , $ href ) ) { continue ; } $ href = preg_replace...
make list by sitemap
231,086
public function hasBundle ( $ name ) { if ( isset ( $ this -> _globalConfig [ 'bundles' ] [ $ name ] ) ) { return true ; } else { foreach ( $ this -> _bundleConfig as $ value ) { if ( $ value [ 'short_name' ] == $ name ) { return true ; } } return false ; } }
Can use shortName or Symfony Bundle Name
231,087
public function validate ( $ value ) { return is_string ( $ value ) ? Ok :: unit ( ) : Error :: unit ( [ Error :: NON_STRING ] ) ; }
Tells if a given value is a valid string .
231,088
public function finish ( ) { $ this -> end = microtime ( true ) ; $ this -> duration = $ this -> end - $ this -> start ; DBA :: addLog ( $ this ) ; }
Add the finished entry to the log
231,089
public function getPrettyStatement ( ) { $ assoc = [ ] ; $ statement = $ this -> statement ; foreach ( $ this -> data as $ key => $ value ) { if ( is_numeric ( $ key ) ) { $ statement = $ this -> strReplaceOnce ( '?' , "'" . $ value . "'" , $ statement ) ; } else { $ assoc [ ] = $ key ; } } usort ( $ assoc , function (...
Returns a readable SQL statement with the parameters merged inline . Both numeric and hashed arrays work but they can t be mixed .
231,090
public function index ( $ dirId = null ) { if ( $ dirId == 'index' ) { $ dirId = NULL ; } $ parentDir = NULL ; $ params = $ this -> getPassThruParams ( ) ; $ dir = $ this -> getDirectory ( $ dirId ) ; if ( isset ( $ params [ 'type' ] ) && $ params [ 'type' ] == 'image' ) { $ this -> filterToImages ( $ dir ) ; } $ this ...
List a directory or the root directory .
231,091
public function upload ( Request $ request , $ dirId ) { try { $ folder = $ this -> getDirOrFail ( $ dirId ) ; if ( ! $ request -> hasFile ( 'uploadedFile' ) ) { throw new RuntimeException ( 'Uploaded File not found' ) ; } $ uploadedFile = $ request -> file ( 'uploadedFile' ) ; $ uploadedFile = is_array ( $ uploadedFil...
Upload a file into the file db .
231,092
public function sync ( $ dirId ) { $ dir = $ this -> getDirOrFail ( $ dirId ) ; $ this -> fileDB -> syncWithFs ( $ dir , 1 ) ; return $ this -> redirectTo ( 'index' , [ $ dir -> getId ( ) ] ) ; }
Synchronize the filesystem into the db in this folder .
231,093
public function provideOpenLinkAttributes ( $ context , Closure $ closure ) { $ closure -> bindTo ( $ this ) ; $ this -> extend ( $ this -> getContextExtendName ( $ context ) , $ closure ) ; return $ this ; }
Assign a callable to manipulate the attributes for the open links to open files .
231,094
protected function getPassThruParams ( ) { if ( $ this -> passThruParams !== null ) { return $ this -> passThruParams ; } $ this -> passThruParams = [ ] ; $ all = Input :: all ( ) ; $ filtered = array_except ( $ all , [ 'sync' , 'uploadedFile' , 'folderName' ] ) ; if ( count ( $ filtered ) > 30 ) { throw new RuntimeExc...
Get some parameters that should be added to every link .
231,095
protected function getAttributeProvider ( $ context ) { $ extendName = $ this -> getContextExtendName ( $ context ) ; if ( $ this -> hasExtension ( $ extendName ) ) { return $ this -> getExtension ( $ extendName ) ; } return function ( $ file ) { return [ 'href' => $ file -> url , 'class' => 'inline' , 'onclick' => "wi...
Return the attribute provider to provide attributes for the open links .
231,096
private function createMoney ( int $ amount = 0 ) : ? Money { if ( ! $ this -> currency ) { return null ; } return DandomainFoundation \ createMoney ( $ this -> currency -> getIsoCodeAlpha ( ) , $ amount ) ; }
A helper method for creating a Money object from a float based on the shared currency .
231,097
public function getDescription ( $ short = false ) { if ( $ short ) { if ( $ pos = strpos ( $ this -> description , "\r" ) ) { return substr ( $ this -> description , 0 , $ pos ) ; } if ( $ pos = strpos ( $ this -> description , "\n" ) ) { return substr ( $ this -> description , 0 , $ pos ) ; } } return $ this -> descr...
Get the description from this doc comment .
231,098
public function getTagValue ( $ tag ) { if ( ! $ this -> hasTag ( $ tag ) ) { throw new \ OutOfBoundsException ( 'Tag ' . $ tag . ' is not set' ) ; } if ( empty ( $ this -> tags [ $ tag ] ) ) { throw new \ OutOfBoundsException ( 'Tag ' . $ tag . ' does not have a value' ) ; } return $ this -> tags [ $ tag ] [ 0 ] ; }
Get the value of a tag .
231,099
public function getFieldType ( NamespaceContext $ context = NULL ) { try { $ var = $ this -> getTagValue ( 'var' ) ; } catch ( \ Exception $ e ) { return new MetaType ( MetaType :: TYPE_MIXED ) ; } return $ this -> parseTypeInfo ( $ var , ( $ context === NULL ) ? new NamespaceContext ( ) : $ context ) ; }
Get the type of the field this doc comment belongs to .