idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
56,200 | public static function boot ( ) { $ links = array_merge_recursive ( Blender :: $ sectionLinks , Blender :: $ pageLinks ) ; ob_start ( "ob_gzhandler" ) ; echo "<!DOCTYPE html>" ; echo "<html lang='pt-br'>" ; echo "<head>" ; echo "<title>" . Blender :: $ title . " | " . Blender :: $ subtitle . "</title>" ; echo "<!--Page... | Boot up the entire page for visualization |
56,201 | public static function startClass ( string $ classpath , string $ namespace = "" ) { $ class = substr ( strrchr ( $ classpath , '/' ) , 1 ) ; $ class = str_replace ( ".class" , "" , $ class ) ; $ classpath = strtolower ( $ classpath ) ; if ( ! file_exists ( "app/" . $ classpath . ".php" ) ) return false ; require_once ... | path with class file name |
56,202 | private function passAsReference ( & $ target ) { foreach ( Blender :: $ sharedClasses as $ key => $ value ) { if ( ! property_exists ( $ target , $ key ) && $ value != $ target ) $ target -> $ key = $ value ; } } | Pass as reference the shared classes propertie to the target object |
56,203 | private function safeMethod ( & $ target , string $ method ) { if ( method_exists ( $ target , $ method ) ) { $ target -> $ method ( ) ; return true ; } else { return false ; } } | Safe method call if the name doesn t match won t throw an error |
56,204 | protected static function safeRequire ( string $ path ) { if ( file_exists ( Blender :: $ root . $ path ) ) { require_once Blender :: $ root . $ path ; return true ; } return false ; } | Safe require call won t generate error upon file not found |
56,205 | public static function resetLinks ( int $ target = 0 ) { switch ( $ target ) { case 1 : Blender :: $ sectionLinks = [ "js" => [ ] , "css" => [ ] , "font" => [ ] ] ; break ; case 2 : Blender :: $ pageLinks = [ "js" => [ ] , "css" => [ ] , "font" => [ ] ] ; break ; default : Blender :: $ sectionLinks = [ "js" => [ ] , "c... | Reset the modules |
56,206 | public function many ( $ property , $ entity = null ) { $ builder = new Many ( ) ; $ builder -> property ( $ property ) ; if ( $ entity ) { $ builder -> entity ( $ entity ) ; } return $ builder ; } | Start mapping a ReferenceMany reference . Entity is optional as ODM allows document type mixing . |
56,207 | protected function getCode ( $ Block ) { if ( ! isset ( $ Block [ 'element' ] [ 'text' ] [ 'text' ] ) ) { return null ; } $ text = $ Block [ 'element' ] [ 'text' ] [ 'text' ] ; if ( $ this -> pygments && $ language = $ this -> getLanguage ( $ Block ) ) { return $ this -> pygments -> highlight ( $ text , $ language ) ; ... | Process code content |
56,208 | private static function _pushTime ( $ cmd ) { $ mt = microtime ( ) ; if ( $ cmd == static :: CMD_START ) { if ( static :: $ _running === true ) { return ; } static :: $ _running = true ; } else if ( $ cmd == static :: CMD_STOP ) { if ( static :: $ _running === false ) { return ; } static :: $ _running = false ; } else ... | Add a time entry to the queue |
56,209 | public static function get ( $ format = self :: SECONDS ) { if ( static :: $ _running === true ) { static :: stop ( ) ; } $ sec = 0 ; $ usec = 0 ; foreach ( static :: $ _queue as $ time ) { $ start = $ time [ static :: CMD_START ] ; $ end = $ time [ static :: CMD_STOP ] ; $ sec_diff = $ end [ 'sec' ] - $ start [ 'sec' ... | Get time of execution from all queue entries |
56,210 | public static function getAverage ( $ format = self :: SECONDS ) { $ count = count ( static :: $ _queue ) ; $ sec = 0 ; $ usec = static :: get ( static :: MICROSECONDS ) ; if ( $ usec > static :: USECDIV ) { $ sec += ( int ) floor ( $ usec / static :: USECDIV ) ; $ usec = $ usec % static :: USECDIV ; } switch ( $ forma... | Get the average time of execution from all queue entries |
56,211 | final public function import ( $ content ) { if ( ! ! filter_var ( $ content , FILTER_VALIDATE_URL ) || ! ! is_readable ( $ content ) ) { $ content = @ file_get_contents ( $ content , false , $ this -> context ) ; return ! ! $ this -> isStringHtml ( $ content ) ? $ content : False ; } return ! ! $ this -> isStringHtml ... | Este metodo permite importar el contenido proveniente de una url path o texto . |
56,212 | protected function setOrderByFunction ( String $ query , String $ functionName ) : String { if ( $ functionName !== null && $ functionName !== '' ) { $ query = ' ORDER BY ' . $ functionName . '(' . $ query . ')' ; } return $ query ; } | This method is used to set a field on ORDER BY clause . |
56,213 | public function getProspectMapper ( ) { if ( $ this -> prospectMapper == null ) { $ this -> prospectMapper = $ this -> serviceLocator -> get ( 'playgroundflow_prospect_mapper' ) ; } return $ this -> prospectMapper ; } | Retrieve service manager instance |
56,214 | public function get ( $ language ) { if ( ! isset ( $ this -> alphabets [ $ language ] ) ) { return null ; } return $ this -> alphabets [ $ language ] ; } | Get alphabet for language |
56,215 | public function load ( $ filepath = null , $ preview = false ) { Environment :: increaseTimeLimitTo ( 3600 ) ; Environment :: increaseMemoryLimitTo ( '512M' ) ; $ this -> mappableFields_cache = $ this -> getMappableColumns ( ) ; return $ this -> processAll ( $ filepath , $ preview ) ; } | Start loading of data |
56,216 | public function scaffoldMappableFields ( $ includerelations = true ) { $ map = $ this -> getMappableFieldsForClass ( $ this -> objectClass ) ; if ( $ includerelations ) { if ( $ has_ones = singleton ( $ this -> objectClass ) -> hasOne ( ) ) { foreach ( $ has_ones as $ relationship => $ type ) { $ fields = $ this -> get... | Generate a field - label list of fields that data can be mapped into . |
56,217 | protected function getMappableFieldsForClass ( $ class ) { $ singleton = singleton ( $ class ) ; $ fields = ( array ) $ singleton -> fieldLabels ( false ) ; foreach ( $ fields as $ field => $ label ) { if ( ! $ singleton -> hasField ( $ field ) ) { unset ( $ fields [ $ field ] ) ; } } return $ fields ; } | Get the fields and labels for a given class |
56,218 | public function preprocessChecks ( ) { if ( ! $ this -> objectClass ) { user_error ( _t ( 'Consumer.NoObjectClass' , 'No objectClass set in the subclass' ) , E_USER_WARNING ) ; } if ( ! is_array ( $ this -> columnMap ) ) { user_error ( _t ( 'Consumer.NoColumnMap' , 'No columnMap set in the subclass' ) , E_USER_WARNING ... | Check that the class has the required settings |
56,219 | public function updateRecords ( array $ apidata , $ preview = false ) { if ( is_array ( $ apidata ) ) { $ this -> setSource ( new ArrayBulkLoaderSource ( $ apidata ) ) ; } $ this -> addNewRecords = false ; $ this -> preprocessChecks ( ) ; return $ this -> load ( null , $ preview ) ; } | Update the dataobject with data from the external API |
56,220 | public function deleteManyRecords ( array $ apidata , $ preview = false ) { if ( is_array ( $ apidata ) ) { $ this -> setSource ( new ArrayBulkLoaderSource ( $ apidata ) ) ; } $ this -> preprocessChecks ( ) ; $ this -> mappableFields_cache = $ this -> getMappableColumns ( ) ; $ results = new BulkLoaderResult ( ) ; $ it... | Delete dataobjects that match to the API data |
56,221 | public function append ( $ bean ) { $ this -> validate ( $ bean ) ; parent :: offsetSet ( $ bean -> getIndex ( ) , $ bean ) ; $ this -> rewind ( ) ; } | Appends the value |
56,222 | public function diff ( AbstractCollection $ collection ) { $ newCollection = $ this -> newInstance ( ) ; $ this -> each ( function ( AbstractBean $ collectable ) use ( $ newCollection , $ collection ) { if ( ! $ collection -> containsIndex ( $ collectable -> getIndex ( ) ) ) { $ newCollection -> append ( $ collectable ... | Diff two Collections |
56,223 | private function _fill ( ) { if ( empty ( $ this -> db ) ) return false ; $ sql = ( string ) "SHOW VARIABLES" ; $ res = $ this -> db -> query ( ( string ) $ sql ) ; if ( ! $ res ) return false ; $ data = $ this -> db -> fetch_assoc_list ( $ res ) ; if ( ! empty ( $ data ) ) { foreach ( $ data as $ variable ) { $ this -... | method that gets all the mysql database settings an fills them into properties of this object |
56,224 | public static function setSigningKey ( $ keyPairId , $ signingKey , $ isFile = true ) { self :: $ __signingKeyPairId = $ keyPairId ; if ( ( self :: $ __signingKeyResource = openssl_pkey_get_private ( $ isFile ? fgc ( $ signingKey ) : $ signingKey ) ) !== false ) { return true ; } self :: __triggerError ( 'S3::setSignin... | Set signing key |
56,225 | public static function listBuckets ( $ detailed = false ) { $ rest = new S3Request ( 'GET' , '' , '' , self :: $ endpoint ) ; $ rest = $ rest -> getResponse ( ) ; if ( $ rest -> error === false && $ rest -> code !== 200 ) { $ rest -> error = array ( 'code' => $ rest -> code , 'message' => 'Unexpected HTTP status' ) ; }... | Get a list of buckets |
56,226 | public function resolve ( $ name ) { if ( ! isset ( self :: $ resources [ $ name ] ) ) { throw new Exception ( "[$name] is not a known resource." ) ; } return isAke ( self :: $ resources , $ name ) ; } | Attempts to return the named resource to a valid class name . |
56,227 | public function getDefaultValue ( ) : Node \ Expr { $ factory = new BuilderFactory ( ) ; if ( $ this -> nullable || $ this -> mixed || $ this -> class ) { return $ factory -> val ( null ) ; } switch ( $ this -> name ) { case 'array' : return $ factory -> val ( [ ] ) ; case 'bool' : return $ factory -> val ( false ) ; c... | Returns default value for this type |
56,228 | public function toTypeHint ( ) : string { if ( $ this -> mixed ) { throw new LogicException ( 'Cannot make typehint for mixed type' ) ; } if ( $ this -> nullable ) { return '?' . $ this -> name ; } return $ this -> name ; } | Makes typehint from Type |
56,229 | public static function add ( $ element , $ location = [ ] ) { if ( ! isset ( self :: $ _elements [ $ element ] ) ) { self :: $ _elements [ $ element ] = [ ] ; } if ( empty ( $ location ) ) { $ default_location = self :: get_default_location ( $ element ) ; if ( $ default_location ) { self :: $ _elements [ $ element ] [... | Init . Takes the location and the elements to register in that location . |
56,230 | public static function register_elements ( ) { foreach ( self :: $ _elements as $ element => $ locations ) { $ class = self :: get_element_class_name ( $ element ) ; if ( method_exists ( $ class , 'init' ) ) { call_user_func ( [ $ class , 'init' ] , $ locations ) ; } } } | Register required elements . |
56,231 | public static function options_page ( $ sub_pages = [ ] ) { if ( function_exists ( 'acf_add_options_page' ) ) { acf_add_options_page ( [ 'page_title' => 'Options' , 'menu_title' => 'Options' , 'menu_slug' => self :: OPTIONS_PAGE , 'capability' => 'edit_posts' , 'redirect' => false , 'position' => 4 , ] ) ; foreach ( $ ... | Set - up an options page and some pre - defined sub pages . |
56,232 | public function setImageFile ( File $ imageFile = null ) { $ this -> imageFile = $ imageFile ; if ( $ imageFile ) { $ this -> modified = new \ DateTimeImmutable ( ) ; } return $ this ; } | imageFile property is not persisted! |
56,233 | protected function registerMigration ( ) { $ this -> app -> singleton ( 'orchestra.publisher.migrate' , function ( Application $ app ) { $ app -> make ( 'migration.repository' ) ; return new MigrateManager ( $ app , $ app -> make ( 'migrator' ) ) ; } ) ; } | Register the service provider for Orchestra Platform migrator . |
56,234 | protected function registerAssetPublisher ( ) { $ this -> app -> singleton ( 'orchestra.publisher.asset' , function ( Application $ app ) { return new AssetManager ( $ app , $ app -> make ( 'asset.publisher' ) ) ; } ) ; } | Register the service provider for Orchestra Platform asset publisher . |
56,235 | public function create ( $ persisted = true ) { return Phactory :: createBlueprint ( $ this -> name , $ this -> type , $ this -> override , $ persisted ) ; } | Creates the relationship object |
56,236 | public function performAccessTokenFlow ( $ directResponse = true , Array $ input = array ( ) ) { $ authServer = $ this -> getOAuth ( ) -> getAuthServer ( ) ; try { if ( empty ( $ input ) ) { $ input = $ this -> getRequest ( ) -> all ( ) ; } if ( $ directResponse ) { return $ this -> resourceJson ( $ authServer -> issue... | Perform the access token flow |
56,237 | public function validateAccessToken ( Array $ scopes = array ( ) ) { try { $ this -> getResource ( ) -> isValid ( $ this -> getConfig ( 'oauth2.http_headers_only' ) ) ; } catch ( InvalidAccessTokenException $ e ) { return $ this -> resourceJson ( array ( 'message' => 'forbidden' , 'description' => $ e -> getMessage ( )... | Validate OAuth token |
56,238 | public function isValidMD5 ( ) { $ client = $ this -> getClient ( ) ; $ clientSecret = '' ; if ( ! is_null ( $ client ) ) { $ clientSecret = $ client -> secret ; } unset ( $ client ) ; $ md5 = $ this -> getRequest ( ) -> header ( 'CONTENT_MD5' ) ; if ( $ this -> getRequest ( ) -> isJson ( ) ) { $ content = $ this -> ge... | Check client content MD5 . |
56,239 | public function checkRequestLimit ( ) { $ isLimitReached = false ; $ client = $ this -> getClient ( ) ; if ( ! is_null ( $ client ) ) { $ currentTotalRequest = 1 ; $ currentTime = time ( ) ; $ requestLimitUntil = $ currentTime ; $ requestLimitUntil = strtotime ( $ client -> request_limit_until ) ; if ( $ requestLimitUn... | Check client request limit and update . |
56,240 | private function getRequestLimitHeader ( ) { $ headers = array ( ) ; $ client = $ this -> getClient ( ) ; if ( ! is_null ( $ client ) ) { $ headers [ 'X-Rate-Limit-Limit' ] = $ client -> request_limit ; $ headers [ 'X-Rate-Limit-Remaining' ] = $ client -> request_limit - $ client -> current_total_request ; $ headers [ ... | Return request limit header . |
56,241 | private function identifyClientFromRequest ( ) { $ clientId = $ this -> getRequest ( ) -> input ( 'client_id' , '' ) ; $ clientSecret = $ this -> getRequest ( ) -> input ( 'client_secret' , null ) ; $ redirectUri = $ this -> getRequest ( ) -> input ( 'redirect_uri' , null ) ; try { $ this -> accessToken = $ this -> get... | Identify client identifed from current request . |
56,242 | private function initResolvers ( ) { $ this -> groupOptionsResolver = new OptionsResolver ( ) ; $ this -> groupOptionsResolver -> setDefaults ( [ 'name' => null , 'label' => null , 'icon' => null , 'position' => 1 , 'domain' => 'messages' , 'route' => null , ] ) -> setAllowedTypes ( 'name' , 'string' ) -> setAllowedTyp... | Initializes the options resolvers . |
56,243 | public function createGroup ( array $ options ) { if ( $ this -> prepared ) { throw new \ RuntimeException ( 'MenuPool has been prepared and can\'t receive new groups.' ) ; } $ group = new MenuGroup ( $ this -> groupOptionsResolver -> resolve ( $ options ) ) ; $ this -> addGroup ( $ group ) ; } | Creates a menu group . |
56,244 | public function createEntry ( $ group_name , array $ options ) { if ( ! $ this -> hasGroup ( $ group_name ) ) { throw new \ RuntimeException ( 'Menu Group "' . $ group_name . '" not found.' ) ; } $ entry = new MenuEntry ( $ this -> entryOptionsResolver -> resolve ( $ options ) ) ; $ group = $ this -> getGroup ( $ group... | Creates a menu entry . |
56,245 | private function addGroup ( MenuGroup $ group ) { if ( ! $ this -> hasGroup ( $ group -> getName ( ) ) ) { $ this -> groups [ $ group -> getName ( ) ] = $ group ; } } | Add group to menu |
56,246 | public function prepare ( ) { if ( $ this -> prepared ) { return ; } usort ( $ this -> groups , function ( MenuGroup $ a , MenuGroup $ b ) { if ( $ a -> getPosition ( ) == $ b -> getPosition ( ) ) { return 0 ; } return $ a -> getPosition ( ) > $ b -> getPosition ( ) ? 1 : - 1 ; } ) ; foreach ( $ this -> groups as $ gro... | Prepares the pool for rendering . |
56,247 | public static function getNotDeleted ( $ objects ) { if ( null === $ objects ) { return null ; } if ( ! $ objects instanceof Collection ) { $ objects = new ArrayCollection ( $ objects ) ; } foreach ( $ objects as $ object ) { $ functionDeletedOld = [ $ object , "getDeleted" ] ; $ functionDeletedNew = [ $ object , "isDe... | Get Not deleted |
56,248 | public static function delete ( $ object ) { if ( null === $ object ) { throw new \ LogicException ( "No object" ) ; } $ setterDelete = [ $ object , "setDeleted" ] ; if ( false === is_callable ( $ setterDelete ) ) { throw new \ LogicException ( sprintf ( "%s is not softdeletable" , get_class ( $ object ) ) ) ; } $ obje... | Soft delete given object and relations |
56,249 | private function extract_data_urls ( $ css ) { $ max_index = strlen ( $ css ) - 1 ; $ append_index = $ index = $ last_index = $ offset = 0 ; $ sb = array ( ) ; $ pattern = '/url\(\s*(["\']?)data\:/i' ; while ( preg_match ( $ pattern , $ css , $ m , 0 , $ offset ) ) { $ index = $ this -> index_of ( $ css , $ m [ 0 ] , $... | Utility method to replace all data urls with tokens before we start compressing to avoid performance issues running some of the subsequent regexes against large strings chunks . |
56,250 | public static function get_filename ( $ name = '' ) { $ name = str_replace ( '.svg' , '' , $ name ) ; $ filename = dirname ( dirname ( __DIR__ ) ) . "/svg/$name.svg" ; if ( file_exists ( $ filename ) ) { return $ filename ; } return '' ; } | Gets the full file path of the filenamename passed in . |
56,251 | public static function get ( $ name = '' ) { $ name = self :: sanitize ( $ name ) ; $ filename = self :: get_filename ( $ name ) ; return $ filename ? @ file_get_contents ( $ filename ) : '' ; } | Retreives an SVG from a filename . |
56,252 | public function transform ( $ value ) { $ parts = array ( 'date' => null , 'time' => null , ) ; if ( $ value ) { $ parts [ 'date' ] = new \ DateTime ( $ value -> format ( 'Y-m-d' ) ) ; $ parts [ 'time' ] = new \ DateTime ( $ value -> format ( 'H:i:s' ) ) ; } return $ parts ; } | Transforms a DateTime into an array . |
56,253 | public function reverseTransform ( $ value ) { if ( $ value [ 'date' ] && $ value [ 'time' ] ) { return new \ DateTime ( sprintf ( '%s %s' , $ value [ 'date' ] -> format ( 'Y-m-d' ) , $ value [ 'time' ] -> format ( 'H:i:s' ) ) ) ; } if ( $ value [ 'date' ] ) { return new \ DateTime ( sprintf ( '%s' , $ value [ 'date' ]... | Transforms an array into a DateTime . |
56,254 | protected function getPluginNames ( $ makefile ) { $ mkdata = file_get_contents ( $ makefile ) ; preg_match ( '/bootstrap(\:|\/js\/\*\.js: js\/\*\.js)\s?\n(\n|.)*?((cat\s)(?P<files>.*?))\s>/i' , $ mkdata , $ matches ) ; return array_map ( function ( $ value ) { return preg_replace ( '/(js\/bootstrap-([\w_-]+)\.js)/' , ... | Get the plugin names from the makefile . |
56,255 | private function setCurrentVersion ( ) { if ( $ this -> getCurrentVersion ( ) !== null ) { update_option ( $ this -> getVersionOptionKey ( ) , $ this -> getVersion ( ) ) ; } else { add_option ( $ this -> getVersionOptionKey ( ) , $ this -> getVersion ( ) ) ; } return $ this ; } | Set the current installed database version . |
56,256 | public function synchronize ( $ lang , $ area ) { $ locale = $ lang -> code ; $ translations = $ this -> translationsFromFiles ( $ locale ) ; if ( empty ( $ translations ) ) { $ translations = $ this -> translationsFromFiles ( lang ( ) -> code ) ; } $ items = Translation :: where ( 'locale' , $ locale ) -> where ( 'are... | synchronize translations between database and translation files |
56,257 | public function translationsFromFiles ( $ locale ) { $ grouped = [ ] ; foreach ( $ this -> hints as $ name => $ hint ) { $ languageDirectory = $ hint . DIRECTORY_SEPARATOR . $ locale ; if ( ! is_dir ( $ languageDirectory ) ) { continue ; } $ files = $ this -> filesystem -> allFiles ( $ languageDirectory ) ; foreach ( $... | gets translations from files |
56,258 | protected function translations ( array $ files = array ( ) ) { $ return = [ ] ; foreach ( $ files as $ file ) { $ translation = $ this -> getStringsBetween ( $ file -> getContents ( ) , 'trans(\'' , "')" ) ; $ translation = array_filter ( $ translation , function ( $ element ) { if ( str_contains ( $ element , ', {' )... | get translations from source files |
56,259 | protected function getStringsBetween ( $ string , $ start , $ end ) { $ pattern = sprintf ( '/%s(.*?)%s/' , preg_quote ( $ start ) , preg_quote ( $ end ) ) ; preg_match_all ( $ pattern , $ string , $ matches ) ; return $ matches [ 1 ] ; } | search all occurences between strings |
56,260 | public static function encrypt ( $ value ) { $ iv = mcrypt_create_iv ( static :: iv_size ( ) , static :: randomizer ( ) ) ; $ value = static :: pad ( $ value ) ; $ value = mcrypt_encrypt ( static :: $ cipher , static :: key ( ) , $ value , static :: $ mode , $ iv ) ; return base64_encode ( $ iv . $ value ) ; } | Encrypt a string using Mcrypt . |
56,261 | public static function decrypt ( $ value ) { $ value = base64_decode ( $ value ) ; $ iv = substr ( $ value , 0 , static :: iv_size ( ) ) ; $ value = substr ( $ value , static :: iv_size ( ) ) ; $ key = static :: key ( ) ; $ value = mcrypt_decrypt ( static :: $ cipher , $ key , $ value , static :: $ mode , $ iv ) ; retu... | Decrypt a string using Mcrypt . |
56,262 | protected static function pad ( $ value ) { $ pad = static :: $ block - ( Inflector :: length ( $ value ) % static :: $ block ) ; return $ value .= str_repeat ( chr ( $ pad ) , $ pad ) ; } | Add PKCS7 compatible padding on the given value . |
56,263 | protected static function unpad ( $ value ) { $ pad = ord ( $ value [ ( $ length = Inflector :: length ( $ value ) ) - 1 ] ) ; if ( $ pad and $ pad < static :: $ block ) { if ( preg_match ( '/' . chr ( $ pad ) . '{' . $ pad . '}$/' , $ value ) ) { return substr ( $ value , 0 , $ length - $ pad ) ; } else { throw new Ex... | Remove the PKCS7 compatible padding from the given value . |
56,264 | public function check ( array $ required , array $ values ) { foreach ( $ required as $ key ) { if ( ! array_key_exists ( $ key , $ values ) ) { return false ; } } return true ; } | Check required values . |
56,265 | public function populate ( array $ vars ) { foreach ( $ vars as $ key => $ value ) { if ( false === getenv ( $ key ) ) { $ _ENV [ $ key ] = $ value ; $ _SERVER [ $ key ] = $ value ; putenv ( "{$key}={$value}" ) ; } } } | Populate environment vars . |
56,266 | protected function getFile ( $ location ) { if ( $ location == 'production' && file_exists ( $ envFile = $ this -> getPath ( ) . ".env.php" ) ) { return $ envFile ; } return $ this -> getPath ( ) . ".env.{$location}.php" ; } | Return the . env file path . |
56,267 | public function getValue ( ) { $ options = $ this -> options ( ) ; if ( $ this -> multiSelected ( ) ) { $ values = array ( ) ; foreach ( $ this -> selected ( ) as $ val ) { $ values [ ] = $ options [ $ val ] ; } return $ values ; } else { return $ options [ $ this -> selected ( ) ] ; } } | Get the selected options . |
56,268 | public function isSelected ( $ val ) { if ( $ this -> isMulti ( ) ) { return in_array ( $ val , $ this -> getValue ( ) ) ; } else { return $ val === $ this -> getValue ( ) ; } } | Check if the given value is selected . |
56,269 | public function update ( ) { $ this -> left = $ this -> x ; $ this -> right = $ this -> x + $ this -> width ; $ this -> top = $ this -> y ; $ this -> bottom = $ this -> y + $ this -> height ; } | Update the left right top and bottom coordinates . |
56,270 | public function intersects ( Box $ box , $ strict = true ) : bool { $ class = Comparators :: class ; $ comparator = $ strict ? array ( $ class , 'strictComparator' ) : array ( $ class , 'nonStrictComparator' ) ; return $ comparator ( $ this -> getLeft ( ) , $ box -> getRight ( ) ) && $ comparator ( $ box -> getLeft ( )... | Detect box collision This algorithm only works with Axis - Aligned boxes! |
56,271 | public function getServiceBroker ( ) { if ( ! $ this -> serviceBroker ) { $ locator = $ this -> getLocator ( ) ; $ this -> setServiceBroker ( $ locator -> get ( 'ServiceBroker' ) ) ; } return $ this -> serviceBroker ; } | Get service broker instance |
56,272 | protected function getLocator ( ) { if ( $ this -> locator ) { return $ this -> locator ; } $ controller = $ this -> getController ( ) ; if ( ! $ controller instanceof ServiceLocatorAwareInterface ) { throw new \ Exception ( 'ServiceBroker plugin requires controller implements ServiceLocatorAwareInterface' ) ; } $ loca... | Get the locator |
56,273 | protected function loadIntermediateContainerInstance ( $ containerClass ) : ContainerInterface { $ arguments = $ this -> getConfiguration ( ) [ AbstractFileConfiguration :: SERVICE_INIT_ARGUMENTS ] ?? NULL ; $ cfg = $ this -> getConfiguration ( ) [ AbstractFileConfiguration :: SERVICE_INIT_CONFIGURATION ] ?? NULL ; try... | Loads the container from configuration that is able to create the final service instance . |
56,274 | protected function loadInstanceFromContainer ( $ containerClass ) { $ this -> containerInstance = $ this -> loadIntermediateContainerInstance ( $ containerClass ) ; try { $ this -> instance = $ this -> containerInstance -> getInstance ( ) ; } catch ( BadConfigurationException $ e ) { $ e = new ServiceException ( $ e ->... | Loads the service instance by creating an intermediate container and get its service instance |
56,275 | protected function loadInstanceFromClass ( $ class ) { $ arguments = $ this -> getConfiguration ( ) [ AbstractFileConfiguration :: SERVICE_INIT_ARGUMENTS ] ?? NULL ; $ config = $ this -> getConfiguration ( ) [ AbstractFileConfiguration :: SERVICE_INIT_CONFIGURATION ] ?? NULL ; $ this -> instance = $ this -> serviceMana... | Loads the service instance directly by using a class name . |
56,276 | protected function loadInstanceFromFile ( $ file ) { if ( file_exists ( $ file ) ) { $ arguments = $ this -> getConfiguration ( ) [ AbstractFileConfiguration :: SERVICE_INIT_ARGUMENTS ] ?? NULL ; $ object = _context_less_require ( $ file , $ arguments , $ this -> serviceManager ) ; if ( is_object ( $ object ) ) { $ thi... | Loads a service instance from return value from a required file |
56,277 | public function seek ( $ num ) { if ( $ num >= 0 && $ num <= $ this -> count ( ) - 1 ) { if ( ! $ this -> resource -> data_seek ( $ num ) ) { return false ; } $ this -> cursor_position = $ num ; return true ; } return false ; } | Set cursor to a given position in the record set . |
56,278 | public function next ( ) { if ( $ this -> cursor_position < $ this -> count ( ) && $ row = $ this -> resource -> fetch_assoc ( ) ) { $ this -> setCurrentRow ( $ row ) ; ++ $ this -> cursor_position ; return true ; } return false ; } | Return next record in result set . |
56,279 | public function toArrayIndexedBy ( $ field_or_getter ) { $ result = [ ] ; foreach ( $ this as $ row ) { if ( $ this -> return_mode === ConnectionInterface :: RETURN_ARRAY ) { $ result [ $ row [ $ field_or_getter ] ] = $ row ; } else { $ result [ $ row -> $ field_or_getter ( ) ] = $ row ; } } return $ result ; } | Returns DBResult indexed by value of a field or by result of specific getter method . |
56,280 | public function jsonSerialize ( ) { if ( ! $ this -> count ( ) ) { return [ ] ; } $ records = [ ] ; foreach ( $ this as $ record ) { if ( $ record instanceof JsonSerializable ) { $ records [ ] = $ record -> jsonSerialize ( ) ; } else { $ records [ ] = $ record ; } } return $ records ; } | Return array or property = > value pairs that describes this object . |
56,281 | protected function setCurrentRow ( $ row ) { if ( ! in_array ( $ this -> return_mode , [ ConnectionInterface :: RETURN_OBJECT_BY_CLASS , ConnectionInterface :: RETURN_OBJECT_BY_FIELD ] , true ) ) { $ this -> current_row = $ row ; $ this -> getValueCaster ( ) -> castRowValues ( $ this -> current_row ) ; return ; } $ cla... | Set current row . |
56,282 | public function handle ( $ old , $ new ) { if ( ! $ this -> canHandle ( $ old ) || ! $ this -> canHandle ( $ new ) ) { return null ; } if ( ( ( string ) $ new -> getReturnType ( ) ) ) { return false ; } if ( ( ( string ) $ new -> getReturnType ( ) ) == ( ( string ) $ old -> getReturnType ( ) ) ) { return false ; } $ th... | Check if return type changed . |
56,283 | protected function getLoginCredential ( $ credentials = array ( ) ) { $ loginField = $ this -> app [ 'config' ] [ 'auth.credentials.login' ] ; if ( isset ( $ credentials [ $ loginField ] ) ) { return $ credentials [ $ loginField ] ; } else if ( Input :: has ( $ loginField ) ) { return Input :: get ( $ loginField ) ; } ... | Return the login value from the credentials |
56,284 | protected function getPasswordCredential ( $ credentials = array ( ) ) { $ passField = $ this -> app [ 'config' ] [ 'auth.credentials.password' ] ; if ( isset ( $ credentials [ $ passField ] ) ) { return $ credentials [ $ passField ] ; } else if ( Input :: has ( $ passField ) ) { return Input :: get ( $ passField ) ; }... | Return the password value from the credentials |
56,285 | public function is ( $ roles ) { if ( ! $ this -> user ( ) ) { return false ; } $ userRoles = $ this -> getUser ( ) -> roles ; foreach ( ( array ) $ roles as $ role ) { if ( in_array ( mb_strtolower ( $ role ) , $ userRoles ) || in_array ( $ role , $ userRoles ) ) { return true ; } } return false ; } | Checks if the user is a certain role or is one of many roles if passed an array . |
56,286 | public function can ( $ capability , $ args = null ) { if ( ! $ this -> user ( ) ) { return false ; } $ userCan = false ; if ( is_array ( $ capability ) ) { foreach ( $ capability as $ cap ) { if ( current_user_can ( $ cap , $ args ) === true ) { $ userCan = true ; break ; } } } else { $ userCan = current_user_can ( $ ... | Checks if the user is has a certain permission or has one of many permissions if passed an array . |
56,287 | public function level ( $ level , $ operator = '>=' ) { if ( ! $ this -> user ( ) ) { return false ; } $ userCaps = array_keys ( $ this -> getUser ( ) -> allcaps ) ; foreach ( $ userCaps as $ cap ) { if ( substr ( $ cap , 0 , 6 ) === 'level_' ) { return $ this -> checkWithOperator ( substr ( $ cap , 6 ) , $ level , $ o... | Each role can have a numerical level as well ; this is useful if you want to check someone has a higher role than someone else . |
56,288 | private function addError ( array & $ errors , string $ message , array $ nodes ) { $ errors [ ] = [ 'text' => $ message , 'nodes' => $ nodes ] ; $ errorGraph = null ; foreach ( $ nodes as $ node ) { if ( $ errorGraph === null ) { $ errorGraph = $ node -> getGraph ( ) ; } else { $ nodeGraph = $ node -> getGraph ( ) ; i... | Add error to the graph |
56,289 | public function get ( $ id ) { if ( ! isset ( $ this -> processors [ $ id ] ) ) { throw new \ InvalidArgumentException ( sprintf ( "processor with id '%s' does not exist" , $ id ) ) ; } return $ this -> processors [ $ id ] ; } | Get processor instance |
56,290 | public function setParameter ( $ parameter ) { if ( ! is_string ( $ parameter ) && ! is_int ( $ parameter ) ) { throw new InvalidArgumentException ( 'Binding parameter value must be a string or an integer.' ) ; } $ this -> parameter = $ parameter ; return $ this ; } | Set the value of the parameter property . |
56,291 | public function isBoolean ( ) { return $ this -> data_type === PDO :: PARAM_BOOL || $ this -> data_type === ( PDO :: PARAM_BOOL | PDO :: PARAM_INPUT_OUTPUT ) ; } | Determine if the data_type property represents a boolean value . |
56,292 | public function isInteger ( ) { return $ this -> data_type === PDO :: PARAM_INT || $ this -> data_type === ( PDO :: PARAM_INT | PDO :: PARAM_INPUT_OUTPUT ) ; } | Determine if the data_type property represents an integer value . |
56,293 | public function isString ( ) { return $ this -> data_type === PDO :: PARAM_STR || $ this -> data_type === ( PDO :: PARAM_STR | PDO :: PARAM_INPUT_OUTPUT ) ; } | Determine if the data_type property represents a string value . |
56,294 | public function isLargeObject ( ) { return $ this -> data_type === PDO :: PARAM_LOB || $ this -> data_type === ( PDO :: PARAM_LOB | PDO :: PARAM_INPUT_OUTPUT ) ; } | Determine if the data_type property represents a large object value . |
56,295 | public function isStatement ( ) { return $ this -> data_type === PDO :: PARAM_STMT || $ this -> data_type === ( PDO :: PARAM_STMT | PDO :: PARAM_INPUT_OUTPUT ) ; } | Determine if the data_type property represents a statement value . |
56,296 | public function getPackageManager ( ) { if ( $ this -> packageManager === null ) { $ this -> packageManager = new PackageManager ( $ this ) ; } return $ this -> packageManager ; } | Returns the package manager |
56,297 | public function getModuleManager ( ) { if ( $ this -> moduleManager === null ) { $ this -> moduleManager = new ModuleManager ( $ this ) ; } return $ this -> moduleManager ; } | Returns the module manager |
56,298 | public function getAuthManager ( ) { if ( $ this -> authManager === null ) { $ this -> authManager = new AuthManager ( $ this ) ; } return $ this -> authManager ; } | Returns the auth manager |
56,299 | public function getFirewall ( ) { if ( $ this -> firewall === null ) { $ this -> firewall = new Firewall ( $ this ) ; } return $ this -> firewall ; } | Returns the firewall |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.