idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
230,000 | public function getPopularTags ( ) { $ question = $ this -> findAll ( ) ; $ tagsMultiArray = array_map ( function ( $ question ) { return explode ( ',' , $ question -> tags ) ; } , $ question ) ; $ tagArr = array_count_values ( call_user_func_array ( "array_merge" , $ tagsMultiArray ) ) ; arsort ( $ tagArr ) ; return $... | Returns array of tags keys are name value is the integer of how many . |
230,001 | private function getKey ( $ key = NULL ) { if ( $ key === NULL ) { $ key = $ this -> __keyName ; return $ this -> getClassKey ( ) . '_' . $ this -> $ key ; } return $ this -> getClassKey ( ) . '_' . $ key ; } | returns the key for scope cache |
230,002 | public function applyData ( $ data = NULL ) { parent :: applyData ( $ data ) ; if ( $ data != null ) { self :: $ propData [ $ this -> getKey ( ) ] = $ this ; self :: $ keyCache [ $ this -> getClassKey ( ) ] = $ this -> __keyName ; $ key = $ this -> __keyName ; self :: $ __ids [ $ this -> getClassKey ( ) ] [ $ this -> $... | ovewrite parent becasue of catching all props |
230,003 | public function getProps ( $ id ) { if ( isset ( self :: $ propData [ $ this -> getKey ( $ id ) ] ) ) { return self :: $ propData [ $ this -> getKey ( $ id ) ] ; } return NULL ; } | returns the content by the id if these already builded . if not is returns NULL |
230,004 | public function fetch ( $ id ) { if ( isset ( self :: $ propData [ $ this -> getKey ( $ id ) ] ) ) { return self :: $ propData [ $ this -> getKey ( $ id ) ] ; } return false ; } | fetch data if exists so the current object is exchanges |
230,005 | private function copyProps ( self $ source ) { foreach ( $ source as $ keyName => $ data ) { if ( substr ( $ keyName , 0 , 2 ) !== '__' ) { $ this -> $ keyName = $ data ; } } } | copy propertie to self |
230,006 | public function preprocess ( $ pSaxReferenceString , array $ pSaxAnalysisStrings ) { $ this -> referenceSuffixTree = new SuffixTree ( $ pSaxReferenceString ) ; foreach ( $ pSaxAnalysisStrings as $ anaString ) { $ anaTree = new SuffixTree ( $ anaString ) ; $ this -> annotateSurpriseValues ( $ this -> referenceSuffixTree... | Creates the suffix trees for the given reference string and the strings under analysis . Annotates the occurences of each substring in the corresponding node of the tree . |
230,007 | public function computeStatistics ( array $ pTimeSeries ) { $ statistics = array ( 'min' => 0 , 'max' => 0 , 'stdDev' => 0 , 'mean' => 0 , 'sum' => 0 , 'size' => count ( $ pTimeSeries ) ) ; foreach ( $ pTimeSeries as $ entry ) { if ( $ entry [ 'count' ] < $ statistics [ 'min' ] ) { $ statistics [ 'min' ] = $ entry [ 'c... | Calculates the minimum maximum standard deviation mean sum and the size of the given time series . It must contain the key count for each entry . |
230,008 | public function discretizeTimeSeries ( array $ pTimeSeries , $ pFeatureWindowLength = 1 ) { $ nrOfBreakpoints = $ this -> alphabetSize - 1 ; $ breakpoints = $ this -> breakpoints [ $ nrOfBreakpoints ] ; $ saxWord = "" ; for ( $ i = 0 ; $ i < count ( $ pTimeSeries ) ; $ i += $ pFeatureWindowLength ) { $ datapoint = $ pT... | Discretizes a given time series to a sax word i . e . a sequence of characters indicating the amplitude of the time series . |
230,009 | public function annotateSurpriseValues ( & $ pReferenceTree , & $ pAnalysisTree ) { $ this -> annotateNode ( $ pReferenceTree , $ pAnalysisTree , $ pAnalysisTree -> nodes [ $ pAnalysisTree -> root ] , "" ) ; } | Annotates surprise values at each node of the analysis tree in context of the reference tree |
230,010 | public static function init ( $ args = null ) { if ( is_null ( self :: $ instance ) ) { self :: $ instance = new ErrorClass ( $ args ) ; } return self :: $ instance ; } | args can be array|object . noEmailErrs development noHtml noOutput errType |
230,011 | public static function createQuery ( $ modelClass , $ ignore = [ ] ) { $ model = $ modelClass :: find ( ) ; $ wheres = [ 'and' ] ; $ filter_fields = self :: getQueryParams ( $ ignore ) ; $ condition_transform_functions = self :: conditionTransformFunctions ( ) ; foreach ( $ filter_fields as $ key => $ value ) { if ( $ ... | Create the query to check for relations and filtering |
230,012 | public static function addOrderSort ( $ sort , $ table , & $ query ) { if ( ! empty ( $ sort ) ) { $ sorts = explode ( ',' , $ sort ) ; foreach ( $ sorts as $ sort ) { if ( ! strpos ( $ sort , '.' ) ) { preg_match ( '/\w+\s+(DESC|ASC)/' , $ sort , $ sort_field ) ; $ type = ! empty ( $ sort_field ) ? trim ( $ sort_field... | Add a sort if there is a sort oder requested . |
230,013 | public static function addGroup ( $ group , $ table , & $ query ) { if ( ! empty ( $ group ) ) { $ groups = explode ( ',' , $ group ) ; foreach ( $ groups as $ group ) { if ( ! strpos ( $ group , '.' ) ) { $ query -> groupBy ( $ table . '.' . $ group ) ; } else { $ query -> groupBy ( $ group ) ; } } } } | Add a group by functionality to the query builder |
230,014 | public function save ( Model \ EnvironmentInterface $ environment , Model \ EnvironmentInterface $ cloneFrom = null ) { $ content = $ this -> getEnvironmentHydrator ( ) -> extract ( $ environment ) ; if ( $ cloneFrom != null ) { $ content [ 'cloneFrom' ] = strval ( $ cloneFrom -> getNormalizedName ( ) ) ; } $ this -> p... | Create or update an environment on the Puppet Master |
230,015 | public function remove ( Model \ EnvironmentInterface $ environment ) { $ this -> pmProxyClient -> delete ( '/environments/' . $ environment -> getNormalizedName ( ) ) ; if ( $ environment -> hasChildren ( ) ) { foreach ( $ environment -> getChildren ( ) as $ child ) { $ this -> remove ( $ child ) ; } } return $ this ;... | Remove an environment on the Puppet Master |
230,016 | public function findIdUrl ( $ id , $ url ) { return $ this -> getModel ( ) -> where ( 'id' , $ id ) -> where ( 'slug_url' , $ url ) -> first ( ) ; } | BUSCAR POR ID Y URL |
230,017 | public function orderByPagination ( $ field , $ order , $ value ) { return $ this -> getModel ( ) -> orderBy ( $ field , $ order ) -> paginate ( $ value ) ; } | ORDERNAR Y PAGINAR |
230,018 | public function findAndPaginateDeletes ( Request $ request ) { return $ this -> getModel ( ) -> onlyTrashed ( ) -> titulo ( $ request -> get ( 'titulo' ) ) -> orderBy ( 'deleted_at' , 'desc' ) -> paginate ( ) ; } | BUSQUEDAS DE REGISTROS ELIMINADOS |
230,019 | static function construct ( ) { $ aniDbTitles = new AniDbTitles ( ) ; $ aniDbTitles -> db = Registry :: getDatabase ( ) ; $ aniDbTitles -> model = $ aniDbTitles -> db -> factory ( '@' . $ aniDbTitles -> table ) ; return $ aniDbTitles ; } | Creates a new AniDbTitles instance |
230,020 | public function syncDatabase ( ) { $ tmpname = '/tmp/odango.php.cache' ; if ( ! file_exists ( $ tmpname ) ) { $ curl = new Curl ( ) ; $ curl -> setOpt ( CURLOPT_ENCODING , "gzip" ) ; $ curl -> download ( $ this -> titleDumpUrl , $ tmpname ) ; $ curl -> close ( ) ; } $ this -> db -> exec ( 'START TRANSACTION' ) ; $ this... | Syncs the database with the up - to - date anidb title dump |
230,021 | public function getAlternativeTitles ( $ title ) { $ builder = $ this -> db -> builder ( ) ; return $ builder -> select ( 'search.title' ) -> from ( [ $ this -> table . ' as main' ] ) -> join ( $ this -> table . ' as search' , 'main."aniDbId" = search."aniDbId"' ) -> where ( 'main.title = :title' ) -> queryColumn ( [ '... | Gets all alternative titles for the title given |
230,022 | public function add ( $ name , $ value = null ) { if ( empty ( $ name ) ) { return $ this ; } $ params = ( ! is_array ( $ name ) ? array ( $ name => $ value ) : $ name ) ; $ query = $ this -> query ( true ) ; foreach ( $ params as $ key => $ val ) { if ( empty ( $ val ) ) { unset ( $ query [ $ key ] ) ; } elseif ( ! em... | Add replace or remove parameters from query url . |
230,023 | public function init ( $ url = null ) { $ url = ( empty ( $ url ) ? Server :: getInstance ( ) -> getCurrentUri ( ) : $ url ) ; $ this -> url = parse_url ( $ url ) ; return $ this ; } | Initialize object properties . |
230,024 | public function query ( $ array = false ) { $ query = ( ! empty ( $ this -> url [ 'query' ] ) ? $ this -> url [ 'query' ] : '' ) ; if ( $ array ) { parse_str ( $ query , $ query ) ; return $ query ; } else { return $ query ; } } | Return query url . |
230,025 | public function setPath ( $ path , $ type = 'replace' , $ replace = '' ) { $ oldPath = ( ! empty ( $ this -> url [ 'path' ] ) ? $ this -> url [ 'path' ] : '' ) ; switch ( $ type ) { case 'add' : $ path = $ oldPath . $ path ; break ; case 'remove' : $ path = str_replace ( $ path , '' , $ oldPath ) ; break ; case 'replac... | Add or replace path |
230,026 | public function uri ( ) { $ uri = ( ! empty ( $ this -> url [ 'scheme' ] ) ? $ this -> url [ 'scheme' ] . '://' : Server :: getInstance ( ) -> get ( 'scheme' , '' ) ) ; $ uri .= ( ! empty ( $ this -> url [ 'user' ] ) ? $ this -> url [ 'user' ] . ':' . $ this -> url [ 'pass' ] . '@' : '' ) ; $ uri .= ( ! empty ( $ this ... | Get formatted uri . |
230,027 | public function getUrlPK ( ) { if ( $ this -> urlPK == null ) { $ this -> urlPK = $ this -> getPrimaryKey ( ) ; } return $ this -> urlPK ; } | The name of the field used as a foreign key in other tables |
230,028 | protected function loadConfiguration ( array $ config , ContainerBuilder $ container ) { $ routeConfigurationChain = $ container -> findDefinition ( 'lp_factory.route_configuration.chain' ) ; foreach ( $ config [ 'routes' ] as $ alias => $ routeConfiguration ) { $ routeConfigurationChain -> addMethodCall ( 'add' , arra... | Load configuration in container |
230,029 | public function filterByLanguagePresets ( $ queryResult , array $ presets ) { $ result = $ queryResult ; if ( ! empty ( $ presets ) ) { $ sysLanguageUid = $ this -> languageService -> getSysLanguageUid ( ) ; $ preset = intval ( $ presets [ $ sysLanguageUid ] ) ; if ( isset ( $ preset ) ) { $ result = [ ] ; foreach ( $ ... | Filters a query result by language presets . |
230,030 | 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 . |
230,031 | public function deleteByKey ( $ name ) : void { if ( ! $ this -> keyExists ( $ name ) ) { return ; } parent :: deleteByKey ( $ name ) ; unset ( $ _SESSION [ $ name ] ) ; } | Removes a variable from the session . |
230,032 | public function set ( $ name , $ value ) : void { $ _SESSION [ $ name ] = $ value ; parent :: set ( $ name , $ value ) ; } | Sets a variable . |
230,033 | 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 . |
230,034 | 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 . |
230,035 | 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 . |
230,036 | 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 . |
230,037 | 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 |
230,038 | 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 |
230,039 | 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 |
230,040 | 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 |
230,041 | 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 . |
230,042 | 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 . |
230,043 | 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 . |
230,044 | 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 |
230,045 | 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 . |
230,046 | 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 . |
230,047 | 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 . |
230,048 | 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 |
230,049 | 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 |
230,050 | 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 . |
230,051 | 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 . |
230,052 | 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 . |
230,053 | 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 . |
230,054 | 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 . |
230,055 | 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 . |
230,056 | 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 |
230,057 | function versionedKey ( $ key ) { if ( $ key == self :: TR8N_VERSION_KEY ) return $ key ; return self :: TR8N_KEY_PREFIX . $ this -> version ( ) . "_" . $ key ; } | Appends version to a key |
230,058 | public function setFails ( array $ fails = null ) : void { if ( ! empty ( $ fails ) ) { foreach ( $ fails as $ fieldName => $ fail ) { $ this -> fails [ $ fieldName ] = $ fail ; } } } | Set fails . |
230,059 | private function createExtensionNode ( ArrayNodeDefinition $ rootNode , $ name , $ validator ) { $ rootNode -> children ( ) -> arrayNode ( $ name ) -> addDefaultChildrenIfNoneSet ( array ( ) ) -> requiresAtLeastOneElement ( ) -> useAttributeAsKey ( 'name' ) -> prototype ( 'variable' ) -> validate ( ) -> ifTrue ( $ vali... | Create configuration section |
230,060 | 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 . |
230,061 | public function min ( $ limit ) { $ result = $ this -> compare ( $ limit , '<' ) ; $ this -> setValid ( $ result ) ; return $ this ; } | Sets the minimum limit . |
230,062 | public function max ( $ limit ) { $ result = $ this -> compare ( $ limit , '>' ) ; $ this -> setValid ( $ result ) ; return $ this ; } | Sets the maximum limit . |
230,063 | 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 . |
230,064 | 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 |
230,065 | 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 . |
230,066 | 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 |
230,067 | 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 |
230,068 | public function secondsBetween ( TimeOfDay $ other ) : int { return abs ( $ this -> dateTime -> getTimestamp ( ) - $ other -> dateTime -> getTimestamp ( ) ) ; } | Returns the amount of seconds between the supplied times . |
230,069 | 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 |
230,070 | 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 . |
230,071 | 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 . |
230,072 | 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 |
230,073 | 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 . |
230,074 | 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 . |
230,075 | 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 . |
230,076 | 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 . |
230,077 | 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 . |
230,078 | 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 . |
230,079 | 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 |
230,080 | 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 |
230,081 | public static function tables ( $ extKey ) { if ( ( TYPO3_MODE === 'BE' ) && Provider :: isGilbertsoft ( ) ) { static :: registerIcons ( $ extKey ) ; static :: adaptWarranty ( $ extKey ) ; static :: adaptLogos ( $ extKey ) ; } } | Adapts the backend |
230,082 | 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 |
230,083 | 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 . |
230,084 | 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 . |
230,085 | 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 . |
230,086 | 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 . |
230,087 | protected function _update ( $ id , array $ data ) { return $ this -> db -> update ( $ this -> table , $ data , [ 'id' => $ id ] ) ; } | Updates item in table . |
230,088 | private function getProperty ( $ key ) { return array_key_exists ( $ key , $ this -> fields ) ? $ this -> fields [ $ key ] : null ; } | Get dynamic property . |
230,089 | private function setProperties ( array $ data ) { foreach ( $ data as $ key => $ value ) { $ this -> setProperty ( $ key , $ value ) ; } return $ this ; } | Go through array and set all dynamic properties . |
230,090 | public function getEndpointUrl ( $ path , $ withTrailingSlash ) { $ url = $ this -> endpoint . '/' . $ path ; if ( $ withTrailingSlash ) { $ url = $ url . '/' ; } return $ url ; } | Get the endpoint url for the request |
230,091 | 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 |
230,092 | 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 . |
230,093 | 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 . |
230,094 | 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 . |
230,095 | 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 . |
230,096 | 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 |
230,097 | 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 . |
230,098 | 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 . |
230,099 | 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 . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.