idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
50,100
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
50,101
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
50,102
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
50,103
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
50,104
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
50,105
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 .
50,106
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 .
50,107
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 .
50,108
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 .
50,109
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 .
50,110
public function format ( $ message_key , $ args ) { return \ MessageFormatter :: formatMessage ( $ this -> locale , $ this -> get ( $ message_key ) , $ args ) ; }
Gets the formatted value of a message .
50,111
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
50,112
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
50,113
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 ....
50,114
private function hasTableDifference ( ) { return ! empty ( $ this -> createdTables ) || ! empty ( $ this -> alteredTables ) || ! empty ( $ this -> droppedTables ) ; }
Checks if the schema diff has table difference .
50,115
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 .
50,116
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 .
50,117
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 .
50,118
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
50,119
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
50,120
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 .
50,121
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 .
50,122
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
50,123
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
50,124
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
50,125
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
50,126
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
50,127
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
50,128
public function getDomainPart ( ) { $ parts = \ explode ( '@' , $ this -> toNative ( ) ) ; $ domain = \ trim ( $ parts [ 1 ] , '[]' ) ; return Domain :: specifyType ( $ domain ) ; }
Returns the domain part of the email address
50,129
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 .
50,130
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
50,131
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
50,132
public function getPageByUid ( int $ uid , int $ languageUid = null ) { return $ this -> getPage ( $ uid , $ languageUid ) ; }
Gets a page by UID .
50,133
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 .
50,134
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 .
50,135
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 .
50,136
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
50,137
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
50,138
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
50,139
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
50,140
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
50,141
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
50,142
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
50,143
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
50,144
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 .
50,145
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 .
50,146
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 .
50,147
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 .
50,148
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 .
50,149
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
50,150
private function AddOptionalParamsField ( ) { $ name = 'OptionalParameters' ; $ field = new Textarea ( $ name , $ this -> OptionalParamsText ( ) ) ; $ this -> AddField ( $ field ) ; $ this -> SetTransAttribute ( $ name , 'placeholder' ) ; }
Adds the optional parameters textarea
50,151
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
50,152
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
50,153
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
50,154
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
50,155
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
50,156
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
50,157
public function validate ( $ value ) { return is_string ( $ value ) ? Ok :: unit ( ) : Error :: unit ( [ Error :: NON_STRING ] ) ; }
Tells if a given value is a valid string .
50,158
public function finish ( ) { $ this -> end = microtime ( true ) ; $ this -> duration = $ this -> end - $ this -> start ; DBA :: addLog ( $ this ) ; }
Add the finished entry to the log
50,159
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 .
50,160
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 .
50,161
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 .
50,162
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 .
50,163
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 .
50,164
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 .
50,165
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 .
50,166
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 .
50,167
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 .
50,168
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 .
50,169
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 .
50,170
protected function parse ( $ comment ) { $ this -> description = '' ; $ this -> tags = [ ] ; $ comment = preg_replace ( "'^\s*/*\**'m" , '' , substr ( $ comment , 0 , - 2 ) ) ; $ parts = preg_split ( "'^\s*@([a-zA-Z][a-zA-Z0-9]*)'m" , $ comment , - 1 , PREG_SPLIT_DELIM_CAPTURE ) ; $ this -> description = preg_replace (...
Parse the given doc comment and populate description and tags .
50,171
protected function setMessage ( $ message , array $ parameters = [ ] ) { $ message = sprintf ( "%s: %s." , ( new \ ReflectionClass ( $ this ) ) -> getShortName ( ) , $ message ) ; $ parameters = array_map ( [ $ this -> getDumper ( ) , "dump" ] , $ parameters ) ; $ this -> message = call_user_func_array ( "sprintf" , ar...
Sets the error message .
50,172
public function addMethod ( $ method , callable $ callback ) { if ( ! is_string ( $ method ) ) { throw new \ InvalidArgumentException ( '$method must be string' ) ; } $ this -> plugins [ $ method ] = $ callback ; }
Dynamically add a method to the class .
50,173
public function addSetters ( array $ setters ) { foreach ( $ setters as $ property => $ setter ) { if ( is_int ( $ property ) ) { $ property = $ setter ; $ setter = 'set' . ucfirst ( $ setter ) ; } $ this -> setters [ $ setter ] = $ property ; } }
Register multiple property setters .
50,174
public function addManuallyAction ( Request $ request ) { $ response = $ this -> getCacheTimeKeeper ( ) -> getResponse ( ) ; if ( $ response -> isNotModified ( $ request ) ) { return $ response ; } $ item = new Item ( ) ; $ form = $ this -> createForm ( 'entity_item' , $ item ) -> handleRequest ( $ request ) ; if ( $ f...
Addition form .
50,175
public function changeAction ( Item $ item , Request $ request ) { $ form = $ this -> createForm ( 'entity_item' , $ item ) -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> persist ( $ item ) ; $ em -> flush ( ) ; return $ this -> redirect ( $ ...
Change item .
50,176
public function deleteAction ( Item $ item ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> remove ( $ item ) ; $ em -> flush ( ) ; return $ this -> redirect ( $ this -> generateUrl ( 'home' ) ) ; }
Delete item .
50,177
public function importAction ( $ plugin , Request $ request ) { $ chain = $ this -> get ( 'anime_db.plugin.import' ) ; if ( ! ( $ import = $ chain -> getPlugin ( $ plugin ) ) ) { throw $ this -> createNotFoundException ( 'Plugin \'' . $ plugin . '\' is not found' ) ; } $ form = $ this -> createForm ( $ import -> getFor...
Import items .
50,178
public function duplicateAction ( Request $ request ) { $ rep = $ this -> getDoctrine ( ) -> getRepository ( 'AnimeDbCatalogBundle:Item' ) ; $ item = $ request -> getSession ( ) -> get ( self :: NAME_ITEM_ADDED ) ; if ( ! ( $ item instanceof Item ) ) { throw $ this -> createNotFoundException ( 'Not found item for confi...
Confirm duplicate item .
50,179
public function limitControlAction ( Request $ request , $ total = '' ) { $ controls = $ this -> get ( 'anime_db.item.list_controls' ) ; if ( ! is_numeric ( $ total ) || $ total < 0 ) { $ rep = $ this -> getDoctrine ( ) -> getRepository ( 'AnimeDbCatalogBundle:Item' ) ; $ total = $ rep -> count ( ) ; } return $ this ->...
List items limit control .
50,180
public function sortControlAction ( Request $ request ) { $ controls = $ this -> get ( 'anime_db.item.list_controls' ) ; $ direction = $ controls -> getSortDirection ( $ request -> query -> all ( ) ) ; $ sort_direction = [ 'type' => $ direction == 'ASC' ? 'DESC' : 'ASC' , 'link' => $ controls -> getSortDirectionLink ( ...
List items sort control .
50,181
public static function editDocumentLink ( $ path ) { if ( self :: isLoggedIn ( ) ) { $ path = 0 === strpos ( $ path , '/' ) ? substr ( $ path , 1 ) : $ path ; return Request :: $ subfolders . 'cms/documents/edit-document?slug=' . urlencode ( $ path ) ; } else { return '' ; } }
Returns the cms link for editing a document
50,182
public static function newDocument ( $ path = '/' , $ documentType = '' ) { if ( self :: isLoggedIn ( ) ) { $ return = self :: getAssetsIfNotIncluded ( ) ; return $ return . '<a title="New Document" data-href="' . self :: newDocumentLink ( $ path , $ documentType ) . '" class="ccEditDocumentButton ccNewDocumentButton">...
Returns a button with a link for creating a new document
50,183
public static function newDocumentLink ( $ path = '/' , $ documentType = '' ) { if ( self :: isLoggedIn ( ) ) { $ path = 0 === strpos ( $ path , '/' ) ? $ path : '/' . $ path ; $ linkPostFix = '' ; if ( $ documentType !== '' ) { $ linkPostFix = '&amp;documentType=' . $ documentType ; } return Request :: $ subfolders . ...
Returns the cms link for creating a new document
50,184
public function resolveFile ( StorageFacilityParams $ params , $ fileid ) { return new StorageFacilityFile ( $ fileid , $ this -> generateStoragePath ( $ params , $ fileid ) , $ this -> generateUrl ( $ params , $ fileid ) ) ; }
Using storage facility params generate a StorageFacilityFile object without querying storage
50,185
protected function createProcessBuilder ( array $ arguments = [ ] , $ timeout = null ) : ProcessBuilder { $ pb = new ProcessBuilder ( $ arguments ) ; if ( null !== $ timeout ) { $ pb -> setTimeout ( $ timeout ) ; } return $ pb ; }
Creates a new process builder that your might use to interact with your virus - scanner s executable .
50,186
public function getUserProfile ( ) { if ( $ this -> _userProfile == NULL ) $ this -> _userProfile = $ this -> getAdapter ( ) -> getUserProfile ( ) ; return $ this -> _userProfile ; }
Caches the getUserProfile request to prevent rate limiting issues .
50,187
public function setProvider ( $ provider = NULL ) { if ( $ provider == NULL ) throw new CException ( Yii :: t ( 'Hybridauth.main' , "You haven't supplied a provider" ) ) ; $ this -> _provider = $ provider ; return $ this -> _provider ; }
Sets the provider for this controller to use
50,188
private function hybridAuth ( ) { if ( strtolower ( $ this -> getProvider ( ) ) == 'openid' ) { if ( ! isset ( $ _GET [ 'openid-identity' ] ) ) throw new CException ( Yii :: t ( 'Hybridauth.main' , "You chose OpenID but didn't provide an OpenID identifier" ) ) ; else $ params = array ( "openid_identifier" => $ _GET [ '...
Handles authenticating the user against the remote identity
50,189
private function authenticate ( ) { $ form = new RemoteIdentityForm ; $ form -> attributes = array ( 'adapter' => $ this -> getUserProfile ( ) , 'provider' => $ this -> getProvider ( ) ) ; return $ form -> login ( ) ; }
Authenticates in as the user
50,190
private function renderLinkForm ( ) { $ this -> layout = '//layouts/main' ; $ this -> setPageTitle ( Yii :: t ( 'HybridAuth.main' , '{{app_name}} | {{label}}' , array ( '{{app_name}}' => Cii :: getConfig ( 'name' , Yii :: app ( ) -> name ) , '{{label}}' => Yii :: t ( 'HybridAuth.main' , 'Link Your Account' ) ) ) ) ; $ ...
Renders the linking form
50,191
protected function getGroup ( string $ name ) : array { if ( ! $ this -> container -> has ( 'config_' . $ name ) ) { $ this -> loadGroup ( $ name ) ; } return $ this -> container -> get ( 'config_' . $ name ) ; }
Loads a group configuration file it has not been loaded before and returns its options . If the group doesn t exist creates an empty one .
50,192
protected function loadGroup ( string $ name ) : void { $ file = $ this -> container -> get ( 'config_dir' ) . '/' . $ name . '.php' ; $ data = \ is_file ( $ file ) ? include ( $ file ) : [ ] ; $ this -> container [ 'config_' . $ name ] = $ data ; }
Load group from file by group name .
50,193
protected function get ( $ name ) { return isset ( $ this -> disks [ $ name ] ) ? $ this -> disks [ $ name ] : $ this -> resolve ( $ name ) ; }
Attempt to get the disk from the local cache .
50,194
public function load ( array $ configs , ContainerBuilder $ container ) { $ config = $ this -> processConfiguration ( new Configuration ( ) , $ configs ) ; if ( empty ( $ config [ 'theme' ] ) ) { $ config [ 'theme' ] = array ( 'simple' => array ( ) , ) ; } else { foreach ( $ config [ 'theme' ] as & $ bundleTheme ) { if...
Loads the ZichtTinymce configuration .
50,195
protected function fetchCollection ( Select $ select ) { $ collection = [ ] ; foreach ( $ this -> selectWith ( $ select ) as $ entity ) { $ collection [ $ entity -> getIdentifier ( ) ] = $ entity ; } return $ collection ; }
Fetch array collection of entities
50,196
public function insertEntity ( EntityInterface $ entity ) { $ insert = $ this -> getSql ( ) -> insert ( ) ; $ insert -> values ( $ this -> getHydrator ( ) -> extract ( $ entity ) ) ; try { $ this -> insertWith ( $ insert ) ; } catch ( RuntimeException $ e ) { return false ; } return true ; }
Insert an new entity
50,197
public function updateEntity ( EntityInterface $ entity ) { $ update = $ this -> getSql ( ) -> update ( ) ; $ update -> set ( $ this -> getHydrator ( ) -> extract ( $ entity ) ) ; $ update -> where -> equalTo ( $ this -> getPrimaryKey ( ) , $ entity -> getIdentifier ( ) ) ; try { $ this -> updateWith ( $ update ) ; } c...
Update an existing entity
50,198
private function UpdateBundleVersions ( ) { $ this -> ClearInstalledBundles ( ) ; $ bundles = PathUtil :: Bundles ( ) ; foreach ( $ bundles as $ bundle ) { if ( ! array_key_exists ( $ bundle , $ this -> failedBundles ) ) { $ this -> UpdateBundleVersion ( $ bundle ) ; } } }
Updates database to store current bundle versions
50,199
private function UpdateBundleVersion ( $ bundle ) { $ instBundle = InstalledBundle :: Schema ( ) -> ByBundle ( $ bundle ) ; if ( ! $ instBundle ) { $ instBundle = new InstalledBundle ( ) ; } $ instBundle -> SetVersion ( $ this -> installedBundles [ $ bundle ] ) ; $ instBundle -> SetBundle ( $ bundle ) ; $ instBundle ->...
Updates the version of the bundle