idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
59,100 | public function getBreadcrumb ( ) : Breadcrumb { if ( $ this -> breadcrumb === null ) { $ this -> breadcrumb = new Breadcrumb ( $ this -> translator ) ; if ( $ this -> baseUrl !== null ) { $ this -> breadcrumb -> addLink ( $ this -> baseUrl -> name , $ this -> baseUrl -> link ) ; } $ current = $ this -> setCurrent ( ) ... | Vrati drobeckovou navidaci |
59,101 | public function get ( $ i ) { if ( ! isset ( $ this -> fragments [ $ i ] ) ) { return null ; } if ( ! isset ( $ this -> halved [ $ i ] ) || ! $ this -> fragments [ $ i ] || ! isset ( $ this -> sizes [ $ i ] ) ) { return $ this -> fragments [ $ i ] ; } $ half = ( int ) floor ( $ this -> sizes [ $ i ] / 2 ) ; $ value = $... | Get time fragment FIXED VALUE checking if it has been halved or not . |
59,102 | public function withHalved ( $ index , $ value ) { $ res = clone $ this ; $ res -> halved = $ this -> insertInList ( $ res -> halved , $ index , $ value ) ; return $ res ; } | Set time fragment halved adding null values if needed . |
59,103 | public function withHalveds ( array $ halved ) { $ res = clone $ this ; $ this -> halved = $ this -> fillArrayInput ( $ halved , false ) ; return $ res ; } | Set all halved adding null values if needed . |
59,104 | public static function bootMetable ( ) { static :: saved ( function ( $ model ) { $ model -> syncMetableTableAttributes ( ) ; } ) ; static :: deleted ( function ( $ model ) { $ model -> handleDeletedModelMetas ( ) ; } ) ; static :: registerModelEvent ( 'restored' , function ( $ model ) { $ model -> handleRestoredModelM... | Trait boot method called by parent model class . |
59,105 | public function metasArray ( ) { $ metas = array ( ) ; foreach ( $ this -> metas as $ meta ) { if ( ! isset ( $ meta -> pivot ) ) { continue ; } $ metas [ $ meta -> name ] = $ meta -> pivot -> value ; } return $ metas ; } | Return an array of all metas associated with this model . |
59,106 | public function meta ( $ meta , $ default = null ) { $ single = ( $ meta instanceof Collection ) ? false : is_array ( $ meta ) ? false : true ; $ metas = ( $ meta instanceof Collection ) ? $ meta -> all ( ) : is_array ( $ meta ) ? $ meta : array ( $ meta ) ; $ values = array ( ) ; foreach ( $ metas as $ m ) { if ( is_o... | Retrieve one or more values from the current model . Can be either a meta name a meta model a collection of models or an array of models . |
59,107 | public function setMeta ( $ meta , $ value = null ) { $ metas = is_array ( $ meta ) ? $ meta : array ( $ meta => $ value ) ; foreach ( $ metas as $ m => $ v ) { if ( ! is_object ( $ m ) ) { $ m = $ this -> findMetaByNameOrCreate ( $ m ) ; } if ( ! $ m || ! $ m instanceof Eloquent ) { continue ; } if ( $ this -> hasMeta... | Add one or more metas to the current model . Can be either a meta name a meta model or an array of models . |
59,108 | public function unsetMeta ( $ meta = null ) { $ args = func_get_args ( ) ; if ( 0 == count ( $ args ) ) { $ args [ ] = $ this -> metas ; } foreach ( $ args as $ arg ) { $ metas = ( $ arg instanceof Collection ) ? $ arg -> all ( ) : is_array ( $ arg ) ? $ arg : array ( $ arg ) ; foreach ( $ metas as $ m ) { if ( ! is_ob... | Remove one or more metas from the current model . Can be either a meta name a meta model a collection of models or an array of models . Will remove all metas if no paramter is passed . |
59,109 | private function newMetaQuery ( ) { $ meta_model = $ this -> metaModel ( ) ; $ meta_instance = new $ meta_model ; $ query = $ meta_instance -> newQuery ( ) ; if ( method_exists ( $ this , 'metaContext' ) ) { if ( method_exists ( $ meta_model , 'applyQueryContext' ) ) { call_user_func_array ( array ( $ meta_model , 'app... | Return a new meta table query . |
59,110 | private function findMetaByNameOrCreate ( $ name ) { if ( $ meta = $ this -> findMetaByName ( $ name ) ) { return $ meta ; } $ meta_model = $ this -> metaModel ( ) ; $ meta = new $ meta_model ; $ meta -> name = $ name ; $ meta -> num_items = 0 ; if ( method_exists ( $ this , 'metaContext' ) ) { if ( method_exists ( $ m... | Find a meta from the given name or create it if not found . |
59,111 | private function metableTableSyncAttributes ( ) { if ( ! isset ( $ this -> metable_table_sync ) ) { return array ( ) ; } $ attributes = array ( ) ; foreach ( $ this -> metable_table_sync as $ attr ) { $ attributes [ $ attr ] = $ this -> getAttribute ( $ attr ) ; } return $ attributes ; } | Return an array of model attributes to sync on the metable_table records . |
59,112 | public function metableTableSoftDeletes ( ) { if ( method_exists ( $ this , 'getDeletedAtColumn' ) ) { if ( array_key_exists ( $ this -> getDeletedAtColumn ( ) , $ this -> metableTableSyncAttributes ( ) ) ) { return true ; } } return false ; } | Returns whether or not we are soft - deleting metable table records . |
59,113 | public function syncMetableTableAttributes ( ) { if ( empty ( $ this -> metableTableSyncAttributes ( ) ) ) { return ; } DB :: table ( $ this -> metableTable ( ) ) -> where ( 'xref_id' , $ this -> getKey ( ) ) -> update ( $ this -> metableTableSyncAttributes ( ) ) ; } | Sync metable table attributes to all metas associated with this model . |
59,114 | private function handleDeletedModelMetas ( ) { if ( $ this -> metableTableSoftDeletes ( ) ) { foreach ( $ this -> metas as $ meta ) { $ this -> syncMetableTableAttributes ( ) ; $ meta -> decrement ( 'num_items' ) ; } return ; } $ this -> unsetMeta ( ) ; } | Delete metable table records for this current model since it was just deleted . |
59,115 | private function handleRestoredModelMetas ( ) { if ( ! $ this -> metableTableSoftDeletes ( ) ) { return ; } foreach ( $ this -> metas as $ meta ) { $ this -> syncMetableTableAttributes ( ) ; $ meta -> increment ( 'num_items' ) ; } } | Restore metable table records for this current model since it was just restorede . |
59,116 | public static function queryMetas ( ) { $ model = new static ; $ conn = $ model -> getConnection ( ) ; $ query = new QueryBuilder ( $ conn , $ conn -> getQueryGrammar ( ) , $ conn -> getPostProcessor ( ) ) ; $ query -> setModel ( $ model ) ; return $ query ; } | Begin querying the model s metable table . |
59,117 | public function build ( $ field ) { $ return = '' ; if ( \ is_array ( $ field ) ) { $ field = $ this -> fieldFactory -> build ( $ field ) ; } $ this -> field = $ field ; $ this -> props = $ field -> props ; $ id = $ field -> getId ( ) ; $ isBuilding = \ in_array ( $ id , $ this -> building ) ; $ uniqueId = $ field -> g... | Build a form input control |
59,118 | protected function doBuild ( ) { switch ( $ this -> props [ 'attribs' ] [ 'type' ] ) { case 'checkbox' : $ return = $ this -> buildCheckbox ( ) ; break ; case 'html' : $ return = $ this -> props [ 'attribs' ] [ 'value' ] ; break ; case 'radio' : $ return = $ this -> buildRadio ( ) ; break ; case 'select' : $ return = $... | Build the html for the given |
59,119 | protected function buildAttribStrings ( $ props ) { $ attribStrings = array ( ) ; foreach ( $ props as $ k => $ v ) { if ( \ strpos ( $ k , 'attribs' ) === 0 ) { $ attribStrings [ $ k ] = \ trim ( Html :: buildAttribString ( $ v ) ) ; } } return $ attribStrings ; } | Build attribute strings |
59,120 | protected function buildButton ( ) { $ attribStrings = $ this -> buildAttribStrings ( $ this -> props ) ; $ props = \ array_merge ( $ this -> props , $ attribStrings ) ; if ( empty ( $ props [ 'input' ] ) ) { if ( empty ( $ props [ 'label' ] ) && ! empty ( $ this -> props [ 'attribs' ] [ 'value' ] ) ) { $ props [ 'labe... | Build a button control |
59,121 | protected function buildInputGroup ( ) { $ props = $ this -> props ; if ( $ props [ 'tagOnly' ] ) { return $ props [ 'input' ] ; } if ( ! $ props [ 'addonBefore' ] && ! $ props [ 'addonAfter' ] ) { return $ props [ 'input' ] ; } if ( $ props [ 'addonBefore' ] ) { $ addonClass = \ preg_match ( '#<(a|button)\b#i' , $ pro... | Handles pressence of addonAfter or addonBefore |
59,122 | protected function buildRadio ( ) { if ( $ this -> props [ 'useFieldset' ] ) { $ this -> props [ 'template' ] = \ preg_replace ( '#^<div([^>]*)>(.+)</div>$#s' , '<fieldset$1>$2</fieldset>' , $ this -> props [ 'template' ] ) ; $ this -> props [ 'template' ] = \ preg_replace ( '#<label([^>]*)>(.+)</label>#s' , '<legend>$... | Builds radio controls |
59,123 | protected function buildSelectOptions ( $ options , $ selectedValues = array ( ) ) { $ str = '' ; $ inOptgroup = false ; foreach ( $ options as $ opt ) { if ( isset ( $ opt [ 'optgroup' ] ) ) { if ( $ inOptgroup ) { $ str .= '</optgroup>' . "\n" ; $ inOptgroup = false ; } if ( $ opt [ 'optgroup' ] ) { $ attribs = $ opt... | Build selects option list |
59,124 | protected function buildStatic ( ) { $ innerhtml = \ htmlspecialchars ( $ this -> props [ 'attribs' ] [ 'value' ] ) ; $ this -> props [ 'attribs' ] = \ array_diff_key ( $ this -> props [ 'attribs' ] , \ array_flip ( array ( 'name' , 'type' , 'value' ) ) ) ; $ attribStrings = $ this -> buildAttribStrings ( $ this -> pro... | Build static control |
59,125 | protected function removeEmptyTags ( $ html ) { if ( ! \ is_string ( $ html ) ) { return $ html ; } $ html = \ preg_replace ( '#^\s*<(div|label|legend|span)\b[^>]*>\s*</\1>\n#m' , '' , $ html ) ; $ html = \ preg_replace ( '#^\s*\n#m' , '' , $ html ) ; $ html = \ preg_replace ( '#<(\w+) >#' , '<$1>' , $ html ) ; return ... | Remove empty tags from string |
59,126 | protected function setIds ( $ id ) { if ( $ id ) { $ this -> props = $ this -> mergeProps ( array ( $ this -> props , array ( 'attribsContainer' => array ( 'id' => $ id . '_container' , ) , 'attribs' => array ( 'id' => $ id , ) , 'attribsLabel' => array ( 'for' => $ id , ) , 'attribsHelpBlock' => array ( 'id' => $ id .... | Set ID attributes |
59,127 | public static function Pmp ( array $ a , array $ b , array & $ amb ) { $ amb [ 0 ] = $ a [ 0 ] - $ b [ 0 ] ; $ amb [ 1 ] = $ a [ 1 ] - $ b [ 1 ] ; $ amb [ 2 ] = $ a [ 2 ] - $ b [ 2 ] ; return ; } | - - - - - - - i a u P m p - - - - - - - |
59,128 | private function getAllTableNames ( ) { $ handler = $ this -> databaseConnection -> queryAndHandle ( "SHOW TABLES FROM `" . $ this -> databaseConnection -> getDatabaseName ( ) . "`" ) ; $ tableNames = array ( ) ; if ( $ handler -> getResultSize ( ) > 0 ) { while ( $ oDatabaseResultRow = $ handler -> fetchNextResultObje... | Returns all tablenames of the current connected database matching to the table prefix in the used connection . |
59,129 | private function createTable ( MWebfile $ webfile , $ dropTableIfExists = true ) { $ tableName = $ this -> resolveTableNameFromWebfile ( $ webfile ) ; if ( ! $ this -> metadataExist ( $ tableName ) ) { $ this -> addMetadata ( $ webfile :: $ m__sClassName , '1' , $ tableName ) ; } $ attributeArray = $ webfile -> getAttr... | Creates a database table to persist objects of this type . |
59,130 | public function deleteAll ( ) { $ tablenames = $ this -> getAllTableNames ( ) ; foreach ( $ tablenames as $ tablename ) { $ this -> databaseConnection -> query ( "DROP TABLE " . $ tablename ) ; } } | Deletes all webfiles in the store and all metadata |
59,131 | private function getBrowsersCountFromSessions ( Carbon $ start , Carbon $ end ) { return $ this -> getVisitorsFilteredByDateRange ( $ start , $ end ) -> filter ( function ( Visitor $ visitor ) { return $ visitor -> hasUserAgent ( ) ; } ) -> transform ( function ( Visitor $ visitor ) { return $ visitor -> agent ; } ) ->... | Get the browsers count from sessions . |
59,132 | public function getCache ( ) { if ( null == $ this -> cache ) { $ this -> setCache ( Cache :: get ( Cache :: CACHE_MEMORY ) ) ; } return $ this -> cache ; } | Gets cache storage for this identity map |
59,133 | private static function show ( $ env = null ) { if ( ! isset ( $ env ) ) { $ env = $ GLOBALS ; } static :: $ current -> display ( static :: $ SHOWMODEL , $ env ) ; exit ( ) ; } | Show the rendering using a child rendering class |
59,134 | final public static function doDisplay ( $ layout = null , $ env = null ) { if ( $ env === null ) { $ env = $ GLOBALS ; } static :: $ current -> display ( $ layout , $ env ) ; return true ; } | Call the display function |
59,135 | public static function endCurrentLayout ( $ env = array ( ) ) { if ( ! ob_get_level ( ) || empty ( static :: $ layoutStack ) ) { return false ; } $ env [ 'Content' ] = ob_get_clean ( ) ; static :: $ current -> display ( array_pop ( static :: $ layoutStack ) , $ env ) ; return true ; } | End the current layout |
59,136 | public function connect ( ) { $ connection = $ this -> config -> get ( 'redis_connection' ) ; $ params = array ( 'prefix' => $ this -> config -> get ( 'redis_prefix' ) . ':' ) ; $ this -> redis = new \ Predis \ Client ( $ connection , $ params ) ; } | Start the redis connection |
59,137 | public function flush ( ) { $ cache_keys = $ this -> redis -> keys ( '*' ) ; foreach ( $ cache_keys as $ key ) { $ this -> redis -> del ( $ key ) ; } unset ( $ cache_keys ) ; return true ; } | Clear all cached items for this driver |
59,138 | public static function rot47 ( $ str ) { $ result = '' ; foreach ( str_split ( $ str ) as $ char ) { $ ord = ord ( $ char ) ; $ result .= ( namespace \ Utils :: numberBetween ( $ ord , 33 , 126 ) ) ? chr ( namespace \ Utils :: numberWrap ( $ ord + 47 , 33 , 126 ) ) : $ char ; } return $ result ; } | Offsets every ASCII character from ! to ~ by 47 bits wrapping overflow |
59,139 | protected function slug ( $ string , $ isDomain = false ) { $ pattern = ( $ isDomain ? '/[^A-Za-z0-9-\.]+/' : '/[^A-Za-z0-9-]+/' ) ; return strtolower ( trim ( preg_replace ( $ pattern , '-' , $ string ) ) ) ; } | Generate a slug from a given string . |
59,140 | public function getFileSystem ( ) { if ( null == $ this -> fileSystem ) { $ this -> setFileSystem ( Helper :: getFileSystem ( ) ) ; } return $ this -> fileSystem ; } | get filesystem instance |
59,141 | protected function saveAccessToken ( $ token , $ expire ) { $ data = [ 'token' => $ token , 'expire' => intval ( $ expire ) , 'time' => time ( ) ] ; return ( $ this -> getFileSystem ( ) -> put ( $ this -> getTokenFilePath ( ) , json_encode ( $ data ) , true ) > 0 ) ; } | save access token to file |
59,142 | protected function readAccessToken ( ) { if ( ! $ this -> getFileSystem ( ) -> isFile ( $ this -> getTokenFilePath ( ) ) ) { return '' ; } $ content = trim ( $ this -> getFileSystem ( ) -> get ( $ this -> getTokenFilePath ( ) ) ) ; $ result = json_decode ( $ content , true ) ; if ( isset ( $ result [ 'token' ] ) && iss... | read access token from file |
59,143 | public function getAccessToken ( ) { $ result = $ this -> readAccessToken ( ) ; if ( '' != $ result ) { return $ result ; } $ data = $ this -> getAccessTokenFromWeChat ( ) ; $ this -> saveAccessToken ( $ data [ 'token' ] , $ data [ 'expire' ] ) ; return $ data [ 'token' ] ; } | get access token |
59,144 | protected function setUpEnvironment ( ) { $ dotEnv = new Dotenv ( ) ; $ dotEnv -> populate ( $ this -> getEnvironmentVars ( ) ) ; $ envFilePath = Path :: getProjectRoot ( '/.env' ) ; if ( is_readable ( $ envFilePath ) ) { $ dotEnv -> load ( $ envFilePath ) ; } $ errorLogFile = getenv ( 'ERROR_LOG' ) ; ini_set ( 'error_... | Load . env if it set and merge with environment |
59,145 | protected function mapCustomInstallPaths ( array $ paths , string $ name , string $ type , string $ vendor = '' ) : string { foreach ( $ paths as $ path => $ names ) { if ( in_array ( $ name , $ names ) || in_array ( 'type:' . $ type , $ names ) ) { return $ path ; } if ( ! empty ( $ vendor ) && in_array ( 'vendor:' . ... | Search through a paths array for a custom install path . |
59,146 | public function init ( ) { $ attributes = $ this -> getAttributes ( ) ; $ fullPath = storage_path ( $ attributes [ 'path' ] ) ; if ( Support \ is_path_exists ( $ fullPath ) ) $ this -> settings = Support \ get_file_contents ( $ fullPath ) ; else Support \ dump_file ( $ fullPath , json_encode ( [ ] ) ) ; register_shutdo... | Set settings . |
59,147 | public function insert ( $ key , $ value , $ group = self :: DEFAULT_GROUP ) { return $ this -> update ( $ key , $ value , $ group ) ; } | Insert a new option and set value . |
59,148 | public function clear ( $ group = null ) { if ( isset ( $ group ) ) unset ( $ this -> settings [ $ group ] ) ; else $ this -> settings = [ ] ; return $ this ; } | delete all options entries from . |
59,149 | private function check_timestamp ( $ timestamp ) { if ( ! $ timestamp ) throw new Exception ( 'Missing timestamp parameter. The parameter is required' ) ; $ now = time ( ) ; if ( abs ( $ now - $ timestamp ) > $ this -> timestamp_threshold ) { throw new Exception ( "Expired timestamp, yours $timestamp, ours $now" ) ; } ... | Check that the timestamp is new enough |
59,150 | private function check_nonce ( $ consumer , $ token , $ nonce , $ timestamp ) { if ( ! $ nonce ) throw new Exception ( 'Missing nonce parameter. The parameter is required' ) ; $ found = $ this -> data_store -> lookup_nonce ( $ consumer , $ token , $ nonce , $ timestamp ) ; if ( $ found ) { throw new Exception ( "Nonce ... | Check that the nonce is not repeated |
59,151 | public static function Sxp ( $ s , array $ p , array & $ sp ) { $ sp [ 0 ] = $ s * $ p [ 0 ] ; $ sp [ 1 ] = $ s * $ p [ 1 ] ; $ sp [ 2 ] = $ s * $ p [ 2 ] ; return ; } | - - - - - - - i a u S x p - - - - - - - |
59,152 | protected function _countIterable ( $ iterable ) { $ resolve = function ( $ it ) { try { return $ this -> _resolveIterator ( $ it , function ( $ it ) { return $ it instanceof Countable ; } ) ; } catch ( RootException $ e ) { return ; } } ; if ( $ iterable instanceof stdClass ) { $ iterable = ( array ) $ iterable ; } if... | Counts the elements in an iterable . |
59,153 | public function json ( array $ data ) { $ data = json_encode ( $ data ) ; $ response = $ this -> withHeader ( 'Content-Type' , 'application/json' ) ; $ response -> getBody ( ) -> write ( $ data ) ; return $ response ; } | set content - type = json and response json |
59,154 | public function withStatus ( $ code , $ reasonPhrase = '' ) { if ( ! is_string ( $ reasonPhrase ) && ! method_exists ( $ reasonPhrase , '__toString' ) ) { throw new InvalidArgumentException ( 'ReasonPhrase must be a string' ) ; } $ clone = clone $ this ; $ clone -> statusCode = $ code ; if ( $ reasonPhrase === '' && is... | set response status |
59,155 | protected function parse ( $ resource ) { $ fp = fopen ( $ resource , 'r' ) ; $ messages = array ( ) ; $ pair = array ( ) ; while ( ! feof ( $ fp ) ) { $ line = fgets ( $ fp ) ; if ( strncmp ( $ line , 'msgid' , strlen ( 'msgid' ) ) === 0 ) { $ str = $ this -> normalize ( substr ( $ line , strlen ( 'msgid' ) + 1 , strl... | Parse a POT file extracting translation units |
59,156 | public function append ( $ value ) { $ values = $ this -> sanitize ( $ value ) ; foreach ( $ values as $ class ) { parent :: append ( $ class ) ; } return $ this ; } | Append a value to the end of the container . |
59,157 | public function setSeparator ( $ separator ) { if ( ! in_array ( $ separator , [ ' ' , '-' ] , true ) ) { $ separator = ' ' ; } $ this -> separator = $ separator ; return $ this ; } | Set Separator . |
59,158 | public function renderMenu ( \ Twig_Environment $ environment , $ name , array $ options = array ( ) ) { $ menu = $ this -> loadMenu ( $ name ) ; $ builder = $ menu -> getBuilder ( ) ; return $ environment -> render ( $ builder -> getTemplateName ( ) , array ( 'menu' => $ menu ) ) ; } | Renders a menu |
59,159 | private function loadMenu ( $ name ) { if ( $ name instanceof Menu ) { return $ name ; } $ menu = $ this -> menuRepository -> findOneBy ( array ( 'name' => $ name ) ) ; if ( ! $ menu ) { throw new \ RuntimeException ( sprintf ( 'Unable to load menu "%s"' , $ name ) ) ; } return $ menu ; } | Loads a Menu entity given its name |
59,160 | public function renderTwig ( \ Twig_Environment $ environment , $ template , array $ parameters = array ( ) ) { $ template = $ this -> loadStringTemplate ( $ environment , $ template ) ; return $ template -> render ( $ parameters ) ; } | Renders raw Twig |
59,161 | private function loadStringTemplate ( \ Twig_Environment $ environment , $ template ) { $ existingLoader = $ environment -> getLoader ( ) ; $ environment -> setLoader ( $ this -> stringLoader ) ; try { $ template = $ environment -> loadTemplate ( $ template ) ; } catch ( \ Exception $ e ) { $ environment -> setLoader (... | Loads raw Twig using the given Environment |
59,162 | public function getItemFormView ( array $ options = array ( ) ) { $ item = new CartItem ( ) ; $ form = $ this -> container -> get ( 'form.factory' ) -> create ( 'EcommerceBundle\Form\CartItemSimpleType' , $ item , $ options ) ; return $ form -> createView ( ) ; } | Returns cart item form view . |
59,163 | public function shareUrl ( $ url , $ big = false ) { if ( ! is_numeric ( strpos ( $ url , 'http' ) ) ) { $ core = $ this -> container -> getParameter ( 'core' ) ; $ url = $ core [ 'server_base_url' ] . $ url ; } $ text = 'Check out this site:' ; $ tweetUrl = 'https://twitter.com/share?url=' . $ url . '&counturl=' . $ u... | Returns the part of a feedID |
59,164 | public function getProductStats ( Product $ product , $ start , $ end ) { $ adminManager = $ this -> container -> get ( 'checkout_manager' ) ; $ stats = $ adminManager -> getProductStats ( $ product , $ start , $ end ) ; return $ stats ; } | Returns statistics from product |
59,165 | public static function validator ( String $ scheme , String $ host , array $ routes ) { self :: validate_domain ( $ scheme , $ host ) ; foreach ( $ routes as $ route ) { if ( ! isset ( $ route [ 'method' ] ) ) throw new Exception ( 'Method is not set in routes.' ) ; if ( ! isset ( $ route [ 'route' ] ) ) throw new Exce... | Validate scheme host & routes |
59,166 | public function shutdown ( $ priorityName = null ) { if ( $ priorityName === null ) { foreach ( $ this -> streams as $ stream ) { if ( is_resource ( $ stream ) ) { fclose ( $ stream ) ; } } } elseif ( isset ( $ this -> streams [ $ priorityName ] ) && is_resource ( $ this -> streams [ $ priorityName ] ) ) { fclose ( $ t... | Close the stream resource . |
59,167 | private function _createCurrentStream ( $ priorityName , $ subPriority = null ) { $ priorityName = strtolower ( $ priorityName ) ; if ( $ subPriority !== null ) { $ priorityName = strtolower ( $ subPriority ) ; } $ streamDir = $ this -> baseDir . DIRECTORY_SEPARATOR . str_ireplace ( '-' , DIRECTORY_SEPARATOR , $ this -... | Create current stream for log priority . |
59,168 | public function length2 ( ) : float { $ value = 0 ; $ count = count ( $ this -> elements ) ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ value += ( $ this [ $ i ] * $ this [ $ i ] ) ; } return $ value ; } | Squared vector length . |
59,169 | public function normalize ( ) { $ len = $ this -> length ( ) ; if ( $ len === 0.0 ) { return ; } $ count = count ( $ this -> elements ) ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ this [ $ i ] /= $ len ; } } | Normalizes the vector . |
59,170 | public function toArray ( ) { $ result = [ ] ; $ count = count ( $ this -> elements ) ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ result [ ] = $ this -> elements [ $ i ] ; } return $ result ; } | Convert the vector to an array . |
59,171 | public function fromArray ( array $ vector ) { $ count = count ( $ vector ) ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ this -> elements [ $ i ] = $ vector [ $ i ] ; } } | Set vector to values from passed array . |
59,172 | protected function originalIsEquivalent ( $ key , $ current ) { if ( array_key_exists ( $ key , $ this -> attachedFiles ) ) { return true ; } return parent :: originalIsEquivalent ( $ key , $ current ) ; } | Overridden to prevent attempts to persist attachment attributes directly . |
59,173 | public function serialize ( Job $ job ) : array { $ this -> ensureReflectorsInitialized ( ) ; return [ 'id' => $ job -> getId ( ) -> __toString ( ) , 'name' => $ this -> jobPropertyReflectors [ 'name' ] -> getValue ( $ job ) , 'arguments' => \ json_encode ( $ this -> jobPropertyReflectors [ 'arguments' ] -> getValue ( ... | Serializes the job instance into an array . |
59,174 | public function deserialize ( array $ serialized ) : Job { $ this -> ensureReflectorsInitialized ( ) ; $ job = $ this -> instantiator -> instantiate ( Job :: class ) ; $ arguments = \ json_decode ( $ serialized [ 'arguments' ] , true ) ; \ assert ( \ is_array ( $ arguments ) ) ; $ this -> jobPropertyReflectors [ 'id' ]... | Deserializes an array generated by this class into a job instance . |
59,175 | public function setHost ( ? string $ host ) : PgSQL { if ( ! $ this -> _supportedAttributes -> get ( 'host' ) -> validateValue ( $ host ) ) { throw new ArgumentException ( 'host' , $ host , 'Invalid host!' ) ; } $ this -> _attributes [ 'host' ] = $ host ; return $ this ; } | Sets the host name or ip address of the PgSQL server . |
59,176 | public function setPort ( $ port ) : PgSQL { if ( null === $ port ) { $ this -> _attributes [ 'port' ] = $ port ; return $ this ; } $ port = false ; if ( \ is_string ( $ port ) ) { $ port = ( int ) $ port ; } else if ( TypeTool :: IsInteger ( $ port ) ) { $ port = ( int ) $ port ; } else if ( TypeTool :: IsStringConver... | Sets the optional port number of the PgSQL server . |
59,177 | public function setDbName ( ? string $ dbName ) : PgSQL { if ( ! $ this -> _supportedAttributes -> get ( 'dbname' ) -> validateValue ( $ dbName ) ) { throw new ArgumentException ( 'dbname' , $ dbName , 'Invalid database name!' ) ; } $ this -> _attributes [ 'dbname' ] = $ dbName ; return $ this ; } | Sets the optional name of the initial connected database . |
59,178 | public function icoAction ( ) { $ options = $ this -> getServiceLocator ( ) -> get ( 'Config' ) [ 'view_manager' ] [ 'head_defaults' ] ; if ( empty ( $ options [ 'headLink' ] [ 'favicon' ] [ 'href' ] ) ) { $ redirect = '/uploads/_central/settings/favicon.ico' ; } else { $ redirect = $ options [ 'headLink' ] [ 'favicon'... | favicon . ico |
59,179 | function get ( $ parm = false ) { if ( isset ( $ this -> __columns [ $ parm ] ) ) return $ this -> __columns [ $ parm ] ; return false ; } | GET Get parameter value |
59,180 | function set ( $ parm , $ value = null ) { if ( is_array ( $ parm ) ) { foreach ( $ parm as $ k => $ v ) { $ this -> __columns [ $ k ] = $ v ; } return $ this ; } elseif ( isset ( $ this -> __columns [ $ parm ] ) ) { $ this -> __columns [ $ parm ] = $ value ; return $ this ; } else return false ; } | SET Set parameter |
59,181 | public function stream_seek ( $ aOffset , $ aWhence ) { switch ( $ aWhence ) { case SEEK_SET : $ this -> position = $ aOffset ; if ( $ aOffset > strlen ( self :: $ string [ $ this -> path ] ) ) { $ this -> stream_truncate ( $ aOffset ) ; } return true ; case SEEK_CUR : $ this -> position += $ aOffset ; return true ; ca... | Seek to new position |
59,182 | public function unfold ( ) { if ( is_null ( $ this -> unfolded ) ) { $ string = $ this -> input -> run ( ) ; $ transformer = new TransformerWorker ( $ string ) ; foreach ( $ this -> modifiers as $ modifier ) { call_user_func_array ( array ( $ transformer , $ modifier [ 'name' ] ) , $ modifier [ 'args' ] ) ; } $ this ->... | Apply all modifiers for given input and return formatted string . |
59,183 | private function getParametersFromRequest ( Request $ request ) { $ parameters = $ request -> query -> all ( ) ; if ( $ routeParameters = $ request -> attributes -> get ( '_route_params' ) ) { $ parameters = array_merge ( $ routeParameters , $ parameters ) ; } return $ parameters ; } | Get parameters from request . |
59,184 | public function addFields ( array $ fields ) { foreach ( $ fields as $ field ) { if ( ! $ field instanceof FieldDefinitionInterface ) { continue ; } $ this -> addField ( $ field ) ; } return $ this ; } | Add multiple fields to form . |
59,185 | public function setResults ( array $ values ) { foreach ( $ values as $ field => $ value ) { if ( empty ( $ value ) ) { continue ; } $ this -> setResult ( $ field , $ value ) ; } return $ this ; } | Set form results . |
59,186 | public function setResult ( $ field , $ value ) { if ( ! isset ( $ this -> results [ $ field ] ) ) { $ this -> results [ $ field ] = $ value ; } return $ this ; } | Set for result . |
59,187 | public function process ( ) { $ this -> results = $ this -> processFields ( $ this -> fields , $ this -> results ) ; return $ this ; } | Process form fields . |
59,188 | public function save ( callable $ function , $ confirm_save = true , $ confirm_message = 'Save results?' ) { $ save = true ; $ this -> process ( ) ; if ( $ confirm_save ) { $ question = $ this -> helperSet -> get ( 'question' ) ; $ save = $ question -> ask ( $ this -> input , $ this -> output , new ConfirmationQuestion... | Save form results . |
59,189 | protected function processFields ( array $ fields , array $ results = [ ] ) { $ input = $ this -> input ; $ output = $ this -> output ; $ helper = $ this -> helperSet -> get ( 'question' ) ; foreach ( $ fields as $ field ) { if ( ! $ field instanceof FieldDefinitionInterface ) { continue ; } $ field_name = $ field -> g... | Process fields . |
59,190 | protected function fieldConditionMet ( FieldInterface $ field , array $ results ) { $ conditions = [ ] ; foreach ( $ field -> getCondition ( ) as $ field_name => $ condition ) { $ value = $ condition [ 'value' ] ; $ operation = $ condition [ 'operation' ] ; $ field_value = $ this -> getFieldValue ( $ field_name , $ res... | Check if field condition are met . |
59,191 | public static function createColumnDefinition ( $ datatype , $ name , $ tableName = null , $ schemaName = null ) { if ( ! array_key_exists ( $ datatype , self :: $ typesMap ) ) { throw new Exception \ UnsupportedTypeException ( __METHOD__ . " Type '$datatype' is not supported." ) ; } $ class = __NAMESPACE__ . '\\Column... | Create a data column definition . |
59,192 | public static function getReflectionCallable ( $ callable ) { if ( is_callable ( $ callable , true ) ) { try { if ( is_object ( $ callable ) ) { return new ReflectionFunction ( $ callable ) ; } if ( is_array ( $ callable ) ) { return new ReflectionMethod ( $ callable [ 0 ] , $ callable [ 1 ] ) ; } if ( strpos ( $ calla... | Get ReflectionFunctionAbstract of a variable if it was callable . |
59,193 | public static function getReflectionCallableName ( ReflectionFunctionAbstract $ reflector ) { $ class = $ reflector instanceof ReflectionFunction ? $ reflector -> getClosureScopeClass ( ) : $ reflector -> getDeclaringClass ( ) ; if ( is_null ( $ class ) ) { return $ reflector -> getName ( ) ; } return $ class -> getNam... | Get callable name from reflection . |
59,194 | public function beforeSnippet ( ) { $ event = new SnippetEvent ( ) ; $ this -> trigger ( self :: EVENT_BEFORE_SNIPPET , $ event ) ; return $ event -> isValid ; } | This method is invoked right before an action is executed . |
59,195 | protected function callFunction ( $ function , array $ params = [ ] ) { if ( is_string ( $ function ) ) { $ function = trim ( $ function ) ; if ( strpos ( $ function , '.' ) !== false ) { $ function = explode ( '.' , $ function ) ; } else { return $ this -> template -> getSnippet ( $ function , $ params ) ; } } if ( is... | Call function . |
59,196 | public function handle ( array $ record ) { if ( ! $ this -> isHandling ( $ record ) ) { return false ; } if ( class_exists ( 'Drips\Debugbar\Debugbar' ) ) { $ debugbar = Debugbar :: getInstance ( ) ; if ( ! $ debugbar -> hasTab ( 'logger' ) ) { $ debugbar -> registerTab ( 'logger' , 'Logs' , '<style>' . file_get_conte... | Schreibt die einzelnen Log - Records in die Debugbar |
59,197 | public function onBeforeDeleteUser ( UserEvent $ event ) { $ user = $ event -> getUser ( ) ; $ locks = $ this -> entityManager -> getRepository ( 'PhlexibleElementBundle:ElementLock' ) -> findBy ( [ 'userId' => $ user -> getId ( ) ] ) ; foreach ( $ locks as $ lock ) { $ this -> entityManager -> remove ( $ lock ) ; } } | User delete callback Cleanup users locks . |
59,198 | public function apply ( ModelCriteria $ query ) { if ( $ this -> query ) { $ query -> mergeWith ( $ this -> query ) ; } return $ query ; } | Applies modifiers and merge query if one has been set |
59,199 | public function getDsn ( ) { if ( $ this -> driver === 'sqlite' ) { return "sqlite:$this->schema" ; } $ opts = [ ] ; $ opts [ 'host' ] = $ this -> host ; if ( $ this -> schema ) { $ opts [ 'dbname' ] = $ this -> schema ; } $ dsnOpts = array_merge ( [ ] , $ this -> dsnOpts , $ opts ) ; return "$this->driver:" . implode ... | Generate a DSN using the info encapsulated in the instance . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.