idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
3,300 | function add ( $ css_file , $ media = null , $ condition = null , $ no_build = false ) { if ( ! $ css_file ) { return $ this ; } $ host = config ( 'larakit.lk-staticfiles.host' ) ; if ( mb_strpos ( $ css_file , '/' ) === 0 && mb_strpos ( $ css_file , '/' , 1 ) !== 1 ) { $ css_file = $ host . $ css_file ; } $ this -> cs... | Add external css file |
3,301 | public function removeField ( Field $ field ) { if ( $ this -> hasField ( $ field ) ) { unset ( $ this -> fields [ $ field -> getName ( ) ] ) ; return true ; } return false ; } | Removes the given field from the fields collection |
3,302 | protected function createRoute ( $ value ) { if ( $ value instanceof Route ) { return $ value ; } if ( is_array ( $ value ) ) { $ value = ( object ) $ value ; } if ( is_object ( $ value ) && is_callable ( $ value ) ) { $ value = ( object ) [ 'fn' => $ value ] ; } if ( ! $ value instanceof \ stdClass ) { throw new \ Inv... | Create a route from an assisiative array or stdClass object |
3,303 | protected function createRoutes ( $ input ) { if ( $ input instanceof \ Traversable ) { $ input = iterator_to_array ( $ input , true ) ; } elseif ( $ input instanceof \ stdClass ) { $ input = get_object_vars ( $ input ) ; } return array_map ( [ $ this , 'createRoute' ] , $ input ) ; } | Create routes from input |
3,304 | public function fnmatch ( $ pattern , $ url ) { $ quoted = preg_quote ( $ pattern , '~' ) ; $ step1 = strtr ( $ quoted , [ '\?' => '[^/]' , '\*' => '[^/]*' , '/\*\*' => '(?:/.*)?' , '#' => '\d+' , '\[' => '[' , '\]' => ']' , '\-' => '-' , '\{' => '{' , '\}' => '}' ] ) ; $ step2 = preg_replace_callback ( '~{[^}]+}~' , f... | Match url against wildcard pattern . |
3,305 | protected function splitRoutePattern ( $ pattern ) { if ( strpos ( $ pattern , ' ' ) !== false && preg_match_all ( '/\s+\+(\w+)\b|\s+\-(\w+)\b/' , $ pattern , $ matches ) ) { list ( $ path ) = preg_split ( '/\s+/' , $ pattern , 2 ) ; $ inc = isset ( $ matches [ 1 ] ) ? array_filter ( $ matches [ 1 ] ) : [ ] ; $ excl = ... | Split the route pattern in a path + inclusive and exclusive methods |
3,306 | protected function findRoute ( UriInterface $ url , $ method = null ) { $ urlPath = $ this -> cleanUrl ( $ url -> getPath ( ) ) ; $ ret = null ; foreach ( $ this as $ pattern => $ route ) { list ( $ path , $ inc , $ excl ) = $ this -> splitRoutePattern ( $ pattern ) ; if ( $ path !== '/' ) $ path = rtrim ( $ path , '/'... | Find a matching route |
3,307 | public function hasRoute ( ServerRequestInterface $ request , $ withMethod = true ) { $ route = $ this -> findRoute ( $ request -> getUri ( ) , $ withMethod ? $ request -> getMethod ( ) : null ) ; return isset ( $ route ) ; } | Check if a route for the URL exists |
3,308 | public function getRoute ( ServerRequestInterface $ request ) { $ url = $ request -> getUri ( ) ; $ route = $ this -> findRoute ( $ url , $ request -> getMethod ( ) ) ; if ( $ route ) { $ route = $ this -> bind ( $ route , $ request , $ this -> splitUrl ( $ url -> getPath ( ) ) ) ; } return $ route ; } | Get route for the request |
3,309 | static function getInstance ( $ namespace = null ) { $ namespace = is_null ( $ namespace ) ? static :: NAMESPACE_DEFAULT : $ namespace ; if ( ! array_key_exists ( $ namespace , static :: $ instances ) ) { self :: $ instances [ $ namespace ] = new static ( ) ; } return self :: $ instances [ $ namespace ] ; } | constructor du singleton |
3,310 | public function generate ( Command $ console ) { $ this -> generateFolders ( ) ; $ this -> generateGitkeep ( ) ; $ this -> generateFiles ( ) ; $ console -> info ( "Pluggable [{$this->name}] has been created successfully." ) ; return true ; } | Generate pluggable folders and files . |
3,311 | protected function generateFolders ( ) { if ( ! $ this -> finder -> isDirectory ( $ this -> pluggable -> getPath ( ) ) ) { $ this -> finder -> makeDirectory ( $ this -> pluggable -> getPath ( ) ) ; } $ this -> finder -> makeDirectory ( $ this -> getPluggablePath ( $ this -> slug , true ) ) ; foreach ( $ this -> folders... | Generate defined pluggable folders . |
3,312 | protected function generateFiles ( ) { foreach ( $ this -> files as $ key => $ file ) { $ file = $ this -> formatContent ( $ file ) ; $ this -> makeFile ( $ key , $ file ) ; } } | Generate defined pluggable files . |
3,313 | protected function makeFile ( $ key , $ file ) { return $ this -> finder -> put ( $ this -> getDestinationFile ( $ file ) , $ this -> getStubContent ( $ key ) ) ; } | Create pluggable file . |
3,314 | protected function getPluggablePath ( $ slug = null , $ allowNotExists = false ) { if ( $ slug ) { return $ this -> pluggable -> getPluggablePath ( $ slug , $ allowNotExists ) ; } return $ this -> pluggable -> getPath ( ) ; } | Get the path to the pluggable . |
3,315 | public function getFileUrl ( $ key , $ path = null ) { if ( is_null ( $ key ) ) { return null ; } $ bucket = config ( 'filesystems.disks.s3.bucket' ) ; $ client = Storage :: disk ( 's3' ) -> getAdapter ( ) -> getClient ( ) ; return $ this -> getRealUrl ( $ client -> getObjectUrl ( $ bucket , $ path . $ key ) ) ; } | Retrieve a file URL |
3,316 | public function getRealUrl ( $ url ) { if ( config ( 'services.cdn.base_url' ) ) { $ s3_url = self :: $ s3_base_url . config ( 'filesystems.disks.s3.bucket' ) . '/' ; return str_replace ( $ s3_url , config ( 'services.cdn.base_url' ) , $ url ) ; } else { return $ url ; } } | Determine if the base S3 url needs to be switched out with a CDN url |
3,317 | public static function registerCustomType ( $ type , $ callback ) { if ( ! is_callable ( $ callback ) ) { throw new \ Exception ( __ ( 'callback_is_not_function_exception' ) ) ; } self :: $ custom_types [ $ type ] = [ 'callback' => $ callback ] ; } | Register a custom data type |
3,318 | public static function validateCustomType ( $ type , $ value , $ field_name , $ model = [ ] ) { if ( ! isset ( self :: $ custom_types [ $ type ] ) ) { throw new \ Exception ( 'type_not_found' ) ; } $ callback = self :: $ custom_types [ $ type ] [ 'callback' ] ; $ output = false ; if ( $ callback ( $ value , $ model , $... | Validate a custom data type . |
3,319 | public function isValidJsonpCallback ( $ subject ) { $ identifier_syntax = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*+$/u' ; $ reserved_words = array ( 'break' , 'do' , 'instanceof' , 'typeof' , 'case' , 'else' , 'new' , 'var' , 'catch' , 'finally' , 'return' , 'void' , 'continue' , 'for' , 'switch'... | Check if callback is valid |
3,320 | public static function int ( $ input , $ min = null , $ max = null , $ field_name = 'int' ) { $ model = [ $ field_name => [ 'type' => Validate :: TYPE_INT , Validate :: REQUIRED ] ] ; if ( $ min !== null ) { $ model [ $ field_name ] [ 'min' ] = $ min ; } if ( $ max !== null ) { $ model [ $ field_name ] [ 'max' ] = $ ma... | Validate a signed integer |
3,321 | public static function uint ( $ input , $ min = 0 , $ max = null , $ field_name = 'uint' ) { $ model = [ $ field_name => [ 'type' => Validate :: TYPE_UINT , Validate :: REQUIRED ] ] ; $ model [ $ field_name ] [ 'min' ] = $ min ; if ( $ max !== null ) { $ model [ $ field_name ] [ 'max' ] = $ max ; } $ parameters = [ $ f... | Validate an unsigned integer |
3,322 | public static function float ( $ input , $ min = null , $ max = null , $ field_name = 'float' ) { $ model = [ $ field_name => [ 'type' => Validate :: TYPE_FLOAT , Validate :: REQUIRED ] ] ; if ( $ min !== null ) { $ model [ $ field_name ] [ 'min' ] = $ min ; } if ( $ max !== null ) { $ model [ $ field_name ] [ 'max' ] ... | Validate a floating point number |
3,323 | public static function double ( $ input , $ min = null , $ max = null , $ field_name = 'double' ) { $ model = [ $ field_name => [ 'type' => Validate :: TYPE_DOUBLE , Validate :: REQUIRED ] ] ; if ( $ min !== null ) { $ model [ $ field_name ] [ 'min' ] = $ min ; } if ( $ max !== null ) { $ model [ $ field_name ] [ 'max'... | Validate a double presision floating point number |
3,324 | public static function url ( $ input , $ field_name = 'url' ) { $ model = [ $ field_name => [ 'type' => Validate :: TYPE_URL , Validate :: REQUIRED ] ] ; $ parameters = [ $ field_name => $ input ] ; Validate :: model ( $ parameters , $ model ) ; return $ parameters [ $ field_name ] ; } | Validate a url |
3,325 | public static function permalink ( $ input , $ field_name = 'permalink' ) { $ model = [ $ field_name => [ 'type' => Validate :: TYPE_PERMALINK , Validate :: REQUIRED ] ] ; $ parameters = [ $ field_name => $ input ] ; Validate :: model ( $ parameters , $ model ) ; return $ parameters [ $ field_name ] ; } | Validate a permalink id |
3,326 | public static function enum ( $ input , $ values , $ field_name = 'enum' ) { if ( ! is_array ( $ values ) ) { throw new \ Exception ( 'Array is expected as values' ) ; } $ model = [ $ field_name => [ 'type' => Validate :: TYPE_ENUM , 'values' => $ values , Validate :: REQUIRED ] ] ; $ parameters = [ $ field_name => $ i... | Check if input value is in allowed values |
3,327 | public static function sqlDate ( $ date , $ field_name = 'date' ) { if ( preg_match ( '/^(\d{4})-(\d{2})-(\d{2}) ([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$/' , $ date , $ matches ) ) { if ( checkdate ( $ matches [ 2 ] , $ matches [ 3 ] , $ matches [ 1 ] ) ) { return $ date ; } } throw new IncorrectParametersExceptio... | Validate SQL date datetime |
3,328 | public static function operator ( $ operator , $ field_name = 'operator' ) { if ( ! in_array ( $ operator , self :: $ operators ) ) { throw new IncorrectParametersException ( [ $ field_name ] ) ; } return $ operator ; } | Validate an operator |
3,329 | public function setDelimiters ( $ begin , $ end ) { $ this -> beginDelimiter = $ begin ; $ this -> endDelimiter = $ end ; return $ this ; } | Set begin and end delimiters which will be used to detect parts to be replaced |
3,330 | public function doRegexpReplace ( $ searchPattern , $ replaceWith ) { $ this -> content = preg_replace_callback ( $ searchPattern , function ( $ matches ) use ( $ replaceWith ) { $ indent = isset ( $ matches [ 'indent' ] ) ? $ matches [ 'indent' ] : '' ; $ output = $ indent ; $ output .= isset ( $ matches [ 'start' ] )... | Immediately replaces part of data using regular expression |
3,331 | public function doReplace ( $ searchFor , $ replaceWith ) { $ this -> content = str_replace ( $ searchFor , $ replaceWith , $ this -> content ) ; return $ this ; } | Immediately replaces part of data |
3,332 | public function process ( $ forceOrder = false ) { if ( ! $ forceOrder ) { array_multisort ( array_map ( 'mb_strlen' , array_keys ( $ this -> replacements ) ) , SORT_DESC , $ this -> replacements ) ; } $ replaceFunc = $ this -> isDelimitersUsed ( ) ? 'replaceWithRegexp' : 'replaceBasic' ; foreach ( $ this -> replacemen... | Start replacing data |
3,333 | public function getHandledCodes ( ) { return array ( self :: CODE_PENDING => 'pending' , self :: CODE_ERROR => 'error' , self :: CODE_SUCCESS => 'success' , self :: CODE_UNAUTHORIZED_EMAIL => 'unauthorized email' , self :: CODE_EMAIL_ALREADY_EXIST => 'email already exist' , self :: CODE_UNAUTHORIZED_OPTOUT_EMAIL => 'un... | Gets an array of handled codes |
3,334 | private static function findCaches ( array $ cachesNames = [ ] ) { $ caches = [ ] ; $ components = Yii :: $ app -> getComponents ( ) ; $ findAll = ( $ cachesNames === [ ] ) ; foreach ( $ components as $ name => $ component ) { if ( ! $ findAll && ! in_array ( $ name , $ cachesNames , true ) ) { continue ; } if ( $ comp... | Returns array of caches in the system keys are cache components names values are class names . |
3,335 | public function submitCartDirectly ( ApiOrderInterface $ cart , UserInterface $ user , $ locale ) { $ orderWasSubmitted = true ; try { $ this -> checkIfCartIsValid ( $ user , $ cart , $ locale ) ; $ cart -> setOrderDate ( new \ DateTime ( ) ) ; $ this -> orderManager -> convertStatus ( $ cart , OrderStatus :: STATUS_CO... | Submits a cart |
3,336 | private function checkProductsAvailability ( OrderInterface $ cart ) { if ( $ cart -> getItems ( ) -> isEmpty ( ) ) { return true ; } $ containsInvalidProducts = false ; foreach ( $ cart -> getItems ( ) as $ item ) { if ( ! $ item -> getProduct ( ) || ! $ item -> getProduct ( ) -> isValidShopProduct ( ) ) { $ containsI... | Removes items from cart that have no valid shop products applied ; and returns if all products are still available |
3,337 | public function addProduct ( $ data , $ user = null , $ locale = null ) { $ cart = $ this -> getUserCart ( $ user , $ locale , null , true ) ; $ userId = $ user ? $ user -> getId ( ) : null ; $ item = $ this -> orderManager -> addItem ( $ data , $ locale , $ userId , $ cart ) ; $ this -> validateIfItemProductActive ( $... | Adds a product to cart |
3,338 | public function updateItem ( $ itemId , $ data , $ user = null , $ locale = null ) { $ cart = $ this -> getUserCart ( $ user , $ locale ) ; $ userId = $ user ? $ user -> getId ( ) : null ; $ this -> validateOrCreateAddresses ( $ cart , $ user ) ; $ item = $ this -> orderManager -> getOrderItemById ( $ itemId , $ cart -... | Update item data |
3,339 | protected function createEmptyCart ( $ user , $ persist , $ currencyCode = null ) { $ cart = new Order ( ) ; $ cart -> setCreator ( $ user ) ; $ cart -> setChanger ( $ user ) ; $ cart -> setCreated ( new \ DateTime ( ) ) ; $ cart -> setChanged ( new \ DateTime ( ) ) ; $ cart -> setOrderDate ( new \ DateTime ( ) ) ; $ c... | Function creates an empty cart this means an order with status in_cart is created and all necessary data is set |
3,340 | private function getCurrencySymbol ( string $ currencyCode , string $ locale ) : string { $ formatter = new NumberFormatter ( $ locale . '@currency=' . $ currencyCode , NumberFormatter :: CURRENCY ) ; return $ formatter -> getSymbol ( NumberFormatter :: CURRENCY_SYMBOL ) ; } | Get the symbol value for the given locale . |
3,341 | public function getVenue ( $ venueId ) { $ resource = '/venues/' . $ venueId ; $ response = $ this -> makeApiRequest ( $ resource ) ; return $ response -> venue ; } | Get venue by ID |
3,342 | public function categories ( ) { $ resource = '/venues/categories' ; $ response = $ this -> makeApiRequest ( $ resource ) ; if ( property_exists ( $ response , 'categories' ) ) { return $ response -> categories ; } return array ( ) ; } | Returns a hierarchical list of categories applied to venues . When designing client applications please download this list only once per session but also avoid caching this data for longer than a week to avoid stale information . |
3,343 | public function managed ( ) { $ resource = '/venues/managed' ; $ response = $ this -> makeApiRequest ( $ resource ) ; if ( property_exists ( $ response , 'venues' ) ) { return $ response -> venues ; } return array ( ) ; } | Get a list of venues the current user manages . |
3,344 | public function search ( array $ params = array ( ) ) { $ resource = '/venues/search' ; $ response = $ this -> makeApiRequest ( $ resource , $ params ) ; if ( property_exists ( $ response , 'venues' ) ) { return $ response -> venues ; } return array ( ) ; } | Returns a list of venues near the current location optionally matching a search term . |
3,345 | public function suggestCompletion ( array $ params = array ( ) ) { $ resource = '/venues/suggestcompletion' ; $ response = $ this -> makeApiRequest ( $ resource , $ params ) ; if ( property_exists ( $ response , 'minivenues' ) ) { return $ response -> minivenues ; } return array ( ) ; } | Returns a list of mini - venues partially matching the search term near the location . |
3,346 | public function timeSeries ( array $ params = array ( ) ) { $ resource = '/venues/timeseries' ; $ response = $ this -> makeApiRequest ( $ resource , $ params ) ; if ( property_exists ( $ response , 'timeseries' ) ) { return $ response -> timeseries ; } return array ( ) ; } | Get daily venue stats for a list of venues over a time range . User must be venue manager . |
3,347 | public function trending ( array $ params = array ( ) ) { $ resource = '/venues/trending' ; $ response = $ this -> makeApiRequest ( $ resource , $ params ) ; if ( property_exists ( $ response , 'venues' ) ) { return $ response -> venues ; } return array ( ) ; } | Returns a list of venues near the current location with the most people currently checked in . |
3,348 | public function events ( $ venueId ) { $ resource = '/venues/' . $ venueId . '/events' ; $ response = $ this -> makeApiRequest ( $ resource ) ; if ( property_exists ( $ response , 'events' ) ) { return $ response -> events -> items ; } return array ( ) ; } | Allows you to access information about the current events at a place . |
3,349 | public function hereNow ( $ venueId ) { $ resource = '/venues/' . $ venueId . '/herenow' ; $ response = $ this -> makeApiRequest ( $ resource ) ; if ( property_exists ( $ response , 'hereNow' ) ) { return $ response -> hereNow -> count ; } return 0 ; } | Provides a count of how many people are at a given venue . |
3,350 | public function hours ( $ venueId ) { $ resource = '/venues/' . $ venueId . '/hours' ; $ response = $ this -> makeApiRequest ( $ resource ) ; return $ response -> hours ; } | Returns hours for a venue . |
3,351 | public function likes ( $ venueId ) { $ resource = '/venues/' . $ venueId . '/likes' ; $ response = $ this -> makeApiRequest ( $ resource ) ; return $ response -> likes ; } | Returns friends and a total count of users who have liked this venue . |
3,352 | public function links ( $ venueId ) { $ resource = '/venues/' . $ venueId . '/links' ; $ response = $ this -> makeApiRequest ( $ resource ) ; if ( property_exists ( $ response , 'links' ) ) { return $ response -> links -> items ; } return array ( ) ; } | Returns URLs or identifiers from third parties that have been applied to this venue . |
3,353 | public function lists ( $ venueId ) { $ resource = '/venues/' . $ venueId . '/listed' ; $ response = $ this -> makeApiRequest ( $ resource ) ; if ( property_exists ( $ response , 'lists' ) ) { return $ response -> lists -> groups ; } return array ( ) ; } | The lists that this venue appears on . |
3,354 | public function nextVenues ( $ venueId ) { $ resource = '/venues/' . $ venueId . '/nextvenues' ; $ response = $ this -> makeApiRequest ( $ resource ) ; if ( property_exists ( $ response , 'nextVenues' ) ) { return $ response -> nextVenues -> items ; } return array ( ) ; } | Returns venues that people often check in to after the current venue . |
3,355 | public function photos ( $ venueId ) { $ resource = '/venues/' . $ venueId . '/photos' ; $ response = $ this -> makeApiRequest ( $ resource ) ; if ( property_exists ( $ response , 'photos' ) ) { return $ response -> photos -> items ; } return array ( ) ; } | Returns photos for a venue . |
3,356 | public function similar ( $ venueId ) { $ resource = '/venues/' . $ venueId . '/similar' ; $ response = $ this -> makeApiRequest ( $ resource ) ; if ( property_exists ( $ response , 'similarVenues' ) ) { return $ response -> similarVenues -> items ; } return array ( ) ; } | Returns a list of venues similar to the specified venue . |
3,357 | public function stats ( $ venueId ) { $ resource = '/venues/' . $ venueId . '/stats' ; $ response = $ this -> makeApiRequest ( $ resource ) ; if ( property_exists ( $ response , 'stats' ) ) { return $ response -> stats ; } return array ( ) ; } | Get venue stats over a given time range . Only available to the manager of a venue . User must be venue manager . |
3,358 | public function tips ( $ venueId ) { $ resource = '/venues/' . $ venueId . '/tips' ; $ response = $ this -> makeApiRequest ( $ resource ) ; if ( property_exists ( $ response , 'tips' ) ) { return $ response -> tips -> items ; } return array ( ) ; } | Returns tips for a venue . |
3,359 | public function addRenderer ( $ index , $ method = null ) { $ this -> renderers [ $ index ] = is_null ( $ method ) ? $ index : $ method ; return $ this ; } | Add a single renderer to the renderers container |
3,360 | public function parsePattern ( $ pattern ) { $ withoutClosing = rtrim ( $ pattern , "]" ) ; $ closingNumber = strlen ( $ pattern ) - strlen ( $ withoutClosing ) ; $ segments = preg_split ( "~" . self :: DYNAMIC_REGEX . "(*SKIP)(*F)|\[~x" , $ withoutClosing ) ; $ this -> parseSegments ( $ segments , $ closingNumber , $ ... | Separate routes pattern with optional parts into n new patterns . |
3,361 | protected function parseSegments ( array $ segments , $ closingNumber , $ withoutClosing ) { if ( $ closingNumber !== count ( $ segments ) - 1 ) { if ( preg_match ( "~" . self :: DYNAMIC_REGEX . "(*SKIP)(*F)|\]~x" , $ withoutClosing ) ) { throw new BadRouteException ( BadRouteException :: OPTIONAL_SEGMENTS_ON_MIDDLE ) ... | Parse all the possible patterns seeking for an incorrect or incompatible pattern . |
3,362 | public static function createUndetectedDeviceLogger ( $ wurflConfig = null ) { if ( self :: isLoggingConfigured ( $ wurflConfig ) ) { return self :: createFileLogger ( $ wurflConfig , "undetected_devices.log" ) ; } return new WURFL_Logger_NullLogger ( ) ; } | Create Logger for undetected devices with filename undetected_devices . log |
3,363 | private static function createFileLogger ( $ wurflConfig , $ fileName ) { $ logFileName = self :: createLogFile ( $ wurflConfig -> logDir , $ fileName ) ; return new WURFL_Logger_FileLogger ( $ logFileName ) ; } | Creates a new file logger |
3,364 | public function hooks ( ) { add_action ( 'plugins_loaded' , [ $ this , 'start_session' ] ) ; add_action ( 'shutdown' , [ $ this , 'commit_session' ] ) ; add_action ( 'wp' , [ $ this , 'register_garbage_collection' ] ) ; add_action ( $ this -> get_schedule_name ( ) , [ $ this , 'cleanup_expired_sessions' ] ) ; } | Hooks into WordPress to start commit and run garbage collector . |
3,365 | protected function getCurrencyFromIsoCode ( $ isoCode ) { $ this -> prepareCurrencies ( ) ; $ isoCode = strtolower ( $ isoCode ) ; if ( ! array_key_exists ( $ isoCode , self :: $ currencies ) ) { throw new UnknownCurrencyException ( 'Currency with ' . $ isoCode . ' iso code does not exist!' ) ; } return self :: $ curre... | Loads currency information from preloaded data by ISO index |
3,366 | protected function fill ( array $ data ) { $ this -> isoCode = $ data [ 'iso_code' ] ; $ this -> name = $ data [ 'name' ] ; $ this -> symbol = $ data [ 'symbol' ] ; $ this -> subunit = $ data [ 'subunit' ] ; $ this -> symbolFirst = $ data [ 'symbol_first' ] ; $ this -> htmlEntity = $ data [ 'html_entity' ] ; $ this -> ... | Protected setter for all fields |
3,367 | protected function aggregateData ( ) { $ data = [ 'iso_code' => $ this -> isoCode , 'name' => $ this -> name , 'symbol' => $ this -> symbol , 'subunit' => $ this -> subunit , 'symbol_first' => $ this -> symbolFirst , 'html_entity' => $ this -> htmlEntity , 'decimal_mark' => $ this -> decimalMark , 'thousands_separator'... | Prepares data for serialization |
3,368 | public function unserialize ( $ serialized ) { $ currentCurrency = $ this -> getCurrencyFromIsoCode ( unserialize ( $ serialized ) ) ; $ this -> fill ( $ currentCurrency ) ; } | Serialization constructor for \ Serializable |
3,369 | public function resolve ( $ sym , $ type = Symbol :: T_NULL ) { $ val = $ sym ; if ( $ sym instanceof \ ECL \ Symbol ) { $ val = $ this -> offsetGet ( $ sym -> getName ( ) ) ; if ( $ type == Symbol :: T_NULL ) { $ type = $ sym -> getType ( ) ; } } switch ( $ type ) { case Symbol :: T_INT : $ val = ( int ) $ val ; break... | Check if the input is a Symbol and resolve it if so . |
3,370 | public function offsetSet ( $ key , $ value ) { if ( ! $ this -> offsetExists ( $ key ) ) { $ this -> table [ $ key ] = new Value ( $ value ) ; } else { $ this -> table [ $ key ] -> setValue ( $ value ) ; } } | Set the value for a symbol . |
3,371 | protected function toStringFunction ( ) { $ string = ( $ this -> isFinal ( ) ? 'final ' : '' ) . ( $ this -> isAbstract ( ) ? 'abstract ' : '' ) . $ this -> getVisibility ( ) . ' ' . ( $ this -> isStatic ( ) ? 'static ' : '' ) . 'function ' ; return $ string ; } | Get string with method type . |
3,372 | public function toStringCode ( ) { if ( ! $ this -> isInterface ( ) && ! $ this -> isAbstract ( ) ) { $ tabulationFormatted = $ this -> getTabulationFormatted ( ) ; $ code = PHP_EOL . $ tabulationFormatted . '{' . $ this -> codeToString ( ) . $ tabulationFormatted . '}' ; return $ code ; } return ';' ; } | Get string code . |
3,373 | public static function createGetterFromProperty ( PropertyInterface $ property ) { $ method = new self ( ) ; $ method -> setName ( 'get_' . $ property -> getName ( ) ) ; $ method -> setCode ( 'return $this->' . $ property -> getName ( ) . ';' ) ; return $ method ; } | Create a Get Method from Property of Class . |
3,374 | public static function createSetterFromProperty ( PropertyInterface $ property ) { $ argument = Argument :: createFromProperty ( $ property ) ; $ code = "\$this->{$property->getName()} = {$argument->getNameFormatted()};" . PHP_EOL . 'return $this;' ; $ method = new self ; $ method -> setName ( 'set_' . $ property -> ge... | Generate Set Method from Property . Add a set method in the class based on Object Property . |
3,375 | public static function createFromReflection ( \ ReflectionMethod $ reflected ) { $ method = new self ( ) ; $ method -> setName ( $ reflected -> getName ( ) ) ; foreach ( $ reflected -> getParameters ( ) as $ parameterReflected ) { $ argument = new Argument ( ) ; $ argument -> setName ( $ parameterReflected -> getName (... | Creates a method from Reflection Method . |
3,376 | public function push ( $ job , $ delay = 0 , $ vars = null ) { if ( $ vars == null ) { $ vars = 'disco-no-variable' ; } else { $ vars = base64_encode ( serialize ( $ vars ) ) ; } $ domain = \ App :: domain ( ) ; if ( $ job instanceof \ Closure ) { $ obj = new \ Jeremeamia \ SuperClosure \ SerializableClosure ( $ job ) ... | Push a job onto the Queue for processing . |
3,377 | public function killJob ( $ pId ) { $ j = $ this -> jobs ( ) ; global $ argv ; foreach ( $ j as $ job ) { if ( $ job -> pId == $ pId ) { exec ( 'kill ' . $ job -> pId ) ; if ( $ argv [ 1 ] == 'kill-job' ) { echo 'Killed Job # ' . $ job -> pId . ' Action:' . $ job -> object . '@' . $ job -> method . PHP_EOL ; } return t... | Kill a Queued job by passing its process ID number |
3,378 | public function addValidator ( $ index , $ method = null , array $ params = [ ] , $ message = null ) { array_unshift ( $ params , $ method ) ; array_unshift ( $ params , $ index ) ; call_user_func_array ( [ $ this -> getValidator ( ) , 'addRule' ] , $ params ) ; if ( ! is_null ( $ message ) ) { $ this -> getValidator (... | Add a single validator with message to the validator container |
3,379 | public static function decode ( string $ data , bool $ assoc = false , int $ depth = 512 , int $ options = 0 ) { $ json = json_decode ( $ data , $ assoc , $ depth , $ options ) ; $ jsonLastError = json_last_error ( ) ; if ( $ jsonLastError !== JSON_ERROR_NONE ) { throw new \ InvalidArgumentException ( 'Failed to decode... | Decodes the specified JSON into an object |
3,380 | public function add ( $ path , $ middleware = null ) { if ( ! isset ( $ middleware ) ) { $ middleware = $ path ; $ path = null ; } if ( ! empty ( $ path ) && ! ctype_digit ( $ path ) && $ path [ 0 ] !== '/' ) { trigger_error ( "Middleware path '$path' doesn't start with a '/'" , E_USER_NOTICE ) ; } if ( ! is_callable (... | Add middleware call to router . |
3,381 | protected function wrapMiddleware ( $ path , $ middleware ) { return function ( ServerRequestInterface $ request , ResponseInterface $ response , $ next ) use ( $ middleware , $ path ) { $ uriPath = $ request -> getUri ( ) -> getPath ( ) ; if ( $ uriPath === $ path || strpos ( $ uriPath , rtrim ( $ path , '/' ) . '/' )... | Wrap middleware so it s only applied to a specified path |
3,382 | public function run ( ServerRequestInterface $ request , ResponseInterface $ response , $ next = null ) { if ( ! $ request -> getAttribute ( 'route' ) instanceof Route ) { $ route = $ this -> routes -> getRoute ( $ request ) ; if ( ! $ route ) { return $ this -> notFound ( $ request , $ response ) ; } $ request = $ req... | Run the action . This method doesn t call the middlewares but only run the action . |
3,383 | protected function notFound ( ServerRequestInterface $ request , ResponseInterface $ response ) { $ notFound = $ response -> withProtocolVersion ( $ request -> getProtocolVersion ( ) ) -> withStatus ( 404 ) ; $ notFound -> getBody ( ) -> write ( 'Not Found' ) ; return $ notFound ; } | Return Not Found response |
3,384 | public static function forParameterName ( $ parameterName , $ typeName , Exception $ cause = null ) { return new static ( sprintf ( 'The parameter "%s" does not exist for type "%s".' , $ parameterName , $ typeName ) , 0 , $ cause ) ; } | Creates a new exception for the given parameter name . |
3,385 | public static function combine ( $ conditions ) { return Arr :: join ( ' AND ' , Arr :: map ( function ( $ condition ) { return "(" . Condition :: render ( $ condition ) . ")" ; } , $ conditions ) ) ; } | Render multiple Condition objects |
3,386 | public static function render ( SQL \ Condition $ condition ) { $ content = $ condition -> getContent ( ) ; $ parameters = $ condition -> getParameters ( ) ; if ( $ parameters and is_string ( $ content ) ) { $ content = self :: expandParameterArrays ( $ content , $ parameters ) ; } return Compiler :: expression ( array... | Render a Condition object |
3,387 | public static function toInt ( $ value ) { if ( ! static :: is ( $ value ) ) { throw new \ InvalidArgumentException ( "The \$value parameter must be numeric (or string representing a big number)." ) ; } if ( is_int ( $ value ) ) { return $ value ; } elseif ( is_float ( $ value ) ) { return ( int ) $ value ; } if ( ( $ ... | Gets the integer value of the given value . |
3,388 | public static function toFloat ( $ value ) { if ( ! static :: is ( $ value ) ) { throw new \ InvalidArgumentException ( "The \$value parameter must be numeric (or string representing a big number)." ) ; } if ( is_int ( $ value ) || is_float ( $ value ) ) { return ( float ) $ value ; } else { return ( ( Str :: contains ... | Converts the given number to float . |
3,389 | public static function inside ( $ value , $ lower , $ upper ) { return static :: inRange ( $ value , $ lower , $ upper , false , false ) ; } | Tests if a number is inside a range . |
3,390 | public static function between ( $ value , $ lower , $ upper ) { return static :: inRange ( $ value , $ lower , $ upper , true , true ) ; } | Tests if a number is between a range . |
3,391 | protected function addResourceString ( string $ resource ) : void { $ data = json_decode ( $ resource , true ) ; if ( json_last_error ( ) !== \ JSON_ERROR_NONE ) { if ( function_exists ( 'json_last_error_msg' ) ) { throw new \ InvalidArgumentException ( json_last_error_msg ( ) , json_last_error ( ) ) ; } throw new \ In... | Adds a resource represented in a JSON string |
3,392 | protected function addResourceArray ( array $ resource ) : void { foreach ( $ resource as $ locale => $ value ) { if ( $ locale === '@metadata' ) { $ this -> parseMetadata ( $ value ) ; continue ; } $ this -> addSubresource ( $ value , $ locale ) ; } } | Adds a resource array |
3,393 | public function addSubresource ( $ subresource , string $ locale ) : void { if ( $ subresource instanceof Resource ) { $ resource = $ subresource ; } elseif ( is_string ( $ subresource ) ) { $ resource = ResourceBuilder :: fromFile ( $ subresource , $ locale ) ; } elseif ( is_array ( $ subresource ) ) { $ resource = Re... | Adds a sub - resource |
3,394 | protected function parseMetadata ( array $ metadata ) : void { if ( isset ( $ metadata [ 'arrayGroups' ] ) ) { foreach ( $ metadata [ 'arrayGroups' ] as $ name => $ values ) { if ( ! isset ( $ this -> arrayGroups [ $ name ] ) ) { $ this -> arrayGroups [ $ name ] = array ( ) ; } foreach ( $ values as $ locale => $ keyNa... | Parses resource file metadata |
3,395 | protected function addResourceFile ( string $ file ) : void { if ( ! is_file ( $ file ) ) { throw new \ InvalidArgumentException ( "$file is not a file" ) ; } $ contents = file_get_contents ( $ file ) ; if ( $ contents === false ) { throw new \ RuntimeException ( "Error reading file at $file." ) ; } $ this -> addResour... | Adds a resource file |
3,396 | public function _e ( string $ key , ? string $ lang = null ) : void { echo $ this -> __ ( $ key , $ lang ) ; } | Prints localized text |
3,397 | public function _f ( string $ key , $ strings , ? string $ lang = null ) : string { if ( $ lang === null ) { $ lang = $ this -> lang ; } if ( ! isset ( $ this -> data [ $ lang ] ) ) { throw new \ OutOfBoundsException ( "Invalid language: $lang" ) ; } if ( ! isset ( $ this -> data [ $ lang ] [ $ key ] ) ) { throw new \ ... | Returns formatted localized text |
3,398 | public function _ef ( string $ key , $ strings , ? string $ lang = null ) : void { echo $ this -> _f ( $ key , $ strings , $ lang ) ; } | Prints formatted localized text |
3,399 | public function localizeDeepArray ( ? array $ arr , string $ group , int $ depth = 1 , ? string $ lang = null ) : ? array { if ( $ arr === null ) { return null ; } if ( $ depth < 0 ) { throw new \ InvalidArgumentException ( "Depth must be a non-negative integer, $depth given" ) ; } if ( $ depth ) { foreach ( $ arr as $... | Localizes a multidimensional array |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.