idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
49,100 | public function filterBySysLanguage ( $ queryResult , $ exceptions = [ ] ) { $ result = $ queryResult ; if ( is_string ( $ exceptions ) ) { $ exceptions = GeneralUtility :: intExplode ( ',' , $ exceptions , true ) ; } $ sysLanguageUid = $ this -> languageService -> getSysLanguageUid ( ) ; if ( ! in_array ( $ sysLanguag... | Filters a query result by system language . |
49,101 | public function deleteByKey ( $ name ) : void { if ( ! $ this -> keyExists ( $ name ) ) { return ; } parent :: deleteByKey ( $ name ) ; unset ( $ _SESSION [ $ name ] ) ; } | Removes a variable from the session . |
49,102 | public function set ( $ name , $ value ) : void { $ _SESSION [ $ name ] = $ value ; parent :: set ( $ name , $ value ) ; } | Sets a variable . |
49,103 | public function initialize ( $ object ) { if ( $ object instanceof ScopedProxyInterface ) { return $ object ; } if ( $ object instanceof ContainerAwareInterface ) { $ object -> setContainer ( $ this ) ; } foreach ( $ this -> initializers as $ initializer ) { $ object = $ initializer -> initializeObject ( $ object , $ t... | Initialize the object by injection the DI container into aware objects and invoking all container initializers passing the target object . |
49,104 | public function registerScope ( ScopeManagerInterface $ scope ) { if ( isset ( $ this -> scopes [ $ scope -> getScope ( ) ] ) ) { throw new DuplicateScopeException ( sprintf ( 'Scope "%s" is already registered' , $ scope -> getScope ( ) ) ) ; } $ this -> scopes [ $ scope -> getScope ( ) ] = $ scope ; $ scope -> correla... | Register and correalate a scope with this DI container instance . |
49,105 | protected function invokeBindingInitializers ( $ typeName , $ object , $ initializers = NULL ) { foreach ( ( array ) $ initializers as $ initializer ) { if ( is_array ( $ initializer ) ) { $ ref = new \ ReflectionMethod ( is_object ( $ initializer [ 0 ] ) ? get_class ( $ initializer [ 0 ] ) : $ initializer [ 0 ] , $ in... | Invoke all passed initializers for the given object . |
49,106 | protected function getCallableName ( \ ReflectionFunctionAbstract $ ref ) { if ( $ ref instanceof \ ReflectionMethod ) { return $ ref -> getDeclaringClass ( ) -> name . '->' . $ ref -> name . '()' ; } if ( $ ref -> isClosure ( ) ) { return '*closure*' ; } return $ ref -> getName ( ) . '()' ; } | Get a human - readable name from a reflected callable . |
49,107 | protected function getGateway ( ) { $ module = $ this -> module -> getInstance ( 'omnipay_library' ) ; $ gateway = $ module -> getGatewayInstance ( 'AuthorizeNet_SIM' ) ; if ( ! $ gateway instanceof SIMGateway ) { throw new UnexpectedValueException ( 'Gateway must be instance of Omnipay\AuthorizeNet\SIMGateway' ) ; } r... | Get gateway instance |
49,108 | protected function cancelPurchase ( ) { $ this -> controller -> setMessage ( $ this -> controller -> text ( 'Payment has been canceled' ) , 'warning' ) ; $ gateway_message = $ this -> response -> getMessage ( ) ; if ( ! empty ( $ gateway_message ) ) { $ this -> controller -> setMessage ( $ gateway_message , 'warning' )... | Performs actions when a payment is canceled |
49,109 | protected function getPurchaseParams ( ) { $ url = "checkout/complete/{$this->data_order['order_id']}" ; return array ( 'currency' => $ this -> data_order [ 'currency' ] , 'amount' => $ this -> data_order [ 'total_formatted_number' ] , 'returnUrl' => $ this -> controller -> url ( $ url , array ( 'authorize_return' => t... | Returns an array of purchase parameters |
49,110 | protected function finishPurchase ( ) { if ( $ this -> response -> isSuccessful ( ) ) { $ this -> updateOrderStatus ( ) ; $ this -> addTransaction ( ) ; $ this -> redirectSuccess ( ) ; } else if ( $ this -> response -> isRedirect ( ) ) { $ this -> response -> redirect ( ) ; } else { $ this -> redirectError ( ) ; } } | Performs final actions on success payment |
49,111 | public function getBestMatch ( array $ formats ) { foreach ( $ this -> items as $ item ) { if ( in_array ( $ item [ 'media_range' ] , $ formats ) ) { return $ item [ 'media_range' ] ; } } return false ; } | Returns the best format out of a list of supplied formats . |
49,112 | public function getItemsByOrderId ( $ orderId ) { $ result = [ ] ; $ asOrder = 'sale' ; $ asPvItem = 'pv' ; $ tblOrder = [ $ asOrder => $ this -> resource -> getTableName ( Cfg :: ENTITY_MAGE_SALES_ORDER_ITEM ) ] ; $ tblPvItem = [ $ asPvItem => $ this -> resource -> getTableName ( Entity :: ENTITY_NAME ) ] ; $ query = ... | Get array of the PvSaleItems entities by Magento order ID . |
49,113 | public function registerAutoloader ( ) { $ aliasManager = $ this ; spl_autoload_register ( function ( $ class ) use ( $ aliasManager ) { $ class = strtolower ( $ class ) ; if ( ! $ aliasManager -> checkIfAliasExists ( $ class ) ) { if ( ! $ aliasManager -> findAlias ( $ class ) ) { throw new Exception ( "Class was not ... | This method is used to register an alias autoloader as an addition to composer . |
49,114 | public function checkIfAliasExists ( $ name ) { if ( isset ( $ this -> aliases [ $ name ] ) ) { return true ; } $ aliasPath = vibius_BASEPATH . $ this -> aliasCache . $ name . ".php" ; if ( file_exists ( $ aliasPath ) ) { $ this -> aliases [ $ name ] = true ; return true ; } } | This method is used to check if alias exists in the cache |
49,115 | public function findAlias ( $ class ) { $ container = Container :: open ( 'aliases' ) ; if ( $ container -> exists ( $ class ) ) { $ instance = $ container -> get ( $ class ) ; $ config [ 'provider' ] = $ instance ; if ( is_object ( $ instance ) ) { Container :: open ( 'instances' ) -> add ( $ class , $ instance ) ; $ ... | This method is used to find a component from composer s psr4 which serves requested alias . |
49,116 | public function getAliasTemplate ( ) { if ( ! isset ( $ this -> template ) ) { $ this -> template = file_get_contents ( $ this -> path . 'AliasTemplate.php' ) ; } return $ this -> template ; } | Method is used to load a template for alias creation . |
49,117 | public function createAlias ( $ name , $ config ) { $ handle = fopen ( vibius_BASEPATH . $ this -> aliasCache . $ name . '.php' , 'w+' ) ; if ( ! $ handle ) { throw new Exception ( 'Unable to create alias, fopen not successful' ) ; } $ template = $ this -> getAliasTemplate ( ) ; $ template = str_replace ( '{$className}... | Method is used to create an alias from specified parameters . |
49,118 | public function hook ( $ hooked_class = null , $ hook_prefix = '' ) { $ this -> hooked_class = $ hooked_class ; $ this -> hook_prefix = $ hook_prefix ; $ this -> class_reflector = new \ ReflectionClass ( $ this -> hooked_class ) ; $ methods = $ this -> class_reflector -> getMethods ( ) ; foreach ( $ methods as $ method... | Parses the methods and kicks of the hooking process |
49,119 | private function parse_method_name ( $ name ) { if ( preg_match ( '|^(_?[^_]+_)(.*)$|' , $ name , $ matches ) ) { $ hook_type = trim ( $ matches [ 1 ] , '_' ) ; $ hook_name = $ matches [ 2 ] ; if ( ! in_array ( $ hook_type , array ( 'theme' , 'action' , 'filter' , 'shortcode' ) ) ) { return false ; } return compact ( '... | Parse the method name to determine how to handle it |
49,120 | public final function getUserColor ( string $ name ) { if ( $ this -> disposed ) { return null ; } if ( ! isset ( $ this -> colors [ $ name ] ) ) { throw new ArgumentError ( '$name' , $ name , 'Drawing.Image' , 'There is no user color with this name defined for this image!' ) ; } return $ this -> colors [ $ name ] ; } | Returns the user defined color with defined name . |
49,121 | public function export ( StorageEntity $ storage ) { $ output = sprintf ( $ this -> output , $ storage -> getId ( ) ) ; $ progress = sprintf ( $ this -> progress , $ storage -> getId ( ) ) ; $ this -> fs -> mkdir ( [ dirname ( $ output ) , dirname ( $ progress ) ] , 0755 ) ; $ this -> fs -> remove ( [ $ output , $ prog... | Scan storage in background and export progress and output . |
49,122 | public function getMetadataFor ( $ className ) { if ( ! $ this -> isService ( $ className ) ) { throw Exception :: classIsNotMappedService ( $ className ) ; } if ( ! isset ( $ this -> loadedMetadata [ $ className ] ) ) { $ this -> loadMetadata ( $ className ) ; } if ( $ this -> cache ) { $ cacheId = $ this -> cachePref... | Returns ServiceMetadata for the specified class . |
49,123 | public function getAllMetadata ( ) { foreach ( $ this -> driver -> getAllClassNames ( ) as $ className ) { if ( ! isset ( $ this -> loadedMetadata [ $ className ] ) ) { $ this -> loadMetadata ( $ className ) ; } } return $ this -> loadedMetadata ; } | Returns the entire collection of ServiceMetadata objects for all mapped services . |
49,124 | protected function loadMetadata ( $ class ) { $ parent = null ; $ parentClasses = $ this -> getParentClasses ( $ class ) ; $ parentClasses [ ] = $ class ; foreach ( $ parentClasses as $ parentClass ) { $ class = new ServiceMetadata ( $ class ) ; if ( $ parent ) { $ class -> setClassName ( $ parent -> getClassName ( ) )... | Loads the ServiceMetadata for the supplied class . |
49,125 | protected function getParentClasses ( $ className ) { $ parents = array ( ) ; foreach ( array_reverse ( class_parents ( $ className ) ) as $ class ) { if ( $ this -> driver -> isService ( $ class ) ) { $ parents [ ] = $ class ; } } return $ parents ; } | Returns the list of parent service classes for the specified class . |
49,126 | function version ( ) { if ( $ this -> version == null ) { $ this -> version = intval ( $ this -> fetch ( self :: TR8N_VERSION_KEY , Config :: instance ( ) -> configValue ( "cache.version" , 1 ) ) ) ; } return $ this -> version ; } | Returns current cache version |
49,127 | function versionedKey ( $ key ) { if ( $ key == self :: TR8N_VERSION_KEY ) return $ key ; return self :: TR8N_KEY_PREFIX . $ this -> version ( ) . "_" . $ key ; } | Appends version to a key |
49,128 | public function setFails ( array $ fails = null ) : void { if ( ! empty ( $ fails ) ) { foreach ( $ fails as $ fieldName => $ fail ) { $ this -> fails [ $ fieldName ] = $ fail ; } } } | Set fails . |
49,129 | private function createExtensionNode ( ArrayNodeDefinition $ rootNode , $ name , $ validator ) { $ rootNode -> children ( ) -> arrayNode ( $ name ) -> addDefaultChildrenIfNoneSet ( array ( ) ) -> requiresAtLeastOneElement ( ) -> useAttributeAsKey ( 'name' ) -> prototype ( 'variable' ) -> validate ( ) -> ifTrue ( $ vali... | Create configuration section |
49,130 | public function rotate ( Point $ center , Angle $ angle ) { $ x = $ this -> x - $ center -> x ; $ y = $ this -> y - $ center -> y ; $ this -> x = $ x * $ angle -> cos - $ y * $ angle -> sin + $ center -> x ; $ this -> y = $ y * $ angle -> cos + $ x * $ angle -> sin + $ center -> y ; return $ this ; } | Rotates current point clockwise . |
49,131 | public function min ( $ limit ) { $ result = $ this -> compare ( $ limit , '<' ) ; $ this -> setValid ( $ result ) ; return $ this ; } | Sets the minimum limit . |
49,132 | public function max ( $ limit ) { $ result = $ this -> compare ( $ limit , '>' ) ; $ this -> setValid ( $ result ) ; return $ this ; } | Sets the maximum limit . |
49,133 | protected function mapAdminRoutes ( ) { Routes \ Admin \ ProfileRoutes :: register ( ) ; $ this -> prefix ( $ this -> config ( ) -> get ( 'arcanesoft.auth.route.prefix' , 'authorization' ) ) -> group ( function ( ) { Routes \ Admin \ StatsRoutes :: register ( ) ; Routes \ Admin \ UsersRoutes :: register ( ) ; Routes \ ... | Define the foundation routes for the application . |
49,134 | public static function createMessage ( string $ message ) : string { $ lastErrorMessage = error_get_last ( ) ; if ( $ lastErrorMessage !== null ) { $ message .= "; " . $ lastErrorMessage [ "message" ] ; } return $ message ; } | Append a message with the message from the last encountered error |
49,135 | public static function fromNative ( \ DateTimeInterface $ dateTime ) : TimeOfDay { return new self ( ( int ) $ dateTime -> format ( 'H' ) , ( int ) $ dateTime -> format ( 'i' ) , ( int ) $ dateTime -> format ( 's' ) ) ; } | Creates a time object from the time part of the supplied date time . |
49,136 | public static function fromFormat ( string $ format , string $ timeString ) : TimeOfDay { return self :: fromNative ( \ DateTimeImmutable :: createFromFormat ( $ format , $ timeString ) ) ; } | Creates a time object from the supplied format string |
49,137 | public static function fromString ( string $ timeString ) : TimeOfDay { $ parts = array_map ( 'intval' , explode ( ':' , $ timeString ) ) + [ 1 => 0 , 2 => 0 ] ; return new self ( $ parts [ 0 ] , $ parts [ 1 ] , $ parts [ 2 ] ) ; } | Creates a time object from the supplied 24 hour time string |
49,138 | public function secondsBetween ( TimeOfDay $ other ) : int { return abs ( $ this -> dateTime -> getTimestamp ( ) - $ other -> dateTime -> getTimestamp ( ) ) ; } | Returns the amount of seconds between the supplied times . |
49,139 | protected function matchTokens ( array $ pathTokens , array $ patternTokens ) { $ matches = [ ] ; for ( $ i = 1 ; $ i < count ( $ patternTokens ) ; $ i ++ ) { $ pathToken = $ pathTokens [ $ i ] ; $ patternToken = $ patternTokens [ $ i ] ; if ( $ pathToken == '' && $ patternToken != '' ) { return false ; } if ( $ patter... | Compare path tokens side by side . Returns false if no match true if match without capture and array with matched tokens if used with capturing pattern |
49,140 | public function setDefaults ( array $ options , bool $ override = FALSE ) : void { $ this -> defaults = $ options + ( $ override ? [ ] : [ 'path' => null , 'maxSize' => self :: DEFAULT_MAX_SIZE , 'rotation' => 0 , 'rights' => null , ] ) ; } | Sets default options . |
49,141 | public function log ( string $ message , string $ path = null , array $ options = [ ] ) : void { $ options = $ options + ( is_null ( $ path ) ? [ ] : [ 'path' => $ path ] ) + $ this -> defaults ; $ path = $ options [ 'path' ] ; if ( is_null ( $ path ) ) { throw new \ RuntimeException ( "Missing path" ) ; } $ realPath =... | Rotate log files and logs message . |
49,142 | public function all ( $ array = [ ] ) { if ( ! empty ( $ array ) ) { foreach ( $ array as $ key => $ model ) { $ this -> set ( $ model , is_numeric ( $ key ) ? null : $ key ) ; } } return $ this -> byAlias ; } | Returns all options If array passed becomes bag content |
49,143 | public static function errorHandler ( $ type = E_USER_NOTICE , $ error = 'Undefined Error' , $ errFile = null , $ errLine = null , $ context = null ) { $ thisType = self :: getType ( $ type ) ; $ LOG = array ( 'type' => ( ! is_null ( $ thisType ) ? $ thisType : 'ERROR' ) , 'message' => ( ! is_null ( $ error ) ? $ error... | System that redirects the errors to the appropriate logging method . |
49,144 | public static function exceptionHandler ( $ exception ) { $ message = $ exception -> getMessage ( ) ; $ code = $ exception -> getCode ( ) ; $ file = $ exception -> getFile ( ) ; $ line = $ exception -> getLine ( ) ; $ context = $ exception -> getTraceAsString ( ) ; self :: logError ( 'Exception thrown: ' . $ message . ... | Exception handler Will be triggered when an uncaught exception occures . This function shows the error - message and shuts down the script . Please note that most of the user - defined exceptions will be caught in the router and handled with the error - controller . |
49,145 | public static function logToScreen ( ) { $ event = Events :: fireEvent ( 'screenLogEvent' ) ; if ( $ event -> isCancelled ( ) ) { return false ; } $ logs = self :: $ Logs ; require ( dirname ( __DIR__ ) . DS . 'Layout' . DS . 'layout.' . self :: $ logger_template . '.php' ) ; } | Output the entire log to the screen . Used for debugging problems with your code . |
49,146 | public static function logToFile ( ) { ob_start ( function ( ) { } ) ; $ logs = self :: $ Logs ; require ( dirname ( __DIR__ ) . DS . 'Layout' . DS . 'layout.logger_cli.php' ) ; $ contents = ob_get_clean ( ) ; $ file = Core :: $ logDir . DS . 'Logs' . DS . 'log_latest.php' ; if ( is_writable ( $ file ) ) { file_put_con... | Output the entire log to a file . Used for debugging problems with your code . |
49,147 | public static function mark ( $ name ) { $ LOG = array ( 'type' => 'BMARK' , 'message' => ( ! is_null ( $ name ) ? $ name : '' ) , 'logFile' => '' , 'logLine' => '' , 'context' => '' , 'runtime' => round ( self :: getRelativeTime ( ) , 4 ) , ) ; self :: $ Logs [ ] = $ LOG ; } | Set a benchmark markpoint . |
49,148 | public static function http_error ( $ errno = 500 , $ message = '' , $ layout = true ) : bool { $ http_codes = array ( 400 => 'Bad Request' , 401 => 'Unauthorized' , 402 => 'Payment Required' , 403 => 'Forbidden' , 404 => 'Not Found' , 405 => 'Method Not Allowed' , 406 => 'Not Acceptable' , 407 => 'Proxy Authentication... | Calls an HTTP error sends it as a header and loads a template if required to do so . |
49,149 | protected static function getTypo3Version ( ) { if ( is_null ( static :: $ version ) ) { static :: $ version = \ TYPO3 \ CMS \ Core \ Utility \ VersionNumberUtility :: convertVersionNumberToInteger ( TYPO3_branch ) ; } return static :: $ version ; } | Returns the TYPO3 version as integer |
49,150 | protected static function adaptLogos ( $ extKey ) { if ( static :: isVersion ( '7.6' ) ) { $ GLOBALS [ 'TBE_STYLES' ] [ 'logo' ] = \ TYPO3 \ CMS \ Core \ Utility \ ExtensionManagementUtility :: extRelPath ( $ extKey ) . 'Resources/Public/Images/Backend/gilbertsoft-t3-topbar@2x.png' ; } if ( ! is_array ( $ GLOBALS [ 'TY... | Adapt Backend Styling |
49,151 | public static function tables ( $ extKey ) { if ( ( TYPO3_MODE === 'BE' ) && Provider :: isGilbertsoft ( ) ) { static :: registerIcons ( $ extKey ) ; static :: adaptWarranty ( $ extKey ) ; static :: adaptLogos ( $ extKey ) ; } } | Adapts the backend |
49,152 | public static function unregister ( $ protocol ) { $ wrappers = stream_get_wrappers ( ) ; if ( ! in_array ( $ protocol , $ wrappers ) ) { throw new Wrapper_Exception ( "Protocol '$protocol' has not been registered yet" ) ; } return stream_wrapper_unregister ( $ protocol ) ; } | Unregister stream wrapper |
49,153 | protected function _find ( $ id ) { $ data = $ this -> db -> get ( $ this -> table , '*' , [ 'id' => $ id ] ) ; if ( empty ( $ data ) ) { return false ; } return $ this -> setProperties ( $ data ) ; } | Find item by ID . |
49,154 | protected function _first ( $ columns = '*' ) { $ data = $ this -> db -> get ( $ this -> table , $ columns , $ this -> where ) ; if ( empty ( $ data ) ) { return false ; } return $ this -> setProperties ( $ data ) ; } | Get s the first result . |
49,155 | protected function _get ( $ columns = '*' ) { $ data = $ this -> db -> select ( $ this -> table , $ columns , $ this -> where ) ; if ( empty ( $ data ) ) { return false ; } return $ this -> getModelObjects ( $ data ) ; } | Get all results filtered on set where . |
49,156 | protected function _all ( $ columns = '*' ) { $ data = $ this -> db -> select ( $ this -> table , $ columns ) ; if ( empty ( $ data ) ) { return false ; } return $ this -> getModelObjects ( $ data ) ; } | Get all results from table . |
49,157 | protected function _update ( $ id , array $ data ) { return $ this -> db -> update ( $ this -> table , $ data , [ 'id' => $ id ] ) ; } | Updates item in table . |
49,158 | private function getProperty ( $ key ) { return array_key_exists ( $ key , $ this -> fields ) ? $ this -> fields [ $ key ] : null ; } | Get dynamic property . |
49,159 | private function setProperties ( array $ data ) { foreach ( $ data as $ key => $ value ) { $ this -> setProperty ( $ key , $ value ) ; } return $ this ; } | Go through array and set all dynamic properties . |
49,160 | public function getEndpointUrl ( $ path , $ withTrailingSlash ) { $ url = $ this -> endpoint . '/' . $ path ; if ( $ withTrailingSlash ) { $ url = $ url . '/' ; } return $ url ; } | Get the endpoint url for the request |
49,161 | public function will ( Behaviour $ behaviour = null ) { if ( $ behaviour ) { $ this -> behaviour = $ behaviour ; return $ behaviour ; } return new BehaviourFactory ( function ( Behaviour $ behaviour ) { $ this -> setStubbed ( true ) ; $ this -> behaviour = $ behaviour ; } ) ; } | Sets the given Behaviour or returns a BehaviourFactory if non given |
49,162 | public function record ( $ arguments , $ returnValue , \ Exception $ thrown = null ) { $ this -> history -> add ( new Call ( $ this -> named ( $ arguments ) , $ returnValue , $ thrown ) ) ; if ( ! $ this -> checkReturnType ) { return ; } if ( $ thrown ) { $ this -> checkException ( $ thrown ) ; } else { $ this -> check... | Records the invocation of the method . |
49,163 | public static function Remove ( array $ array , int $ index ) : array { if ( $ index < 0 || $ index >= \ count ( $ array ) ) { return $ array ; } if ( $ index == 0 ) { return \ array_slice ( $ array , 1 ) ; } if ( $ index + 1 == \ count ( $ array ) ) { return \ array_slice ( $ array , 0 , - 1 ) ; } $ neu = \ array_slic... | Removes the element with defined index from array and reset the array element index after the removed element . |
49,164 | public static function GetMaxDepth ( array $ array ) : int { if ( \ count ( $ array ) < 1 ) { return 0 ; } $ c = 1 ; foreach ( $ array as $ v ) { if ( \ is_array ( $ v ) ) { $ x = 1 + static :: GetMaxDepth ( $ v ) ; if ( $ x > $ c ) { $ c = $ x ; } } } return $ c ; } | Returns the depth of permitted array . |
49,165 | public function hydrate ( stdClass $ input , $ strict = false ) { $ this -> strict = $ strict ; $ failedStrict = [ ] ; foreach ( $ input as $ name => $ value ) { if ( $ this -> strict && ! property_exists ( $ this , $ name ) ) { $ failedStrict [ $ name ] = $ value ; } else { $ this -> $ name = $ value ; } } if ( count ... | Given a class object hydrate it from a provided stdClass data object . |
49,166 | protected function format ( $ data , $ file_handle ) { $ header = false ; foreach ( $ data as $ idx => $ row ) { $ row = WF :: cast_array ( $ row ) ; $ this -> validateRow ( $ row ) ; if ( $ this -> write_bom && ftell ( $ file_handle ) === 0 ) fwrite ( $ file_handle , Encoding :: getBOM ( 'UTF8' ) ) ; if ( ! $ header &... | Format the data into CSV |
49,167 | protected function validateRow ( array $ row ) { foreach ( $ row as $ k => $ v ) { if ( WF :: is_array_like ( $ v ) ) throw new InvalidArgumentException ( "CSVWriter does not support nested arrays" ) ; } } | Make sure that the data is not nested more than 1 level deep as CSV does not support that . |
49,168 | public function addAction ( $ action ) { if ( ! $ action instanceof ActionInterface ) { return $ this ; } $ name = $ action -> getIdentifier ( ) ; if ( empty ( $ name ) ) { return $ this ; } $ this -> actions [ ] = $ action ; return $ this ; } | Execute the given callback after class instance is created . |
49,169 | public function load ( ReflectionClass $ class ) { $ this -> reset ( ) ; $ this -> reflectionClass = $ class ; $ this -> name = $ this -> reflectionClass -> getName ( ) ; if ( ! $ this -> reflectionClass -> isInstantiable ( ) ) { return $ this ; } $ this -> interfaces = $ this -> resolveInterfaces ( ) ; $ this -> paren... | Load a class using its ReflectionClass object . |
49,170 | public function resolveParamName ( $ identifier ) { if ( ! isset ( $ this -> paramNames [ $ identifier ] ) ) { return $ identifier ; } return $ this -> paramNames [ $ identifier ] ; } | Resolve the parameter name |
49,171 | public function descendants ( $ includeSelf = false , $ depth = null ) { $ this -> getQuerySet ( ) -> descendants ( $ includeSelf , $ depth ) ; return $ this ; } | Named scope . Gets descendants for node . |
49,172 | public function ancestors ( $ includeSelf = false , $ depth = null ) { $ this -> getQuerySet ( ) -> ancestors ( $ includeSelf , $ depth ) ; return $ this ; } | Named scope . Gets ancestors for node . |
49,173 | public function rebuild ( ) { $ i = 0 ; $ skip = [ ] ; while ( 0 != $ this -> filter ( [ 'lft__isnull' => true ] ) -> count ( ) ) { ++ $ i ; $ fixed = 0 ; echo 'Iteration: ' . $ i . PHP_EOL ; $ clone = clone $ this ; $ models = $ clone -> exclude ( [ 'pk__in' => $ skip ] ) -> filter ( [ 'lft__isnull' => true ] ) -> ord... | Completely rebuild broken tree |
49,174 | public function detach ( string $ event , $ callback ) { if ( isset ( $ this -> listeners [ $ event ] ) ) { return $ this -> listeners [ $ event ] -> remove ( $ callback ) ; } return false ; } | Detaches a listener from an event |
49,175 | public function decorationTokens ( ) { if ( $ this -> decoration_tokens == null ) { $ dt = new DecorationTokenizer ( $ this -> label ) ; $ dt -> parse ( ) ; $ this -> decoration_tokens = $ dt -> tokens ; } return $ this -> decoration_tokens ; } | Returns an array of decoration tokens from the translation key |
49,176 | public function dataTokens ( ) { if ( $ this -> data_tokens == null ) { $ dt = new DataTokenizer ( $ this -> label ) ; $ this -> data_tokens = $ dt -> tokens ; } return $ this -> data_tokens ; } | Returns an array of data tokens from the translation key |
49,177 | protected function convertAmount ( OrderInterface $ order ) { $ amount = $ order -> getSummary ( ) -> getGrossAmount ( ) ; $ baseCurrency = $ order -> getCurrency ( ) ; return $ this -> getCurrencyHelper ( ) -> convert ( $ amount , $ baseCurrency ) ; } | Converts the order s gross total to target currency |
49,178 | private function cacheTranslations ( ) { $ this -> log ( "Downloading translations..." ) ; stream_wrapper_register ( "chdb" , '\Tr8n\Cache\Generators\ChdbStream' ) or die ( "Failed to register Chdb protocol for streaming Tr8n translation keys" ) ; $ fp = fopen ( "chdb://ChdbInMemory" , "r+" ) ; $ ch = curl_init ( ) ; $... | Caches translation keys |
49,179 | public function generateChdb ( ) { $ this -> extracted_at = new \ DateTime ( ) ; $ this -> log ( "Writing chdb file..." ) ; $ this -> log ( "File: " . $ this -> chdb_path ) ; $ success = chdb_create ( $ this -> chdb_path , $ this -> cache ) ; if ( ! $ success ) { fprintf ( STDERR , "Failed to create chdb file $this->ch... | Generates chdb database |
49,180 | public function search ( array $ filters ) { return $ this -> filter ( function ( CollectionableInterface $ entity ) use ( $ filters ) { $ res = true ; foreach ( $ filters as $ key => $ value ) { $ current = $ this -> getPropertyAccessor ( ) -> getValue ( $ entity , $ key ) ; $ res = $ res && ( is_array ( $ value ) ? i... | filter given collection on given fields . |
49,181 | public function sort ( \ Closure $ p ) { $ elements = $ this -> toArray ( ) ; if ( ! uasort ( $ elements , $ p ) ) { throw new \ InvalidArgumentException ( 'Sort failed.' ) ; } return new static ( array_values ( $ elements ) ) ; } | Sort collection with given closure . |
49,182 | public function reduce ( \ Closure $ p , $ initialValue = null ) { return array_reduce ( $ this -> toArray ( ) , $ p , $ initialValue ) ; } | Reduce collection with given closure . |
49,183 | public function indexBy ( $ field ) { $ elements = $ this -> toArray ( ) ; $ this -> clear ( ) ; foreach ( $ elements as $ element ) { $ this -> set ( $ this -> getFieldValue ( $ element , $ field ) , $ element ) ; } return $ this ; } | index collection by given object field . |
49,184 | public function column ( $ column ) { return $ this -> map ( function ( CollectionableInterface $ entity ) use ( $ column ) { return $ this -> getFieldValue ( $ entity , $ column ) ; } ) -> toArray ( ) ; } | Return value of inner objects given property as an array . |
49,185 | public function flatten ( $ indexColumn , $ valueColumn ) { return $ this -> reduce ( function ( $ carry , CollectionableInterface $ entity ) use ( $ indexColumn , $ valueColumn ) { $ carry [ $ this -> getFieldValue ( $ entity , $ indexColumn ) ] = $ this -> getFieldValue ( $ entity , $ valueColumn ) ; return $ carry ;... | Create a flattened view of collection as a key value array . |
49,186 | public function display ( $ column , $ slug = '", "' , $ format = '["%s"]' ) { return sprintf ( $ format , implode ( $ slug , $ this -> column ( $ column ) ) ) ; } | Returns a string representation of given column values . |
49,187 | public function totalPages ( ) { $ maxrows = ( ( $ m = $ this -> getParameter ( 'RowsPerPage' ) ) !== null ) ? $ m : $ this -> getLocal ( 'MaxRows' ) ; $ totalrecords = ( ( $ m = $ this -> getParameter ( 'TotalRecords' ) ) !== null ) ? $ m : $ this -> getLocal ( 'TotalRecords' ) ; if ( empty ( $ totalrecords ) ) return... | Returns the total number of pages |
49,188 | protected function _setCertConfigure ( ) { $ this -> certConfigure = [ 'config' => $ this -> typeConfigurations [ $ this -> type ] , 'x509_extensions' => $ this -> _getConfig ( 'x509_extensions' ) , 'private_key_bits' => $ this -> config [ 'default' ] [ 'private_key_bits' ] ] ; } | Load Default Configuration |
49,189 | public function getKeyPair ( $ file = false ) { $ pk = $ this -> _generatePK ( ) ; openssl_pkey_export ( $ pk , $ privKey , null , $ this -> certConfigure ) ; $ pubKey = openssl_pkey_get_details ( $ pk ) ; $ keys = new KeyPair ( ) ; $ keys -> setPrivateKey ( $ privKey ) -> setPublicKey ( $ pubKey [ 'key' ] ) ; if ( $ f... | Returns key pair |
49,190 | public function setType ( $ type , $ options = null ) { $ this -> type = $ type ; $ this -> _setCertConfigure ( ) ; return $ this ; } | Sets type of certificate |
49,191 | public function setCa ( $ name = null , $ password = null ) { $ this -> caName = $ name ; $ this -> caPassword = $ password ; return $ this ; } | Function SetCa Functions to set CA name to use for signing certificate |
49,192 | public function setName ( $ name = null ) { $ this -> fileName = $ this -> caDataRoot . $ name . DS ; if ( ! file_exists ( $ this -> fileName ) ) { mkdir ( $ this -> fileName , 0777 , true ) ; } return $ this ; } | Function SetName Set name of certificate file |
49,193 | public function sign ( ) { $ this -> crt = new SignedCertificate ( ) ; $ this -> _altConfiguration ( ) ; $ this -> crt -> setPrivateKey ( $ this -> _generatePK ( ) ) ; $ privKey = $ this -> crt -> getPrivateKey ( ) ; $ this -> crt -> setCsr ( openssl_csr_new ( $ this -> domainName ( ) -> get ( ) , $ privKey , $ this ->... | Sign certificate file and export tem to disk |
49,194 | public function createRequest ( ) { $ this -> crt = new SignedCertificate ( ) ; $ this -> crt -> setPrivateKey ( openssl_pkey_new ( $ this -> certConfigure ) ) ; $ privKey = $ this -> crt -> getPrivateKey ( ) ; $ this -> crt -> setCsr ( openssl_csr_new ( $ this -> domainName ( ) -> get ( ) , $ privKey , $ this -> certC... | Create request for server signing For Client App |
49,195 | public function signWithServer ( $ request ) { $ clientRequest = json_decode ( $ request ) ; $ this -> crt -> setSignedCert ( openssl_csr_sign ( $ clientRequest -> csr , $ this -> _getCaCert ( ) , $ this -> _getCaKey ( ) , $ this -> _getConfig ( 'daysvalid' ) , $ this -> certConfigure , time ( ) ) ) ; openssl_x509_expo... | Sign certificate from client request For Server app |
49,196 | public function getPrivateKey ( $ caName = null , $ caPassword = null ) { if ( $ caPassword !== null ) { return [ file_get_contents ( $ this -> caDataRoot . $ caName . DS . static :: PRIV_KEY_FILENAME ) , $ caPassword ] ; } return file_get_contents ( $ this -> caDataRoot . $ caName . DS . static :: PRIV_KEY_FILENAME ) ... | Method getCaKey Returns array for encrypted keys and string othervise |
49,197 | public static function fromString ( $ httpVersion ) : self { if ( empty ( $ httpVersion ) ) { throw new \ InvalidArgumentException ( 'Given HTTP version is empty' ) ; } $ major = null ; $ minor = null ; if ( 2 != sscanf ( $ httpVersion , 'HTTP/%d.%d' , $ major , $ minor ) ) { throw new \ InvalidArgumentException ( 'Giv... | parses http version from given string |
49,198 | public function equals ( $ httpVersion ) : bool { if ( empty ( $ httpVersion ) ) { return false ; } try { $ other = self :: castFrom ( $ httpVersion ) ; } catch ( \ InvalidArgumentException $ iae ) { return false ; } return $ this -> major ( ) === $ other -> major ( ) && $ this -> minor ( ) === $ other -> minor ( ) ; } | checks if given http version is equal to this http version |
49,199 | public function map ( Closure $ func ) { $ this -> guardAgainstInvalidGivenType ( ) ; $ elements = $ this -> collection -> map ( $ func ) -> toArray ( ) ; $ newCollection = $ this -> create ( ) ; foreach ( $ elements as $ key => $ element ) { try { $ newCollection -> set ( $ key , $ element ) ; } catch ( InvalidArgumen... | Applies the given public function to each element in the collection and returns a new collection with the elements returned by the function . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.