idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
12,300 | public function transform ( $ dateTime ) { if ( $ dateTime === null || trim ( $ dateTime ) == '' ) { return '' ; } if ( ! $ dateTime instanceof \ DateTime ) { throw new TransformationFailedException ( 'Expected a \DateTime.' ) ; } $ dateTime = clone $ dateTime ; if ( $ this -> inputTimezone !== $ this -> outputTimezone... | Transforms a normalized date into a the concrete5 datetime widget format . |
12,301 | public function setPreMessageTemplate ( $ template = null ) { if ( null !== $ template ) { $ template = ( string ) $ template ; } $ this -> abstractOptions [ 'messageTemplates' ] [ self :: PRE_MESSAGE_TEMPLATE_KEY ] = $ template ; return $ this ; } | Sets template of validation failure message to be inserted at beginning of validation failure message map . |
12,302 | public function setPostMessageTemplate ( $ postMessage = null ) { if ( null !== $ postMessage ) { $ postMessage = ( string ) $ postMessage ; } $ this -> abstractOptions [ 'messageTemplates' ] [ self :: POST_MESSAGE_TEMPLATE_KEY ] = $ postMessage ; return $ this ; } | Sets template of validation failure message to be inserted at end of validation failure message map . |
12,303 | public function attach ( ValidatorInterface $ validator , $ showMessages = true , $ leadingTemplate = null , $ trailingTemplate = null , $ priority = self :: DEFAULT_PRIORITY ) { $ this -> validators -> insert ( array ( 'instance' => $ validator , 'show_messages' => ( bool ) $ showMessages , 'leading_message_template' ... | Attaches validator to end of chain . |
12,304 | public function prependValidator ( ValidatorInterface $ validator , $ showMessages = true , $ leadingTemplate = null , $ trailingTemplate = null ) { $ priority = self :: DEFAULT_PRIORITY ; if ( ! $ this -> validators -> isEmpty ( ) ) { $ queue = $ this -> validators -> getIterator ( ) ; $ queue -> setExtractFlags ( Pri... | Adds validator to beginning of chain . |
12,305 | protected function createMessageFromTemplate ( $ messageTemplate , $ value ) { $ message = $ this -> translateMessage ( 'dummyValue' , ( string ) $ messageTemplate ) ; if ( is_object ( $ value ) && ! in_array ( '__toString' , get_class_methods ( $ value ) ) ) { $ value = get_class ( $ value ) . ' object' ; } elseif ( i... | Constructs and returns validation failure message for specified message template and value . |
12,306 | public function merge ( VerboseOrChain $ validatorChain ) { foreach ( $ validatorChain -> validators -> toArray ( PriorityQueue :: EXTR_BOTH ) as $ item ) { $ this -> attach ( $ item [ 'data' ] [ 'instance' ] , $ item [ 'data' ] [ 'show_messages' ] , $ item [ 'data' ] [ 'leading_message_template' ] , $ item [ 'data' ] ... | Merges in logical or validator chain provided as argument . |
12,307 | private function getRawType ( \ ReflectionProperty $ property ) { $ matches = [ ] ; if ( preg_match ( '/@var\s+([^\s]+)/' , $ property -> getDocComment ( ) , $ matches ) ) { list ( , $ rawType ) = $ matches ; } else { $ rawType = 'mixed' ; } return $ rawType ; } | Returns raw string type format from the var annotation |
12,308 | public static function random ( $ length = 6 , $ pool = self :: RANDOM_POOL ) { return substr ( str_shuffle ( str_repeat ( $ pool , 5 ) ) , 0 , $ length ) ; } | Make a random string . |
12,309 | protected function locateTemplate ( FileLocatorInterface $ locator , TemplateReference $ template , array & $ templates ) { $ templates [ $ template -> getLogicalName ( ) ] = $ locator -> locate ( $ template -> getPath ( ) ) ; } | Locates and appends template to an array |
12,310 | public function validate ( $ element ) { $ docBlock = $ element -> getDocBlock ( ) ; if ( null === $ docBlock ) { throw new \ UnexpectedValueException ( 'A DocBlock should be present (and validated) before this validator can be applied' ) ; } if ( $ docBlock -> hasTag ( 'return' ) ) { $ returnTag = current ( $ docBlock... | Validates whether the given Reflector s arguments match the business rules of phpDocumentor . |
12,311 | protected function validateArguments ( $ element ) { $ params = $ element -> getDocBlock ( ) -> getTagsByName ( 'param' ) ; $ arguments = $ element -> getArguments ( ) ; foreach ( array_values ( $ arguments ) as $ key => $ argument ) { if ( ! $ this -> isArgumentInDocBlock ( $ key , $ argument , $ element , $ params ) ... | Returns an error if the given Reflector s arguments do not match expectations . |
12,312 | protected function isArgumentInDocBlock ( $ index , ArgumentReflector $ argument , BaseReflector $ element , array $ params ) { if ( isset ( $ params [ $ index ] ) ) { return null ; } return new Error ( LogLevel :: ERROR , 'PPC:ERR-50015' , $ argument -> getLinenumber ( ) , array ( $ argument -> getName ( ) , $ element... | Validates whether an argument is mentioned in the docblock . |
12,313 | protected function doesArgumentNameMatchParam ( ParamTag $ param , ArgumentReflector $ argument , BaseReflector $ element ) { $ param_name = $ param -> getVariableName ( ) ; if ( $ param_name == $ argument -> getName ( ) ) { return null ; } if ( $ param_name == '' ) { $ param -> setVariableName ( $ argument -> getName ... | Validates whether the name of the argument is the same as that of the param tag . |
12,314 | private function check_path ( ) { $ ar = \ func_get_args ( ) ; foreach ( $ ar as $ a ) { $ b = bbn \ str :: parse_path ( $ a , true ) ; if ( empty ( $ b ) && ! empty ( $ a ) ) { $ this -> error ( "The path $a is not an acceptable value" ) ; return false ; } } return 1 ; } | This checks whether an argument used for getting controller view or model - which are files - doesn t contain malicious content . |
12,315 | static function fetchByEmail ( $ email ) { $ cond = array ( 'email' => $ email ) ; $ return = eZPersistentObject :: fetchObject ( self :: definition ( ) , null , $ cond ) ; return $ return ; } | Fetch ezcomSubscriber by given email |
12,316 | public function getWsdl ( $ urlservice ) { $ aURL = explode ( '?' , $ urlservice ) ; if ( count ( $ aURL ) == 1 ) { $ urlservice .= '?wsdl' ; } $ resposta = $ this -> zCommCurl ( $ urlservice ) ; $ nPos = strpos ( $ resposta , '<wsdl:def' ) ; if ( $ nPos === false ) { $ nPos = strpos ( $ resposta , '<definit' ) ; } if ... | getWsdl Baixa o arquivo wsdl do webservice . |
12,317 | public function post ( $ url , $ body , array $ headers = array ( ) ) { if ( is_array ( $ body ) ) { $ body = http_build_query ( $ body ) ; } $ response = $ this -> getClient ( ) -> post ( $ url , $ body , $ headers ) ; if ( ! $ response instanceof Response ) { throw new InvalidType ( 'HttpInterface post method must re... | Create post request |
12,318 | public function findByUsername ( $ username ) { $ qb = $ this -> createQueryBuilder ( "u" ) ; $ qb -> where ( "(u.username = :username OR u.email = :email)" ) -> setParameter ( "username" , $ username ) -> setParameter ( "email" , $ username ) ; $ qb -> andWhere ( "u.status = :status" ) -> setParameter ( "status" , 1 )... | Find by username . |
12,319 | public function getPrefixString ( $ array , $ prefix ) { $ items = array ( ) ; if ( ! empty ( $ array ) ) { foreach ( $ array as $ item ) { preg_match ( '/' . $ prefix . '(.*)/' , $ item , $ results ) ; if ( isset ( $ results [ 1 ] ) ) { $ items [ ] = $ results [ 1 ] ; } } } return $ items ; } | Get array of string using prefix |
12,320 | public function read ( $ file ) { $ this -> file = $ file ; if ( $ this -> fs -> exists ( $ this -> file ) ) { $ this -> data = file_get_contents ( $ this -> file ) ; return $ this ; } throw new Exceptions \ FileNotExists ( $ this -> file ) ; } | Read from the file |
12,321 | public static function fromString ( $ json , $ directory = "." ) { $ json = json_decode ( $ json , true ) ; if ( is_null ( $ json ) ) throw new SettingsException ( "invalid json" ) ; return new static ( $ json , $ directory ) ; } | Creates settings from a JSON - encoded string . |
12,322 | public static function fromFile ( $ fileName ) { if ( ! file_exists ( $ fileName ) ) throw new SettingsException ( "file $fileName does not exist" ) ; return static :: fromString ( file_get_contents ( $ fileName ) , dirname ( $ fileName ) ) ; } | Creates settings from a JSON - encoded file . |
12,323 | protected function has ( $ key , $ cfg = null ) { if ( ! $ cfg ) $ cfg = $ this -> cfg ; return array_key_exists ( $ key , $ cfg ) ; } | Returns whether a plain settings array has a key . If no settings array is given the internal settings array is assumed . |
12,324 | private function _get ( $ cfg ) { $ args = array_slice ( func_get_args ( ) , 1 ) ; if ( count ( $ args ) === 0 ) return $ cfg ; else { if ( ! is_array ( $ cfg ) || ! $ this -> has ( $ args [ 0 ] , $ cfg ) ) throw new NotFoundSettingsException ( $ args [ 0 ] ) ; $ args [ 0 ] = $ cfg [ $ args [ 0 ] ] ; return call_user_f... | Returns a setting in a plain settings array . A setting path can be supplied variadically . |
12,325 | public function get ( ) { $ args = func_get_args ( ) ; array_unshift ( $ args , $ this -> cfg ) ; return call_user_func_array ( array ( $ this , "_get" ) , $ args ) ; } | Returns a setting . A setting path can be supplied variadically . |
12,326 | public function getOptional ( $ defaultValue ) { $ args = func_get_args ( ) ; try { return call_user_func_array ( array ( $ this , "get" ) , array_slice ( $ args , 0 , - 1 ) ) ; } catch ( fphp \ NotFoundSettingsException $ e ) { return $ args [ count ( $ args ) - 1 ] ; } } | Returns an optional setting defaulting to a value . A setting path can be supplied variadically . |
12,327 | private function _set ( & $ cfg , $ args ) { if ( count ( $ args ) === 2 ) { $ key = $ args [ count ( $ args ) - 2 ] ; $ value = $ args [ count ( $ args ) - 1 ] ; $ cfg [ $ key ] = $ value ; } else { if ( ! is_array ( $ cfg ) || ! $ this -> has ( $ args [ 0 ] , $ cfg ) ) throw new NotFoundSettingsException ( $ args [ 0... | Sets a setting in a plain settings array . |
12,328 | protected function setOptional ( $ key , $ value ) { if ( ! $ this -> has ( $ key ) ) $ this -> set ( $ key , $ value ) ; } | Sets a setting if it is not already set . |
12,329 | public function current ( ) { if ( ! isset ( $ this -> tokenList [ $ this -> ptr ] ) ) { throw new \ UnexpectedValueException ( "Unexpected input at offset {$this->ptr}, unexpected end of stream" ) ; } return $ this -> tokenList [ $ this -> ptr ] ; } | Returns the current token |
12,330 | public function to ( $ unit , $ precision = null ) { $ fromUnit = UnitResolver :: resolve ( $ this -> from ) ; $ toUnit = UnitResolver :: resolve ( $ unit ) ; $ this -> setBase ( $ unit ) ; $ base = $ this -> getBase ( ) == 2 ? 1024 : 1000 ; if ( $ toUnit > $ fromUnit ) return $ this -> div ( $ this -> start , pow ( $ ... | Convert the start value to the given unit . Accepts an optional precision for how many significant digits to retain |
12,331 | public function toBest ( $ precision = null ) { $ fromUnit = UnitResolver :: resolve ( $ this -> from ) ; $ base = $ this -> getBase ( ) == 2 ? 1024 : 1000 ; $ converted = $ this -> start ; while ( $ converted >= 1 ) { $ fromUnit ++ ; $ result = $ this -> div ( $ this -> start , pow ( $ base , $ fromUnit ) , $ precisio... | Convert the start value to it s highest whole unit . Accespts an optional precision for how many significant digits to retain |
12,332 | protected function div ( $ left , $ right , $ precision ) { if ( is_null ( $ precision ) ) return $ left / $ right ; return floatval ( \ bcdiv ( $ left , $ right , $ precision ) ) ; } | Use bcdiv if precision is specified otherwise use native division operator |
12,333 | protected function mul ( $ left , $ right , $ precision ) { if ( is_null ( $ precision ) ) return $ left * $ right ; return floatval ( \ bcmul ( $ left , $ right , $ precision ) ) ; } | Use bcmul if precision is specified otherwise use native multiplication operator |
12,334 | protected function shouldSetBaseTen ( $ unit ) { $ unitMatchesIec = preg_match ( UnitResolver :: IEC_PATTERN , $ unit ) ; return ( $ this -> from == 'B' && ! $ unitMatchesIec ) || ( preg_match ( UnitResolver :: SI_PATTERN , $ this -> from ) && ! $ unitMatchesIec ) ; } | Match from against the unit to see if the base should be set to 10 |
12,335 | public function isValid ( $ json = null ) { if ( empty ( $ json ) || ctype_space ( $ json ) ) return false ; json_decode ( $ json ) ; return ( json_last_error ( ) === JSON_ERROR_NONE ) ; } | Determine is valid json or not |
12,336 | public function locate ( $ name , $ dir = null , $ first = true ) { if ( '@' === $ name [ 0 ] ) { return $ this -> themeLocator -> locateTemplate ( $ name ) ; } return parent :: locate ( $ name , $ dir , $ first ) ; } | Returns a full path for a given template |
12,337 | private function buildRightJoins ( ) { $ resultArray = array ( ) ; foreach ( $ this -> rightJoins as $ rJoinPart ) { $ oneItemResult = '' ; if ( $ rJoinPart === null ) { break ; } $ reversedTables = array_reverse ( $ rJoinPart [ 'tables' ] ) ; $ reversedConditions = array_reverse ( $ rJoinPart [ 'conditions' ] ) ; list... | Returns SQL string with part of FROM clause that performs right join emulation . |
12,338 | protected function injectServices ( Container $ app ) { if ( isset ( $ app [ 'profiler' ] ) ) { $ app [ 'geocoder.logger' ] = function ( $ app ) { return new \ Geocoder \ Logger \ GeocoderLogger ( ) ; } ; $ app [ 'geocoder' ] = function ( $ app ) { $ geocoder = new \ Geocoder \ LoggableGeocoder ( ) ; $ geocoder -> setL... | Injects Geocoder related services in the application . |
12,339 | protected function injectDataCollector ( Container $ app ) { $ app [ 'data_collector.templates' ] = $ app -> extend ( 'data_collector.templates' , function ( $ templates ) { $ templates [ ] = [ 'geocoder' , '@Geocoder/Collector/geocoder.html.twig' ] ; return $ templates ; } ) ; $ app [ 'data_collectors' ] = $ app -> ex... | Injects Geocoder s data collector in the profiler |
12,340 | public static function asArray ( $ collection , $ safe = false , $ eager = false ) { $ elements = array ( ) ; foreach ( $ collection as $ key => $ element ) $ elements [ ] = $ element -> asArray ( $ safe , $ eager ) ; return $ elements ; } | Retrieve all the Collections s data in an array |
12,341 | public function canCreateServiceWithName ( ServiceLocatorInterface $ serviceLocator , $ name , $ requestedName ) { $ config = $ serviceLocator -> get ( 'config' ) ; $ class = $ this -> getClass ( $ config , $ requestedName ) ; return $ class && class_exists ( $ class ) ; } | Test if configuration exists and has class field |
12,342 | public function createServiceWithName ( ServiceLocatorInterface $ serviceLocator , $ name , $ requestedName ) { $ config = $ serviceLocator -> get ( 'config' ) ; $ class = $ this -> getClass ( $ config , $ requestedName ) ; return new $ class ( $ config [ $ requestedName ] ) ; } | Create and configure class by creating new instance of class from configuration |
12,343 | protected function getClass ( $ config , $ name ) { if ( array_key_exists ( $ name , $ config ) && is_array ( $ config [ $ name ] ) && array_key_exists ( 'class' , $ config [ $ name ] ) && is_scalar ( $ config [ $ name ] [ 'class' ] ) ) { return $ config [ $ name ] [ 'class' ] ; } return false ; } | Look for class name in configuration |
12,344 | public function connect ( ) { if ( ! class_exists ( 'SQLite3' ) ) { throw new Exceptions \ UnableToConnectException ( 'SQLite3 PHP extension is not available. It probably has not ' . 'been installed. Please install and configure it in order to use ' . 'SQLite3.' ) ; } $ filename = $ this -> config [ 'SQLite3' ] [ 'file... | Connect to the SQLite3 database . |
12,345 | public function disconnect ( ) { if ( $ this -> connected ) { if ( is_a ( $ this -> link , 'SQLite3' ) ) { $ this -> link -> exec ( "PRAGMA optimize;" ) ; $ this -> link -> close ( ) ; } $ this -> connected = false ; } return $ this -> connected ; } | Disconnect from the SQLite3 database . |
12,346 | public function log ( $ message ) { if ( ! empty ( $ this -> log_file ) ) { \ file_put_contents ( $ this -> log_file , "\n" . $ message , \ FILE_APPEND ) ; } } | Logs messages to a log file if it is set |
12,347 | public function open ( ) { $ host = "{" . $ this -> host . ":" . $ this -> port . "/" . $ this -> protocol . "/notls}INBOX" ; $ this -> inbox = \ imap_open ( $ host , $ this -> address , $ this -> pass ) ; if ( ! $ this -> inbox ) { $ this -> connected = 0 ; } else { $ this -> connected = 1 ; } return $ this -> connect... | Opens the inbox and returns the connection status |
12,348 | public function close ( $ expunge ) { if ( $ expunge ) { \ imap_close ( $ this -> inbox , CL_EXPUNGE ) ; } else { \ imap_close ( $ this -> inbox ) ; } } | Closes the inbox and expunges deleted messages if expunge is true |
12,349 | public function parseHeaderInfo ( Email & $ email , $ header ) { $ email -> all_headers = $ header ; $ email -> subject = $ header -> subject ; $ email -> to = $ header -> to [ 0 ] -> mailbox . '@' . $ header -> to [ 0 ] -> host ; $ email -> from = $ header -> from [ 0 ] -> mailbox . '@' . $ header -> from [ 0 ] -> hos... | Parses header information from an email and returns it to as properties of the email object |
12,350 | private function examinePart ( & $ email , $ part ) { $ subtype = \ strtolower ( $ part -> subtype ) ; $ encoding = $ part -> encoding ; switch ( $ subtype ) { case 'plain' : if ( empty ( $ email -> body ) ) { $ email -> body_encoding = $ encoding ; $ email -> body = imap_fetchbody ( $ this -> inbox , $ email -> index ... | Check in an email part for attachments and data |
12,351 | public function fetchMessages ( ) { $ this -> countMessages ( ) ; if ( $ this -> email_count == 0 ) { $ this -> log ( 'There are no emails to process!' ) ; return false ; } $ this -> log ( $ this -> email_count . ' ' . \ Strings :: pluralize ( $ this -> email_count , 'email' ) . ' to process.' ) ; for ( $ i = 1 ; $ i <... | Fetches all the messages in an inbox and put them in the emails array |
12,352 | public function index ( TeamRequest $ request ) { $ view = $ this -> response -> theme -> listView ( ) ; if ( $ this -> response -> typeIs ( 'json' ) ) { $ function = camel_case ( 'get-' . $ view ) ; return $ this -> repository -> setPresenter ( \ Litecms \ Team \ Repositories \ Presenter \ TeamPresenter :: class ) -> ... | Display a list of team . |
12,353 | public function show ( TeamRequest $ request , Team $ team ) { if ( $ team -> exists ) { $ view = 'team::team.show' ; } else { $ view = 'team::team.new' ; } return $ this -> response -> title ( trans ( 'app.view' ) . ' ' . trans ( 'team::team.name' ) ) -> data ( compact ( 'team' ) ) -> view ( $ view , true ) -> output ... | Display team . |
12,354 | public function edit ( TeamRequest $ request , Team $ team ) { return $ this -> response -> title ( trans ( 'app.edit' ) . ' ' . trans ( 'team::team.name' ) ) -> view ( 'team::team.edit' , true ) -> data ( compact ( 'team' ) ) -> output ( ) ; } | Show team for editing . |
12,355 | public function update ( TeamRequest $ request , Team $ team ) { try { $ attributes = $ request -> all ( ) ; $ team -> update ( $ attributes ) ; return $ this -> response -> message ( trans ( 'messages.success.updated' , [ 'Module' => trans ( 'team::team.name' ) ] ) ) -> code ( 204 ) -> status ( 'success' ) -> url ( gu... | Update the team . |
12,356 | public function destroy ( TeamRequest $ request , Team $ team ) { try { $ team -> delete ( ) ; return $ this -> response -> message ( trans ( 'messages.success.deleted' , [ 'Module' => trans ( 'team::team.name' ) ] ) ) -> code ( 202 ) -> status ( 'success' ) -> url ( guard_url ( 'team/team/0' ) ) -> redirect ( ) ; } ca... | Remove the team . |
12,357 | public function Quality ( $ quality ) { $ variant = $ this -> owner -> variantName ( __FUNCTION__ , $ quality ) ; return $ this -> owner -> manipulateImage ( $ variant , function ( Image_Backend $ backend ) use ( $ quality ) { $ backendClone = clone $ backend ; $ backendClone -> setQuality ( $ quality ) ; return $ back... | This function adjusts the quality of of an image using SilverStripe 4 syntax . |
12,358 | protected function httpPatch ( string $ path , $ body , array $ requestHeaders = [ ] ) : ResponseInterface { $ requestHeaders [ 'Content-Type' ] = 'application/json' ; return $ response = $ this -> httpClient -> sendRequest ( $ this -> requestBuilder -> create ( 'PATCH' , $ path , $ requestHeaders , json_encode ( $ bod... | Send a PATCH request with json encoded data . |
12,359 | protected function getCurrentNode ( ) { libxml_clear_errors ( ) ; $ node = @ $ this -> reader -> expand ( ) ; $ error = libxml_get_last_error ( ) ; if ( $ error instanceof LibXMLError ) { if ( $ error -> level > LIBXML_ERR_WARNING ) { throw new EssenceException ( sprintf ( '%s @ line #%d [%s]' , trim ( $ error -> messa... | Get the current node |
12,360 | protected function nextElement ( ) { do { if ( ! $ this -> reader -> read ( ) ) { return false ; } $ this -> stack = array_slice ( $ this -> stack , 0 , $ this -> reader -> depth , true ) ; $ this -> stack [ ] = $ this -> reader -> name ; $ this -> current = implode ( '/' , $ this -> stack ) ; $ this -> skip = ( $ this... | Read the next Element and handle skipping |
12,361 | protected function getData ( $ xpath ) { $ xpath = trim ( $ xpath , '/' ) ; if ( isset ( $ this -> data [ $ xpath ] ) ) { return $ this -> data [ $ xpath ] ; } throw new EssenceException ( 'Unregistered Element XPath: "/' . $ xpath . '"' ) ; } | Get registered Element data |
12,362 | protected static function DOMNodeChildCount ( DOMNode $ node ) { $ count = 0 ; if ( $ node -> hasChildNodes ( ) ) { foreach ( $ node -> childNodes as $ child ) { if ( $ child -> nodeType == XML_ELEMENT_NODE ) { $ count ++ ; } } } return $ count ; } | Count the children of a DOMNode |
12,363 | protected static function DOMNodeAttributes ( DOMNode $ node ) { $ attributes = array ( ) ; foreach ( $ node -> attributes as $ attribute ) { $ attributes [ $ attribute -> name ] = $ attribute -> value ; } return $ attributes ; } | Get the DONNode attributes |
12,364 | protected static function DOMNodeValue ( DOMNode $ node , $ associative = false , $ attributes = false ) { if ( static :: DOMNodeChildCount ( $ node ) == 0 && ( $ node -> hasAttributes ( ) === false || $ attributes === false ) ) { return $ node -> nodeValue ; } $ children = array ( ) ; if ( $ node -> hasAttributes ( ) ... | Get the DOMNode value |
12,365 | public static function DOMNodeListToArray ( DOMNodeList $ nodeList , $ associative = false , $ attributes = false ) { $ nodes = array ( ) ; foreach ( $ nodeList as $ node ) { $ nodes [ ] = static :: DOMNodeValue ( $ node , $ associative , $ attributes ) ; } return $ nodes ; } | Convert a DOMNodeList into an Array |
12,366 | public function dump ( $ input , array $ config = array ( ) ) { $ config = array_replace_recursive ( array ( 'encoding' => 'UTF-8' , 'options' => LIBXML_PARSEHUGE , ) , $ config ) ; $ this -> prepare ( $ input , $ config ) ; $ paths = array ( ) ; while ( $ this -> nextElement ( ) ) { if ( ! $ this -> reader -> isEmptyE... | Dump XPaths and all their occurrences |
12,367 | public function validateLicenseUrl ( $ str ) { if ( $ str ) { return ( $ this -> validateUrl ( $ str ) || $ this -> validatePackageName ( $ str ) ) ; } return true ; } | Validate License url |
12,368 | public function validateCompatible ( array $ data ) { if ( ! count ( $ data ) ) { return true ; } $ count = 0 ; foreach ( $ data as $ k => $ v ) { foreach ( array ( 'name' , 'channel' , 'min' , 'max' ) as $ fld ) { $ $ fld = trim ( $ v [ $ fld ] ) ; } $ count ++ ; $ res = $ this -> validateUrl ( $ channel ) && strlen (... | Validate compatible data |
12,369 | public function validateAuthors ( array $ authors ) { if ( ! count ( $ authors ) ) { $ this -> addError ( 'Empty authors section' ) ; return false ; } $ count = 0 ; foreach ( $ authors as $ k => $ v ) { $ count ++ ; array_map ( 'trim' , $ v ) ; $ name = $ v [ 'name' ] ; $ login = $ v [ 'user' ] ; $ email = $ v [ 'email... | Validate authors of package |
12,370 | public function validateDate ( $ date ) { $ subs = null ; $ check1 = preg_match ( "/^([\d]{4})-([\d]{2})-([\d]{2})$/i" , $ date , $ subs ) ; if ( ! $ check1 ) { return false ; } return checkdate ( $ subs [ 2 ] , $ subs [ 3 ] , $ subs [ 1 ] ) ; } | Validate date format |
12,371 | public function input ( $ type , $ options = [ ] ) { $ options = array_merge ( $ this -> inputOptions , [ 'class' => 'hint-' . Html :: getInputId ( $ this -> model , $ this -> attribute ) ] ) ; $ this -> adjustLabelFor ( $ options ) ; $ this -> parts [ '{input}' ] = Html :: activeInput ( $ type , $ this -> model , $ th... | Renders an input tag . |
12,372 | public function getOption ( InputInterface $ input , $ name , $ configPath = null , $ default = null , $ commaSeparated = false ) { $ value = $ input -> getOption ( $ name ) ; if ( $ this -> valueIsEmpty ( $ value ) && $ configPath !== null ) { $ value = $ this -> getConfigValueFromPath ( $ configPath ) ; } if ( $ this... | Returns the value of an option from the command - line parameters configuration or given default . |
12,373 | protected function splitCommaSeparatedValues ( $ value ) { if ( ! is_array ( $ value ) || ( count ( $ value ) == 1 ) && is_string ( current ( $ value ) ) ) { $ value = ( array ) $ value ; $ value = explode ( ',' , $ value [ 0 ] ) ; } return $ value ; } | Split comma separated values . |
12,374 | public function getConfigValueFromPath ( $ path ) { $ node = $ this -> configuration ; foreach ( explode ( '/' , $ path ) as $ nodeName ) { if ( ! is_object ( $ node ) ) { return null ; } $ node = $ node -> { 'get' . ucfirst ( $ nodeName ) } ( ) ; } return $ node ; } | Returns a value by traversing the configuration tree as if it was a file path . |
12,375 | public function load ( ConfigFile $ master , ConfigFile $ slave ) { $ this -> master = $ master ; $ this -> slave = $ slave ; return $ this ; } | Loads the master and slave files |
12,376 | public function merge ( ) { if ( $ this -> saveBackupBeforeMerge ) { $ this -> saveBackup ( ) ; } $ this -> master -> params ( ) -> merge ( $ this -> slave -> params ( ) -> all ( ) ) ; if ( $ this -> autoSaveMaster ) { $ this -> master -> save ( ) ; } if ( $ this -> deleteSlaveOnMerge ) { $ this -> slave -> delete ( ) ... | Performs the merge action |
12,377 | public function restore ( ) { $ this -> master -> params ( ) -> rollback ( ) ; $ this -> slave -> params ( ) -> rollback ( ) ; $ this -> master -> save ( ) ; $ this -> slave -> save ( ) ; } | Restores the files |
12,378 | public function updateCron ( SmileEzCron $ cron , $ type , $ value ) { switch ( $ type ) { case 'expression' : if ( ! CronExpression :: isValidExpression ( $ value ) ) { throw new InvalidArgumentException ( 'expression' , 'cron.invalid.type' ) ; } $ cron -> setExpression ( $ value ) ; break ; case 'arguments' : if ( pr... | Edit cron definition |
12,379 | public function & SetAllowedLocalizations ( ) { $ allowedLocalizations = func_get_args ( ) ; if ( count ( $ allowedLocalizations ) === 1 && is_array ( $ allowedLocalizations [ 0 ] ) ) $ allowedLocalizations = $ allowedLocalizations [ 0 ] ; $ this -> allowedLocalizations = array_combine ( $ allowedLocalizations , $ allo... | Set allowed localizations for the routed module if there is used any variant of module router with localization . |
12,380 | protected function trriggerUnusedMethodError ( $ method ) { $ selfClass = version_compare ( PHP_VERSION , '5.5' , '>' ) ? self :: class : __CLASS__ ; trigger_error ( "[$selfClass] The method `$method` is not used in this extended class." , E_USER_WARNING ) ; return $ this ; } | Trigger E_USER_WARNING user error about not used method in this extended module domain route . |
12,381 | public function executeSending ( $ subject , $ body , $ subscriber ) { $ email = $ subscriber -> attribute ( 'email' ) ; $ parameters = array ( ) ; $ parameters [ 'content_type' ] = $ this -> emailContentType ; $ parameters [ 'from' ] = $ this -> emailFrom ; $ transport = eZNotificationTransport :: instance ( 'ezmail' ... | Execute sending process in Email |
12,382 | public function setAuthProviders ( array $ params = array ( ) ) { if ( ! isset ( $ params [ 'providers' ] ) ) { throw new MissingArgumentException ( 'providers' ) ; } if ( ! is_array ( $ params [ 'providers' ] ) ) { throw new InvalidArgumentException ( 'Invalid Argument: providers must be passed as array' ) ; } $ param... | Defines the list of identity providers provided by the Engage server to sign - in widgets . This is the same list that is managed by the dashboard . |
12,383 | public function selectDistinct ( ) { if ( $ this -> selectString == null ) { $ this -> selectString = 'SELECT DISTINCT ' ; } elseif ( strpos ( $ this -> selectString , 'DISTINCT' ) === false ) { throw new ezcQueryInvalidException ( 'SELECT' , 'You can\'t use selectDistinct() after using select() in the same query.' ) ;... | Opens the query and uses a distinct select on the columns you want to return with the query . |
12,384 | public function getQuery ( ) { if ( $ this -> selectString == null ) { throw new ezcQueryInvalidException ( "SELECT" , "select() was not called before getQuery()." ) ; } $ query = "{$this->selectString}" ; if ( $ this -> fromString != null ) { $ query = "{$query} {$this->fromString}" ; } if ( $ this -> whereString != n... | Returns the complete select query string . |
12,385 | public function injectIdentityModel ( MvcEvent $ event ) { $ viewModel = $ event -> getViewModel ( ) ; if ( $ viewModel -> getTemplate ( ) == 'layout/layout' ) { $ servies = $ event -> getApplication ( ) -> getServiceManager ( ) ; $ appConfig = $ servies -> get ( 'config' ) ; if ( isset ( $ appConfig [ 'view_model_iden... | Inject identity view model into layout |
12,386 | public function create ( string $ projectKey , string $ name , array $ params = [ ] ) { $ params [ 'name' ] = $ name ; $ response = $ this -> httpPost ( sprintf ( '/api/v2/projects/%s/keys' , $ projectKey ) , $ params ) ; if ( ! $ this -> hydrator ) { return $ response ; } if ( $ response -> getStatusCode ( ) !== 200 &... | Create a new key . |
12,387 | public function search ( string $ projectKey , array $ params = [ ] ) { $ q = '' ; if ( isset ( $ params [ 'tags' ] ) ) { $ q .= 'tags:' . $ params [ 'tags' ] . ' ' ; } if ( isset ( $ params [ 'name' ] ) ) { $ q .= 'name:' . $ params [ 'name' ] . ' ' ; } if ( isset ( $ params [ 'ids' ] ) ) { $ q .= 'ids:' . $ params [ ... | Search keys . |
12,388 | public function delete ( string $ projectKey , string $ keyId ) { $ response = $ this -> httpDelete ( sprintf ( '/api/v2/projects/%s/keys/%s' , $ projectKey , $ keyId ) ) ; if ( ! $ this -> hydrator ) { return $ response ; } if ( $ response -> getStatusCode ( ) !== 204 ) { $ this -> handleErrors ( $ response ) ; } retu... | Delete a key . |
12,389 | private function setPayloadParameter ( string $ parameter , $ value ) : void { $ this -> checkParameterType ( $ value ) ; $ this -> defaultSetPayloadParameter ( $ parameter , $ value ) ; } | Set payload parameter . |
12,390 | final protected function checkParameterType ( $ value ) : void { if ( \ is_array ( $ value ) ) { foreach ( $ value as $ val ) { $ this -> checkParameterType ( $ val ) ; } } elseif ( $ value !== null && ! \ is_scalar ( $ value ) ) { throw new InvalidScalarParameterException ( \ sprintf ( 'Class %s can only accept scalar... | Check only scalar types allowed . |
12,391 | public function parse ( ) { $ raw = $ this -> getRaw ( ) ; $ count = count ( $ raw ) ; for ( $ i = 7 ; $ i < $ count ; $ i ++ ) { $ line = $ raw [ $ i ] ; $ process = new Process ( $ line [ 11 ] , $ line [ 0 ] , floatval ( $ line [ 8 ] ) , floatval ( $ line [ 9 ] ) ) ; $ this -> processes [ ] = $ process ; } } | Run the parsing process |
12,392 | public function setItems ( $ items = array ( ) ) { $ this -> items = array ( ) ; foreach ( $ items as $ key => $ item ) { if ( ! is_numeric ( $ key ) && is_array ( $ item ) ) { if ( array_key_exists ( '1' , $ item ) ) { $ this -> setItems ( $ item ) ; return false ; } else { $ this -> push ( $ item ) ; } } elseif ( is_... | Set all the items at once |
12,393 | public function push ( $ item ) { $ full_class_name = $ this -> getFullClassName ( ) ; if ( is_array ( $ item ) ) { array_push ( $ this -> items , new $ full_class_name ( $ item ) ) ; } elseif ( $ item instanceof $ full_class_name ) { array_push ( $ this -> items , $ item ) ; } } | Add a new item to the collection |
12,394 | public static function isInt ( $ int ) { return ( is_string ( $ int ) || is_int ( $ int ) || is_float ( $ int ) ) && ctype_digit ( ( string ) $ int ) ; } | Checks to see if str float or int type and represents whole number |
12,395 | public function setQueryParameter ( $ name , $ value ) { $ this -> query [ ( string ) $ name ] = ( string ) $ value ; return $ this ; } | Set a query parameter . |
12,396 | public function getQueryParameter ( $ name ) { return isset ( $ this -> query [ $ name ] ) ? $ this -> query [ $ name ] : null ; } | Retrieve the value of a query parameter . |
12,397 | public function addQueryParameters ( $ queryString ) { $ queries = preg_split ( '/&(amp;)?/i' , $ queryString ) ; foreach ( $ queries as $ v ) { $ explode = explode ( '=' , $ v ) ; $ name = $ explode [ 0 ] ; $ value = isset ( $ explode [ 1 ] ) ? $ explode [ 1 ] : '' ; $ rpos = strrpos ( $ name , '?' ) ; if ( $ rpos !==... | Absorb the query parameters from a query string . |
12,398 | public function getBaseUrl ( ) { $ url = '' ; if ( isset ( $ this -> scheme ) ) { if ( '' !== $ this -> scheme ) { $ url .= $ this -> scheme . ':' ; } $ url .= '//' ; } if ( isset ( $ this -> user ) ) { $ url .= $ this -> user ; if ( isset ( $ this -> pass ) ) { $ url .= ':' . $ this -> pass ; } $ url .= '@' ; } $ url ... | Retrieve the base url . |
12,399 | public function getUrl ( ) { $ url = $ this -> getBaseUrl ( ) ; if ( $ query = $ this -> getQueryString ( ) ) { if ( $ url ) { if ( ! $ this -> path ) { $ url .= '/' ; } $ url .= '?' ; } $ url .= $ query ; } if ( isset ( $ this -> fragment ) ) { $ url .= '#' . $ this -> fragment ; } return $ url ; } | Retrieve the complete generated URL . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.