idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
237,200 | private function setTableHeader ( $ aElements , $ bHeadersBreaked ) { $ aTableHeader = $ aElements ; if ( $ bHeadersBreaked ) { $ aTableHeader = $ this -> setArrayToArrayKbr ( $ aElements ) ; } $ sReturn = [ ] ; foreach ( array_keys ( $ aTableHeader ) as $ value ) { $ sReturn [ ] = $ this -> setStringIntoTag ( $ value ... | Generates a table header |
237,201 | public function setNovaData ( Rock_Datet_DateObj $ dateObj ) { $ this -> format = $ dateObj -> getFormat ( ) ; $ this -> ts = $ dateObj -> getTimeStamp ( ) ; } | Substituir data de referencia por uma nova . |
237,202 | private function somaDia ( $ qtdDias ) { $ somaDia = $ qtdDias ; if ( $ qtdDias > 0 ) { $ somaDia = "+$qtdDias" ; } $ ts = strtotime ( "$somaDia day" , $ this -> ts ) ; return $ ts ; } | Soma dias . |
237,203 | private function ultimoDiaMes ( ) { $ ts = $ this -> ts ; $ mesAtual = strftime ( '%m' , $ ts ) ; $ mesTmp = $ mesAtual ; $ i = 0 ; while ( $ mesAtual == $ mesTmp ) { $ ts = $ this -> somaDia ( ++ $ i ) ; $ mesTmp = strftime ( '%m' , $ ts ) ; } return $ this -> somaDia ( -- $ i ) ; } | Calcula ultimo dia do mes . |
237,204 | public function syncPackages ( $ type ) { $ criteria = [ 'type' => $ type ] ; $ em = $ this -> getDoctrineHelper ( ) -> getEntityManager ( ) ; $ searchResults = $ this -> getHelper ( ) -> getPackages ( $ criteria ) ; foreach ( $ searchResults as $ result ) { $ package = $ this -> getHelper ( ) -> getPackage ( $ result ... | Searches for all packages of particular type and adds them to Smuggler |
237,205 | public function getConsoleCommandArguments ( Request $ request ) { $ port = ( int ) $ request -> attributes -> get ( 'port' ) ; $ package = $ request -> attributes -> get ( 'id' ) ; $ operation = $ request -> attributes -> get ( 'operation' ) ; return [ 'app/console' , 'wellcommerce:package:' . $ operation , '--port=' ... | Returns console command arguments |
237,206 | public function changePackageStatus ( Request $ request ) { $ id = $ request -> attributes -> get ( 'id' ) ; $ em = $ this -> getDoctrineHelper ( ) -> getEntityManager ( ) ; $ repository = $ this -> getRepository ( ) ; $ package = $ repository -> find ( $ id ) ; if ( null === $ package ) { throw new EntityNotFoundExcep... | Changes package info according to operation and data fetched from PackagistAPI |
237,207 | public static function fromString ( string $ dateTimeString , string $ timeZoneId ) : TimezonedDateTime { return new self ( new \ DateTimeImmutable ( $ dateTimeString , new \ DateTimeZone ( $ timeZoneId ) ) ) ; } | Creates a DateTime object from the supplied date string |
237,208 | public function convertTimezone ( string $ timezoneId ) : TimezonedDateTime { return new TimezonedDateTime ( ( new \ DateTimeImmutable ( 'now' , new \ DateTimeZone ( $ timezoneId ) ) ) -> setTimestamp ( $ this -> dateTime -> getTimestamp ( ) ) ) ; } | Returns the current date time according to the supplied timezone |
237,209 | public static function secondsSinceMidnightStr ( $ time ) { $ time_a = explode ( ':' , $ time ) ; switch ( count ( $ time_a ) ) { case 0 : case 1 : return null ; case 2 : $ time_a [ ] = 0 ; break ; case 3 : break ; default : return null ; } return self :: secondsSinceMidnight ( ( int ) $ time_a [ 0 ] , ( int ) $ time_a... | Return number of seconds since midnight . |
237,210 | public static function formatStrTime ( $ time , $ withSeconds = true ) { $ time = str_pad ( $ time . '' , 6 , '0' , STR_PAD_LEFT ) ; $ _time = array ( ) ; $ _time [ ] = substr ( $ time , 0 , 2 ) ; $ _time [ ] = substr ( $ time , 2 , 2 ) ; if ( $ withSeconds ) { $ _seconds = substr ( $ time , 4 , 2 ) ; $ _time [ ] = $ _... | Takes time in hhmmss format and returns formatted string . |
237,211 | final public function interpolate ( $ message , array $ context = array ( ) ) { return strtr ( $ message , array_combine ( array_map ( function ( $ key ) { return "{{$key}}" ; } , array_keys ( $ context ) ) , array_values ( $ context ) ) ) ; } | This is the default method for interpolating in PSR - 3 loggers |
237,212 | public static function isWord ( $ word ) { if ( ! is_string ( $ word ) ) { return false ; } return ( bool ) preg_match ( self :: WORD_FILTER , $ word ) ; } | Filters non - words out . |
237,213 | public function handleError ( $ errNumber , $ errString , $ errFile = '' , $ errLine = 0 ) { $ interfaceSettings = $ this -> cmd -> getConfigOpt ( 'interface' ) ; $ textColor = $ interfaceSettings [ 'error' ] [ 'text_color' ] ; $ textBgColor = $ interfaceSettings [ 'error' ] [ 'text_background' ] ; $ this -> env -> sen... | Handles generated errors . |
237,214 | public static function redirect ( $ url , array $ parameters = [ ] , int $ statusCode = Response :: STATUS_MOVED_PERMANENTLY ) : Response { if ( ! empty ( $ parameters ) ) { $ url = $ url . '?' . http_build_query ( $ parameters ) ; } $ headers = new Headers ( ) ; $ headers -> add ( new Header ( 'Location' , $ url ) ) ;... | Redirect to a url |
237,215 | public static function createFromString ( string $ string ) : Response { $ lines = explode ( "\r\n" , $ string ) ; list ( $ httpVersion , $ statusCode , $ statusText ) = explode ( ' ' , array_shift ( $ lines ) , 3 ) ; $ headers = new Headers ( ) ; foreach ( $ lines as $ index => $ line ) { unset ( $ lines [ $ index ] )... | Create a Response object from a string |
237,216 | public function getStatusLine ( ) : string { return sprintf ( 'HTTP/%s %s %s' , self :: HTTP_VERSION , $ this -> statusCode , self :: getStatusText ( $ this -> statusCode ) ) ; } | Get the complete status line |
237,217 | public function send ( ) { if ( headers_sent ( ) ) { throw new HttpException ( Response :: STATUS_INTERNAL_SERVER_ERROR , 'Headers already send' ) ; } header ( $ this -> getStatusLine ( ) ) ; foreach ( $ this -> headers as $ header ) { header ( $ header ) ; } echo $ this -> body ; } | Sends the response to the web server |
237,218 | public function isTranslatable ( $ vid ) { if ( ! is_numeric ( $ vid ) ) { $ vid = $ this -> vocabulary ( $ vid ) ; } return $ this -> vocabularyById [ $ vid ] -> isTranslatable ( ) ; } | Is this vocabulary translatable ? |
237,219 | public function getLanguage ( $ vocabulary_id , $ language_id = null ) { if ( ! $ this -> isTranslatable ( $ vocabulary_id ) ) { return 1 ; } if ( $ language_id === null ) { return I18N :: getCurrentId ( ) ; } return $ language_id ; } | Get the internal language for the vocabulary |
237,220 | public function vocabulary ( $ key ) { if ( is_numeric ( $ key ) ) { return $ this -> vocabularyById [ $ key ] -> machine_name ; } return $ this -> vocabularyByName [ $ key ] -> id ; } | Get a vocabulary by name or ID |
237,221 | public function uncacheTerm ( $ term_id ) { if ( array_key_exists ( $ term_id , $ this -> terms ) ) { unset ( $ this -> terms [ $ term_id ] ) ; } return $ this -> termRepository -> uncacheTerm ( $ term_id ) ; } | Remove a term from the cache |
237,222 | public function addParent ( $ term_id , $ parent_id ) { $ this -> testCanAddParents ( $ term_id , 1 ) ; $ this -> termHierarchyRepository -> addParent ( $ term_id , $ parent_id ) ; } | Add one parent to a term |
237,223 | public function addParents ( $ term_id , array $ parent_ids ) { $ this -> testCanAddParents ( $ term_id , count ( $ parent_ids ) ) ; foreach ( $ parent_ids as $ id ) { $ this -> termHierarchyRepository -> addParent ( $ term_id , $ id ) ; } } | Add a list of parents to a term |
237,224 | public function getTermsForVocabulary ( $ vocabulary_id ) { return $ this -> cache -> remember ( 'Rocket::Taxonomy::Terms::' . $ vocabulary_id , 60 , function ( ) use ( $ vocabulary_id ) { $ terms = TermContainer :: where ( 'vocabulary_id' , $ vocabulary_id ) -> get ( [ 'id' ] ) ; $ results = [ ] ; if ( ! empty ( $ ter... | Get all the terms of a vocabulary |
237,225 | public function searchTerm ( $ term , $ vocabulary_id , $ language_id = null , $ exclude = [ ] ) { $ language_id = $ this -> getLanguage ( $ vocabulary_id , $ language_id ) ; $ term = trim ( $ term ) ; if ( $ term == '' ) { return ; } $ query = TermData :: select ( 'taxonomy_terms.id' ) -> join ( 'taxonomy_terms' , 'ta... | Search a specific term if it doesn t exist returns false |
237,226 | public function getTermId ( $ title , $ vocabulary_id , $ language_id = null , $ type = 0 ) { $ title = trim ( $ title ) ; if ( $ title == '' ) { return false ; } if ( ! is_numeric ( $ vocabulary_id ) ) { $ vocabulary_id = $ this -> vocabulary ( $ vocabulary_id ) ; } $ language_id = $ this -> getLanguage ( $ vocabulary... | Returns the id of a term if it doesn t exist creates it . |
237,227 | public function getTermIds ( $ taxonomies ) { $ tags = [ ] ; foreach ( $ taxonomies as $ voc => $ terms ) { $ vocabulary_id = $ this -> vocabulary ( $ voc ) ; $ exploded = is_array ( $ terms ) ? $ terms : explode ( ',' , $ terms ) ; foreach ( $ exploded as $ term ) { $ result = $ this -> getTermId ( $ term , $ vocabula... | Adds one or more tags and returns an array of id s |
237,228 | public function getHttp ( ) { if ( ! $ this -> http ) { $ this -> http = new Http ( ) ; $ this -> http -> setRequest ( $ this ) ; } return $ this -> http ; } | Returns Http object |
237,229 | protected function getCountCommon ( $ data = array ( ) ) { parent :: getCountCommon ( $ data ) ; $ oDb = Factory :: service ( 'Database' ) ; $ oDb -> select ( $ this -> tableAlias . '.*' ) ; if ( ! empty ( $ data [ 'include_count' ] ) ) { $ subQuery = ' SELECT COUNT(DISTINCT post_id) ... | Set some common data |
237,230 | public function create ( $ aData , $ bReturnObject = false ) { $ aCategoryData = array ( ) ; if ( empty ( $ aData [ 'label' ] ) ) { $ this -> setError ( '"label" is a required field.' ) ; return false ; } else { $ aCategoryData [ 'label' ] = trim ( $ aData [ 'label' ] ) ; } if ( empty ( $ aData [ 'blog_id' ] ) ) { $ th... | Creates a new category |
237,231 | public function update ( $ iId , $ aData ) { $ aCategoryData = array ( ) ; if ( empty ( $ aData [ 'label' ] ) ) { $ this -> setError ( '"label" is a required field.' ) ; return false ; } else { $ aCategoryData [ 'label' ] = trim ( $ aData [ 'label' ] ) ; } $ aCategoryData [ 'slug' ] = $ this -> generateSlug ( $ aData [... | Updates an existing category |
237,232 | public function replaceTokens ( $ text ) { $ tokens = $ this -> macro -> search ( $ text ) ; if ( empty ( $ tokens ) ) { return $ text ; } static $ last = [ ] ; $ replacements = [ ] ; foreach ( $ tokens as $ type => $ typeTokens ) { foreach ( $ typeTokens as $ name => $ token ) { if ( $ type == "any" ) { $ value = $ th... | Replace fake data tokens . |
237,233 | public function replaceTableTokens ( TableNode $ input ) { $ table = $ input -> getTable ( ) ; foreach ( $ table as $ row => $ values ) { foreach ( $ values as $ idx => $ value ) { $ table [ $ row ] [ $ idx ] = $ this -> replaceTokens ( $ value ) ; } } return new TableNode ( $ table ) ; } | Replace fake data tokens in tables . |
237,234 | public function gatherContexts ( BeforeScenarioScope $ scope ) { $ environment = $ scope -> getEnvironment ( ) ; $ this -> mink = $ environment -> getContext ( 'Starbug\Behat\Context\MinkContext' ) ; } | Access other contexts . |
237,235 | public function send ( $ destination , $ text ) { $ response = $ this -> browser -> post ( 'http://distext.wavy.be/api/sms' , array ( 'X-Auth-Token' => $ this -> apiKey , ) , json_encode ( [ 'destination' => $ destination , 'text' => $ text , ] ) ) ; if ( ! $ response -> isSuccessful ( ) ) { $ message = $ response -> g... | Send a text message |
237,236 | public function remove ( $ key ) { if ( ! array_key_exists ( $ key , $ this -> data ) ) { return NULL ; } $ oldValue = $ this -> data [ $ key ] ; unset ( $ this -> data [ $ key ] ) ; return $ oldValue ; } | unset key value ; returns previously held data |
237,237 | public function replace ( array $ data ) { $ this -> data = array ( ) ; foreach ( $ data as $ k => $ v ) { $ this -> data [ $ k ] = $ v ; } } | replace current data array |
237,238 | private function cleanData ( array $ data ) : array { foreach ( $ data as $ key => $ value ) { $ data [ $ key ] = $ this -> replace ( $ key , $ value ) ; } return $ data ; } | Loop through the values and pass them to the replace method |
237,239 | private function replace ( $ key , $ value ) { if ( is_array ( $ value ) ) return $ this -> cleanData ( $ value ) ; return $ this -> transform ( $ key , $ value ) ; } | Pass arrays back to the cleanData method and pass everything else to transform |
237,240 | public function washCreateForm ( ) { $ data = [ ] ; $ data [ 'to_email_address' ] = trim ( $ this -> request -> input ( 'to_email_address' ) ) ; $ data [ 'to_name' ] = $ this -> genericWashText ( $ this -> request -> input ( 'to_name' ) ) ; $ data [ 'subject' ] = $ this -> genericWashText ( $ this -> request -> input (... | Wash the create form s input fields |
237,241 | public function prepEmailData ( $ id ) { $ email = $ this -> email_message -> find ( $ id ) ; $ data = [ ] ; $ data [ 'from_name' ] = $ email -> from_name ; $ data [ 'from_email_address' ] = $ email -> from_email_address ; $ data [ 'to_name' ] = $ email -> to_name ; $ data [ 'to_email_address' ] = $ email -> to_email_a... | Prepare the email |
237,242 | public static function isFile ( $ object , $ value ) : bool { if ( $ object === null ) { return true ; } $ all = false ; if ( ! Any :: isArray ( $ value ) ) { if ( $ value === '*' ) { $ all = true ; } else { $ value = [ $ value ] ; } } if ( $ object === null || ! Any :: isObj ( $ object ) ) { return false ; } $ type = ... | Check if field is file or null |
237,243 | public static function sizeFile ( $ object , $ value ) : bool { if ( $ object === null ) { return true ; } if ( ! Any :: isArray ( $ value ) ) { $ value = [ 0 , $ value ] ; } if ( $ object === null || ! Any :: isObj ( $ object ) ) { return false ; } $ realSize = $ object -> getClientSize ( ) ; if ( $ realSize === null ... | Check file size . If is null - will return true |
237,244 | private function extended ( callable $ factory , callable ... $ extensions ) : callable { return array_reduce ( $ extensions , function ( $ factory , $ extension ) { return new Extension ( $ factory , $ extension ) ; } , $ factory ) ; } | Return an extension from the given callables . |
237,245 | public function replaceDatabase ( Connection $ connection , string $ databaseName , string $ searchTerm , string $ replaceTerm , int $ batchSize = 100 ) : \ Generator { $ databaseMetadata = ( new MetadataFactory ( ) ) -> getDatabaseMetadata ( $ connection , $ databaseName ) ; foreach ( $ databaseMetadata -> getAllTable... | Performs a search on all tables in the the provided database batching queries to the specified batch size . |
237,246 | public function replaceTable ( Connection $ connection , string $ databaseName , string $ tableName , string $ searchTerm , string $ replaceTerm , int $ batchSize = 100 ) : \ Generator { $ connection -> query ( 'START TRANSACTION' ) ; $ rowCount = 0 ; $ rowSearchResultList = ( new Search ( ) ) -> searchTable ( $ connec... | Performs a search on the provided table batching queries to the specified batch size . |
237,247 | private function replace ( ColumnMetadata $ columnMetadata , string $ searchTerm , string $ replaceTerm , string $ subject ) : FieldReplaceResult { $ fieldReplaced = null ; foreach ( $ this -> replacementStrategyList as $ replacementStrategy ) { if ( $ replacementStrategy -> canReplace ( $ searchTerm , $ subject ) ) { ... | Perform the string replacement on the field . |
237,248 | public function register ( ServiceProviderInterface $ provider , array $ values = array ( ) ) { $ this -> registeredProviders [ get_class ( $ provider ) ] = true ; parent :: register ( $ provider , $ values ) ; } | Keep track of registered providers . |
237,249 | public function handleError ( $ errno , $ errstr , $ errfile , $ errline ) { if ( ! $ this [ 'debug' ] ) { return ; } throw new \ ErrorException ( $ errstr , 0 , $ errno , $ errfile , $ errline ) ; } | A generic error handler will convert errors into exceptions in debug mode . |
237,250 | public function listReport ( ) { $ this -> setTitleListReport ( ) ; $ this -> setBreadcrumbListReport ( ) ; $ this -> clearCacheReport ( ) ; $ this -> setData ( 'stores' , $ this -> store -> getList ( ) ) ; $ this -> setData ( 'panels' , $ this -> getPanelsReport ( ) ) ; $ default = $ this -> module -> getSettings ( 'g... | Route callback Displays the report page |
237,251 | protected function getPanelsReport ( ) { $ settings = $ this -> module -> getSettings ( 'ga_report' ) ; $ store_id = $ this -> getQuery ( 'ga.update.store_id' ) ; if ( ! empty ( $ store_id ) ) { $ settings [ 'store_id' ] = $ store_id ; } $ panels = array ( ) ; foreach ( $ this -> report_model -> getHandlers ( ) as $ ha... | Returns an array of report panels |
237,252 | public function handleViolation ( Route $ route ) { if ( in_array ( $ route , $ this -> violatingRoutes ) ) { throw new ApplicationException ( 'Circular redirects detected; aborting.' ) ; } $ this -> violatingRoutes [ ] = $ route ; Session :: getSessionDataBag ( ) -> set ( 'authViolatingRequest' , Request :: createFrom... | handle authentication violation by trying to find a redirecting route |
237,253 | function ToArray ( ) { $ result = array ( ) ; $ item = $ this -> TopMost ( ) ; while ( $ item ) { $ result [ ] = $ item ; $ item = $ this -> NextOf ( $ item ) ; } return $ result ; } | Gets the sorted item list |
237,254 | function Last ( ) { $ items = $ this -> ToArray ( ) ; $ cnt = count ( $ items ) ; return $ cnt > 0 ? $ items [ $ cnt - 1 ] : null ; } | Gets the last item |
237,255 | public function complexity ( ) { $ dynamicPartsCount = substr_count ( $ this -> pattern , ':' ) + substr_count ( $ this -> pattern , '?' ) ; return ( substr_count ( $ this -> pattern , '/' ) - $ dynamicPartsCount ) * 100 + $ dynamicPartsCount ; } | Count the number of pattern segments for this rule . |
237,256 | public function prune ( array $ results ) { $ mean = array_sum ( $ results ) / count ( $ results ) ; $ deviation = $ this -> deviations * $ this -> standardDeviation ( $ results ) ; $ lower = $ mean - $ deviation ; $ upper = $ mean + $ deviation ; return array_values ( array_filter ( $ results , function ( $ val ) use ... | Prune the results |
237,257 | private function standardDeviation ( array $ results ) { $ mean = array_sum ( $ results ) / count ( $ results ) ; $ initial = 0 ; $ f = function ( $ carry , $ val ) use ( $ mean ) { return $ carry + pow ( $ val - $ mean , 2 ) ; } ; $ sum = array_reduce ( $ results , $ f , $ initial ) ; $ n = count ( $ results ) - 1 ; r... | Returns one standard deviation for the given results |
237,258 | public function index ( ) { $ this -> data [ 'page' ] -> title = 'Blog › Tags' ; $ data = array ( ) ; $ data [ 'include_count' ] = true ; $ data [ 'where' ] = array ( ) ; $ data [ 'where' ] [ ] = array ( 'column' => 'blog_id' , 'value' => $ this -> blog -> id ) ; $ this -> data [ 'tags' ] = $ this -> blog_tag_mo... | Browse blog tags |
237,259 | public function create ( ) { if ( ! userHasPermission ( 'admin:blog:tag:' . $ this -> blog -> id . ':create' ) ) { unauthorised ( ) ; } if ( $ this -> input -> post ( ) ) { $ oFormValidation = Factory :: service ( 'FormValidation' ) ; $ oFormValidation -> set_rules ( 'label' , '' , 'required' ) ; $ oFormValidation -> s... | Create a new blog tag |
237,260 | public function edit ( ) { if ( ! userHasPermission ( 'admin:blog:tag:' . $ this -> blog -> id . ':edit' ) ) { unauthorised ( ) ; } $ this -> data [ 'tag' ] = $ this -> blog_tag_model -> getById ( $ this -> uri -> segment ( 6 ) ) ; if ( empty ( $ this -> data [ 'tag' ] ) ) { show404 ( ) ; } if ( $ this -> input -> post... | Edit a blog tag |
237,261 | public function addConfiguration ( ConfigurationInterface $ configuration ) { $ this -> parentMap = null ; $ id = $ configuration -> getResourceId ( ) ; if ( array_key_exists ( $ id , $ this -> configurations ) ) { throw new \ RuntimeException ( sprintf ( "Configuration for resource '%s' is already registered." , $ id ... | Adds the resource configuration . |
237,262 | public function get ( $ id ) { if ( ! $ this -> has ( $ id ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Configuration "%s" not found.' , $ id ) ) ; } return $ this -> configurations [ $ id ] ; } | Returns the configuration for the given identifier . |
237,263 | public function getAncestors ( ConfigurationInterface $ configuration , $ included = false ) { $ ancestors = [ ] ; if ( $ included ) { $ ancestors [ $ configuration -> getResourceName ( ) ] = $ configuration ; } while ( null !== $ configuration -> getParentId ( ) ) { $ configuration = $ this -> findConfiguration ( $ co... | Returns all the ancestors configuration . |
237,264 | public function getChildren ( ConfigurationInterface $ configuration ) { $ children = [ ] ; foreach ( $ this -> configurations as $ child ) { if ( $ child -> getParentId ( ) === $ configuration -> getResourceId ( ) ) { $ children [ $ child -> getResourceName ( ) ] = $ child ; } } return $ children ; } | Returns all the children configuration . |
237,265 | public function getObjectIdentity ( $ object ) { foreach ( $ this -> configurations as $ config ) { if ( $ config -> isRelevant ( $ object ) ) { return $ config -> getObjectIdentity ( ) ; } } return null ; } | Returns the object identity . |
237,266 | public function getParentMap ( ) { if ( null !== $ this -> parentMap ) { return $ this -> parentMap ; } return $ this -> parentMap = $ this -> buildParentMap ( ) ; } | Returns the hierarchy map . |
237,267 | public function getEventPriorityMap ( ) { if ( null !== $ this -> eventPriorityMap ) { return $ this -> eventPriorityMap ; } return $ this -> eventPriorityMap = $ this -> buildEventPriorityMap ( ) ; } | Returns the event priority map . |
237,268 | private function buildParentMap ( ) { $ map = [ ] ; foreach ( $ this -> configurations as $ configuration ) { if ( null !== $ parentId = $ configuration -> getParentId ( ) ) { $ map [ $ configuration -> getResourceId ( ) ] = $ parentId ; } } ksort ( $ map ) ; return $ map ; } | Builds the parent map . |
237,269 | private function buildEventPriorityMap ( ) { $ map = [ ] ; foreach ( $ this -> configurations as $ configuration ) { if ( 0 != $ priority = $ configuration -> getEventPriority ( ) ) { $ map [ $ configuration -> getResourceId ( ) ] = $ priority ; } } ksort ( $ map ) ; return $ map ; } | Builds the event priority map . |
237,270 | protected function getValue ( ) { if ( ( $ this -> data == '0' || ! empty ( $ this -> data ) ) && ! is_object ( $ this -> data ) ) { $ value = ( $ this -> parent && is_array ( $ this -> data ) ) ? $ this -> data [ 0 ] : $ this -> data ; } else if ( $ this -> options -> default == '0' || ! empty ( $ this -> options -> d... | Fetches the current value of the element |
237,271 | public function render ( ) { if ( $ this -> parent ) { if ( ! static :: $ count [ $ this -> parent ] ) static :: $ count [ $ this -> parent ] = 0 ; static :: $ count [ $ this -> parent ] ++ ; $ this -> attributes -> id += static :: $ count [ $ this -> parent ] ; } ob_start ( ) ; ?> <div class="element-group <?= $ this... | Render the element for output |
237,272 | public function getPaymentStateLabel ( $ stateOrPayment ) { $ state = $ stateOrPayment instanceof PaymentInterface ? $ stateOrPayment -> getState ( ) : $ stateOrPayment ; return $ this -> translator -> trans ( PaymentStates :: getLabel ( $ state ) ) ; } | Returns the payment state label . |
237,273 | public function getPaymentStateBadge ( $ stateOrPayment ) { $ state = $ stateOrPayment instanceof PaymentInterface ? $ stateOrPayment -> getState ( ) : $ stateOrPayment ; return sprintf ( '<span class="label label-%s">%s</span>' , PaymentStates :: getTheme ( $ state ) , $ this -> getPaymentStateLabel ( $ state ) ) ; } | Returns the payment state badge . |
237,274 | public function renderMethodConfig ( MethodInterface $ method ) { $ output = '<dl class="dl-horizontal">' ; foreach ( $ method -> getConfig ( ) as $ key => $ value ) { if ( is_array ( $ value ) ) { continue ; } $ output .= sprintf ( '<dt>%s</dt><dd>%s</dd>' , $ key , $ value ) ; } $ output .= '</dl>' ; return $ output ... | Renders the method config . |
237,275 | public function addDocumentFolder ( $ postValues ) { $ documentFolderObject = DocumentFolderFactory :: createDocumentFolderFromPostValues ( $ postValues ) ; if ( $ postValues [ 'path' ] === '/' ) { $ documentFolderObject -> path = $ postValues [ 'path' ] . $ documentFolderObject -> slug ; } else { $ documentFolderObjec... | Add new document in given path |
237,276 | public function deleteDocumentFolderBySlug ( $ slug ) { $ path = '/' . $ slug ; $ this -> repository -> getContentRepository ( ) -> deleteDocumentByPath ( $ this -> repository , $ path ) ; $ this -> repository -> getContentRepository ( ) -> cleanPublishedDeletedDocuments ( ) ; } | Delete a folder by its compound slug |
237,277 | public function getDocumentFolderBySlug ( $ slug ) { if ( $ slug === '/' ) { $ path = $ slug ; } else { $ path = '/' . $ slug ; } return $ this -> repository -> getContentRepository ( ) -> getDocumentByPath ( $ this -> repository , $ path , 'unpublished' ) ; } | Retrieve a folder by its compound slug |
237,278 | public function canRead ( string $ uri ) : bool { if ( in_array ( Acl :: RULE_ALL , ( array ) $ this -> getPermissionsOf ( $ this -> getUriRoot ( $ uri ) ) ) ) { return true ; } $ permission = array_filter ( ( array ) $ this -> getPermissionsOf ( $ uri ) , function ( $ rule ) { return ( $ rule == Acl :: RULE_ALL || $ r... | Can read . |
237,279 | public function canWrite ( string $ uri ) : bool { if ( in_array ( Acl :: RULE_ALL , ( array ) $ this -> getPermissionsOf ( $ this -> getUriRoot ( $ uri ) ) ) ) { return true ; } $ permission = array_filter ( ( array ) $ this -> getPermissionsOf ( $ uri ) , function ( $ rule ) { return ( $ rule == Acl :: RULE_ALL || $ ... | Can write . |
237,280 | public function redirectIf ( string $ dir , string $ to = '/' , bool $ exit = true ) : void { if ( $ this -> acl != null ) { $ app = $ this -> acl -> getService ( ) -> getApp ( ) ; if ( $ dir == 'in' && $ this -> isLoggedIn ( ) ) { $ app -> response ( ) -> redirect ( $ to ) ; } elseif ( $ dir == 'out' && ! $ this -> is... | Redirect if . |
237,281 | protected function getCleanAdditionalConfiguration ( $ extensionKey ) { $ newLines = [ ] ; if ( ( $ content = GeneralUtility :: getUrl ( $ this -> getConfigurationManager ( ) -> getAdditionalConfigurationFileLocation ( ) ) ) !== false ) { $ currentLines = explode ( LF , $ content ) ; array_shift ( $ currentLines ) ; $ ... | Returns the lines from AdditionalConfiguration . php file without own additions |
237,282 | public function values ( array $ values ) { $ this -> fieldValues = array ( ) ; $ this -> fieldsSql = '?i' ; $ this -> fieldValues [ ] = array_keys ( $ values ) ; $ this -> valuesSql = array ( ) ; foreach ( $ values as $ v ) { if ( is_object ( $ v ) and $ v instanceof SqlValueInterface ) { $ this -> valuesSql [ ] = $ v... | Prepares values for inserting into db |
237,283 | protected function getConnection ( $ uri ) { if ( $ this -> pdo ) { return ; } $ this -> splitURI ( $ uri ) ; try { $ this -> pdo = new PDO ( $ this -> dsn , $ this -> user , $ this -> passwd ) ; $ this -> pdo -> setAttribute ( PDO :: ATTR_ERRMODE , PDO :: ERRMODE_EXCEPTION ) ; } catch ( PDOException $ e ) { throw new ... | Connects to the DB . |
237,284 | public function create ( ) { try { $ this -> pdo -> exec ( "CREATE DATABASE `{$this->dbName}`" ) ; } catch ( PDOException $ e ) { } $ sql = <<<SQL CREATE TABLE IF NOT EXISTS `{$this->dbName}`.`{$this->dbTable}` ( `eid` int(10) NOT NULL, `id` int(10) NOT NULL, `ty... | Attempt to create the database and tables needed to store pclasses . |
237,285 | protected function loadPClasses ( ) { try { $ sth = $ this -> pdo -> prepare ( "SELECT * FROM `{$this->dbName}`.`{$this->dbTable}`" , array ( PDO :: ATTR_CURSOR => PDO :: CURSOR_FWDONLY ) ) ; $ sth -> execute ( ) ; while ( $ row = $ sth -> fetch ( PDO :: FETCH_ASSOC , PDO :: FETCH_ORI_NEXT ) ) { $ this -> addPClass ( n... | Loads the PClasses . |
237,286 | public function clear ( $ uri ) { try { $ this -> connect ( $ uri ) ; unset ( $ this -> pclasses ) ; $ this -> clearTable ( ) ; } catch ( Exception $ e ) { throw new Klarna_DatabaseException ( $ e -> getMessage ( ) , $ e -> getCode ( ) ) ; } } | Drops the database table to clear the PClasses . |
237,287 | public function closeRow ( $ last = false ) { $ this -> _strategy -> output ( $ this -> endRow ( ) . ( $ last ? '' : $ this -> rowSeparator ( ) ) ) ; } | End the row |
237,288 | public function column ( $ v , $ last = false ) { $ this -> _strategy -> output ( $ this -> beginColumn ( ) . $ v . $ this -> endColumn ( ) . ( $ last ? '' : $ this -> columnSeparator ( ) ) ) ; } | Write a column value for the current row |
237,289 | public function row ( $ r , $ last = false ) { $ this -> _strategy -> output ( $ this -> beginRow ( ) ) ; $ values = array_values ( $ r ) ; $ valuesl = count ( $ values ) ; for ( $ i = 0 ; $ i < $ valuesl ; $ i ++ ) $ this -> column ( $ values [ $ i ] , $ i + 1 == $ valuesl ) ; $ this -> _strategy -> output ( $ this ->... | Write a row |
237,290 | public function __getSerialisablePropertyValue ( $ propertyName ) { try { return parent :: __getSerialisablePropertyValue ( $ propertyName ) ; } catch ( PropertyNotReadableException $ e ) { if ( $ this -> __strictMode ) { throw $ e ; } else { return null ; } } } | Override the parent get property value method to be a little more tolerant than the parent |
237,291 | public function __getSerialisablePropertyMap ( ) { $ serialisableProperties = parent :: __getSerialisablePropertyMap ( ) ; $ dynamicProperties = $ this -> __dynamicPropertyMap ; $ map = array ( ) ; foreach ( $ dynamicProperties as $ key => $ value ) { $ map [ $ key ] = $ value ; } foreach ( $ serialisableProperties as ... | Get the array of serialisable properties |
237,292 | public function __setSerialisablePropertyMap ( $ propertyMap , $ ignoreNoneWritableProperties = false ) { $ dynamicProperties = parent :: __setSerialisablePropertyMap ( $ propertyMap , true ) ; if ( ! $ this -> __strictMode ) { $ this -> __dynamicPropertyMap = array_merge ( $ this -> __dynamicPropertyMap , $ dynamicPro... | Set an array of serialisable properties |
237,293 | public function process ( ServerRequestInterface $ request , RequestHandlerInterface $ handler ) : ResponseInterface { $ errorPageConfig = Config :: getInstance ( ) -> get ( 'errorPage' ) ; $ controllerClass = '\\app\\Controllers\\' . $ errorPageConfig [ 0 ] ; $ route = new Route ( '404' , $ errorPageConfig [ 0 ] , $ e... | Process method for NotFoundMiddleware |
237,294 | public static function getFromFile ( $ path ) { if ( ! ( $ path instanceof File ) ) $ path = new File ( $ path ) ; $ ext = $ path -> getExtension ( ) ; $ path = $ path -> getFullPath ( ) ; $ type = new FileType ( $ ext ?? "" , "" ) ; if ( empty ( $ type -> getMimeType ( ) ) && file_exists ( $ path ) ) $ type -> setMime... | Return the mime type based on a file name |
237,295 | public function isPlainText ( ) { $ sc_pos = strpos ( $ this -> mime_type , ';' ) ; if ( $ sc_pos !== false ) $ mime_type = substr ( $ this -> mime_type , 0 , $ sc_pos ) ; else $ mime_type = $ this -> mime_type ; switch ( $ mime_type ) { case "application/javascript" : case "application/json" : case "application/xml" :... | Check if a mime type is plain text |
237,296 | protected function parse ( ) { $ lines = explode ( "\n" , $ this -> comment ) ; $ current_annotation = null ; $ value = null ; foreach ( $ lines as $ line ) { $ line = trim ( ltrim ( $ line , "/* \t" ) ) ; if ( preg_match ( "/^@(\w+)( (.*))?$/" , $ line , $ matches ) === 1 ) { if ( ! empty ( $ value ) ) $ this -> annot... | Helper method that parses the doc comment |
237,297 | public function getAnnotation ( string $ name , bool $ single = true ) { $ val = $ this -> annotations [ $ name ] ?? [ ] ; return $ single ? ( count ( $ val ) ? reset ( $ val ) : null ) : $ val ; } | Get an annotated value for the DocComment |
237,298 | public function getAnnotationTokens ( string $ name ) { $ val = $ this -> getAnnotation ( $ name , true ) ; $ val = trim ( preg_replace ( "/\s{1,}/" , " " , $ val ) ) ; return ! empty ( $ val ) ? explode ( " " , $ val ) : [ ] ; } | Get the tokenized annotation - split by whitespace |
237,299 | protected function cacheTerm ( $ term_id ) { $ term = TermContainer :: with ( 'translations' ) -> find ( $ term_id ) ; if ( ! $ term || ! count ( $ term -> translations ) ) { return false ; } $ translations = [ ] ; foreach ( $ term -> translations as $ t ) { $ translations [ $ t -> language_id ] = $ t ; } $ first = $ t... | Puts the term in the cache and returns it for usage |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.