idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
46,800 | public function addWordList ( string $ path , $ name ) : self { $ this -> generator -> addWordList ( $ path , $ name ) ; return $ this ; } | Add a word list to the generator . |
46,801 | public function unread ( $ data ) { $ this -> readBytes -= strlen ( $ data ) ; $ this -> data = $ data . $ this -> data ; } | Push again data in data buffer . It s use when you want to extract a bit from a value a let the rest of the code normally read the data |
46,802 | public function readCodedBinary ( ) { $ c = ord ( $ this -> read ( self :: UNSIGNED_CHAR_LENGTH ) ) ; if ( $ c === self :: NULL_COLUMN ) { return '' ; } if ( $ c < self :: UNSIGNED_CHAR_COLUMN ) { return $ c ; } if ( $ c === self :: UNSIGNED_SHORT_COLUMN ) { return $ this -> readUInt16 ( ) ; } if ( $ c === self :: UNSI... | Read a Length Coded Binary number from the data buffer . Length coded numbers can be anywhere from 1 to 9 bytes depending on the value of the first byte . From PyMYSQL source code |
46,803 | public function readUIntBySize ( $ size ) { if ( $ size === self :: UNSIGNED_CHAR_LENGTH ) { return $ this -> readUInt8 ( ) ; } if ( $ size === self :: UNSIGNED_SHORT_LENGTH ) { return $ this -> readUInt16 ( ) ; } if ( $ size === self :: UNSIGNED_INT24_LENGTH ) { return $ this -> readUInt24 ( ) ; } if ( $ size === self... | Read a little endian integer values based on byte number |
46,804 | public function readIntBeBySize ( $ size ) { if ( $ size === self :: UNSIGNED_CHAR_LENGTH ) { return $ this -> readInt8 ( ) ; } if ( $ size === self :: UNSIGNED_SHORT_LENGTH ) { return $ this -> readInt16Be ( ) ; } if ( $ size === self :: UNSIGNED_INT24_LENGTH ) { return $ this -> readInt24Be ( ) ; } if ( $ size === se... | Read a big endian integer values based on byte number |
46,805 | public function getBinarySlice ( $ binary , $ start , $ size , $ binaryLength ) { $ binary >>= $ binaryLength - ( $ start + $ size ) ; $ mask = ( ( 1 << $ size ) - 1 ) ; return $ binary & $ mask ; } | Read a part of binary data and extract a number |
46,806 | public function makeTableMapDTO ( ) { $ data = [ ] ; $ data [ 'table_id' ] = $ this -> binaryDataReader -> readTableId ( ) ; $ this -> binaryDataReader -> advance ( 2 ) ; $ data [ 'schema_length' ] = $ this -> binaryDataReader -> readUInt8 ( ) ; $ data [ 'schema_name' ] = $ this -> binaryDataReader -> read ( $ data [ '... | This describe the structure of a table . It s send before a change append on a table . A end user of the lib should have no usage of this |
46,807 | protected function getBit ( array $ column ) { $ res = '' ; for ( $ byte = 0 ; $ byte < $ column [ 'bytes' ] ; ++ $ byte ) { $ current_byte = '' ; $ data = $ this -> binaryDataReader -> readUInt8 ( ) ; if ( 0 === $ byte ) { if ( 1 === $ column [ 'bytes' ] ) { $ end = $ column [ 'bits' ] ; } else { $ end = $ column [ 'b... | Read MySQL BIT type |
46,808 | public function getAll ( $ termType ) { $ arr = array ( ) ; foreach ( $ this -> terms as $ term ) { if ( ( string ) $ term -> getTermType ( ) === $ termType ) { array_push ( $ arr , $ term ) ; } } return $ arr ; } | Returns all terms that have the given term type or empty array if none . |
46,809 | public function getFirst ( $ termType ) { foreach ( $ this -> terms as $ term ) { if ( ( string ) $ term -> getTermType ( ) === $ termType ) { return $ term ; } } return null ; } | Returns the first term that has the given term type or null if none . |
46,810 | public function convert ( $ asset , $ basePath ) { $ extension = $ this -> getExtension ( $ asset ) ; if ( $ extension !== 'scss' ) { return $ asset ; } $ cssAsset = $ this -> getCssAsset ( $ asset , 'css' ) ; $ inFile = "$basePath/$asset" ; $ outFile = "$basePath/$cssAsset" ; $ this -> compiler -> setImportPaths ( dir... | Converts a given SCSS asset file into a CSS file . |
46,811 | protected function getCssAsset ( string $ filename , string $ newExtension ) : string { $ extensionlessFilename = pathinfo ( $ filename , PATHINFO_FILENAME ) ; $ filenamePosition = strrpos ( $ filename , $ extensionlessFilename ) ; $ relativePath = substr ( $ filename , 0 , $ filenamePosition ) ; return "$relativePath$... | Get the relative path and filename of the asset |
46,812 | private function hasFormProtection ( string $ name ) : bool { $ key = $ this -> getSessionKey ( $ name ) ; return $ this -> session -> has ( $ key ) ; } | Check if a form has a time protection . |
46,813 | private function getFormTime ( string $ name ) : ? DateTime { $ key = $ this -> getSessionKey ( $ name ) ; if ( $ this -> hasFormProtection ( $ name ) ) { return $ this -> session -> get ( $ key ) ; } return null ; } | Gets the form time for specified form . |
46,814 | public function format ( ) : Format \ Format { if ( null === $ this -> format ) { $ this -> format = Format \ Format :: fromJson ( $ this ) ; } return $ this -> format ; } | Returns the format of the original JSON value . |
46,815 | public function setSerialized ( $ serialized ) { try { parent :: setSerialized ( $ serialized ) ; } catch ( \ Exception $ e ) { Yii :: error ( 'Failed to unserlialize cart: ' . $ e -> getMessage ( ) , __METHOD__ ) ; $ this -> _positions = [ ] ; $ this -> saveToSession ( ) ; } } | Sets cart from serialized string |
46,816 | public function addXmls ( $ importXml = false , $ offersXml = false , $ ordersXml = false ) { $ this -> loadImportXml ( $ importXml ) ; $ this -> loadOffersXml ( $ offersXml ) ; $ this -> loadOrdersXml ( $ ordersXml ) ; } | Add XML files . |
46,817 | private function push ( int $ newState ) { array_push ( $ this -> stateStack , $ this -> state ) ; $ this -> state = $ newState ; if ( $ this -> state !== self :: STATE_ROOT ) { array_push ( $ this -> valueStack , $ this -> value ) ; } $ this -> value = [ ] ; } | Push previous layer to the stack and set new state |
46,818 | private function pop ( $ valueToPrevLevel ) { $ this -> state = array_pop ( $ this -> stateStack ) ; if ( $ this -> state !== self :: STATE_ROOT ) { $ this -> value = array_pop ( $ this -> valueStack ) ; $ this -> value [ ] = $ valueToPrevLevel ; } else { $ this -> decoded = $ valueToPrevLevel ; } } | Pop previous layer from the stack and give it a parsed value |
46,819 | public function antispam ( string $ string , bool $ html = true ) : string { if ( $ html ) { return preg_replace_callback ( self :: MAIL_HTML_PATTERN , [ $ this , 'encryptMail' ] , $ string ) ? : '' ; } return preg_replace_callback ( self :: MAIL_TEXT_PATTERN , [ $ this , 'encryptMailText' ] , $ string ) ? : '' ; } | Replaces E - Mail addresses with an alternative text representation . |
46,820 | public function import ( Category $ category , ImportRecordsDataTable $ importRecordsDataTable ) { return $ importRecordsDataTable -> with ( [ 'resource' => $ category , 'tabs' => 'adminarea.categories.tabs' , 'url' => route ( 'adminarea.categories.stash' ) , 'id' => "adminarea-categories-{$category->getRouteKey()}-imp... | Import categories . |
46,821 | public function destroy ( Category $ category ) { $ category -> delete ( ) ; return intend ( [ 'url' => route ( 'adminarea.categories.index' ) , 'with' => [ 'warning' => trans ( 'cortex/foundation::messages.resource_deleted' , [ 'resource' => trans ( 'cortex/categories::common.category' ) , 'identifier' => $ category -... | Destroy given category . |
46,822 | public static function dump ( string $ filename , $ data , array $ options = [ ] ) : bool { return file_put_contents ( $ filename , self :: encode ( $ data , $ options ) ) !== false ; } | Dump data to bencoded file |
46,823 | public function image ( $ email , $ alt = null , $ attributes = [ ] , $ rating = null ) { $ dimensions = [ ] ; if ( array_key_exists ( 'width' , $ attributes ) ) { $ dimensions [ ] = $ attributes [ 'width' ] ; } if ( array_key_exists ( 'height' , $ attributes ) ) { $ dimensions [ ] = $ attributes [ 'height' ] ; } if ( ... | Return the code of HTML image for a Gravatar . |
46,824 | public function exists ( $ email ) { $ this -> setDefaultImage ( '404' ) ; $ url = $ this -> buildGravatarURL ( $ email ) ; $ headers = get_headers ( $ url , 1 ) ; return substr ( $ headers [ 0 ] , 9 , 3 ) == '200' ; } | Check if a Gravatar image exists . |
46,825 | protected function formatLine ( $ string , $ indent = 0 ) { return str_repeat ( $ this -> spaces , $ indent ) . $ string . $ this -> linebreak ; } | Formats a line |
46,826 | protected function writeObjectInheritance ( $ object , $ parentName ) { try { $ parent = $ this -> reflector -> getClass ( $ parentName ) ; $ longName = $ parent -> getName ( ) ; $ this -> writeObjectElement ( $ parent ) ; } catch ( \ Exception $ e ) { $ parts = explode ( '\\' , $ parentName ) ; $ shortName = array_pop... | Prints an object inheritance |
46,827 | protected function writeObjectInterfaces ( $ object , $ interfaces ) { foreach ( $ interfaces as $ interfaceName ) { try { $ interface = $ this -> reflector -> getClass ( $ interfaceName ) ; $ longName = $ interface -> getName ( ) ; $ this -> writeObjectElement ( $ interface ) ; } catch ( \ Exception $ e ) { $ parts = ... | Prints interfaces that implement an object |
46,828 | protected function writeConstantElements ( $ constants , $ format = '%s %s\l' , $ indent = - 1 ) { $ constantString = '' ; foreach ( $ constants as $ name => $ value ) { $ line = sprintf ( $ format , '+' , $ name ) ; if ( $ indent >= 0 ) { $ constantString .= $ this -> formatLine ( $ line , $ indent ) ; } else { $ cons... | Prints class constants |
46,829 | protected function writePropertyElements ( $ properties , $ format = '%s %s\l' , $ indent = - 1 ) { $ propertyString = '' ; foreach ( $ properties as $ property ) { if ( $ property -> isPrivate ( ) ) { $ visibility = '-' ; } elseif ( $ property -> isProtected ( ) ) { $ visibility = '#' ; } else { $ visibility = '+' ; }... | Prints class properties |
46,830 | protected function writeMethodElements ( $ methods , $ format = '%s %s()\l' , $ indent = - 1 ) { $ methodString = '' ; foreach ( $ methods as $ method ) { if ( $ method -> isPrivate ( ) ) { $ visibility = '-' ; } elseif ( $ method -> isProtected ( ) ) { $ visibility = '#' ; } else { $ visibility = '+' ; } if ( $ method... | Prints class methods |
46,831 | protected function writeGraphHeader ( ) { $ nodeAttributes = array ( 'fontname' => "Verdana" , 'fontsize' => 8 , 'shape' => "none" , 'margin' => 0 , 'fillcolor' => '#FEFECE' , 'style' => 'filled' , ) ; $ edgeAttributes = array ( 'fontname' => "Verdana" , 'fontsize' => 8 , ) ; $ indent = 1 ; $ graph = $ this -> formatLi... | Prints header of the main graph |
46,832 | protected function generateSamples ( ) : void { $ module = str_after ( $ this -> getNameInput ( ) , '/' ) ; $ this -> call ( 'make:config' , [ 'name' => 'config' , '--module' => $ this -> getNameInput ( ) ] ) ; $ this -> call ( 'make:model' , [ 'name' => 'Example' , '--module' => $ this -> getNameInput ( ) ] ) ; $ this... | Generate code samples . |
46,833 | protected function processStubs ( $ stubs , $ path ) : void { $ this -> makeDirectory ( $ path ) ; $ this -> files -> copyDirectory ( $ stubs , $ path ) ; $ files = [ ( $ phpunit = $ path . DIRECTORY_SEPARATOR . 'phpunit.xml.dist' ) => $ this -> files -> get ( $ phpunit ) , ( $ composer = $ path . DIRECTORY_SEPARATOR .... | Process stubs placeholders . |
46,834 | protected function rootNamespace ( ) : string { return $ this -> rootNamespace ?? $ this -> rootNamespace = implode ( '\\' , array_map ( 'ucfirst' , explode ( '/' , trim ( $ this -> moduleName ( ) ) ) ) ) ; } | Get the root namespace for the class . |
46,835 | protected function moduleName ( ) : string { return $ this -> moduleName ?? $ this -> input -> getOption ( 'module' ) ?? $ this -> moduleName = $ this -> ask ( 'What is your module?' ) ; } | Get the module name for the class . |
46,836 | public function process ( ServerRequestInterface $ request , RequestHandlerInterface $ handler ) : ResponseInterface { $ serviceHandler = $ request -> getAttribute ( RouterMiddleware :: ATTRIBUTE ) ; $ handlerAdapter = App :: getBean ( 'serviceHandlerAdapter' ) ; $ response = $ handlerAdapter -> doHandler ( $ request ,... | execute service with handler |
46,837 | public function findByPK ( $ id , array $ load = [ ] ) { return $ this -> getSelector ( ) -> wherePK ( $ id ) -> load ( $ load ) -> findOne ( ) ; } | Find document by it s primary key . |
46,838 | public function findOne ( array $ query = [ ] , array $ sortBy = [ ] , array $ load = [ ] ) { return $ this -> getSelector ( ) -> orderBy ( $ sortBy ) -> load ( $ load ) -> findOne ( $ query ) ; } | Select one document from mongo collection . |
46,839 | public function getIndexes ( ) : \ Generator { $ definitions = $ this -> reflection -> getProperty ( 'indexes' ) ?? [ ] ; foreach ( $ definitions as $ definition ) { yield $ this -> castIndex ( $ definition ) ; } } | Returns set of declared indexes . |
46,840 | protected function packDefaults ( AbstractTable $ table ) : array { $ mutators = $ this -> buildMutators ( $ table ) ; $ defaults = [ ] ; foreach ( $ table -> getColumns ( ) as $ column ) { $ field = $ column -> getName ( ) ; $ default = $ column -> getDefaultValue ( ) ; if ( ! is_null ( $ default ) && ! is_object ( $ ... | Generate set of default values to be used by record . |
46,841 | protected function mutateValue ( array $ mutators , string $ field , $ default ) { if ( isset ( $ mutators [ RecordEntity :: MUTATOR_SETTER ] [ $ field ] ) ) { try { $ setter = $ mutators [ RecordEntity :: MUTATOR_SETTER ] [ $ field ] ; $ default = call_user_func ( $ setter , $ default ) ; return $ default ; } catch ( ... | Process value thought associated mutator if any . |
46,842 | public function republishCommand ( string $ collection = 'persistent' ) : void { $ collectionName = $ collection ; $ collection = $ this -> resourceManager -> getCollection ( $ collectionName ) ; if ( ! $ collection ) { $ this -> outputLine ( '<error>The collection %s does not exist.</error>' , [ $ collectionName ] ) ;... | Republish a collection |
46,843 | public function actionLogout ( ) { Yii :: $ app -> user -> logout ( ) ; $ back = Yii :: $ app -> request -> post ( 'back' ) ? : Yii :: $ app -> request -> get ( 'back' ) ; return $ back ? $ this -> redirect ( $ back ) : $ this -> goHome ( ) ; } | Logout action . |
46,844 | public function actionContact ( ) { $ model = new ContactForm ( ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> contact ( Yii :: $ app -> params [ 'adminEmail' ] ) ) { Yii :: $ app -> session -> setFlash ( 'contactFormSubmitted' ) ; return $ this -> refresh ( ) ; } return $ this -> render... | Displays contact page and sends contact form . |
46,845 | public function extractRelations ( array & $ data ) { $ relations = array_intersect_key ( $ data , $ this -> schema ) ; foreach ( $ relations as $ name => $ relation ) { $ this -> relations [ $ name ] = $ relation ; unset ( $ data [ $ name ] ) ; } } | Extract relations data from given entity fields . |
46,846 | public function queueRelations ( ContextualCommandInterface $ parent ) : ContextualCommandInterface { if ( empty ( $ this -> relations ) ) { return $ parent ; } $ transaction = new TransactionalCommand ( ) ; foreach ( $ this -> leadingRelations ( ) as $ relation ) { if ( $ relation -> isLoaded ( ) ) { $ transaction -> ... | Generate command tree with or without relation to parent command in order to specify update or insert sequence . Commands might define dependencies between each other in order to extend FK values . |
46,847 | public function get ( string $ relation ) : RelationInterface { if ( isset ( $ this -> relations [ $ relation ] ) && $ this -> relations [ $ relation ] instanceof RelationInterface ) { return $ this -> relations [ $ relation ] ; } $ instance = $ this -> orm -> makeRelation ( $ this -> class , $ relation ) ; if ( array_... | Get associated relation instance . |
46,848 | public function isJoined ( ) : bool { if ( ! empty ( $ this -> options [ 'using' ] ) ) { return true ; } return in_array ( $ this -> getMethod ( ) , [ self :: INLOAD , self :: JOIN , self :: LEFT_JOIN ] ) ; } | Indicated that loaded must generate JOIN statement . |
46,849 | public function isLoaded ( ) : bool { return $ this -> getMethod ( ) !== self :: JOIN && $ this -> getMethod ( ) !== self :: LEFT_JOIN ; } | Indication that loader want to load data . |
46,850 | protected function configureQuery ( SelectQuery $ query , bool $ loadColumns = true , array $ outerKeys = [ ] ) : SelectQuery { if ( $ loadColumns ) { if ( $ this -> isJoined ( ) ) { $ this -> mountColumns ( $ query , $ this -> options [ 'minify' ] ) ; } else { $ this -> mountColumns ( $ query , $ this -> options [ 'mi... | Configure query with conditions joins and columns . |
46,851 | protected function getAlias ( ) : string { if ( ! empty ( $ this -> options [ 'using' ] ) ) { return $ this -> options [ 'using' ] ; } if ( ! empty ( $ this -> options [ 'alias' ] ) ) { return $ this -> options [ 'alias' ] ; } throw new LoaderException ( "Unable to resolve loader alias" ) ; } | Relation table alias . |
46,852 | protected function localKey ( $ key ) { if ( empty ( $ this -> schema [ $ key ] ) ) { return null ; } return $ this -> getAlias ( ) . '.' . $ this -> schema [ $ key ] ; } | Generate sql identifier using loader alias and value from relation definition . Key name to be fetched from schema . |
46,853 | protected function ensureAlias ( AbstractLoader $ parent ) { if ( empty ( $ this -> options [ 'alias' ] ) ) { if ( $ this -> isLoaded ( ) && $ this -> isJoined ( ) ) { $ this -> options [ 'alias' ] = 'd' . decoct ( ++ self :: $ countLevels ) ; } else { $ this -> options [ 'alias' ] = $ parent -> getAlias ( ) . '_' . $ ... | Ensure table alias . |
46,854 | public function doHandler ( ServerRequestInterface $ request , array $ handler ) : Response { $ data = $ request -> getAttribute ( PackerMiddleware :: ATTRIBUTE_DATA ) ; $ params = $ data [ 'params' ] ?? [ ] ; list ( $ serviceClass , $ method ) = $ handler ; $ service = App :: getBean ( $ serviceClass ) ; $ response = ... | Execute service handler |
46,855 | public function getName ( ) : string { if ( ! empty ( $ this -> name ) ) { return $ this -> name ; } $ name = ( $ this -> isUnique ( ) ? 'unique_' : 'index_' ) . join ( '_' , $ this -> getColumns ( ) ) ; return strlen ( $ name ) > 64 ? md5 ( $ name ) : $ name ; } | Generate unique index name . |
46,856 | protected function mountColumns ( SelectQuery $ query , bool $ minify = false , string $ prefix = '' , bool $ overwrite = false ) { $ alias = $ this -> getAlias ( ) ; $ columns = $ overwrite ? [ ] : $ query -> getColumns ( ) ; foreach ( $ this -> getColumns ( ) as $ name ) { $ column = $ name ; if ( $ minify ) { $ colu... | Set columns into SelectQuery . |
46,857 | public function withContext ( RelationContext $ source , RelationContext $ target = null ) : self { $ definition = clone $ this ; $ definition -> sourceContext = $ source ; $ definition -> targetContext = $ target ; return $ definition ; } | Set relation contexts . |
46,858 | public function locateSchemas ( ) : array { if ( ! $ this -> container -> has ( ClassesInterface :: class ) ) { return [ ] ; } $ classes = $ this -> container -> get ( ClassesInterface :: class ) ; $ schemas = [ ] ; foreach ( $ classes -> getClasses ( RecordEntity :: class ) as $ class ) { if ( $ class [ 'abstract' ] )... | Locate all available document schemas in a project . |
46,859 | public function registerRelation ( SchemaBuilder $ builder , RelationDefinition $ definition ) { if ( ! $ this -> config -> hasRelation ( $ definition -> getType ( ) ) ) { throw new DefinitionException ( sprintf ( "Undefined relation type '%s' in '%s'.'%s'" , $ definition -> getType ( ) , $ definition -> sourceContext ... | Registering new relation definition . At this moment function would not check if relation is unique and will redeclare it . |
46,860 | public function inverseRelations ( SchemaBuilder $ builder ) { foreach ( $ this -> relations as $ relation ) { $ definition = $ relation -> getDefinition ( ) ; if ( $ definition -> needInversion ( ) ) { if ( ! $ relation instanceof InversableRelationInterface ) { throw new DefinitionException ( sprintf ( "Unable to inv... | Create inverse relations where needed . |
46,861 | public function packRelations ( string $ class , SchemaBuilder $ builder ) : array { $ result = [ ] ; foreach ( $ this -> relations as $ relation ) { $ definition = $ relation -> getDefinition ( ) ; if ( $ definition -> sourceContext ( ) -> getClass ( ) == $ class ) { $ result [ $ definition -> getName ( ) ] = $ relati... | Pack relation schemas for specific model class in order to be saved in memory . |
46,862 | protected function locateOuter ( SchemaBuilder $ builder , RelationDefinition $ definition ) : RelationDefinition { if ( ! empty ( $ definition -> targetContext ( ) ) ) { return $ definition ; } $ found = null ; foreach ( $ builder -> getSchemas ( ) as $ schema ) { if ( $ this -> matchBinded ( $ definition -> getTarget... | Populate entity target based on interface or role . |
46,863 | private function matchBinded ( string $ target , SchemaInterface $ schema ) : bool { if ( $ schema -> getRole ( ) == $ target ) { return true ; } if ( interface_exists ( $ target ) && is_a ( $ schema -> getClass ( ) , $ target , true ) ) { return true ; } return false ; } | Check if schema matches relation target . |
46,864 | protected function mapResourceAbilities ( ) : array { $ controller = new ReflectionClass ( static :: class ) ; $ methods = array_filter ( $ controller -> getMethods ( ReflectionMethod :: IS_PUBLIC ) , function ( $ item ) use ( $ controller ) { return $ item -> class === $ controller -> name && mb_substr ( $ item -> nam... | Map resource actions to resource abilities . |
46,865 | public function add ( RecordInterface $ record ) : self { $ this -> assertValid ( $ record ) ; $ this -> loadData ( true ) -> instances [ ] = $ record ; return $ this ; } | Add new record into entity set . Attention usage of this method WILL load relation data unless partial . |
46,866 | public function delete ( RecordInterface $ record ) : self { $ this -> loadData ( true ) ; $ this -> assertValid ( $ record ) ; foreach ( $ this -> instances as $ index => $ instance ) { if ( $ this -> match ( $ instance , $ record ) ) { unset ( $ this -> instances [ $ index ] ) ; $ this -> deleteInstances [ ] = $ inst... | Delete one record strict compaction make sure exactly same instance is given . |
46,867 | public function setExpressions ( array $ expressions ) { $ this -> expressions = array ( ) ; foreach ( $ expressions as $ expression ) { $ this -> addExpression ( $ expression ) ; } return $ this ; } | Set the set of subexpressions |
46,868 | protected function _setDefaultPlaceholderValue ( $ value ) { if ( ! is_null ( $ value ) ) { $ value = $ this -> _normalizeStringable ( $ value ) ; } $ this -> defaultPlaceholderValue = $ value ; } | Assigns a default placeholder value to this instance . |
46,869 | public function validateCode ( ErrorElement $ errorElement , $ object ) { $ code = $ object -> getCode ( ) ; $ registry = $ this -> getConfigurationPool ( ) -> getContainer ( ) -> get ( 'blast_core.code_generators' ) ; $ codeGenerator = $ registry -> getCodeGenerator ( Plot :: class ) ; if ( ! empty ( $ code ) && ! $ c... | Plot code validator . |
46,870 | protected function display ( $ data = [ ] ) { $ function = debug_backtrace ( DEBUG_BACKTRACE_IGNORE_ARGS , 2 ) [ 1 ] [ 'function' ] ; $ event = lcfirst ( substr ( $ function , 2 ) ) ; $ id = $ this -> getId ( ) ; $ name = '@' . $ id . '/' . $ id . '/' . $ event . $ this -> view -> getExtension ( ) ; $ this -> view -> d... | Output a rendered template by current event template |
46,871 | public function getBasePath ( ) { if ( ! $ this -> basePath ) { $ class = new \ ReflectionClass ( $ this ) ; $ this -> basePath = substr ( dirname ( $ class -> getFileName ( ) ) , strlen ( getcwd ( ) ) + 1 ) ; if ( substr ( $ class -> getName ( ) , 0 , 8 ) == 'Miaoxing' ) { $ this -> basePath = dirname ( $ this -> base... | Returns the web path for this plugin |
46,872 | public function isInCidrRange ( string $ cidrIpShort , $ cidrMask ) : bool { if ( is_string ( $ cidrMask ) && ! ctype_digit ( $ cidrMask ) ) { throw new \ InvalidArgumentException ( 'cidrMask must be of type int or a string losslessly' . ' convertible to int.' ) ; } list ( $ lower , $ upper ) = $ this -> calculateIpRan... | checks if IP address is in given CIDR range |
46,873 | private function calculateIpRange ( int $ cidrIpLong , int $ cidrMask ) : array { $ netWork = $ cidrIpLong & $ this -> netMask ( $ cidrMask ) ; $ lower = $ netWork + 1 ; $ upper = ( $ netWork | $ this -> inverseNetMask ( $ cidrMask ) ) - 1 ; return array ( $ lower , $ upper ) ; } | returns lower and upper ip for IP range as long |
46,874 | public function openSocket ( int $ port , int $ timeout = 5 , callable $ openWith = null ) : Stream { $ socket = new Socket ( $ this -> ip , $ port , null ) ; if ( null !== $ openWith ) { $ socket -> openWith ( $ openWith ) ; } return $ socket -> connect ( ) -> setTimeout ( $ timeout ) ; } | opens socket to this ip address |
46,875 | public function form ( array $ args = [ ] , $ implode = false ) { $ attributes = $ this -> parseAttributes ( self :: FORM_ATTRIBUTES , $ args ) ; return $ this -> maybeImplode ( $ attributes , $ implode ) ; } | Normalize form attributes |
46,876 | public function input ( array $ args = [ ] , $ implode = false ) { $ this -> filterInputType ( ) ; $ attributes = $ this -> parseAttributes ( self :: INPUT_ATTRIBUTES , $ args ) ; return $ this -> maybeImplode ( $ attributes , $ implode ) ; } | Normalize input attributes |
46,877 | public function maybeImplode ( array $ attributes , $ implode = true ) { if ( ! $ implode || $ implode !== 'implode' ) { return $ attributes ; } $ results = [ ] ; foreach ( $ attributes as $ key => $ value ) { $ quotes = false !== stripos ( $ key , 'data-' ) ? "'" : '"' ; if ( is_array ( $ value ) ) { $ value = json_en... | Possibly implode attributes into a string |
46,878 | public function select ( array $ args = [ ] , $ implode = false ) { $ attributes = $ this -> parseAttributes ( self :: SELECT_ATTRIBUTES , $ args ) ; return $ this -> maybeImplode ( $ attributes , $ implode ) ; } | Normalize select attributes |
46,879 | public function textarea ( array $ args = [ ] , $ implode = false ) { $ attributes = $ this -> parseAttributes ( self :: TEXTAREA_ATTRIBUTES , $ args ) ; return $ this -> maybeImplode ( $ attributes , $ implode ) ; } | Normalize textarea attributes |
46,880 | protected function filterAttributes ( array $ attributeKeys ) { $ filtered = array_intersect_key ( $ this -> args , array_flip ( $ attributeKeys ) ) ; foreach ( $ filtered as $ key => $ value ) { if ( ! in_array ( $ key , self :: BOOLEAN_ATTRIBUTES ) ) continue ; if ( $ value !== false ) { $ filtered [ $ key ] = '' ; c... | Filter attributes by the provided attrribute keys and remove any non - boolean keys with empty values |
46,881 | private function requireProvider ( $ message = '' ) { if ( empty ( $ this -> cacheProvider ) ) { if ( ! empty ( $ this -> log ) ) $ this -> log -> notice ( "Cache provider is not available. " . $ message ) ; return false ; } return true ; } | Require a provider |
46,882 | public function execute ( Request $ request ) { if ( ! $ this -> requireProvider ( "Executing cache request" ) ) return null ; $ cacheKey = $ request -> getCacheKey ( ) ; if ( empty ( $ cacheKey ) ) { if ( ! empty ( $ this -> log ) ) $ this -> log -> error ( "Invalid or missing cache key." ) ; return null ; } $ cacheRe... | Do a cache request |
46,883 | protected function validateKey ( $ key ) { $ reserved = [ 'type' , 'id' ] ; if ( in_array ( strtolower ( $ key ) , $ reserved ) ) { throw MetadataException :: reservedFieldKey ( $ key , $ reserved ) ; } } | Validates that the field key is not reserved . |
46,884 | public function executeHandler ( $ request , $ handler ) { if ( ! is_array ( $ handler ) || is_callable ( $ handler ) ) { $ handler = [ $ handler , \ Bit55 \ Midcore \ Middleware \ NotFoundHandler :: class ] ; } $ dispatcher = new Dispatcher ( $ handler , $ this -> container ) ; return $ dispatcher -> dispatch ( $ requ... | Executing application action . |
46,885 | protected function RemovalObject ( ) { $ id = Request :: PostData ( 'delete' ) ; return $ id ? Layout :: Schema ( ) -> ByID ( $ id ) : null ; } | Gets the layout that is requested to be removed |
46,886 | protected function CanDelete ( Layout $ layout ) { return self :: Guard ( ) -> Allow ( BackendAction :: Delete ( ) , $ layout ) && self :: Guard ( ) -> Allow ( BackendAction :: UseIt ( ) , new LayoutForm ( ) ) ; } | True if layout can be deleted |
46,887 | public function resolve ( RouteInterface $ route ) { if ( is_string ( $ handler = $ route -> handler ( ) ) ) { $ handler = explode ( '@' , $ handler ) ; } $ parameters = ( array ) $ route -> parameters ( ) ; list ( $ handler , $ reflection ) = $ this -> reflection ( $ handler ) ; $ parameters = $ this -> arguments ( $ ... | Resolves the specified route instance . |
46,888 | protected function instance ( $ class ) { $ reflection = new \ ReflectionClass ( $ class ) ; $ arguments = array ( ) ; $ constructor = $ reflection -> getConstructor ( ) ; if ( $ this -> container -> has ( $ class ) ) { return $ this -> container -> get ( $ class ) ; } if ( $ constructor !== null ) { $ arguments = $ th... | Returns the instance of the identifier from the container . |
46,889 | protected function reflection ( $ handler ) { if ( ! is_array ( $ handler ) ) { $ instance = new \ ReflectionFunction ( $ handler ) ; return array ( $ handler , $ instance ) ; } list ( $ class , $ method ) = ( array ) $ handler ; $ instance = new \ ReflectionMethod ( $ class , $ method ) ; $ handler = array ( $ this ->... | Returns a ReflectionFunctionAbstract instance . |
46,890 | public function indexAction ( Request $ request ) { $ query = $ this -> get ( 'ydle.logger' ) -> createViewLogQuery ( ) ; $ paginator = $ this -> get ( 'knp_paginator' ) ; $ pagination = $ paginator -> paginate ( $ query , $ this -> get ( 'request' ) -> query -> get ( 'page' , 1 ) , 25 ) ; $ logs = new Logs ( ) ; $ for... | Homepage for logs |
46,891 | public function getDefinition ( ) { $ definition [ 'KeySchema' ] = $ this -> getDefinitionKeySchema ( ) ; if ( $ this -> isPrimary ( ) ) { $ definition [ 'AttributeDefinitions' ] = $ this -> getDefinitionAttributes ( ) ; } else { $ definition [ 'IndexName' ] = $ this -> getName ( ) ; $ definition [ 'Projection' ] = $ t... | Return the index definition formatted for AWS SDK . |
46,892 | public static function createBrickFromPostValues ( $ postValues ) { if ( isset ( $ postValues [ 'title' ] ) ) { $ brickObject = new \ stdClass ( ) ; $ brickObject -> title = $ postValues [ 'title' ] ; $ brickObject -> slug = StringUtil :: slugify ( $ postValues [ 'title' ] ) ; $ brickObject -> fields = array ( ) ; if (... | Create a brick from post values |
46,893 | public function manage ( ) { if ( ! ( $ this -> processManagerDto instanceof ProcessManagerDto ) ) { throw new ProcessManagerException ( "ProcessManagerDto wasn't set." ) ; } $ this -> executionDto = new ExecutionDto ( ) ; $ this -> reactControlDto = $ this -> processManagerDto ; $ this -> initStartMethods ( ) ; $ this... | Manage processes creation and termination during to load manager info and tasks number |
46,894 | public function render ( ElementInterface $ element ) { $ captcha = $ element -> getCaptcha ( ) ; if ( $ captcha === null || ! $ captcha instanceof CaptchaAdapter ) { throw new Exception \ DomainException ( sprintf ( '%s requires that the element has a "captcha" attribute of type Zend\Captcha\Image; none found' , __MET... | Render the captcha |
46,895 | public function createView ( ExpressViewRenderer $ renderer , $ resource ) { $ resource = ( string ) $ resource ; if ( ! is_file ( $ resource ) ) { throw new \ RuntimeException ( sprintf ( 'Express view not found: "%s"' , $ resource ) ) ; } $ key = $ this -> createKey ( $ resource ) ; $ typeName = $ this -> createTypeN... | Create an express view from the given XML view will utilize the cache directory to dump and load a template compiled into plain PHP code . |
46,896 | protected function parseView ( ExpressViewRenderer $ renderer , $ data , $ resource = '' ) { try { $ reader = new XmlStreamReader ( ) ; $ reader -> XML ( $ data ) ; $ buffer = '<?xml version="1.0"?>' . "\n" ; while ( $ reader -> read ( ) ) { switch ( $ reader -> nodeType ) { case XmlStreamReader :: ELEMENT : $ buffer .... | Compile the given XML source and return a compiler object . |
46,897 | protected function Init ( ) { $ sql = Access :: SqlBuilder ( ) ; $ tbl = Membergroup :: Schema ( ) -> Table ( ) ; $ order = $ sql -> OrderList ( $ sql -> OrderAsc ( $ tbl -> Field ( 'Name' ) ) ) ; $ this -> groups = Membergroup :: Schema ( ) -> Fetch ( false , null , $ order ) ; return parent :: Init ( ) ; } | Initiaizes the set of groups |
46,898 | protected function resolveSubQueryClosure ( \ Closure $ callback ) : Query { if ( $ this -> closureResolver === null ) { return $ this -> makeCopyForSubQuery ( ) -> apply ( $ callback ) ; } else { return $ this -> closureResolver -> resolveSubQueryClosure ( $ callback ) ; } } | Retrieves the query object from a closure given instead of a subquery . |
46,899 | protected function resolveCriteriaGroupClosure ( \ Closure $ callback ) : Query { if ( $ this -> closureResolver === null ) { return $ this -> makeCopyForCriteriaGroup ( ) -> apply ( $ callback ) ; } else { return $ this -> closureResolver -> resolveCriteriaGroupClosure ( $ callback ) ; } } | Retrieves the query object from a closure given instead of a criteria group query . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.