idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
57,800 | private function routeAllRulesToRoot ( ) { $ rules = $ this -> rules ; foreach ( $ this -> defaultRules as $ k => $ v ) $ rules [ $ k ] = '/content/nr' ; foreach ( $ rules as $ k => $ v ) $ rules [ $ k ] = '/content/nr' ; $ rules [ '/sitemap.xml' ] = '/site/sitemap' ; $ rules [ '/login' ] = '/site/login' ; $ rules [ '/... | Eraseses all the existing rules and remaps them to the index |
57,801 | private function generateContentRules ( ) { $ rules = array ( ) ; $ criteria = Content :: model ( ) -> getBaseCriteria ( ) ; $ content = Content :: model ( ) -> findAll ( $ criteria ) ; foreach ( $ content as $ el ) { if ( $ el -> slug == NULL ) continue ; $ pageRule = $ el -> slug . '/<page:\d+>' ; $ rule = $ el -> sl... | Generates content rules |
57,802 | private function generateCategoryRules ( ) { $ rules = array ( ) ; $ categories = Categories :: model ( ) -> findAll ( ) ; foreach ( $ categories as $ el ) { if ( $ el -> slug == NULL ) continue ; $ pageRule = $ el -> slug . '/<page:\d+>' ; $ rule = $ el -> slug ; $ pageRule = $ el -> slug . '/<page:\d+>' ; $ rule = $ ... | Generates category rules |
57,803 | public function onSuccessActivate ( Event $ event ) { $ user = $ event -> getData ( 'user' ) ; $ this -> _getMailer ( $ user ) -> sendActivationMessage ( ) ; } | On success user activation profile . |
57,804 | public function onModelAfterSave ( Event $ event ) { $ user = $ event -> getData ( 'user' ) ; if ( $ user instanceof EntityInterface ) { if ( $ user -> isNew ( ) && Filter :: bool ( $ user -> get ( 'notify' ) ) ) { $ this -> _getMailer ( $ user ) -> sendCreateMessage ( ) ; } } } | Global after save user data . |
57,805 | public function getListnameByListId ( $ listID ) { $ list = $ this -> model -> where ( 'id' , $ listID ) -> first ( ) ; return $ list -> title ; } | Get the list title by ID |
57,806 | public function setLogger ( string $ id , LoggerInterface $ logger ) : self { $ this -> _loggers [ $ id ] = $ logger ; return $ this ; } | Sets a logger instance . |
57,807 | public function getLogger ( string $ id ) { if ( ! isset ( $ this -> _loggers [ $ id ] ) ) { throw new \ RuntimeException ( 'Logger with ID "' . $ id . '" is not registered on the logger factory.' ) ; } return $ this -> _loggers [ $ id ] ; } | Returns a logger instance . |
57,808 | public function createHandler ( string $ id , string $ type , int $ level , array $ config ) : HandlerInterface { if ( ! isset ( $ this -> _handlers [ $ id ] ) ) { $ config = array_replace ( [ 'processorIds' => [ ] ] , $ config ) ; if ( ! is_array ( $ config [ 'processorIds' ] ) ) { throw InvalidConfigException :: crea... | Creates a handler . |
57,809 | public function setHandler ( string $ handlerId , HandlerInterface $ handler ) : self { $ this -> _handlers [ $ handlerId ] = $ handler ; return $ this ; } | Sets a handler instance . |
57,810 | public function getHandler ( string $ id ) { if ( ! isset ( $ this -> _handlers [ $ id ] ) ) { throw new \ RuntimeException ( 'Handler with ID "' . $ id . '" is not registered on the logger factory.' ) ; } return $ this -> _handlers [ $ id ] ; } | Returns a handler instance . |
57,811 | public function setProcessor ( string $ processorId , callable $ processor ) : self { $ this -> _processors [ $ processorId ] = $ processor ; return $ this ; } | Sets a processor instance . |
57,812 | public function getProcessor ( string $ id ) { if ( ! isset ( $ this -> _processors [ $ id ] ) ) { throw new \ RuntimeException ( 'Processor with ID "' . $ id . '" is not registered on the logger factory.' ) ; } return $ this -> _processors [ $ id ] ; } | Returns a processor instance . |
57,813 | public function createFormatter ( string $ id , string $ type , array $ config ) : FormatterInterface { if ( ! isset ( $ this -> _formatters [ $ id ] ) ) { switch ( $ type ) { case self :: FORMATTER_TYPE_LINE : $ config = array_replace ( [ 'format' => null , 'dateFormat' => null , 'allowInlineLineBreaks' => false , 'ig... | Creates a Formatter . |
57,814 | public function setFormatter ( string $ formatterId , FormatterInterface $ formatter ) : self { $ this -> _formatters [ $ formatterId ] = $ formatter ; return $ this ; } | Sets a Formatter instance . |
57,815 | public function getFormatter ( string $ id ) { if ( ! isset ( $ this -> _formatters [ $ id ] ) ) { throw new \ RuntimeException ( 'Formatter with ID "' . $ id . '" is not registered on the logger factory.' ) ; } return $ this -> _formatters [ $ id ] ; } | Returns a formatter instance . |
57,816 | public function & createBody ( $ autoadd = true ) { $ body = new PanelBody ( ) ; if ( $ autoadd ) { $ this -> content [ ] = $ body ; } return $ body ; } | Creates a PanelBody object adds it by default to the content stack and returns a reference on it |
57,817 | protected function parseEnv ( array $ envs , $ path , $ overload ) { foreach ( $ envs as $ key => $ val ) { if ( $ this -> source_marker === $ val ) { $ src = $ this -> expandPath ( $ this -> deReference ( $ key ) , $ path ) ; $ this -> load ( $ src , $ overload ) ; } else { $ this -> setEnv ( $ key , $ this -> deRefer... | Parse & set env |
57,818 | public static function selector ( $ selector , $ child = true ) { $ css = '' ; if ( $ selector -> getType ( ) ) { $ css .= $ selector -> getType ( ) . ' ' ; } if ( ! $ selector -> getTagName ( ) && ! $ selector -> getIdentification ( ) && ! $ selector -> getClasses ( ) && ! $ selector -> getPseudos ( ) ) { $ css .= '*'... | Formats a selector |
57,819 | public function search ( $ params ) { $ query = self :: find ( ) ; $ dataProvider = new \ yii \ data \ ActiveDataProvider ( [ 'query' => $ query , 'pagination' => [ 'pageSize' => 100 , ] , 'sort' => [ 'defaultOrder' => [ 'code' => SORT_DESC ] ] ] ) ; if ( $ this -> load ( $ params ) && $ this -> validate ( ) ) { $ quer... | Search categories list |
57,820 | public function matchPattern ( string $ pattern ) : Element { $ this -> attributes [ 'pattern' ] = $ pattern ; return $ this -> addTest ( 'pattern' , function ( $ value ) use ( $ pattern ) { return preg_match ( "@^$pattern$@" , trim ( $ value ) ) ; } ) ; } | The field must match the pattern supplied . |
57,821 | public function maxLength ( int $ length ) : Element { $ this -> attributes [ 'maxlength' ] = ( int ) $ length ; return $ this -> addTest ( 'maxlength' , function ( $ value ) use ( $ length ) { return mb_strlen ( trim ( $ value ) , 'UTF-8' ) <= ( int ) $ length ; } ) ; } | The maximum length of the field . |
57,822 | public function register ( ) { $ this -> handler = $ this -> make ( Handler :: class ) ; $ this -> handler -> setDebug ( $ this -> app ( ) -> getGeneral ( ) [ 'debug' ] ) -> setLog ( $ this -> app ( ) -> getGeneral ( ) [ 'log' ] ) -> fire ( ) ; $ this -> registerErrorHandler ( ) ; $ this -> registerExceptionHandler ( )... | create a new instance and register handlers |
57,823 | protected function execute ( InputInterface $ input , OutputInterface $ output ) { $ this -> input = $ input ; $ this -> output = $ output ; $ repository = $ this -> getContainer ( ) -> get ( 'ezpublish.api.repository' ) ; $ contentTypeService = $ repository -> getContentTypeService ( ) ; $ contentLanguageService = $ r... | Execute ContentType generate command |
57,824 | public static function checkModel ( $ errors , Model $ model ) : array { $ output = [ ] ; if ( ! is_array ( $ errors ) ) { return $ output ; } foreach ( $ errors as $ attribute => $ message ) { $ obj = $ model ; if ( strpos ( $ attribute , '.' ) !== false ) { list ( $ nested , $ attr ) = explode ( '.' , $ attribute ) ;... | Check input errors . |
57,825 | public static function booleanSwitch ( string $ name = '' , array $ values = [ ] , bool $ active = false , array $ attributes = [ ] ) : string { $ defaultAttributes = [ 'method-get' => false ] ; $ userAttributes = \ array_merge ( $ defaultAttributes , $ attributes ) ; $ isEnabled = ! \ array_key_exists ( 'disabled' , $... | Returns boolean switch controll |
57,826 | public static function Atci13 ( $ rc , $ dc , $ pr , $ pd , $ px , $ rv , $ date1 , $ date2 , & $ ri , & $ di , & $ eo ) { $ astrom = new iauASTROM ( ) ; IAU :: Apci13 ( $ date1 , $ date2 , $ astrom , $ eo ) ; IAU :: Atciq ( $ rc , $ dc , $ pr , $ pd , $ px , $ rv , $ astrom , $ ri , $ di ) ; } | - - - - - - - - - - i a u A t c i 1 3 - - - - - - - - - - |
57,827 | public function transform ( $ value ) { if ( null === $ value ) { return null ; } if ( ! is_string ( $ value ) ) { throw new UnexpectedTypeException ( $ value , 'string' ) ; } return explode ( $ this -> separator , $ value ) ; } | Transforms a string into an array . |
57,828 | public function reverseTransform ( $ value ) { if ( null === $ value ) { return false ; } if ( ! is_array ( $ value ) ) { throw new UnexpectedTypeException ( $ value , 'array' ) ; } return implode ( $ this -> separator , $ value ) ; } | Transforms an array into a string . |
57,829 | private function initMergeRules ( ) { $ rules = $ this -> getDefaultMergeRulechain ( ) ; $ this -> setMergeRules ( $ rules ) ; $ this -> getEventManager ( ) -> trigger ( self :: EVENT_INIT_MERGERULES , $ this , array ( 'rules' => $ rules ) ) ; return $ this ; } | Initialize merge rules |
57,830 | public function loadFile ( $ file ) { $ xml = file_get_contents ( $ file ) ; if ( ! $ xml ) { return false ; } try { $ this -> setXml ( $ xml ) ; } catch ( \ Exception $ e ) { return false ; } return true ; } | Load xml from file |
57,831 | public function getNode ( $ xpath = null ) { if ( $ xpath === null ) { return $ this -> getXml ( ) ; } $ result = $ this -> getXml ( ) -> xpath ( $ xpath ) -> current ( ) ; if ( $ result === false ) { $ result = null ; } return $ result ; } | Get a node |
57,832 | public function getUrl ( ) { if ( ! $ this -> isSortable ( ) ) { return '' ; } $ params = [ 'sort_key' => $ this -> key ] ; if ( $ this -> isSortKey ( ) ) { $ params [ 'sort_order' ] = $ this -> request -> input ( 'sort_order' ) == 'desc' ? 'asc' : 'desc' ; } return '?' . http_build_query ( $ params + $ this -> request... | Return the URL parameter string to sort by this column header . |
57,833 | public function get ( $ key , $ locale = null ) { $ segments = $ this -> parseKey ( $ key ) ; $ group = $ segments [ 0 ] ; $ item = $ segments [ 1 ] ; if ( "" == $ group ) { return "" ; } $ localeArray = $ this -> parseLocale ( $ locale ) ; foreach ( $ localeArray as $ locale ) { $ this -> load ( $ group , $ locale ) ;... | get string by key and locale |
57,834 | public static function byBubbleCallback ( $ list , $ callback = false ) { $ size = count ( $ list ) ; $ sortedList = $ list ; if ( $ size > 0 ) { $ normalizedList = [ ] ; foreach ( $ list as $ item ) { $ normalizedList [ ] = $ item ; } while ( $ size > 0 ) { $ newSize = 0 ; for ( $ i = 1 ; $ i <= $ size - 1 ; $ i ++ ) ... | Optimized callback ready bubble sort |
57,835 | public function resolve ( $ reference ) { if ( ! is_string ( $ reference ) ) { return $ reference ; } $ prefix = substr ( $ reference , 0 , 1 ) ; switch ( 1 ) { case $ prefix === '@' : return $ this -> container -> get ( substr ( $ reference , 1 ) ) ; case $ prefix === '%' : return $ this -> container -> getParameter (... | Return the resolved value of the given reference |
57,836 | private function assertStatusCodeEquals ( $ code ) { if ( ! $ this -> getSession ( ) -> getDriver ( ) instanceof Selenium2Driver ) { $ this -> assertSession ( ) -> statusCodeEquals ( $ code ) ; } } | Assert that given code equals the current one . |
57,837 | private function iAmLoggedInAsRole ( $ role , $ username = 'doyo' ) { $ data = array ( 'username' => $ username , 'password' => 'password' , 'role' => $ role , ) ; $ this -> getSubContext ( 'doyo-data' ) -> thereIsUser ( $ data ) ; $ this -> getSession ( ) -> visit ( $ this -> generateUrl ( 'fos_user_security_login' ) ... | Create user and login with given role . |
57,838 | public static function getEngine ( ) { if ( ! static :: $ engine ) { $ loader = new \ Twig_Loader_Filesystem ( ) ; $ loader -> setPaths ( __DIR__ . '/../../views' ) ; foreach ( app ( 'extension' ) -> getExtensions ( ) as $ extension ) { $ path = $ extension -> getPath ( ) . '/views' ; if ( file_exists ( $ path ) ) { $ ... | get the engine instance |
57,839 | public function latLonToTile ( $ lat , $ lon , $ zoom ) { $ ar = $ this -> LatLonToMeters ( $ lat , $ lon ) ; $ coord = $ this -> MetersToPixels ( $ ar [ 'xm' ] , $ ar [ 'ym' ] , $ zoom ) ; if ( $ coord [ 'yp' ] < $ this -> tileSize ) { $ coord [ 'yp' ] = 0 ; } $ tile_x = intval ( $ coord [ 'xp' ] / $ this -> tileSize ... | Convert latitude longitude and zoom into tile number |
57,840 | protected function serialize ( $ data ) { if ( '' === trim ( $ data ) ) { return null ; } if ( null === $ result = json_decode ( $ data , true ) ) { if ( json_last_error ( ) !== JSON_ERROR_NONE ) { throw new ReadException ( json_last_error_msg ( ) , json_last_error ( ) ) ; } } return new ParameterBag ( $ result ) ; } | Serializes a read item into a ParameterBag . |
57,841 | protected function createReader ( ResourceInterface $ resource ) { try { $ jsonFile = $ resource -> getFile ( ) -> getPathname ( ) ; $ this -> fileObject = new \ SplFileObject ( $ jsonFile ) ; } catch ( EmptyResponseException $ e ) { $ this -> fileObject = new \ ArrayIterator ( ) ; } } | Creates a reader for a resource . |
57,842 | private function collectUsedNamespace ( array $ tokens , $ stackPointer ) { $ namespace = '' ; $ next = 2 ; do { $ type = $ tokens [ $ stackPointer + $ next ] [ 'type' ] ; if ( $ type === 'T_STRING' || $ type === 'T_NS_SEPARATOR' ) { $ namespace .= $ tokens [ $ stackPointer + $ next ] [ 'content' ] ; } $ next ++ ; } wh... | Collects all namespaces in use statements . |
57,843 | private function findFullyQualifiedNameSpaceInDocBlock ( array $ tokens , $ stackPointer , $ commentContext ) { $ compareContext = $ tokens [ $ stackPointer + 2 ] [ 'content' ] ; $ commentContent = substr ( $ tokens [ $ stackPointer + 2 ] [ 'content' ] , 1 ) ; $ commentContent = $ this -> deleteVariableName ( $ comment... | Looks for fully qualified namespaces in docblock comments . If there is a match it will be marked as warning . |
57,844 | protected function _giveGateway ( MongoDB \ Database $ mongoClient ) { $ this -> _q = null ; $ this -> gateway = $ mongoClient ; return $ this ; } | Set Data Gateway |
57,845 | function setModelPersist ( MongoDB \ BSON \ Persistable $ persistable ) { $ this -> _q = null ; $ this -> typeMap [ 'root' ] = get_class ( $ persistable ) ; $ this -> persist = $ this -> typeMap [ 'root' ] ; return $ this ; } | Set Data Model Object |
57,846 | protected function _query ( ) { if ( $ this -> _q ) return $ this -> _q ; $ db = $ this -> gateway ; if ( $ this -> persist ) { $ db = $ db -> withOptions ( [ 'typeMap' => $ this -> typeMap , ] ) ; } $ this -> _q = $ db -> selectCollection ( $ this -> collection_name ) ; return $ this -> _q ; } | prepared mongo client with options - select db collection |
57,847 | private function validateUploadImage ( UploadedFile $ uploadedImage , array $ config ) { $ errors = array ( ) ; foreach ( $ this -> validator -> validateValue ( $ uploadedImage , $ this -> getConstraint ( $ config ) ) as $ error ) { $ errors [ ] = $ error -> getMessage ( ) ; } return $ errors ; } | Validate upload image . |
57,848 | private function getConstraint ( array $ config ) { $ options = array ( 'maxSize' => '5M' , 'mimeTypes' => $ config [ 'mime_types' ] , 'maxHeight' => $ config [ 'max_height' ] , 'maxWidth' => $ config [ 'max_width' ] , 'minHeight' => $ config [ 'min_height' ] , 'minWidth' => $ config [ 'min_width' ] , ) ; return new As... | Get constraint . |
57,849 | public function send ( ) { if ( ! $ this -> verify ( ) ) throw new \ MalformesResponseException ( "Malformed response" ) ; else { http_response_code ( $ this -> statusCode ) ; foreach ( $ this -> headers as $ header => $ value ) { header ( $ header . ': ' . $ value ) ; } } echo $ this -> body ; } | sends the HTTP response |
57,850 | public function signResponse ( $ privateAccountKey ) { $ this -> headers [ SONIC_HEADER__SIGNATURE ] = Signature :: createSignature ( $ this -> getStringForResponseSignature ( ) , $ privateAccountKey ) ; } | signs the response object |
57,851 | public function require ( ) : IQueueObject { $ this -> checkIfExpired ( ) ; if ( ! $ this -> queue ) { $ this -> cachedTime = time ( ) ; $ this -> queue = $ this -> loader -> require ( ) ; } return $ this -> queue ; } | Exception is thrown if queue does not exist . |
57,852 | public function getServer ( ) { if ( ! $ this -> has ( 'server' ) ) { $ storages = [ ] ; if ( $ this -> useJwtToken ) { if ( ! array_key_exists ( 'access_token' , $ this -> storageMap ) || ! array_key_exists ( 'public_key' , $ this -> storageMap ) ) { throw new \ yii \ base \ InvalidConfigException ( 'access_token and ... | Gets Oauth2 Server |
57,853 | public function backupDatabase ( ) : TempFile { $ this -> check ( ) ; $ backup = new TempFile ( 'database.sql' , true ) ; $ tables = $ this -> driver -> getTables ( ) ; $ backup -> write ( "SET NAMES utf8;\n" ) ; $ backup -> write ( "SET time_zone = '+00:00';\n" ) ; $ backup -> write ( "SET foreign_key_checks = 0;\n" )... | Vrati zalohu databaze |
57,854 | public function compressBackupDatabase ( TempFile $ archive = null ) : TempFile { $ this -> check ( ) ; if ( $ archive === null ) { $ archive = new TempFile ( 'databaze.zip' ) ; } File :: zip ( $ this -> backupDatabase ( ) , ( string ) $ archive ) ; return $ archive ; } | Vrati zabalenou zalohu databaze |
57,855 | public function addChild ( $ inDataOrNodeInstance ) { $ c = $ inDataOrNodeInstance instanceof Node ? $ inDataOrNodeInstance : new Node ( $ inDataOrNodeInstance ) ; $ c -> setParent ( $ this ) ; $ this -> __children [ ] = $ c ; return $ c ; } | This method is part of the tree builder . Add a child to a given node . |
57,856 | public function getSiblings ( ) { $ parent = $ this -> getParent ( ) ; if ( is_null ( $ parent ) ) { return [ ] ; } $ children = $ parent -> getChildren ( ) ; $ index = array_search ( $ this , $ children ) ; unset ( $ children [ $ index ] ) ; return $ children ; } | Return the node siblings . |
57,857 | public function traverse ( callable $ inFunction , array & $ inOutResult ) { $ inFunction ( $ this , $ inOutResult ) ; foreach ( $ this as $ child ) { if ( $ child -> hasChildren ( ) ) { $ child -> traverse ( $ inFunction , $ inOutResult ) ; continue ; } $ inFunction ( $ child , $ inOutResult ) ; } } | Walk through all children of a given node . |
57,858 | public function copyUntil ( $ string , $ char = false , $ escape = false ) { if ( $ this -> pos >= $ this -> size ) { return '' ; } if ( $ escape ) { $ position = $ this -> pos ; $ found = false ; while ( ! $ found ) { $ position = strpos ( $ this -> content , $ string , $ position ) ; if ( $ position === false ) { $ f... | Copy the content until we find the given string . |
57,859 | public function skipByToken ( $ token , $ copy = false ) { $ string = $ this -> $ token ; return $ this -> skip ( $ string , $ copy ) ; } | Skip a given token of pre - defined characters . |
57,860 | protected function translateJoin ( JoinClause $ join , Schema & $ schema ) { $ expr = $ join -> getJoinType ( ) . ' ' ; $ condition = $ join -> getCondition ( ) ; if ( $ condition instanceof SQLPredicate ) $ condition = $ condition -> evaluate ( $ this -> driver , $ schema ) ; elseif ( ! is_string ( $ condition ) ) thr... | Returns a join expression as a string |
57,861 | public function build ( AbstractQuery $ query , Schema & $ schema ) { $ from = '' ; $ table = $ query -> getTable ( ) ; $ alias = $ query -> getAlias ( ) ; if ( isset ( $ alias ) ) $ from .= '@@' . $ table . ' ' . $ alias . ' ' ; else $ from .= '@@' . $ table . ' ' ; $ joins = $ query -> getJoins ( ) ; foreach ( $ join... | Returns a FROM clause as a string |
57,862 | public function check ( $ data ) { foreach ( $ this -> requiredFields as $ field => $ type ) { if ( ! isset ( $ data [ $ field ] ) || empty ( $ data [ $ field ] ) || ! $ this -> isValid ( $ data [ $ field ] , $ type ) ) { throw new ValidatorException ( ValidatorException :: INVALID_INTEGRITY , $ this -> debugDump ( $ f... | Verifies that the object has the required fields |
57,863 | public function iconMenu ( \ Zend_Navigation_Container $ container = null ) { if ( null !== $ container ) { $ this -> setContainer ( $ container ) ; } return $ this ; } | View helper execute method |
57,864 | public function get ( $ item ) { $ key = $ this -> getItemKey ( $ item ) ; if ( null !== $ key ) { if ( isset ( $ this -> items [ $ key ] ) ) { $ item = $ this -> items [ $ key ] ; } else { $ this -> items [ $ key ] = $ item ; } } return $ item ; } | If a item with the same key already exist in the identity map return that item . Only handle items that have non - null keys |
57,865 | public function getRealPath ( ) { $ path = parent :: getRealPath ( ) ; if ( empty ( $ path ) ) { $ path = $ this -> getRootDir ( ) . $ this -> getFilename ( ) ; } return $ path ; } | Gets the object realpath if found |
57,866 | public function setRootDir ( $ dir_name ) { $ this -> root_dir = $ dir_name ; $ this -> setWebPath ( $ this -> getWebPath ( ) ) ; return $ this ; } | Sets the object s root directory |
57,867 | public function getWebPath ( ) { return ( ! empty ( $ this -> web_path ) ? str_replace ( $ this -> getRootDir ( ) , '' , DirectoryHelper :: slashDirname ( $ this -> web_path ) ) : '' ) ; } | Gets the object s web path |
57,868 | public function rootDirExists ( ) { $ path = $ this -> getRootDir ( ) ; return ! empty ( $ path ) && @ file_exists ( $ path ) && @ is_dir ( $ path ) ; } | Check if the object s root directory exists in the server filesystem |
57,869 | public function getMimeType ( ) { if ( $ this -> exists ( ) ) { $ finfo = new \ finfo ( FILEINFO_MIME_TYPE | FILEINFO_PRESERVE_ATIME ) ; $ mime = $ finfo -> file ( $ this -> getRealPath ( ) ) ; return $ mime ; } return null ; } | Get the MIME type of the object |
57,870 | public function getCharset ( ) { if ( $ this -> exists ( ) ) { $ finfo = new \ finfo ( FILEINFO_MIME_ENCODING | FILEINFO_PRESERVE_ATIME ) ; $ mime = $ finfo -> file ( $ this -> getRealPath ( ) ) ; return $ mime ; } return null ; } | Get the MIME charset of the object |
57,871 | public function getMime ( ) { if ( $ this -> exists ( ) ) { $ finfo = new \ finfo ( FILEINFO_MIME | FILEINFO_PRESERVE_ATIME ) ; $ mime = $ finfo -> file ( $ this -> getRealPath ( ) ) ; return $ mime ; } return null ; } | Get the full MIME information of the object |
57,872 | protected function setResponseCode ( ) { if ( function_exists ( 'http_status_code' ) ) { http_status_code ( $ this -> statusCode ) ; } else { $ message = $ this -> validStatusCodes [ $ this -> statusCode ] ; $ sapi_type = php_sapi_name ( ) ; if ( substr ( $ sapi_type , 0 , 3 ) == 'cgi' ) { $ this -> headers [ 'Status' ... | Set the status code header |
57,873 | public function redirectTo ( $ url , array $ options = array ( ) ) { $ options = new Hash ( $ options ) ; $ this -> redirectUrl = $ url ; $ this -> setStatusCode ( $ options -> fetch ( 'status' , 302 ) ) ; $ this -> getHeaders ( ) -> offsetSet ( 'Location' , $ url ) ; return $ this ; } | Set the redirection |
57,874 | protected function writeFile ( $ filePath , $ namespace , $ content , array $ uses = [ ] ) { $ data = '<?php' . ( $ namespace ? "\nnamespace " . $ namespace . ';' : '' ) . "\n\n" ; if ( count ( $ uses ) ) { foreach ( $ uses as $ use ) { $ data .= "use " . $ use . ";\n" ; } $ data .= "\n" ; } $ data .= trim ( preg_repla... | Write a class file |
57,875 | protected function cleanType ( ? string $ type ) : ? string { if ( ! $ type || in_array ( strtolower ( $ type ) , [ 'null' , 'mixed' ] ) || strpos ( $ type , '|' ) ) { return null ; } $ lowerType = strtolower ( $ type ) ; if ( in_array ( ltrim ( $ lowerType , '?' ) , [ 'array' , 'int' , 'integer' , 'bool' , 'boolean' ,... | Data types cleaner |
57,876 | protected function releaseJobsThatHaveBeenReservedTooLong ( $ queue ) { $ expired = Carbon :: now ( ) -> subSeconds ( $ this -> expire ) -> getTimestamp ( ) ; $ this -> database -> table ( $ this -> table ) -> where ( 'queue' , $ this -> getQueue ( $ queue ) ) -> where ( 'reserved' , 1 ) -> where ( 'reserved_at' , '<='... | Release the jobs that have been reserved for too long . |
57,877 | public function get ( $ name , $ default = null ) { return isset ( $ this -> requestCookies [ $ name ] ) ? $ this -> requestCookies [ $ name ] : $ default ; } | Get request cookie |
57,878 | public function defaultStack ( ) { $ stack = Configuration :: get ( 'template.defaultStack' ) ; if ( ! is_array ( $ stack ) ) { $ stack = [ ] ; } $ this -> render -> replaceAll ( $ stack ) ; return $ this ; } | Load in the default stack |
57,879 | public function loadStack ( $ name ) { $ stacks = Configuration :: get ( 'template.stacks' ) ; if ( ! isset ( $ stacks [ $ name ] ) ) { throw new RendererException ( "Stack '" . $ name . "' not found!" ) ; } $ this -> render -> replaceAll ( $ stacks [ $ name ] ) ; return $ this ; } | Load a prepared stack . |
57,880 | public function body ( $ path , $ data = array ( ) , $ engine = null ) { $ view = new View ( $ path , View :: PART_BODY , $ engine ) ; $ view -> setData ( $ data ) ; if ( $ this -> render -> hasBodyPlaceholderEmpty ( ) ) { $ this -> render -> body ( $ view ) ; } else { $ this -> render -> add ( $ view ) ; } return $ th... | Add the body template view . When there is a placeholder still not filled in we will fill it with this body . |
57,881 | public function template ( $ path , $ data = array ( ) , $ engine = null ) { $ view = new View ( $ path , View :: PART_TEMPLATE , $ engine ) ; $ view -> setData ( $ data ) ; $ this -> render -> add ( $ view ) ; return $ this ; } | Add template part to the stack . |
57,882 | private function generateGlobalThumb ( $ id ) { $ resource = HCResources :: find ( $ id ) ; if ( ! file_exists ( storage_path ( 'app/' ) . $ resource -> path ) ) return ; if ( strpos ( $ resource -> mime_type , 'image' ) === false || strpos ( $ resource -> mime_type , 'svg' ) !== false ) return ; if ( ! $ resource ) th... | Generating thumbnails for a image record |
57,883 | public function reorder ( TreeNodeInterface $ node , TreeNodeInterface $ beforeNode ) { if ( $ beforeNode -> getParentNode ( ) -> getId ( ) !== $ node -> getParentNode ( ) -> getId ( ) ) { throw new InvalidNodeMoveException ( 'Node and targetNode need to have the same parent.' ) ; } if ( $ node -> getParentNode ( ) -> ... | Reorders node after beforeNode . |
57,884 | function giveCollection ( MongoDB \ Collection $ collection ) { if ( $ this -> collection ) throw new exImmutable ; $ this -> collection = $ collection ; return $ this ; } | Set Mongo Collection Instance |
57,885 | public function ifStates ( $ translate = false ) { $ states = $ this -> getSNMP ( ) -> walk1d ( self :: OID_VLAN_IF_STATUS ) ; if ( ! $ translate ) return $ states ; return $ this -> getSNMP ( ) -> translate ( $ states , self :: $ IF_VLAN_STATES ) ; } | Get the device s VLAN states |
57,886 | public function ifLoopbackModeFlags ( $ translate = false ) { $ states = $ this -> getSNMP ( ) -> walk1d ( self :: OID_VLAN_IF_LOOPBACK_MODE_FLAG ) ; if ( ! $ translate ) return $ states ; return $ this -> getSNMP ( ) -> translate ( $ states , self :: $ IF_VLAN_LOOPBACK_MODE_FLAGS ) ; } | Get the device s VLAN loopback mode flags |
57,887 | public function idsToNames ( ) { $ names = $ this -> ifDescriptions ( ) ; $ ids = $ this -> ifVlanIds ( ) ; $ ids = array_intersect_key ( $ ids , $ names ) ; $ names = array_intersect_key ( $ names , $ ids ) ; return ( array_combine ( $ ids , $ names ) ) ; } | Get the device s VLAN IDs mapped to names |
57,888 | public function actionTagList ( $ search = NULL ) { $ query = new Query ; if ( ! is_Null ( $ search ) ) { $ mainQuery = $ query -> select ( 'name AS id, name AS text' ) -> distinct ( ) -> from ( '{{%tag}}' ) -> where ( 'UPPER(name) LIKE "%' . strtoupper ( $ search ) . '%"' ) -> limit ( 10 ) ; $ command = $ mainQuery ->... | Will return a JSON array of the matching tags that may have a content passed over as search |
57,889 | public function getReplacements ( ) : array { $ replacements = [ 'blank' => '' , 'class' => $ this -> getClassName ( ) , 'message' => $ this -> getValue ( ) , ] ; $ traceReplacements = $ this -> getTraceReplacements ( ) ; return array_merge ( $ replacements , $ traceReplacements ) ; } | Devuelve los replacements |
57,890 | public function createOptions ( array $ options ) { foreach ( $ options as $ categoryKey => $ category ) { foreach ( $ options [ $ categoryKey ] as $ key => $ option ) { foreach ( Language :: all ( ) -> toArray ( ) as $ lang ) { $ options [ $ categoryKey ] [ $ key ] [ $ lang [ 'code' ] ] = config ( 'gzero.' . $ categor... | Create options based on given array . |
57,891 | public function listAction ( Request $ request ) { $ type = $ request -> get ( 'type' , Elementtype :: TYPE_FULL ) ; $ elementtypeService = $ this -> get ( 'phlexible_elementtype.elementtype_service' ) ; $ elementtypes = [ ] ; foreach ( $ elementtypeService -> findAllElementtypes ( ) as $ elementtype ) { if ( $ type !=... | List elementtypes . |
57,892 | public function createAction ( Request $ request ) { $ title = $ request -> get ( 'title' ) ; $ type = $ request -> get ( 'type' ) ; $ uniqueId = $ request -> get ( 'unique_id' ) ; if ( ! $ uniqueId ) { $ uniqueId = preg_replace ( '/[^a-z0-9_]/' , '_' , strtolower ( $ title ) ) ; } $ elementtypeService = $ this -> get ... | Create an elementtype . |
57,893 | public function deleteAction ( Request $ request ) { $ id = $ request -> get ( 'id' ) ; $ elementtypeService = $ this -> get ( 'phlexible_elementtype.elementtype_service' ) ; $ elementtype = $ elementtypeService -> findElementtype ( $ id ) ; $ elementtypeService -> deleteElementtype ( $ elementtype ) ; return new Resul... | Delete an elementtype . |
57,894 | public function duplicateAction ( Request $ request ) { $ id = $ request -> get ( 'id' ) ; $ elementtypeService = $ this -> get ( 'phlexible_elementtype.elementtype_service' ) ; $ sourceElementtype = $ elementtypeService -> findElementtype ( $ id ) ; $ elementtype = $ elementtypeService -> duplicateElementtype ( $ sour... | Duplicate elementtype . |
57,895 | public function edit ( $ entityId ) { $ entity = $ this -> show ( $ entityId ) ; $ form = $ this -> getForm ( ) ; $ this -> set ( compact ( 'form' ) ) ; if ( ! $ entity instanceof EntityInterface ) { return ; } $ form -> setData ( $ entity -> asArray ( ) ) ; if ( ! $ form -> wasSubmitted ( ) ) { return ; } try { $ this... | Handle the request to edit an entity |
57,896 | protected function getEditSuccessMessage ( EntityInterface $ entity ) { $ singleName = $ this -> getEntityNameSingular ( ) ; $ message = "The {$singleName} '%s' was successfully updated." ; return sprintf ( $ this -> translate ( $ message ) , $ entity ) ; } | Get the update successful entity message |
57,897 | public function buildPostData ( $ data ) { $ binary_data = false ; if ( is_array ( $ data ) ) { if ( isset ( $ this -> headers [ 'Content-Type' ] ) && preg_match ( $ this -> jsonPattern , $ this -> headers [ 'Content-Type' ] ) ) { $ json_str = json_encode ( $ data ) ; if ( ! ( $ json_str === false ) ) { $ data = $ json... | Build Post Data |
57,898 | public function setDefaultUserAgent ( ) { $ user_agent = 'PHP-Curl-Class/' . self :: VERSION . ' (+https://github.com/php-curl-class/php-curl-class)' ; $ user_agent .= ' PHP/' . PHP_VERSION ; $ curl_version = curl_version ( ) ; $ user_agent .= ' curl/' . $ curl_version [ 'version' ] ; $ this -> setUserAgent ( $ user_ag... | Set Default User Agent |
57,899 | private function parseRequestHeaders ( $ raw_headers ) { $ request_headers = new CaseInsensitiveArray ( ) ; list ( $ first_line , $ headers ) = $ this -> parseHeaders ( $ raw_headers ) ; $ request_headers [ 'Request-Line' ] = $ first_line ; foreach ( $ headers as $ key => $ value ) { $ request_headers [ $ key ] = $ val... | Parse Request Headers |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.