idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
1,300 | public static function doInsert ( $ criteria , ConnectionInterface $ con = null ) { if ( null === $ con ) { $ con = Propel :: getServiceContainer ( ) -> getWriteConnection ( KstrukturTableMap :: DATABASE_NAME ) ; } if ( $ criteria instanceof Criteria ) { $ criteria = clone $ criteria ; } else { $ criteria = $ criteria ... | Performs an INSERT on the database given a Kstruktur or Criteria object . |
1,301 | public function recreate ( ) { $ this -> riakCursor = $ this -> collection -> getRiakCollection ( ) -> find ( $ this -> query , $ this -> fields ) ; if ( $ this -> hint !== null ) { $ this -> riakCursor -> hint ( $ this -> hint ) ; } if ( $ this -> immortal !== null ) { $ this -> riakCursor -> immortal ( $ this -> immo... | Recreates the internal RiakCursor . |
1,302 | public function toArray ( $ useIdentifierKeys = null ) { $ originalUseIdentifierKeys = $ this -> useIdentifierKeys ; $ useIdentifierKeys = isset ( $ useIdentifierKeys ) ? ( boolean ) $ useIdentifierKeys : $ this -> useIdentifierKeys ; $ cursor = $ this ; $ this -> useIdentifierKeys = true ; $ results = $ this -> retry ... | Return the cursor s results as an array . |
1,303 | public function getModel ( ) { $ Model = $ this -> Model ; $ table = $ this -> model -> getTable ( ) ; return \ VextSchema :: getExtJsModel ( $ table ) ; } | Retrieve model information for ExtJs |
1,304 | protected function filterQuery ( & $ query , $ filters ) { $ table = $ this -> model -> getTable ( ) ; foreach ( $ filters as $ property => $ value ) { $ type = DB :: connection ( ) -> getDoctrineColumn ( $ table , $ property ) -> getType ( ) -> getName ( ) ; $ property = $ table . '.' . $ property ; if ( str_contains ... | Sets filters for query |
1,305 | protected function getKeyFromInput ( ) { $ Model = $ this -> Model ; $ key = $ this -> model -> getKeyName ( ) ; $ id = Input :: get ( $ key ) ; return $ id ; } | Retrieve primary key from client - side data |
1,306 | public function beforeFilter ( Event $ event ) { parent :: beforeFilter ( $ event ) ; $ this -> Crud -> addListener ( 'Users.Users' , [ 'mailer' => 'Users.User' ] ) ; $ this -> Crud -> mapAction ( 'signup' , [ 'className' => 'CrudUsers.Register' , 'view' => 'Users.signup' , 'saveOptions' => [ 'fieldList' => [ 'username... | Before filter method |
1,307 | public static function Trxp ( array $ r , array $ p , array & $ trp ) { $ tr = [ ] ; IAU :: Tr ( $ r , $ tr ) ; IAU :: Rxp ( $ tr , $ p , $ trp ) ; return ; } | - - - - - - - - i a u T r x p - - - - - - - - |
1,308 | public function render ( ) { if ( ! is_readable ( $ this -> template ) || ! is_file ( $ this -> template ) ) { throw new \ RuntimeException ( 'Cannot read template ' . $ this -> template ) ; } ob_start ( ) ; include $ this -> template ; return ob_get_clean ( ) ; } | Renders template and returns renderer content . |
1,309 | public function resolvePath ( $ path ) { if ( $ path [ 0 ] == '/' ) { throw new \ InvalidArgumentException ( 'Cannot resolve absolute path.' ) ; } $ segments = $ this -> getPathSegments ( ) ; if ( ! empty ( $ segments ) ) { array_pop ( $ segments ) ; } $ path = trim ( $ path , '/' ) ; foreach ( explode ( '/' , trim ( $... | Resolves a relative path based on the path of this resource . |
1,310 | public static function satisfies ( $ required_version , $ operator = '>=' ) { $ current_version = self :: woo_version ( ) ; return ( bool ) version_compare ( $ current_version , $ required_version , $ operator ) ; } | Test version compatibility |
1,311 | public static function check_dependency ( $ plugin_file_array ) { $ plugins = ( array ) get_option ( 'active_plugins' ) ; foreach ( ( array ) $ plugin_file_array as $ file ) { $ found = false ; foreach ( $ plugins as $ plugin ) { if ( false !== strpos ( $ plugin , $ file ) ) { $ found = true ; break ; } } if ( ! $ foun... | Check dependency for active plugins . |
1,312 | public static function property ( $ property = null ) { $ property = strtolower ( $ property ) ; return array_key_exists ( $ property , static :: $ properties ) ? static :: $ properties [ $ property ] : null ; } | Get any browser property |
1,313 | protected static function get_from_browscap ( ) { $ cache = \ Cache :: forge ( static :: $ config [ 'cache' ] [ 'identifier' ] . '.browscap' , static :: $ config [ 'cache' ] [ 'driver' ] ) ; try { $ browscap = $ cache -> get ( ) ; } catch ( \ Exception $ e ) { $ browscap = static :: $ config [ 'browscap' ] [ 'enabled' ... | use the parsed php_browscap . ini file to find a user agent match |
1,314 | public function loadClass ( $ className ) { try { $ bFile = strtolower ( $ className ) ; if ( ! empty ( $ this -> classes [ $ bFile ] ) ) { $ path = null ; $ path = $ this -> classes [ $ bFile ] ; require_once $ path ; if ( ! class_exists ( $ className , false ) && ! interface_exists ( $ className , false ) ) { throw n... | Load class file |
1,315 | public function setClass ( $ className , $ classPath ) { $ className = strtolower ( $ className ) ; $ path = null ; if ( existsPathOf ( LIBSDIR . $ classPath . '/' . $ className . '.php' , $ path ) || existsPathOf ( LIBSDIR . $ classPath . '.php' , $ path ) || existsPathOf ( LIBSDIR . $ classPath . '_class.php' , $ pat... | Set the file path to the class |
1,316 | public static function set ( ClassLoader $ loader ) { if ( static :: $ loader ) { static :: $ loader -> unregister ( ) ; } static :: $ loader = $ loader ; if ( static :: $ loader ) { static :: $ loader -> register ( true ) ; } } | Set the active autoloader |
1,317 | public function Base_GetAppSettingsMenuItems_Handler ( $ Sender ) { $ Menu = & $ Sender -> EventArguments [ 'SideMenu' ] ; $ Menu -> AddItem ( 'Forum' , T ( 'Forum' ) ) ; $ Menu -> AddLink ( 'Forum' , T ( 'Tagging' ) , 'settings/tagging' , 'Garden.Settings.Manage' ) ; } | Add the Tagging admin menu option . |
1,318 | public function DiscussionController_AfterDiscussionBody_Handler ( $ Sender ) { if ( C ( 'Plugins.Tagging.DisableInline' , FALSE ) ) return ; if ( ! property_exists ( $ Sender -> EventArguments [ 'Object' ] , 'CommentID' ) ) { $ DiscussionID = property_exists ( $ Sender , 'DiscussionID' ) ? $ Sender -> DiscussionID : 0... | Show tags after discussion body . |
1,319 | public function DiscussionModel_BeforeSaveDiscussion_Handler ( $ Sender , $ Args ) { $ FormPostValues = GetValue ( 'FormPostValues' , $ Args , array ( ) ) ; $ TagsString = trim ( strtolower ( GetValue ( 'Tags' , $ FormPostValues , '' ) ) ) ; $ NumTagsMax = C ( 'Plugin.Tagging.Max' , 5 ) ; if ( StringIsNullOrEmpty ( $ T... | Validate tags when saving a discussion . |
1,320 | public function PluginController_TagSearch_Create ( $ Sender , $ q , $ id = false ) { $ CategorySearch = C ( 'Plugins.Tagging.CategorySearch' , FALSE ) ; if ( $ CategorySearch ) $ CategoryID = GetIncomingValue ( 'CategoryID' ) ; $ Query = $ q ; $ Data = array ( ) ; $ Database = Gdn :: Database ( ) ; if ( $ Query ) { $ ... | Search results for tagging autocomplete . |
1,321 | public function PostController_AfterDiscussionFormOptions_Handler ( $ Sender ) { if ( in_array ( $ Sender -> RequestMethod , array ( 'discussion' , 'editdiscussion' , 'question' ) ) ) { $ TagModel = new TagModel ; $ Tags = $ TagModel -> GetWhere ( array ( 'Type' => NULL ) , 'CountDiscussions' , 'desc' , C ( 'Plugins.Ta... | Add the tag input to the discussion form . |
1,322 | public function Controller_Index ( $ Sender ) { $ Sender -> Title ( 'Tagging' ) ; $ Sender -> AddSideMenu ( 'settings/tagging' ) ; $ Sender -> AddCSSFile ( 'plugins/Tagging/design/tagadmin.css' ) ; $ Sender -> AddJSFile ( 'plugins/Tagging/js/admin.js' ) ; $ SQL = Gdn :: SQL ( ) ; $ Sender -> Form -> Method = 'get' ; $ ... | List all tags and allow searching |
1,323 | public function Controller_Add ( $ Sender ) { $ Sender -> AddSideMenu ( 'settings/tagging' ) ; $ Sender -> Title ( 'Add Tag' ) ; $ TagModel = new TagModel ; $ Sender -> Form -> SetModel ( $ TagModel ) ; if ( $ Sender -> Form -> AuthenticatedPostBack ( ) ) { $ TagName = $ Sender -> Form -> GetFormValue ( 'Name' ) ; if (... | Add a Tag |
1,324 | public function Controller_Edit ( $ Sender ) { $ Sender -> AddSideMenu ( 'settings/tagging' ) ; $ Sender -> Title ( T ( 'Edit Tag' ) ) ; $ TagID = GetValue ( 1 , $ Sender -> RequestArgs ) ; $ TagModel = new TagModel ; $ Sender -> Form -> SetModel ( $ TagModel ) ; $ Tag = $ TagModel -> GetID ( $ TagID ) ; $ Sender -> Fo... | Edit a Tag |
1,325 | public function Controller_Delete ( $ Sender ) { $ Sender -> Permission ( 'Garden.Settings.Manage' ) ; $ TagID = GetValue ( 1 , $ Sender -> RequestArgs ) ; $ TagModel = new TagModel ( ) ; $ Tag = $ TagModel -> GetID ( $ TagID , DATASET_TYPE_ARRAY ) ; if ( $ Sender -> Form -> AuthenticatedPostBack ( ) ) { $ SQL = Gdn ::... | Delete a Tag |
1,326 | public function setTypeHandler ( $ type , TypeHandler $ typeHandler ) { if ( ! is_string ( $ type ) || empty ( $ type ) ) throw new \ InvalidArgumentException ( "Type must be defined as a string" ) ; $ this -> typeHandlers [ $ type ] = $ typeHandler ; } | Associates a type handler to a given type |
1,327 | public function addAlias ( $ type , $ alias ) { if ( ! is_string ( $ type ) || empty ( $ type ) ) throw new \ InvalidArgumentException ( "Type must be defined as a string" ) ; if ( ! is_string ( $ alias ) || empty ( $ alias ) ) throw new \ InvalidArgumentException ( "Alias must be defined as a string" ) ; $ this -> ali... | Stores a new alias for a given type |
1,328 | public function getTypeHandler ( $ type_or_alias ) { if ( array_key_exists ( $ type_or_alias , $ this -> aliases ) ) $ type_or_alias = $ this -> aliases [ $ type_or_alias ] ; if ( ! array_key_exists ( $ type_or_alias , $ this -> typeHandlers ) ) return false ; return $ this -> typeHandlers [ $ type_or_alias ] ; } | Obtains the type handler assigned to a type |
1,329 | public function setQueryBuilder ( \ pwf \ components \ querybuilder \ interfaces \ SelectBuilder $ builder ) { $ this -> queryBuilder = $ builder ; return $ this ; } | Set query builder |
1,330 | public static function cleanFilename ( $ filename , $ replacement = '-' ) { $ filename = str_replace ( "\0" , '' , $ filename ) ; $ filename = preg_replace ( '#[^a-zA-Z0-9._-]+#' , $ replacement , $ filename ) ; if ( strlen ( $ filename ) > 255 ) { $ ext = substr ( $ filename , strrpos ( $ filename , '.' ) ) ; $ name =... | Cleans a filename and replace special characters |
1,331 | public static function incrementFilename ( $ path ) { $ i = 1 ; $ dir = dirname ( $ path ) ; $ filename = basename ( $ path ) ; if ( preg_match ( '#^(\d+)-(.*)$#' , basename ( $ path ) , $ matches ) ) { $ i = ( int ) $ matches [ 1 ] ; $ filename = $ matches [ 2 ] ; } do { $ target = rtrim ( $ dir , '/' ) . '/' . self :... | Adds or increment a prefixed integer in the path |
1,332 | public function end ( $ processed = null ) { $ this -> end = ( float ) microtime ( true ) ; $ this -> updateEstimate ( $ processed ) ; } | Call this method immediately after the end of each chunk being processed |
1,333 | public function interval ( $ interval , $ processed = null ) { $ this -> begin = 0.0 ; $ this -> end = $ interval ; $ this -> updateEstimate ( $ processed ) ; } | Alternative way to set observed time |
1,334 | protected function updateEstimate ( $ processed = null ) { $ previous = $ processed !== null ? $ processed : $ this -> estimate ; $ time = ( $ this -> end - $ this -> begin ) ; $ observed = $ previous / $ time ; $ this -> average = $ this -> updateExponentialAverage ( $ this -> average , $ observed ) ; $ this -> estima... | Updates the current estimate of the correct chunk size |
1,335 | protected function checkPause ( ) { $ this -> paused = false ; if ( $ this -> options [ 'pause_always' ] ) { usleep ( $ this -> options [ 'pause_always' ] ) ; $ this -> paused = true ; } } | Pause if necessary |
1,336 | protected function clampEstimate ( ) { $ this -> clamped = false ; if ( $ this -> estimate > $ this -> options [ 'max' ] ) { $ this -> clamped = true ; $ this -> estimate = ( int ) $ this -> options [ 'max' ] ; } if ( $ this -> estimate < $ this -> options [ 'min' ] ) { $ this -> clamped = true ; $ this -> estimate = (... | Clamp the current estimate according to the options |
1,337 | private function getFilesMaxAge ( $ path , $ names = array ( ) , $ default = 0 ) { $ finder = new Finder ( ) ; $ finder -> files ( ) -> in ( realpath ( $ path ) ) -> ignoreDotFiles ( true ) ; foreach ( $ names as $ name ) { $ finder -> name ( $ name ) ; } $ ages = array ( ) ; foreach ( $ finder as $ file ) { $ ages [ ]... | Get max_age with a Finder instance |
1,338 | public function process ( FormInterface $ form , Request $ request ) { if ( $ request -> isMethod ( 'POST' ) ) { $ form -> submit ( $ request ) ; if ( $ form -> isValid ( ) ) { $ this -> bannerManager -> add ( $ form -> getData ( ) ) ; return true ; } } return false ; } | Process banner form . |
1,339 | private function generateVideoPreview ( HCResources $ resource , string $ storagePath , string $ previewPath ) { $ fullPreviewPath = $ storagePath . 'video-previews/' . $ previewPath ; if ( ! file_exists ( $ fullPreviewPath ) ) mkdir ( $ fullPreviewPath , 0755 , true ) ; $ videoPreview = $ fullPreviewPath . '/preview_f... | generating video preview |
1,340 | public function regenerateVideoPreview ( string $ id ) { $ resource = HCResources :: findOrFail ( $ id ) ; $ storagePath = storage_path ( 'app/' ) ; $ previewPath = str_replace ( '-' , '/' , $ resource -> id ) ; if ( file_exists ( $ storagePath . 'video-previews/' . $ previewPath ) ) removeDirectory ( $ storagePath . '... | Regenerating video preview |
1,341 | public function add ( $ conf ) { if ( empty ( $ conf ) ) { return ; } $ this -> config = array_merge ( $ this -> config , $ conf ) ; } | Add configuration to this object |
1,342 | public function hasSource ( $ source , $ package = null ) { try { return ! ! static :: getFilePath ( $ source , $ package ) ; } catch ( Exception $ e ) { return false ; } } | Check if source is available |
1,343 | public function load ( $ source , $ cached = true ) { try { $ path = static :: getFilePath ( $ source ) ; if ( class_exists ( '\Orpheus\Cache\FSCache' , true ) ) { $ cache = new \ Orpheus \ Cache \ FSCache ( 'config' , strtr ( $ source , '/\\' , '--' ) , filemtime ( $ path ) ) ; if ( ! static :: $ caching || ! $ cached... | Load new configuration from source |
1,344 | public static function buildFrom ( $ package , $ source , $ cached = true , $ silent = false ) { if ( get_called_class ( ) === get_class ( ) ) { throw new \ Exception ( 'Use a subclass of ' . get_class ( ) . ' to build your configuration' ) ; } $ newConf = new static ( ) ; if ( $ silent && ! $ newConf -> hasSource ( $ ... | Build new configuration source from package |
1,345 | public static function build ( $ source , $ minor = false , $ cached = true ) { if ( get_called_class ( ) === get_class ( ) ) { throw new \ Exception ( 'Use a subclass of ' . get_class ( ) . ' to build your configuration' ) ; } if ( ! $ minor ) { if ( ! isset ( static :: $ main ) ) { static :: $ main = new static ( ) ;... | Build new configuration source |
1,346 | public static function get ( $ key , $ default = null ) { if ( ! isset ( static :: $ main ) ) { return $ default ; } return isset ( static :: $ main -> $ key ) ? static :: $ main -> $ key : $ default ; } | Get configuration from the main configuration object |
1,347 | public static function getFilePath ( $ source , $ package = null ) { if ( is_readable ( $ source ) ) { return $ source ; } $ configFile = $ source . '.' . static :: $ extension ; $ path = null ; if ( $ package ) { $ path = VENDORPATH . $ package . '/' . CONFDIR . $ configFile ; } else { foreach ( static :: $ repositori... | Get the file path |
1,348 | public function date ( $ date , $ format = null ) { $ datetime = DateTimeUtil :: getDateTime ( $ date ) ; if ( empty ( $ format ) ) { $ format = $ this -> cfg [ 'date_format' ] ; } if ( $ format == 'rel' ) { $ date = DateTimeUtil :: getRelTime ( $ datetime ) ; } else { $ date = $ datetime -> format ( $ format ) ; } ret... | return a formatted date |
1,349 | public function dollar ( $ str ) { $ this -> debug -> groupCollapsed ( __CLASS__ . '->' . __FUNCTION__ , $ str ) ; $ str = preg_replace ( '/[^\d.-]/' , '' , $ str ) ; $ num = floatval ( $ str ) ; $ str = '$' . number_format ( $ num , 2 ) ; $ this -> debug -> groupEnd ( ) ; return $ str ; } | return a formatted dollar ammount |
1,350 | public function mask ( $ string , $ repeat = true , $ numShow = 4 , $ maskChar = 'x' ) { if ( strlen ( $ string ) > $ numShow ) { $ string = ( $ repeat ? str_repeat ( $ maskChar , strlen ( $ string ) - $ numShow ) : $ maskChar ) . substr ( $ string , - $ numShow ) ; } return $ string ; } | Mask a string such as an account or cc - num |
1,351 | public function configure ( Configuration $ configuration ) { foreach ( $ this -> nsMap as $ type => $ map ) { if ( ! count ( $ map ) ) { continue ; } $ method = 'get' . ucfirst ( $ type ) . 'NamespacesMap' ; if ( ! method_exists ( $ configuration , $ method ) ) { throw new InvalidArgumentException ( 'Invalid type of s... | Apply namespaces map configuration to given structures configuration object |
1,352 | protected function setupConfig ( ) { $ path = realpath ( __DIR__ . "/../../config/gravatar-helper.php" ) ; $ this -> publishes ( [ $ path => config_path ( "gravatar-helper.php" ) ] ) ; $ this -> mergeConfigFrom ( $ path , 'gravatar-helper' ) ; } | Setup the package config . |
1,353 | public function setUnixSocket ( ? string $ socket ) : MySQL { if ( ! $ this -> _supportedAttributes -> get ( 'unix_socket' ) -> validateValue ( $ socket ) ) { throw new ArgumentException ( 'socket' , $ socket , 'Invalid unix socket!' ) ; } $ this -> _attributes [ 'unix_socket' ] = $ socket ; return $ this ; } | Sets the unix socket . If you want to use it do not define a host! |
1,354 | public function setCharset ( string $ charset = 'UTF8' ) : MySQL { if ( ! $ this -> _supportedAttributes -> get ( 'charset' ) -> validateValue ( $ charset ) ) { throw new ArgumentException ( 'charset' , $ charset , 'Invalid charset!' ) ; } $ this -> _attributes [ 'charset' ] = $ charset ; return $ this ; } | Sets the connection charset . |
1,355 | public function setAuthUserName ( ? string $ user ) : MySQL { if ( ! $ this -> _supportedAttributes -> get ( 'user' ) -> validateValue ( $ user ) ) { throw new ArgumentException ( 'user' , \ str_repeat ( '*' , min ( 64 , \ mb_strlen ( $ user , 'utf-8' ) ) ) , 'Invalid auth user!' ) ; } $ this -> _attributes [ 'user' ] ... | Sets the auth DBMS login user name . |
1,356 | public function setAuthPassword ( ? string $ password ) : MySQL { if ( ! $ this -> _supportedAttributes -> get ( 'password' ) -> validateValue ( $ password ) ) { throw new ArgumentException ( 'password' , \ str_repeat ( '*' , min ( 48 , \ mb_strlen ( $ password , 'utf-8' ) ) ) , 'Invalid auth password!' ) ; } $ this ->... | Sets the auth DBMS login password . |
1,357 | public function execute ( InputInterface $ input , OutputInterface $ output ) { $ assetsDirectory = str_replace ( '/' , DIRECTORY_SEPARATOR , 'web/bundles' ) ; $ manager = $ this -> getDocumentManager ( ) ; $ assetFactory = $ this -> getAssetFactory ( ) ; if ( $ input -> getOption ( 'clear' ) ) { $ output -> writeln ( ... | Moves assets into the content repository |
1,358 | public function findOrCreateNode ( $ path ) { if ( $ node = $ this -> getDocumentManager ( ) -> find ( null , $ path ) ) { return $ node ; } NodeHelper :: createPath ( $ this -> getDocumentManager ( ) -> getPhpcrSession ( ) , $ path ) ; return $ this -> findOrCreateNode ( $ path ) ; } | Finds or creates a node |
1,359 | public function deleteDirectoryContents ( $ path ) { $ dir = new \ RecursiveDirectoryIterator ( $ path ) ; $ iterator = new \ RecursiveIteratorIterator ( $ dir , \ RecursiveIteratorIterator :: CHILD_FIRST ) ; foreach ( $ iterator as $ object ) { if ( ! in_array ( $ object -> getBasename ( ) , [ '.' , '..' ] ) ) { if ( ... | Deletes a directories contents |
1,360 | public function resolve ( $ value , $ default = 'value' ) { $ callable = $ this -> getCallable ( $ value ) ; if ( is_array ( $ callable ) && is_callable ( $ callable [ 0 ] ) ) { if ( count ( $ callable ) === 1 ) { return call_user_func ( $ callable [ 0 ] ) ; } else { return call_user_func_array ( $ callable [ 0 ] , $ c... | Attempts to resolve the value using callables |
1,361 | public function fullName ( $ lastNameFirst = false ) { if ( ! Wasabi :: setting ( 'Core.User.has_firstname_lastname' ) ) { return $ this -> username ; } if ( $ lastNameFirst ) { return $ this -> lastname . ', ' . $ this -> firstname ; } return $ this -> firstname . ' ' . $ this -> lastname ; } | Get the full name of the user . |
1,362 | public function getGroupNames ( ) { if ( empty ( $ this -> groups ) ) { return [ ] ; } $ result = [ ] ; foreach ( $ this -> groups as $ group ) { $ result [ ] = $ group -> name ; } return $ result ; } | Get an array of group names the user belongs to . |
1,363 | public function getAccessLevel ( $ url = null ) { if ( $ url === null ) { $ url = Wasabi :: getCurrentUrlArray ( ) ; } $ path = guardian ( ) -> getPathFromUrl ( $ url ) ; if ( ! array_key_exists ( $ path , $ this -> permissions ) ) { return 0 ; } return $ this -> permissions [ $ path ] ; } | Returns the access level of the user for the given plugin controller action path . |
1,364 | protected function migrate ( Component $ component ) { $ path = str_replace ( base_path ( ) , '' , ( new Migrator ( $ component ) ) -> getPath ( ) ) ; $ this -> call ( 'migrate' , [ '--path' => $ path , '--database' => $ this -> option ( 'database' ) , '--pretend' => $ this -> option ( 'pretend' ) , '--force' => $ this... | Run the migration from the specified component . |
1,365 | public function register ( $ binding ) { $ finder = new FileFinder ( new Filesystem , $ this -> container [ 'config' ] [ 'view.paths.style' ] ) ; $ finder -> addExtension ( 'yml' ) ; $ this -> container -> bind ( 'view.viewfinder' , new FileFinder ( new Filesystem , $ this -> container [ 'config' ] [ 'view.paths.view' ... | Register bindings into the container |
1,366 | private function getEntityIdentifierValue ( $ entity ) { $ entityMetaData = $ this -> entityManager -> getEntityMetadataRegister ( ) -> getEntityMetadata ( $ entity ) ; return $ entityMetaData ? $ entityMetaData -> getIdentifierValue ( ) : null ; } | if identifier value does not exist null is now returned to prevent error |
1,367 | public function exception ( Throwable $ error , $ extra = [ ] ) { $ messages = $ error -> getMessage ( ) ; $ traces = $ error -> getTrace ( ) ; $ serverInfo = $ this -> getServerInfo ( ) ; $ backtrace = [ ] ; if ( is_array ( $ traces ) ) { foreach ( $ traces as $ line ) { if ( ! isset ( $ line [ 'file' ] ) ) { $ line [... | Log an exception triggered by ZF2 for administrative purposes . |
1,368 | protected function typeToString ( $ type ) { if ( is_object ( $ type ) ) { return sprintf ( 'Object::%s' , get_class ( $ type ) ) ; } if ( is_array ( $ type ) ) { $ types = [ ] ; foreach ( $ type as $ key => $ item ) { $ types [ ] = sprintf ( '%s => %s' , $ key , $ this -> typeToString ( $ item ) ) ; } return 'Array(' ... | Convert type data to a string . |
1,369 | protected function getPlugins ( array $ config ) { if ( ! isset ( $ config [ 'plugins' ] ) || ! is_array ( $ config [ 'plugins' ] ) ) { throw new \ RuntimeException ( 'Configuration must contain "plugins" key referencing an array' , self :: ERR_PLUGINS_NONARRAY ) ; } $ filtered = array_filter ( $ config [ 'plugins' ] ,... | Validates and extracts plugins from configuration . |
1,370 | protected function getFilter ( array $ config ) { if ( ! isset ( $ config [ 'filter' ] ) || ! $ config [ 'filter' ] instanceof FilterInterface ) { throw new \ RuntimeException ( 'Configuration must contain a "filter" key referencing an object' . ' implementing \Phergie\Irc\Plugin\EventFilter\FilterInterface' , self :: ... | Validates and extracts filter from configuration . |
1,371 | public function getSubscribedEvents ( ) { $ events = array ( ) ; $ self = $ this ; foreach ( $ this -> plugins as $ plugin ) { foreach ( array_keys ( $ plugin -> getSubscribedEvents ( ) ) as $ event ) { if ( isset ( $ events [ $ event ] ) ) { continue ; } $ events [ $ event ] = function ( ) use ( $ event , $ self ) { $... | Returns callbacks that invoke a central handler for events to which contained plugins subscribe . |
1,372 | public function handleEvent ( $ event , array $ args ) { $ logger = $ this -> getLogger ( ) ; $ eventObjects = array_filter ( $ args , function ( $ arg ) { return $ arg instanceof EventInterface ; } ) ; if ( ! $ eventObjects ) { $ logger -> info ( 'Event emitted without EventInterface argument' , array ( 'event' => $ e... | Applies filters to events and forwards those that pass to contained plugins . |
1,373 | protected function getEventHandlers ( $ event ) { $ logger = $ this -> getLogger ( ) ; $ handlers = array ( ) ; foreach ( $ this -> plugins as $ plugin ) { $ callbacks = $ plugin -> getSubscribedEvents ( ) ; if ( ! is_array ( $ callbacks ) ) { $ logger -> warning ( 'Plugin returns non-array value for event callbacks' ,... | Returns handlers from contained plugins for a specified event . |
1,374 | public function setLogger ( LoggerInterface $ logger ) { parent :: setLogger ( $ logger ) ; foreach ( $ this -> plugins as $ plugin ) { if ( ! ( $ plugin instanceof LoggerAwareInterface ) ) { continue ; } $ plugin -> setLogger ( $ logger ) ; } } | Set Logger Interface |
1,375 | public function setEventEmitter ( EventEmitterInterface $ emitter ) { parent :: setEventEmitter ( $ emitter ) ; foreach ( $ this -> plugins as $ plugin ) { if ( ! ( $ plugin instanceof EventEmitterAwareInterface ) ) { continue ; } $ plugin -> setEventEmitter ( $ emitter ) ; } } | Set Event Emitter Interface |
1,376 | public function setClient ( ClientInterface $ client ) { parent :: setClient ( $ client ) ; foreach ( $ this -> plugins as $ plugin ) { if ( ! ( $ plugin instanceof ClientAwareInterface ) ) { continue ; } $ plugin -> setClient ( $ client ) ; } } | Set Client Interface |
1,377 | public function setEventQueueFactory ( EventQueueFactoryInterface $ queueFactory ) { parent :: setEventQueueFactory ( $ queueFactory ) ; foreach ( $ this -> plugins as $ plugin ) { if ( ! ( $ plugin instanceof EventQueueFactoryAwareInterface ) ) { continue ; } $ plugin -> setEventQueueFactory ( $ queueFactory ) ; } } | Set Event Queue Factory |
1,378 | public function setLoop ( LoopInterface $ loop ) { parent :: setLoop ( $ loop ) ; foreach ( $ this -> plugins as $ plugin ) { if ( ! ( $ plugin instanceof LoopAwareInterface ) ) { continue ; } $ plugin -> setLoop ( $ loop ) ; } } | Set Loop Interface |
1,379 | protected function getReleaseId ( $ releaseName ) { $ releaseId = null ; $ releaseNames = array ( ) ; $ releases = $ this -> client -> api ( 'repo' ) -> releases ( ) -> all ( $ this -> owner , $ this -> repository ) ; foreach ( $ releases as $ release ) { if ( $ release [ 'name' ] == $ releaseName ) { $ releaseId = $ r... | Determines the id of a release based on its name . |
1,380 | protected function filterContentsByType ( $ contents , $ type ) { return Collection :: make ( $ contents ) -> where ( 'type' , $ type ) -> fetch ( 'path' ) -> values ( ) -> all ( ) ; } | Filter directory contents by type . |
1,381 | public function setStarted ( $ val ) { if ( ( $ val instanceof \ DateTime ) ) { $ this -> started = $ val ; } else if ( is_string ( $ val ) && ! empty ( $ val ) ) { try { $ this -> started = new \ DateTime ( $ val ) ; } catch ( \ Exception $ e ) { $ this -> started = null ; } } else { $ this -> started = null ; } retur... | Set date time when was the activity started . |
1,382 | public function setStopped ( $ val ) { if ( ( $ val instanceof \ DateTime ) ) { $ this -> stopped = $ val ; } else if ( is_string ( $ val ) && ! empty ( $ val ) ) { try { $ this -> stopped = new \ DateTime ( $ val ) ; } catch ( \ Exception $ e ) { $ this -> stopped = null ; } } else { $ this -> stopped = null ; } retur... | Set date time when was the activity stopped . |
1,383 | public function getDuration ( ) { $ started = ( is_null ( $ this -> started ) ) ? new \ DateTime ( 'now' ) : $ this -> started ; $ stopped = ( is_null ( $ this -> stopped ) ) ? new \ DateTime ( 'now' ) : $ this -> stopped ; return $ started -> diff ( $ stopped ) ; } | Retrieve duration between started and stopped . If stopped is NULL calculates duration up to now . |
1,384 | public function getDurationFormatted ( ) { $ duration = $ this -> getDuration ( ) ; if ( $ duration -> d == 0 && $ duration -> h == 0 && $ duration -> i == 0 ) { return 'Less than minute' ; } $ ret = '' ; if ( $ duration -> d == 1 ) { $ ret .= 'One day' ; } else if ( $ duration -> d > 1 ) { $ ret .= $ duration -> d . '... | Retrieve duration as formatted string . |
1,385 | public function isWithinOneDay ( ) { $ started = ( is_null ( $ this -> started ) ) ? new \ DateTime ( 'now' ) : $ this -> started ; $ stopped = ( is_null ( $ this -> stopped ) ) ? new \ DateTime ( 'now' ) : $ this -> stopped ; return ( $ started -> format ( 'Y-m-d' ) === $ stopped -> format ( 'Y-m-d' ) ) ; } | Returns TRUE if activity is started and stopped within one day . |
1,386 | public function getUrl ( string $ path = null , array $ params = [ ] ) : Uri { $ pathParams = $ this -> getPathParams ( $ params ) ; $ queryParams = $ this -> getQueryParams ( $ params ) ; $ path .= ! empty ( $ pathParams ) ? '/' . $ pathParams : '' ; if ( ! empty ( $ path ) && $ path [ 0 ] !== '/' ) { $ path = '/' . $... | Performs the path and query parameter processing before returning the final path . |
1,387 | public function attach ( SplObserver $ observer ) { if ( ! isset ( $ this -> __observers ) ) { $ this -> __observers = new SplObjectStorage ; } $ this -> __observers -> attach ( $ observer ) ; } | Attach an observer model . |
1,388 | public function detach ( SplObserver $ observer ) { if ( ! isset ( $ this -> __observers ) ) { $ this -> __observers = new SplObjectStorage ; } $ this -> __observers -> detach ( $ observer ) ; } | Detach an observer model . |
1,389 | public function notify ( ) { if ( ! isset ( $ this -> __observers ) ) { $ this -> __observers = new SplObjectStorage ; } foreach ( $ this -> __observers as $ observer ) { $ observer -> update ( $ this ) ; } } | Notify all registered observers . |
1,390 | protected function registerListener ( ) { $ this -> registerListenCommand ( ) ; $ this -> app -> singleton ( 'queue.listener' , function ( $ app ) { return new Listener ( $ app -> basePath ( ) ) ; } ) ; } | Register the queue listener . |
1,391 | public function redirect ( $ url , $ msg = '' , $ msgType = 'message' , $ moved = false ) { if ( trim ( $ msg ) ) { $ this -> enqueueMessage ( $ msg , $ msgType ) ; } if ( count ( $ this -> _messageQueue ) ) { $ session = $ this -> getSession ( ) ; $ session -> set ( 'application.queue' , $ this -> _messageQueue ) ; } ... | Redirige le navigateur vers une nouvelle adresse . |
1,392 | protected function doExecute ( ) { $ container = $ this -> getContainer ( ) ; if ( $ container -> has ( 'logger' ) ) { $ this -> setLogger ( $ container -> get ( 'logger' ) ) ; } $ container -> get ( 'config' ) -> merge ( $ this -> config ) ; $ this -> setConfiguration ( $ container -> get ( 'config' ) ) ; $ session = ... | Effectue la logique de l application . |
1,393 | protected function render ( $ result ) { $ profiler = $ this -> container -> has ( 'profiler' ) ? $ this -> container -> get ( 'profiler' ) : false ; if ( $ profiler ) { $ profiler -> mark ( 'beforeRender' ) ; } if ( is_string ( $ result ) ) { $ this -> mimeType = 'text/html' ; $ data = $ result ; } elseif ( is_object ... | Effectue le rendu de l application . |
1,394 | public function zipAction ( Request $ request ) { $ filename = basename ( $ request -> get ( 'filename' ) ) ; $ path = $ this -> container -> getParameter ( 'phlexible_media_manager.temp_dir' ) ; $ filepath = $ path . '/' . $ filename ; if ( ! $ filename || ! file_exists ( $ filepath ) ) { return $ this -> createNotFou... | Stream file . |
1,395 | public function offsetGet ( $ id ) { $ value = parent :: offsetGet ( $ id ) ; if ( is_object ( $ value ) ) { $ this -> initialize ( $ value ) ; } return $ value ; } | Override Pimple s offsetGet to add support for initializers |
1,396 | public function findDataByNames ( array $ names , array $ modCombinationIds = [ ] ) : array { $ result = [ ] ; if ( count ( $ names ) > 0 ) { $ columns = [ 'm.id AS id' , 'm.name AS name' , 'mc.order AS order' ] ; $ queryBuilder = $ this -> entityManager -> createQueryBuilder ( ) ; $ queryBuilder -> select ( $ columns ... | Finds the data of the machines with the specified names . |
1,397 | protected function mapMachineDataResult ( array $ machineData ) : array { $ result = [ ] ; foreach ( $ machineData as $ data ) { $ result [ ] = MachineData :: createFromArray ( $ data ) ; } return $ result ; } | Maps the query result to instances of MachineData . |
1,398 | public function removeOrphans ( ) : void { $ machineIds = $ this -> findOrphanedIds ( ) ; if ( count ( $ machineIds ) > 0 ) { $ this -> removeIds ( $ machineIds ) ; } } | Removes any orphaned machines i . e . machines no longer used by any combination . |
1,399 | protected function removeIds ( array $ machineIds ) : void { $ queryBuilder = $ this -> entityManager -> createQueryBuilder ( ) ; $ queryBuilder -> delete ( Machine :: class , 'm' ) -> andWhere ( 'm.id IN (:machineIds)' ) -> setParameter ( 'machineIds' , array_values ( $ machineIds ) ) ; $ queryBuilder -> getQuery ( ) ... | Removes the machines with the specified ids from the database . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.