idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
10,800 | public function normalize ( $ obj ) { $ properties = $ this -> getClassProperties ( get_class ( $ obj ) ) ; $ data = [ ] ; foreach ( $ properties as $ name => $ prop ) { if ( isset ( $ prop [ 'getter' ] ) ) { $ getter = $ prop [ 'getter' ] ; $ value = $ obj -> $ getter ( ) ; } else { $ key = $ prop [ 'name' ] ; $ value... | Normalizes the object into an array of scalars|arrays . |
10,801 | private function getClassProperties ( $ class ) { $ properties = $ this -> getCache ( ) -> get ( '_PHX.serialze_properties.' . $ class ) ; if ( ! isset ( $ properties ) ) { $ classResolver = $ this -> getClassResolver ( ) ; $ properties = $ this -> getReflectionProperties ( $ class ) ; foreach ( $ this -> getAnnotation... | gets class properties metadata |
10,802 | public function getSiteFilterQuery ( $ targetTableAlias ) { $ parent = $ this -> getParent ( ) ; if ( $ parent and $ parentId = $ parent -> getId ( ) ) { return $ targetTableAlias . '.site_id = ' . $ parentId ; } elseif ( $ id = $ this -> getId ( ) ) { return $ targetTableAlias . '.site_id = ' . $ id ; } return '' ; } | Get filter query |
10,803 | public function sumOfferCount ( ) { $ count = $ this -> getOfferCount ( ) ; if ( $ this -> getParent ( ) ) { $ count += $ this -> getParent ( ) -> getOfferCount ( ) ; } if ( $ this -> getLinkedSites ( ) -> count ( ) ) { foreach ( $ this -> getLinkedSites ( ) as $ linked ) { $ count += $ linked -> getOfferCount ( ) ; } ... | Get sum of all offers |
10,804 | public function afterScript ( Buffer $ buffer ) { $ buffer -> write ( sprintf ( '$z->pop(\'%s\');' , $ this -> key ) ) ; $ buffer -> write ( sprintf ( '$z->pop(\'%s\');' , $ this -> value ) ) ; $ buffer -> indent ( - 1 ) ; $ buffer -> writeln ( '}' ) ; } | Allows the annotation to modify the buffer after the script is compiled . |
10,805 | protected function _timeToMongoDate ( $ time ) { if ( ! is_numeric ( $ time ) ) { $ time = strtotime ( $ time ) ; if ( ! $ time ) { $ time = time ( ) ; } } return new \ MongoDate ( $ time ) ; } | Convert time in different formats to mongo date |
10,806 | protected function processLogs ( $ logs ) { $ logCollection = \ Yii :: app ( ) -> { $ this -> serviceName } -> getCollection ( $ this -> collectionName ) ; foreach ( $ logs as $ log ) { $ logCollection -> createDocument ( array ( 'level' => $ log [ 1 ] , 'category' => $ log [ 2 ] , 'logtime' => $ this -> _timeToMongoDa... | Write log messages |
10,807 | public function isSingular ( Pluralizer $ pluralizer = null ) { $ pluralizer = $ pluralizer ? : new EnglishPluralizer ( ) ; return $ pluralizer -> isSingular ( $ this -> string ) ; } | Check if a string is singular form . |
10,808 | public function isPlural ( Pluralizer $ pluralizer = null ) { $ pluralizer = $ pluralizer ? : new EnglishPluralizer ( ) ; return $ pluralizer -> isPlural ( $ this -> string ) ; } | Check if a string is plural form . |
10,809 | protected function initRuntimeVars ( Dwoo_ITemplate $ tpl ) { $ this -> runtimePlugins = array ( ) ; $ this -> scope = & $ this -> data ; $ this -> scopeTree = array ( ) ; $ this -> stack = array ( ) ; $ this -> curBlock = null ; $ this -> buffer = '' ; } | re - initializes the runtime variables before each template run |
10,810 | public function addPlugin ( $ name , $ callback , $ compilable = false ) { $ compilable = $ compilable ? self :: COMPILABLE_PLUGIN : 0 ; if ( is_array ( $ callback ) ) { if ( is_subclass_of ( is_object ( $ callback [ 0 ] ) ? get_class ( $ callback [ 0 ] ) : $ callback [ 0 ] , 'Dwoo_Block_Plugin' ) ) { $ this -> plugins... | adds a custom plugin that is not in one of the plugin directories |
10,811 | public function addFilter ( $ callback , $ autoload = false ) { if ( $ autoload ) { $ class = 'Dwoo_Filter_' . $ callback ; if ( ! class_exists ( $ class , false ) && ! function_exists ( $ class ) ) { try { $ this -> getLoader ( ) -> loadPlugin ( $ callback ) ; } catch ( Dwoo_Exception $ e ) { if ( strstr ( $ callback ... | adds a filter to this Dwoo instance it will be used to filter the output of all the templates rendered by this instance |
10,812 | public function removeFilter ( $ callback ) { if ( ( $ index = array_search ( 'Dwoo_Filter_' . $ callback , $ this -> filters , true ) ) !== false ) { unset ( $ this -> filters [ $ index ] ) ; } elseif ( ( $ index = array_search ( $ callback , $ this -> filters , true ) ) !== false ) { unset ( $ this -> filters [ $ ind... | removes a filter |
10,813 | public function addResource ( $ name , $ class , $ compilerFactory = null ) { if ( strlen ( $ name ) < 2 ) { throw new Dwoo_Exception ( 'Resource names must be at least two-character long to avoid conflicts with Windows paths' ) ; } if ( ! class_exists ( $ class ) ) { throw new Dwoo_Exception ( 'Resource class does not... | adds a resource or overrides a default one |
10,814 | public function getLoader ( ) { if ( $ this -> loader === null ) { $ this -> loader = new Dwoo_Loader ( $ this -> getCompileDir ( ) ) ; } return $ this -> loader ; } | returns the current loader object or a default one if none is currently found |
10,815 | public function getCacheDir ( ) { if ( $ this -> cacheDir === null ) { $ this -> setCacheDir ( dirname ( __FILE__ ) . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR ) ; } return $ this -> cacheDir ; } | returns the cache directory with a trailing DIRECTORY_SEPARATOR |
10,816 | public function setCacheDir ( $ dir ) { $ this -> cacheDir = rtrim ( $ dir , '/\\' ) . DIRECTORY_SEPARATOR ; if ( is_writable ( $ this -> cacheDir ) === false ) { throw new Dwoo_Exception ( 'The cache directory must be writable, chmod "' . $ this -> cacheDir . '" to make it writable' ) ; } } | sets the cache directory and automatically appends a DIRECTORY_SEPARATOR |
10,817 | public function getCompileDir ( ) { if ( $ this -> compileDir === null ) { $ this -> setCompileDir ( dirname ( __FILE__ ) . DIRECTORY_SEPARATOR . 'compiled' . DIRECTORY_SEPARATOR ) ; } return $ this -> compileDir ; } | returns the compile directory with a trailing DIRECTORY_SEPARATOR |
10,818 | public function setCompileDir ( $ dir ) { $ this -> compileDir = rtrim ( $ dir , '/\\' ) . DIRECTORY_SEPARATOR ; if ( is_writable ( $ this -> compileDir ) === false ) { throw new Dwoo_Exception ( 'The compile directory must be writable, chmod "' . $ this -> compileDir . '" to make it writable' ) ; } } | sets the compile directory and automatically appends a DIRECTORY_SEPARATOR |
10,819 | private function getAllGenerators ( ) { $ allGenerators = array ( ) ; foreach ( fphp \ Generator \ Generator :: getGeneratorMap ( ) as $ key => $ klass ) $ allGenerators [ $ key ] = new $ klass ( $ this -> productLine -> getGeneratorSettings ( $ key ) ) ; return $ allGenerators ; } | Returns all generators . The generators are instantiated with their respective generator settings . |
10,820 | private function addArtifactToUsedGenerators ( $ allGenerators , $ feature , $ func ) { $ artifact = $ this -> productLine -> getArtifact ( $ feature ) ; foreach ( $ artifact -> getGenerators ( ) as $ key => $ cfg ) { if ( ! array_key_exists ( $ key , $ allGenerators ) ) throw new ProductException ( "\"$key\" is not a ... | Adds a feature s artifact to all generators it specifies . This is done independently from whether the corresponding feature is selected or deselected to support generating code for both cases . |
10,821 | private function getGeneratorElements ( $ func ) { $ allGenerators = $ this -> getAllGenerators ( ) ; foreach ( $ this -> configuration -> getSelectedFeatures ( ) as $ feature ) $ this -> addArtifactToUsedGenerators ( $ allGenerators , $ feature , "addSelectedArtifact" ) ; foreach ( $ this -> configuration -> getDesele... | Returns elements generated for the product . To do this every artifact is registered with the generators it specifies . Then every generator generates some elements . Finally all the elements are merged . |
10,822 | public function generateFiles ( ) { $ files = $ this -> getGeneratorElements ( "generateFiles" ) ; $ files = fphp \ Helper \ _Array :: assertNoDuplicates ( $ files , "getTarget" ) ; $ files = fphp \ Helper \ _Array :: sortByKey ( $ files , "getTarget" ) ; return $ files ; } | Generates the product s files . |
10,823 | public function trace ( ) { $ tracingLinks = array_merge ( $ this -> getGeneratorElements ( "trace" ) , $ this -> getAllGenerators ( ) [ "runtime" ] -> traceRuntimeCalls ( $ this -> generateFiles ( ) , $ this -> productLine ) ) ; $ tracingLinks = fphp \ Helper \ _Array :: sortByKey ( $ tracingLinks , "getFeatureName" )... | Returns tracing links for the product . |
10,824 | public static function hasSessionMoved ( ) { if ( ! isset ( $ _SESSION [ 'dachi_agent' ] ) ) return true ; $ agents = $ _SESSION [ 'dachi_agent' ] ; $ agentc = $ _SERVER [ 'HTTP_USER_AGENT' ] ; if ( $ agents != $ agentc ) { if ( strpos ( $ agentc , "Trident" ) !== false && strpos ( $ agents , "Trident" ) !== false ) re... | Has this session moved |
10,825 | public static function isValid ( ) { if ( isset ( $ _SESSION [ 'dachi_closed' ] ) && ! isset ( $ _SESSION [ 'dachi_expires' ] ) ) return false ; if ( isset ( $ _SESSION [ 'dachi_expires' ] ) && $ _SESSION [ 'dachi_expires' ] < time ( ) ) return false ; return true ; } | Is this session still valid? |
10,826 | public static function regenerate ( ) { if ( isset ( $ _SESSION [ 'dachi_closed' ] ) && $ _SESSION [ 'dachi_closed' ] == true ) return false ; $ _SESSION [ 'dachi_closed' ] = true ; $ _SESSION [ 'dachi_expires' ] = time ( ) + 10 ; session_regenerate_id ( false ) ; $ new_session = session_id ( ) ; session_write_close ( ... | Regenerate the session for security |
10,827 | private function buildRadiusOptions ( ) { if ( ! $ this -> radius || ! isset ( $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ this -> radius ] ) ) { return null ; } $ options = [ 'element' => 'ctrl_' . $ this -> radius , 'min' => 0 , 'max' => 0 , 'defaultValue' => 0 ] ; if ( isset ( $ GLOBALS [ 'TL_DCA'... | Build the radius options . |
10,828 | public static function createMany ( array $ datasets ) : array { $ models = [ ] ; foreach ( $ datasets as $ dataset ) { $ models [ ] = static :: create ( $ dataset ) ; } return $ models ; } | Creates many Models . |
10,829 | public function expires ( $ time ) { if ( ! empty ( $ time ) && is_string ( $ time ) && ! $ timestamp = strtotime ( $ time ) ) { throw new \ Ergo \ Routing \ Exception ( "Invalid expiry time: $timestamp" ) ; } else if ( is_numeric ( $ time ) ) { $ timestamp = $ time ; } else if ( $ time == false ) { return $ this ; } $... | Sets the Expires header based on a Unix timestamp . |
10,830 | public function created ( $ location = null ) { $ this -> respondWith ( 201 ) ; if ( ! empty ( $ location ) ) { $ this -> setResponseHeader ( 'Location' , $ location ) ; } } | Response with created 201 code and optionally the created location |
10,831 | public function partialContent ( $ rangeFrom , $ rangeTo , $ totalSize ) { $ this -> respondWith ( 206 ) ; $ this -> setResponseHeader ( 'Content-Range' , "bytes {$rangeFrom}-{$rangeTo}/{$totalSize}" ) ; $ this -> setResponseHeader ( 'Content-Length' , $ rangeTo - $ rangeFrom ) ; } | Respond with a 206 Partial content with Content - Range header |
10,832 | public function redirect ( $ url , $ code = 303 ) { $ this -> respondWith ( $ code ) ; $ this -> setResponseHeader ( 'Location' , $ url ) ; $ urlHtml = htmlentities ( $ url ) ; $ this -> output ( 'You are being redirected to <a href="' . $ urlHtml . '">' . $ urlHtml . '</a>' , 'text/html' ) ; } | Redirect to url and output a short message with the link |
10,833 | protected function getContentType ( $ format ) { if ( \ Jasny \ str_contains ( $ format , '/' ) ) { return $ format ; } $ repository = new ApacheMimeTypes ( ) ; $ mime = $ repository -> findType ( $ format ) ; if ( ! isset ( $ mime ) ) { throw new \ UnexpectedValueException ( "Format '$format' doesn't correspond with a... | Get MIME type for extension |
10,834 | protected function outputContentType ( $ format ) { if ( ! isset ( $ format ) ) { $ contentType = $ this -> getResponse ( ) -> getHeaderLine ( 'Content-Type' ) ; if ( empty ( $ contentType ) ) { $ format = $ this -> defaultFormat ? : 'text/html' ; } } if ( empty ( $ contentType ) ) { $ contentType = $ this -> getConten... | Set the content type for the output |
10,835 | public function listFolder ( string $ path , bool $ recursive = false ) : array { $ path = $ this -> normalizePath ( $ path ) ; $ requestUrl = $ this -> siteUrl . '/sites/' . $ this -> siteName . '/_api/Web/GetFolderByServerRelativeUrl(\'' . $ this -> folderPath . $ path . '\')/Folders' ; $ options = [ 'headers' => $ t... | Returns the contents of a folder . |
10,836 | public function copy ( string $ fromPath , string $ toPath , array $ mimeType ) : bool { $ fromPath = $ this -> normalizePath ( $ fromPath ) ; $ toPath = $ this -> normalizePath ( $ toPath ) ; if ( substr ( $ mimeType [ 'mimetype' ] , 0 , 4 ) === 'text' ) { $ requestUrl = $ this -> siteUrl . '/sites/' . $ this -> siteN... | Copy a file or folder to a different location . |
10,837 | public function images ( $ file , $ version = '' ) { if ( empty ( $ version ) ) { $ version = '?ver=' . Kecik :: $ version ; } return $ this -> BaseUrl . Config :: get ( 'path.assets' ) . '/images/' . $ file . $ version ; } | Create of images Url from Assets |
10,838 | public function url ( $ file = '' , $ version = '' ) { if ( empty ( $ version ) ) { $ version = '?ver=' . Kecik :: $ version ; } if ( ! empty ( $ file ) ) { return $ this -> BaseUrl . Config :: get ( 'path.assets' ) . '/' . $ file . $ version ; } else { return $ this -> BaseUrl . Config :: get ( 'path.assets' ) . '/' ;... | Create url from assets |
10,839 | public function delete ( $ file ) { $ key = array_search ( $ file , $ this -> assets [ $ this -> type ] ) ; unset ( $ this -> assets [ $ this -> type ] [ $ key ] ) ; unset ( $ this -> attr [ $ this -> type ] [ $ key ] ) ; } | Delete Assets from register delete |
10,840 | protected function build_input ( $ data , array $ fields = [ ] ) { $ fields = implode ( ' ' , $ fields ) ; return sprintf ( '<input id="%1$s" name="%1$s" type="%2$s" %3$s value="%4$s" />' , $ this -> name , $ this -> type , $ fields , esc_attr ( $ data ) ) ; } | build input field |
10,841 | protected function constructDataModuleNamespace ( & $ data ) { if ( isset ( $ data -> module ) ) $ this -> SetModule ( $ data -> module ) ; if ( isset ( $ data -> namespace ) ) $ this -> SetNamespace ( $ data -> namespace ) ; } | If route is initialized by single array argument with all data initialize route application module name and optional target controllers namespace - used only if routed controller is not defined absolutely . Initialize both properties by setter methods . |
10,842 | public function transform ( $ route ) { $ route = $ this -> entityToArray ( Route :: class , $ route ) ; return [ 'id' => ( int ) $ route [ 'id' ] , 'createdAt' => $ route [ 'created_at' ] , 'updatedAt' => $ route [ 'updated_at' ] ] ; } | Transforms route entity |
10,843 | public function provide ( $ name , $ args ) { $ services = $ this -> getServices ( ) ; if ( isset ( $ services [ $ name ] ) ) { return ( new Service ( $ name , $ services [ $ name ] ) ) -> resolve ( $ args , $ this -> getDi ( ) ) ; } else { $ method = self :: METHOD_PREFIX . $ name ; if ( method_exists ( $ this , $ met... | Creates service instance |
10,844 | public function getNames ( ) { $ names = array_keys ( $ this -> getServices ( ) ) ; $ len = strlen ( self :: METHOD_PREFIX ) ; foreach ( get_class_methods ( $ this ) as $ method ) { if ( Text :: startsWith ( $ method , self :: METHOD_PREFIX ) ) { $ name = lcfirst ( substr ( $ method , $ len ) ) ; if ( $ name ) { $ name... | Gets all service names |
10,845 | public function append ( ) { if ( ! $ this -> hasMultiHandle ( ) ) { $ this -> setMultiHandle ( curl_multi_init ( ) ) ; } $ this -> initOption ( ) -> buildBody ( ) ; $ curl = curl_init ( ) ; curl_setopt_array ( $ curl , $ this -> getOptions ( ) ) ; curl_multi_add_handle ( $ this -> getMultiHandle ( ) , $ curl ) ; $ thi... | add multi handle |
10,846 | public function validateModelId ( $ attribute , $ params ) { $ class = Model :: findIdentity ( $ this -> model_class ) ; if ( $ class === null ) { $ this -> addError ( $ attribute , \ Yii :: t ( 'net_frenzel_communication' , 'ERROR_MSG_INVALID_MODEL_ID' ) ) ; } else { $ model = $ class -> name ; if ( $ model :: find ( ... | Model ID validation . |
10,847 | public static function getIPLocation ( ) { $ adapter = new GuzzleHttpAdapter ( ) ; $ geocoder = new \ Geocoder \ Provider \ FreeGeoIp ( $ adapter ) ; if ( ! isset ( $ _SERVER [ 'HTTP_X_FORWARDED_FOR' ] ) ) { $ client_ip = $ _SERVER [ 'REMOTE_ADDR' ] ; } else { $ client_ip = $ _SERVER [ 'HTTP_X_FORWARDED_FOR' ] ; } retu... | find the use location based upon his current IP address |
10,848 | protected function handleInvalidMethod ( $ method ) { $ emptyResponse = new Response ( ) ; $ emptyResponse -> setHeader ( "HTTP/1.1 405 Method $method Not Allowed" , false ) ; $ emptyResponse -> setHeader ( "Allow" , implode ( ", " , $ this -> getSupportedHttpMethods ( ) ) ) ; throw new ForceResponseException ( $ empty... | Override to handle the case where an HTTP method is unsupported . |
10,849 | public function factory ( ) { $ redis = new \ Redis ( ) ; $ host = $ this -> getConfig ( ) -> getValue ( self :: CONFIG_HOST ) ; $ port = $ this -> getConfig ( ) -> getValue ( self :: CONFIG_PORT ) ; $ timeout = $ this -> getConfig ( ) -> getValue ( self :: CONFIG_TIMEOUT ) ; if ( $ this -> getConfig ( ) -> getValueFla... | Creates a configured \ Redis instance in the object context |
10,850 | public function setTemplateDir ( $ path = VIEW ) { $ old = $ this -> _sv_template_dir ; $ this -> _sv_template_dir = $ path ; return $ old ; } | changes the template directory |
10,851 | public function jsonDecode ( ) { $ json = json_decode ( $ this -> body , true ) ; if ( $ json === null ) { throw new JsonFormatException ( $ this -> body ) ; } return $ json ; } | Decode as JSON |
10,852 | protected function addFile ( Phar $ phar , SplFileInfo $ file , $ strip = true ) { $ path = strtr ( str_replace ( dirname ( dirname ( dirname ( __DIR__ ) ) ) . DIRECTORY_SEPARATOR , '' , $ file -> getRealPath ( ) ) , '\\' , '/' ) ; $ content = file_get_contents ( $ file ) ; if ( $ strip ) { $ content = $ this -> stripW... | Add a file into the phar package |
10,853 | protected function addBin ( Phar $ phar ) { $ content = file_get_contents ( __DIR__ . '/../../../bin/visithor' ) ; $ content = preg_replace ( '{^#!/usr/bin/env php\s*}' , '' , $ content ) ; $ phar -> addFromString ( 'bin/visithor' , $ content ) ; return $ this ; } | Add bin into Phar |
10,854 | public function addCron ( CronInterface $ cron , $ alias , $ priority , $ arguments ) { if ( ! isset ( $ this -> crons [ $ priority ] ) ) { $ this -> crons [ $ priority ] = array ( ) ; } $ cron -> setAlias ( $ alias ) ; $ cron -> addArguments ( $ arguments ) ; $ cron -> addPriority ( $ priority ) ; $ this -> crons [ $ ... | Add cron to crons list |
10,855 | public function index ( $ request ) { $ application = $ request -> get ( 'application' ) ; $ path = $ request -> get ( 'path' ) ; if ( empty ( $ application ) || empty ( $ path ) ) { return new Response ( "Not a valid asset" , 404 ) ; } if ( strpos ( '..' , $ path ) === 0 ) { return new Response ( "Only assets will be ... | Serves assets from the Application directory . |
10,856 | public function createNewUser ( $ serviceName , AbstractUser $ response ) { $ data = $ this -> parseServiceResponse ( $ response ) ; $ existingUser = $ this -> userRepo -> getByEmail ( $ data [ 'email' ] ) ; if ( $ existingUser === null ) { $ data [ 'password' ] = str_random ( 40 ) ; $ user = $ this -> userRepo -> crea... | Function creates new user based on social service response and create relation with social integration in database . |
10,857 | public function addUserSocialAccount ( User $ user , $ serviceName , AbstractUser $ response ) { $ user -> has_social_integrations = true ; $ user -> save ( ) ; $ this -> addSocialRelation ( $ user , $ serviceName , $ response ) ; return $ user ; } | Function adds new social account for existing user . |
10,858 | public function addSocialRelation ( User $ user , $ serviceName , AbstractUser $ response ) { return $ this -> newQB ( ) -> insert ( [ 'user_id' => $ user -> id , 'social_id' => $ serviceName . '_' . $ response -> id , 'created_at' => \ DB :: raw ( 'NOW()' ) ] ) ; } | Function creates relation for given user and social integration . |
10,859 | private function parseServiceResponse ( AbstractUser $ response ) { $ userData = [ 'has_social_integrations' => true , 'nick' => $ response -> getNickname ( ) ] ; if ( $ response -> getEmail ( ) ) { $ userData [ 'email' ] = $ response -> getEmail ( ) ; } else { $ userData [ 'email' ] = uniqid ( 'social_' , true ) ; } $... | Function parses social service response and prepares user data to insert to database . |
10,860 | public function executeQueryCopy ( Transformation $ transformation ) { $ path = $ transformation -> getSourceAsPath ( ) ; if ( ! is_readable ( $ path ) ) { throw new Exception ( 'Unable to read the source file: ' . $ path ) ; } if ( ! is_writable ( $ transformation -> getTransformer ( ) -> getTarget ( ) ) ) { throw new... | Copies files or folders to the Artifact location . |
10,861 | public function loadConfiguration ( ) { $ builder = $ this -> getContainerBuilder ( ) ; $ config = $ this -> getConfig ( $ this -> defaults ) ; $ menuFactory = $ builder -> addDefinition ( $ this -> prefix ( 'extension' ) ) -> setClass ( 'Smf\Menu\MenuExtension' ) ; $ menuFactory = $ builder -> addDefinition ( $ this -... | Configuration - container building |
10,862 | public static function register ( Nette \ Configurator $ configurator , $ name = self :: DEFAULT_EXTENSION_NAME ) { $ class = get_called_class ( ) ; $ configurator -> onCompile [ ] = function ( Nette \ Configurator $ configurator , Nette \ DI \ Compiler $ compiler ) use ( $ class , $ name ) { $ compiler -> addExtension... | Register extension to compiler . |
10,863 | public function hasEnabledInvitationRegistration ( ) { if ( $ this -> invitationRegistrationClass === false || ! is_string ( $ this -> invitationRegistrationClass ) || ! class_exists ( $ this -> invitationRegistrationClass ) ) { return false ; } return true ; } | Check whether this user enables the invitation from registration feature or not . |
10,864 | public function setColumn ( $ name , $ value ) { foreach ( $ this -> entities as $ entity ) { $ entity -> set ( $ name , $ value ) ; } return $ this ; } | Set the value of a column for all entities in this collection . Setter methods will be called . |
10,865 | public function setColumnRaw ( $ name , $ value ) { foreach ( $ this -> entities as $ entity ) { $ entity -> setRaw ( $ name , $ value ) ; } return $ this ; } | Set the value of a column for all entities in this collection . Setter methods will not be called . |
10,866 | public function getColumn ( $ name ) { $ results = [ ] ; foreach ( $ this -> entities as $ entity ) { $ results [ ] = $ entity -> get ( $ name ) ; } return $ results ; } | Get the values of a single column from all entities in this collection . Getter methods will be called . |
10,867 | public function getColumnRaw ( $ name ) { $ results = [ ] ; foreach ( $ this -> entities as $ entity ) { $ results [ ] = $ entity -> getRaw ( $ name ) ; } return $ results ; } | Get the values of a single column from all entities in this collection . Getter methods will not be called . |
10,868 | public function getOne ( $ column , $ value , $ strict = true ) { if ( $ strict ) { foreach ( $ this -> entities as $ entity ) { if ( $ entity -> get ( $ column ) === $ value ) { return $ entity ; } } } else { foreach ( $ this -> entities as $ entity ) { if ( $ entity -> get ( $ column ) == $ value ) { return $ entity ... | Get a single Entity from this collection where column = value . If more than one Entity is matched the first will be returned . If no Entity is matched null will be returned . |
10,869 | public function getRandom ( ) { return empty ( $ this -> entities ) ? null : $ this -> entities [ array_rand ( $ this -> entities ) ] ; } | Get a random Entity from this collection or null if the collection is empty . |
10,870 | public function remove ( $ column , $ value ) { foreach ( $ this -> entities as $ index => $ entity ) { if ( $ entity -> get ( $ column ) === $ value ) { unset ( $ this -> entities [ $ index ] ) ; $ this -> entities = array_values ( $ this -> entities ) ; return $ entity ; } } return ; } | Remove a single Entity from this collection where column = value . If more than one Entity is matched the first will be removed and returned . If no Entity is matched null will be returned . |
10,871 | public function removeRandom ( ) { $ index = array_rand ( $ this -> entities ) ; $ entity = $ this -> entities [ $ index ] ; unset ( $ this -> entities [ $ index ] ) ; return $ entity ; } | Remove a random Entity from this collection or null if the collection is empty . |
10,872 | public static function term ( $ pid , $ lagger_timeout = 0 , $ signal = SIGTERM ) { $ kill_time = time ( ) + $ lagger_timeout ; $ term = self :: signal ( $ pid , $ signal ) ; while ( time ( ) < $ kill_time ) { if ( ! self :: isRunning ( $ pid ) ) return $ term ; usleep ( 20000 ) ; } return self :: kill ( $ pid ) ; } | Terminate a process asking PID to terminate or killing it directly . |
10,873 | public static function setNiceness ( $ niceness , $ pid = null ) { return is_null ( $ pid ) ? @ proc_nice ( $ niceness ) : @ pcntl_setpriority ( $ pid , $ niceness ) ; } | Set niceness of a running process |
10,874 | public static function calc_base_directory_for_object ( DataObject $ do ) { $ str = 'dataobjects' ; $ ancestry = $ do -> getClassAncestry ( ) ; foreach ( $ ancestry as $ c ) { if ( $ c == 'SiteTree' ) { $ str = 'pages' ; } } switch ( $ do -> ClassName ) { case 'SiteConfig' : $ str = 'site' ; break ; default : } return ... | Base rules . |
10,875 | public function delete_index ( string $ table , string $ key ) : bool { if ( ( $ table = $ this -> table_full_name ( $ table , 1 ) ) && bbn \ str :: check_name ( $ key ) ) { return ( bool ) $ this -> db -> query ( "ALTER TABLE $table DROP INDEX `$key`" ) ; } return false ; } | Deletes an index |
10,876 | public function addRoute ( Route $ route ) { foreach ( $ route -> getMethods ( ) as $ method ) { $ this -> routes [ $ method ] [ ] = $ route ; } $ this -> allRoutes [ ] = $ route ; return $ this ; } | Add a Route instans to application routes . |
10,877 | protected function rglob ( $ pattern , $ excludes = array ( ) ) { $ files = array ( ) ; foreach ( glob ( $ pattern , 0 ) as $ item ) { if ( ! empty ( $ excludes ) && in_array ( ltrim ( $ item , '\.\/' ) , $ excludes ) ) { $ this -> trace ( "Skipping excluded item ./%s" , ltrim ( $ item , '\.\/' ) ) ; continue ; } if ( ... | Recursively globs all the files and directories using the given pattern . If any file or directory exists in the list of excluded items it is skipped |
10,878 | private function amendDynamicAttributesToJson ( array & $ json ) { if ( ! is_null ( $ this -> package_version ) ) { $ json [ 'version' ] = array ( ) ; $ json [ 'version' ] [ 'release' ] = $ this -> package_version ; } if ( ! is_null ( $ this -> package_name ) ) { $ json [ 'name' ] = $ this -> package_name ; } } | Adds attributes given from command line to the json |
10,879 | public function getValue ( $ feature ) { $ defaultValue = $ feature -> getDefaultValue ( ) ; $ values = $ this -> xmlConfiguration -> getValues ( ) ; if ( array_key_exists ( $ feature -> getName ( ) , $ values ) ) return $ values [ $ feature -> getName ( ) ] ; else return $ defaultValue ; } | Returns the configuration s value for a value feature . |
10,880 | public function renderAnalysis ( $ productLine = null , $ textOnly = false ) { return ( new ConfigurationRenderer ( $ this , $ productLine ) ) -> render ( $ textOnly ) ; } | Analyzes the model and configuration by returning a web page . |
10,881 | protected function get_field ( \ WP_Post $ post ) { $ field = parent :: get_field ( $ post ) ; if ( $ this -> prefix ) { $ field = $ this -> prefix . ' ' . $ field ; } if ( $ this -> suffix ) { $ field .= $ this -> suffix ; } return $ field ; } | Add suffix or prefix to field |
10,882 | public function getSortedModuleList ( ) : array { $ moduleList = $ this -> modules ; foreach ( $ moduleList as $ moduleSpec ) { $ moduleClass = $ moduleSpec [ 'class' ] ; $ module = $ moduleSpec [ 'object' ] ; if ( $ module instanceof OrderAwareModule ) { foreach ( $ module -> getModulesAfter ( ) as $ afterModuleClass ... | Returns a list of modules sorted by dependencies . |
10,883 | public function afterAddingComment ( $ comment , $ notification ) { $ contentID = $ comment -> attribute ( 'contentobject_id' ) ; $ languageID = $ comment -> attribute ( 'language_id' ) ; $ subscriptionType = 'ezcomcomment' ; $ subscription = ezcomSubscriptionManager :: instance ( ) ; $ user = eZUser :: instance ( ) ; ... | add subscription after adding comment 1 ) If notification is true add the user as a subscriber if subscriber with same email doesn t exist otherwise get the subscriber 2 ) If notification is true if the subscription with user s email and contentid doesn t exist add a new subscription 3 ) If there is subscription add th... |
10,884 | public function afterUpdatingComment ( $ comment , $ notified , $ time ) { $ user = eZUser :: fetch ( $ comment -> attribute ( 'user_id' ) ) ; $ contentID = $ comment -> attribute ( 'contentobject_id' ) ; $ languageID = $ comment -> attribute ( 'language_id' ) ; $ subscriptionType = 'ezcomcomment' ; if ( ! is_null ( $ ... | clean up subscription after updating comment |
10,885 | public function authenticate ( ) { $ request = new Request ( $ this -> handler ) ; $ this -> token = $ request -> execute ( RequestMethods :: HTTP_POST , $ this -> makeUrl ( RequestMethods :: DOMUSERP_API_PEDIDOVENDA . '/auth' ) , [ 'json' => [ 'login' => $ this -> username , 'password' => $ this -> password ] ] ) -> t... | Request an access token and sets it to the client . |
10,886 | private function plugins_loaded ( ) { if ( $ this -> _plugins_loaded ) { return ; } $ this -> _plugins_loaded = true ; spl_autoload_register ( function ( $ class ) { return $ this -> get_main ( ) -> load_class ( $ class ) ; } ) ; $ this -> load_functions ( ) ; } | load basic files |
10,887 | private function load_functions ( ) { if ( $ this -> is_theme ) { return ; } $ functions = $ this -> define -> plugin_dir . DS . 'functions.php' ; if ( is_readable ( $ functions ) ) { require_once $ functions ; } } | load functions file |
10,888 | private function resolveQsen ( $ link ) { if ( ! $ this -> isFqsen ( $ link ) ) { $ typeCollection = new TypeCollection ( array ( $ link ) , $ this -> createDocBlockContext ( ) ) ; $ link = $ typeCollection [ 0 ] ; } return $ link ; } | Resolves a QSEN to a FQSEN . |
10,889 | private function findElement ( $ fqsen ) { return isset ( $ this -> elementCollection [ $ fqsen ] ) ? $ this -> elementCollection [ $ fqsen ] : null ; } | Tries to find an element with the given FQSEN in the elements listing for this project . |
10,890 | public function getMenu ( $ level = 1 ) { if ( class_exists ( ContentController :: class ) ) { $ controller = Injector :: inst ( ) -> get ( ContentController :: class ) ; return $ controller -> getMenu ( $ level ) ; } } | If content controller exists return it s menu function |
10,891 | public function index ( SS_HTTPRequest $ request ) { $ this -> customise ( array ( 'Title' => _t ( 'Users.Register' , 'Register' ) , 'MetaTitle' => _t ( 'Users.Register' , 'Register' ) , 'Form' => $ this -> RegisterForm ( ) , ) ) ; $ this -> extend ( "updateIndexAction" ) ; return $ this -> renderWith ( array ( "Users_... | Default action this controller will deal with |
10,892 | public function check ( $ file , $ verify = null ) { if ( is_string ( $ verify ) ) { $ verify = "lead" . strtoupper ( $ verify ) ; } $ detectives = [ ] ; foreach ( $ this -> detectives as $ detectiveClass ) { if ( $ detectiveClass :: on ( ) ) { $ detectives [ ] = $ detectiveClass ; } } $ case = null ; foreach ( $ detec... | Runs the file against all dectives . |
10,893 | public function setDataDirectory ( string $ directory ) { if ( ! is_dir ( $ directory ) ) { $ exception = new StorageException ( sprintf ( StorageException :: DIRECTORY_NOT_FOUND , $ directory ) ) ; $ exception -> setDirectory ( $ exception ) ; $ exception -> setProvider ( static :: class ) ; throw $ exception ; } $ th... | Set data directory |
10,894 | public function active ( ) { if ( ! \ Yii :: $ app -> user -> isGuest && ! \ Yii :: $ app -> user -> identity -> isAdmin ) { $ this -> andWhere ( [ 'deleted_at' => NULL ] ) ; } return $ this ; } | only none delted records should be returned deleted would mean they are not null anymore within field value |
10,895 | public function related ( $ entity = NULL , $ enity = NULL ) { $ this -> andWhere ( [ 'entity' => $ entity , 'entity_id' => $ this -> entity_id ] ) ; return $ this ; } | find all records which are related to the same entity |
10,896 | public function processClass ( ProjectDescriptor $ project , Transformation $ transformation ) { try { $ this -> checkIfGraphVizIsInstalled ( ) ; } catch ( \ Exception $ e ) { echo $ e -> getMessage ( ) ; return ; } if ( $ transformation -> getParameter ( 'font' ) !== null && $ transformation -> getParameter ( 'font' )... | Creates a class inheritance diagram . |
10,897 | public function add ( $ alias , $ source = null , $ dependencies = [ ] , $ options = [ ] ) { if ( $ source !== null ) { $ asset = $ this -> _factory -> create ( $ alias , $ source , $ dependencies , $ options ) ; $ this -> _collection -> add ( $ asset ) ; } $ this -> _queued [ $ alias ] = true ; return $ this ; } | Adds a registered asset or a new asset to the queue . |
10,898 | public function register ( $ alias , $ source = null , $ dependencies = [ ] , $ options = [ ] ) { $ asset = $ this -> _factory -> create ( $ alias , $ source , $ dependencies , $ options ) ; $ this -> _collection -> add ( $ asset ) ; return $ this ; } | Registers an asset . |
10,899 | public function unregister ( $ alias ) { $ this -> _collection -> remove ( $ alias ) ; $ this -> remove ( $ alias ) ; return $ this ; } | Unregisters an asset from collection . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.