idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
58,600 | public function getPdoType ( $ type , $ value ) { if ( null === $ value ) { $ type = \ PDO :: PARAM_NULL ; } else { switch ( $ type ) { case AbstractEntity :: TYPE_BOOL : $ type = \ PDO :: PARAM_BOOL ; break ; case AbstractEntity :: TYPE_INT : $ type = \ PDO :: PARAM_INT ; break ; default : $ type = \ PDO :: PARAM_STR ... | Get PDO parameter type for given RIO property type |
58,601 | protected function setDB ( \ Native5 \ Core \ Database \ DB $ db ) { if ( empty ( $ db ) ) throw new \ InvalidArgumentException ( "Emoty DB object received" ) ; $ this -> db = $ db ; } | setDB Set the DB connection to use |
58,602 | protected function setDBFromConfigurationArray ( $ dbConfigArray ) { $ dbConfigFactory = new \ Native5 \ Core \ Database \ DBConfigFactory ( ) ; $ dbConfigFactory -> setRawConfig ( $ dbConfigArray ) ; $ this -> db = \ Native5 \ Core \ Database \ DBFactory :: makeDB ( $ dbConfigFactory -> getConfig ( ) ) ; } | setDBFromConfigurationArray Create and Set the DB connection using parameters in assoc . array |
58,603 | protected function loadQueries ( $ sqlQueriesFile ) { if ( ! file_exists ( $ sqlQueriesFile ) ) throw new \ Exception ( "File with mysql queries not found at expected location: $sqlQueriesFile" ) ; if ( ! ( $ this -> queries = \ Symfony \ Component \ Yaml \ Yaml :: parse ( file_get_contents ( $ sqlQueriesFile ) ) ) ) t... | setYamlQueries Set the name of the yaml file with sql queries indexed by query names |
58,604 | protected function execQuery ( $ queryIndex , $ valArr , $ type = \ Native5 \ Core \ Database \ DB :: SELECT ) { return $ this -> db -> execQuery ( $ this -> queries [ $ queryIndex ] , $ valArr , $ type ) ; } | execQuery Execute Indexed Query |
58,605 | protected function execQueryString ( $ query , $ valArr , $ type = \ Native5 \ Core \ Database \ DB :: SELECT ) { return $ this -> db -> execQuery ( $ query , $ valArr , $ type ) ; } | execQueryString Execute Query String |
58,606 | public function __async_upload ( ) { $ fsModule = $ this -> system -> module ( 'fs' ) ; $ upload = new Upload ( array ( ) , $ _GET [ 'i' ] ) ; $ upload -> upload ( $ file_path ) ; if ( class_exists ( '\samson\scale\ScaleController' , false ) && $ this -> isImage ( $ fsModule -> extension ( $ file_path ) ) ) { $ scale =... | Upload file controller |
58,607 | public function __async_delete ( ) { $ fsModule = $ this -> system -> module ( 'fs' ) ; $ this -> createField ( new dbQuery ( ) , $ _GET [ 'e' ] , $ _GET [ 'f' ] , $ _GET [ 'i' ] ) ; $ file = $ this -> field -> value ( ) ; if ( class_exists ( '\samson\scale\ScaleController' , false ) && $ this -> isImage ( $ fsModule -... | Delete file controller |
58,608 | public function build ( $ params ) { return ( ( isset ( $ params [ 'scheme' ] ) ) ? $ params [ 'scheme' ] . '://' : '' ) . ( ( isset ( $ params [ 'user' ] ) ) ? $ params [ 'user' ] . ( ( isset ( $ params [ 'pass' ] ) ) ? ':' . $ params [ 'pass' ] : '' ) . '@' : '' ) . ( ( isset ( $ params [ 'host' ] ) ) ? $ params [ 'h... | Reverse of the PHP built - in function parse_url |
58,609 | public function encode ( $ input ) { $ chars = [ 'Ă' => 'a' , 'ă' => 'a' , 'Â' => 'A' , 'â' => 'a' , 'Î' => 'I' , 'î' => 'i' , 'Ș' => 'S' , 'ș' => 's' , 'Ş' => 'S' , 'ş' => 's' , 'Ț' => 'T' , 'ț' => 't' , 'Ţ' => 'T' , 'ţ' => 't' ] ; $ change ... | Replaces all non - alphanumeric characters and returns dash - separated string |
58,610 | public function onRequestError ( Event $ event ) { $ e = $ this -> factory -> fromResponse ( $ event [ 'request' ] , $ event [ 'response' ] ) ; $ event -> stopPropagation ( ) ; throw $ e ; } | Convert generic Guzzle exceptions into Kinvey - specific exceptions . |
58,611 | public function expand ( ) : IP { $ result = clone $ this ; if ( $ this -> isIPv6 ) { $ bytes = unpack ( 'n*' , inet_pton ( $ this -> address ) ) ; $ result -> address = implode ( ':' , array_map ( function ( $ b ) { return sprintf ( '%04x' , $ b ) ; } , $ bytes ) ) ; } return $ result ; } | Returns a fully expanded representation of the IP address . |
58,612 | public function compact ( ) : IP { $ result = clone $ this ; if ( $ this -> isIPv6 ) { $ result -> address = inet_ntop ( inet_pton ( $ this -> address ) ) ; } return $ result ; } | Returns a compact representation of the IP address . |
58,613 | public function isPrivate ( ) : bool { if ( $ this -> isLoopback ( ) ) { return true ; } $ filtered = filter_var ( $ this -> address , FILTER_VALIDATE_IP , FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) ; return $ filtered === false ; } | Checks if the IP is a private IP address . |
58,614 | public function isInRange ( string $ range ) : bool { $ targetRange = strtolower ( $ range ) ; $ myIP = bin2hex ( inet_pton ( $ this -> address ) ) ; if ( strpos ( $ targetRange , '-' ) !== false ) { $ parts = explode ( '-' , $ targetRange ) ; if ( count ( $ parts ) > 2 ) { throw new \ InvalidArgumentException ( sprint... | Checks whether this IP is in the given range or not . |
58,615 | private function isLoopback ( ) : bool { if ( $ this -> isIPv6 ) { return $ this -> compact ( ) -> address == '::1' ; } return ( ip2long ( $ this -> address ) & 0xff000000 ) == 0x7f000000 ; } | Checks if the IP is a known loopback address . |
58,616 | public function setTemplateVariable ( $ name , $ value ) { $ this -> initViewModel ( ) ; $ this -> viewModel -> setVariable ( $ name , $ value ) ; return $ this ; } | Set view variable |
58,617 | public function setVariables ( $ variables , $ overwrite = false ) { $ this -> initViewModel ( ) ; try { $ this -> viewModel -> setVariables ( $ variables , $ overwrite ) ; } catch ( Exception \ InvalidArgumentException $ e ) { throw new Exception \ InvalidArgumentException ( $ e -> getMessage ( ) ) ; } } | Set view variables en masse |
58,618 | public function initTwig ( ) { if ( $ this -> twig ) return ; Twig_Autoloader :: register ( ) ; $ this -> twig = new Twig_Environment ( ) ; $ loader = new Twig_Loader_Filesystem ( dirname ( $ this -> path ) ) ; $ this -> twig -> setLoader ( $ loader ) ; } | initialize twig . |
58,619 | static function assertLooselyIdentical ( $ expected , $ actual , bool $ canonicalizeKeys = false , string $ message = '' ) : void { static :: assertThat ( $ actual , static :: looselyIdenticalTo ( $ expected , $ canonicalizeKeys ) , $ message ) ; } | Assert that two values have the same type and value but consider different instances of the same class identical as long as they have identical properties |
58,620 | static function assertSameIterable ( iterable $ expected , $ actual , string $ message = '' ) : void { static :: assertThat ( $ actual , static :: identicalIterable ( $ expected ) , $ message ) ; } | Assert that two iterables contain the same values and types in the same order |
58,621 | static function assertLooselyIdenticalIterable ( iterable $ expected , $ actual , bool $ canonicalizeKeys = false , string $ message = '' ) { static :: assertThat ( $ actual , static :: looselyIdenticalIterable ( $ expected , $ canonicalizeKeys ) , $ message ) ; } | Assert that two iterables contain the same values and types in the same order but consider different instances of the same class identical as long as they have identical properties |
58,622 | static function assertEqualIterable ( iterable $ expected , $ actual , string $ message = '' ) : void { static :: assertThat ( $ actual , static :: equalIterable ( $ expected ) , $ message ) ; } | Assert that two iterables contain equal values in any order |
58,623 | public function blameBus ( $ file , $ line ) { $ blameCommand = sprintf ( "-L%s,%s --line-porcelain -- %s" , $ line , $ line , $ file ) ; return $ this -> command ( 'blame' , $ blameCommand ) ; } | Returns information on the last edit of a file and line . |
58,624 | protected function command ( $ command , $ args ) { $ command = trim ( sprintf ( 'git %s %s' , $ command , Stringify :: arguments ( $ args ) ) ) ; list ( $ output , $ return ) = $ this -> execute ( $ command ) ; if ( $ return != self :: SUCCESS ) { throw new CommandFailureException ( $ output ) ; } if ( is_array ( $ ou... | Returns output from a command . |
58,625 | public function delete ( $ id ) { if ( $ ids = $ this -> db -> ids ( array ( 'SELECT node.id' , 'FROM ' . $ this -> table . ' AS node, ' . $ this -> table . ' AS parent' , 'WHERE node.lft BETWEEN parent.lft AND parent.rgt AND parent.' . $ this -> id . ' = ?' , 'ORDER BY node.lft' , ) , $ id ) ) { $ this -> db -> exec (... | Delete a node and all of it s children from your hierarchical table . |
58,626 | public function id ( $ field , array $ values ) { $ from = array ( ) ; $ where = array ( ) ; foreach ( range ( 1 , count ( $ values ) ) as $ level => $ num ) { $ from [ ] = ( isset ( $ previous ) ) ? "{$this->table} AS t{$num} ON t{$num}.parent = t{$previous}.{$this->id}" : "{$this->table} AS t{$num}" ; $ where [ ] = "... | Get the id of a given path . |
58,627 | public function path ( $ field , $ value , $ column = null ) { if ( is_null ( $ column ) ) { $ column = $ field ; } $ single = ( ! is_array ( $ column ) ) ? $ column : false ; $ path = array ( ) ; if ( $ stmt = $ this -> db -> query ( array ( 'SELECT parent.' . $ this -> id . ', ' . $ this -> fields ( 'parent' , ( arra... | Retrieve a single path . |
58,628 | public function children ( $ id , $ column ) { $ single = ( ! is_array ( $ column ) ) ? $ column : false ; $ children = array ( ) ; if ( $ stmt = $ this -> db -> query ( 'SELECT ' . $ this -> id . ', ' . implode ( ', ' , ( array ) $ column ) . ' FROM ' . $ this -> table . ' WHERE parent = ? ORDER BY lft' , $ id , 'asso... | Find the immediate subordinates of a node ie . no grand children . |
58,629 | public function counts ( $ table , $ match , $ id = null ) { if ( ! is_null ( $ id ) ) { return ( int ) $ this -> db -> value ( array ( 'SELECT COUNT(' . $ table . '.' . $ match . ') AS count' , 'FROM ' . $ this -> table . ' AS node' , 'INNER JOIN ' . $ this -> table . ' AS parent' , 'INNER JOIN ' . $ table , 'WHERE pa... | Aggregate the total records in a table for each tree node . |
58,630 | public function tree ( $ column , $ field = null , $ value = null , $ having = null ) { $ tree = array ( ) ; if ( func_num_args ( ) >= 3 ) { $ depth = ( is_string ( $ having ) && strpos ( $ having , 'depth' ) !== false ) ? ' HAVING ' . $ having : null ; $ stmt = $ this -> db -> query ( array ( 'SELECT node.' . $ this -... | Retrieve a full tree or any parts thereof . |
58,631 | public function lister ( array $ tree , array $ nest = null ) { if ( is_null ( $ nest ) ) { return $ this -> lister ( $ tree , $ this -> nestify ( $ tree ) ) ; } $ list = array ( ) ; foreach ( $ nest as $ id => $ values ) { if ( ! empty ( $ values ) ) { $ list [ array_shift ( $ tree [ $ id ] ) ] = $ this -> lister ( $ ... | Create a multi - dimensional array using the first value of each tree array . |
58,632 | public function flatten ( array $ nest , array $ related = array ( ) ) { $ children = array ( ) ; foreach ( $ nest as $ id => $ values ) { $ parents = $ related ; $ parents [ ] = $ id ; if ( ! empty ( $ values ) ) { foreach ( $ this -> flatten ( $ values , $ parents ) as $ nest ) { $ children [ ] = $ nest ; } } else { ... | Flatten a nested tree . |
58,633 | private function traverse ( $ id , $ level = - 1 ) { $ lft = $ this -> count ; ++ $ this -> count ; if ( isset ( $ this -> parents [ $ id ] ) ) { foreach ( $ this -> parents [ $ id ] as $ child ) { $ this -> traverse ( $ child , $ level + 1 ) ; } unset ( $ this -> parents [ $ id ] ) ; } $ rgt = $ this -> count ; ++ $ t... | Used to refresh the database . |
58,634 | public function getLocaleFromAuthenticatedUser ( ) { $ user = $ this -> findAuthenticatedUser ( ) ; return ( null !== $ user && $ user -> getLocale ( ) ) ? $ user -> getLocale ( ) : 'es' ; } | Get locale from authenticated user |
58,635 | public function encodeReversibleString ( $ string ) { $ salt = $ this -> getSecretAppString ( ) ; $ key = substr ( base64_encode ( $ salt ) , 0 , 50 ) ; $ iv = '12345678' ; $ cc = base64_encode ( json_encode ( array ( 'time' => strrev ( '' . time ( ) ) , 'key' => $ string , 'random' => rand ( 10000000 , 99999999 ) ) ) ... | Encode an string with a reversible algorithm |
58,636 | public function decodeReversibleString ( $ string ) { $ salt = $ this -> getSecretAppString ( ) ; $ key = substr ( base64_encode ( $ salt ) , 0 , 50 ) ; $ iv = '12345678' ; $ cc = base64_decode ( $ string ) ; $ cipher = mcrypt_module_open ( MCRYPT_BLOWFISH , '' , 'cbc' , '' ) ; mcrypt_generic_init ( $ cipher , $ key , ... | Decode an string with a reversible algorithm |
58,637 | public function encodeHashOfString ( $ string ) { $ salt = $ this -> getServiceContainer ( ) -> getParameter ( 'secret' ) ; $ key = substr ( base64_encode ( $ salt ) , 0 , 30 ) ; $ options = array ( 'cost' => 13 , 'salt' => $ key ) ; $ hash = hash ( 'sha512' , password_hash ( $ string , PASSWORD_BCRYPT , $ options ) ) ... | Encode an string with in a irreversible hash |
58,638 | private function activateCheckMode ( InputInterface $ input ) { $ this -> check = $ input -> getOption ( 'check' ) ; $ this -> start = microtime ( true ) ; } | Activate check mode but only if the check option was given and note the execution start time . |
58,639 | private function reportChange ( OutputInterface $ output ) { $ this -> end = microtime ( true ) ; $ output -> writeLn ( sprintf ( '[DROID-RESULT] %s' , json_encode ( array ( 'changed' => $ this -> change , 'start' => $ this -> start , 'end' => $ this -> end , ) ) ) ) ; } | Write the result of the check to the supplied OutputInterface . |
58,640 | public static function add ( string $ p_ns , \ FreeFW \ Interfaces \ DependencyInjectorInterface $ p_di ) { self :: $ containers [ $ p_ns ] = $ p_di ; } | Add new DI |
58,641 | public static function registerDI ( string $ p_ns , \ FreeFW \ Application \ Config $ p_config , \ Psr \ Log \ LoggerInterface $ p_logger ) { $ di = \ FreeFW \ DI \ DependencyInjector :: getFactory ( $ p_ns , $ p_config , $ p_logger ) ; self :: add ( $ p_ns , $ di ) ; return $ di ; } | Register new DI |
58,642 | public static function getShared ( string $ p_name ) { if ( array_key_exists ( $ p_name , self :: $ shared ) ) { return self :: $ shared [ $ p_name ] ; } return false ; } | Get shared object |
58,643 | public static function fixPath ( string $ path ) : string { if ( false !== strpos ( $ path , '\\' ) ) { $ path = str_replace ( '\\' , '/' , $ path ) ; } while ( false !== strpos ( $ path , '//' ) ) { $ path = str_replace ( '//' , '/' , $ path ) ; } if ( strlen ( $ path ) ) { if ( '/' === substr ( $ path , 0 , 1 ) ) { $... | Fix slashes and backslashes in path . |
58,644 | public function process ( ContainerBuilder $ container ) { $ this -> container = $ container ; foreach ( $ container -> getDefinitions ( ) as $ id => $ definition ) { if ( $ definition -> isSynthetic ( ) || $ definition -> isAbstract ( ) ) { continue ; } $ this -> currentId = $ id ; $ this -> validateReferences ( $ def... | Processes the ContainerBuilder to validate References . |
58,645 | private function validateReferences ( array $ arguments ) { foreach ( $ arguments as $ argument ) { if ( is_array ( $ argument ) ) { $ this -> validateReferences ( $ argument ) ; } elseif ( $ argument instanceof Reference ) { $ targetDefinition = $ this -> getDefinition ( ( string ) $ argument ) ; if ( null !== $ targe... | Validates an array of References . |
58,646 | private function getDefinition ( $ id ) { if ( ! $ this -> container -> hasDefinition ( $ id ) ) { return ; } return $ this -> container -> getDefinition ( $ id ) ; } | Returns the Definition given an id . |
58,647 | public function mutateAttribute ( $ key , $ value ) { if ( $ this -> hasGetMutator ( $ key ) ) { return parent :: mutateAttribute ( $ key , $ value ) ; } return $ this -> getAttribute ( $ key ) ; } | Get alias value from mutator or directly from attribute |
58,648 | public function checkToken ( ) { if ( \ Config :: get ( 'tiga.skip_csrf_protect' , false ) ) return ; if ( $ this -> session -> get ( 'tiga_csrf_token' , false ) == false ) { throw new \ Exception ( 'Invalid csrf token' ) ; } $ input = $ this -> input ( '_tiga_token' ) ; if ( $ this -> isXmlHttpRequest ( ) ) { $ input ... | Check request token and throw exception if token is not found . |
58,649 | protected function getBrowserCommand ( $ url ) { if ( \ Tivie \ OS \ MACOSX == $ this -> os -> getType ( ) ) { return "open $url" ; } if ( $ this -> os -> isWindowsLike ( ) ) { return "start $url" ; } return "xdg-open $url" ; } | Find the right command to launch a url on a platform . |
58,650 | public function normalize ( $ name ) { if ( $ name instanceof RawExpressionInterface ) { return ( string ) $ name ; } return implode ( '.' , array_map ( function ( $ value ) { return $ value === '*' ? $ value : '"' . $ value . '"' ; } , explode ( '.' , $ name ) ) ) ; } | Normalize the name for PGSQL Quotes are put around all the words which are divided with dot as PG is case sensitive |
58,651 | private static function validateReleaseFormatForHyphen ( $ name ) { if ( ! stristr ( $ name , '-' ) ) { throw new \ Exception ( 'Release must include a hyphen' ) ; } if ( strpos ( $ name , '-' ) === 0 ) { throw new \ Exception ( 'Hyphen cannot be first character' ) ; } if ( strpos ( $ name , '-' ) === ( strlen ( $ name... | Validate given release name for hyphen position |
58,652 | public static function validateReleaseFormat ( $ name ) { self :: validateReleaseFormatForHyphen ( $ name ) ; list ( $ adjective , $ noun ) = explode ( '-' , $ name ) ; if ( $ adjective [ 0 ] != $ noun [ 0 ] ) { throw new \ Exception ( 'Invalid combination of release name: ' . $ name ) ; } } | Validate format of release name |
58,653 | public static function randomFor ( $ char ) { return new Release ( implode ( '-' , array ( \ ReleaseName \ Component \ Adjective :: randomFor ( $ char ) , \ ReleaseName \ Component \ Noun :: randomFor ( $ char ) ) ) ) ; } | Get random release name for given character |
58,654 | protected function dispatch ( string $ aggregateId , PayloadInterface $ payload , array $ metaData = null ) : void { $ this -> getCommandDispatcher ( ) -> dispatch ( new CommandMessage ( $ payload , new PayloadType ( $ payload ) , $ aggregateId , $ metaData ) ) ; } | Dispatch new command message . |
58,655 | public function newAction ( Request $ request ) { $ page = new Page ( ) ; $ form = $ this -> createForm ( 'CoreBundle\Form\PageType' , $ page , array ( 'translator' => $ this -> get ( 'translator' ) ) ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { $ em = $ this -... | Creates a new page entity . |
58,656 | private function createDeleteForm ( Page $ page ) { return $ this -> createFormBuilder ( ) -> setAction ( $ this -> generateUrl ( 'core_page_delete' , array ( 'id' => $ page -> getId ( ) ) ) ) -> setMethod ( 'DELETE' ) -> getForm ( ) ; } | Creates a form to delete a page entity . |
58,657 | public function logIn ( string $ password , string $ hash , array $ user ) : bool { if ( ! $ user || ! password_verify ( $ password , $ hash ) ) { return false ; } $ this -> session -> set ( 'user' , $ user ) ; return true ; } | Logs a user in |
58,658 | public function logInRememberMe ( array $ user ) : bool { if ( ! $ user ) { return false ; } $ this -> session -> set ( 'user' , $ user ) ; return true ; } | Logs a user in using the remember me cookie |
58,659 | public function needsRehash ( string $ hash ) : bool { if ( ! $ this -> isLoggedIn ( ) ) { return false ; } return password_needs_rehash ( $ hash , PASSWORD_DEFAULT , [ 'cost' => self :: PASSWORD_COST ] ) ; } | Checks whether the user s password needs to be rehashed |
58,660 | public function isAdmin ( ) : bool { return $ this -> isLoggedIn ( ) && isset ( $ this -> session -> get ( 'user' ) [ 'admin' ] ) && $ this -> session -> get ( 'user' ) [ 'admin' ] === true ; } | Checks whether the current user is an administrator |
58,661 | public function foreign ( $ datas = [ ] ) { if ( ! array_key_exists ( 'type' , $ datas ) ) { throw new MissingEntityException ( 'The parameter "type" is missing for the foreign key' ) ; } if ( ! array_key_exists ( 'reference' , $ datas ) ) { throw new MissingEntityException ( 'The parameter "reference" is missing for t... | Set foreigns key |
58,662 | public function FormatContent ( $ Log ) { $ Data = $ Log [ 'Data' ] ; switch ( $ Log [ 'RecordType' ] ) { case 'Activity' : $ Result = $ this -> FormatKey ( 'Story' , $ Data ) ; break ; case 'Discussion' : $ Result = '<b>' . $ this -> FormatKey ( 'Name' , $ Data ) . '</b><br />' . $ this -> FormatKey ( 'Body' , $ Data ... | Format the content of a log file . |
58,663 | public function GetOperationCount ( $ Operation ) { if ( $ Operation == 'edits' ) $ Operation = array ( 'edit' , 'delete' ) ; else $ Operation = explode ( ',' , $ Operation ) ; sort ( $ Operation ) ; array_map ( 'ucfirst' , $ Operation ) ; $ CacheKey = 'Moderation.LogCount.' . implode ( '.' , $ Operation ) ; $ Count = ... | Wrapper for GetCountWhere that takes care of caching specific operation counts . |
58,664 | public function dumpTask ( Option $ option ) { $ databases = $ this -> getDatabases ( $ option ) ; $ start = microtime ( true ) ; foreach ( $ databases as $ alias => $ database ) { $ manager = $ this -> getManager ( $ alias , $ database ) ; $ schemaFile = $ this -> migrationHelper -> getSchemaFile ( $ alias ) ; $ this ... | database schema dump task . |
58,665 | public function loadTask ( Option $ option ) { $ databases = $ this -> getDatabases ( $ option ) ; $ start = microtime ( true ) ; foreach ( $ databases as $ alias => $ database ) { $ manager = $ this -> getManager ( $ alias , $ database ) ; $ schemaFile = $ this -> migrationHelper -> getSchemaFile ( $ alias ) ; $ this ... | database schema load task . |
58,666 | public function getManager ( $ alias , Database $ database ) { $ reporter = $ this -> getReporter ( ) ; $ config = new Config ( [ ] ) ; $ config -> setContainer ( $ this -> raikiri ( ) ) ; $ config -> initialize ( $ alias , $ database ) ; $ env = $ config -> getEnvironment ( $ this -> application -> getEnv ( ) ) ; $ re... | get migration manager . |
58,667 | protected function getDatabases ( Option $ option ) { if ( $ option -> get ( 'database' ) === 'all' ) { $ databases = $ this -> onikiri -> getDatabases ( ) ; } else { $ alias = $ option -> get ( 'database' ) ; $ databases = [ $ alias => $ this -> onikiri -> getDatabase ( $ alias ) ] ; } return $ databases ; } | get target databases |
58,668 | protected function _setValidationErrors ( $ errorList ) { if ( ! is_null ( $ errorList ) ) { $ errorList = $ this -> _normalizeIterable ( $ errorList ) ; } $ this -> validationErrors = $ errorList ; } | Sets the list of validation errors that this instance should represent . |
58,669 | public function getPageCount ( ) : int { return intval ( $ this -> count / $ this -> pageSize ) + ( $ this -> count % $ this -> pageSize == 0 ? 0 : 1 ) ; } | Get Page Count . |
58,670 | public function hasData ( $ key = '' ) { $ key = $ this -> normalizeKeyName ( $ key ) ; if ( empty ( $ key ) || ! is_string ( $ key ) ) { return ! empty ( $ this -> _data ) ; } return array_key_exists ( $ key , $ this -> _data ) ; } | Check if has data on object |
58,671 | public function getData ( $ key = '' ) { $ key = $ this -> normalizeKeyName ( $ key ) ; if ( $ key === '' ) { return $ this -> _data ; } return isset ( $ this -> _data [ $ key ] ) ? $ this -> _data [ $ key ] : NULL ; } | Retrieve data from object |
58,672 | public function setData ( $ key , $ value ) { $ key = $ this -> normalizeKeyName ( $ key ) ; if ( isset ( $ this -> _data [ $ key ] ) ) { if ( $ this -> _data [ $ key ] !== $ value ) { $ this -> _original [ $ key ] = $ this -> _data [ $ key ] ; $ this -> _changes [ $ key ] = $ value ; } } else { $ this -> _changes [ $ ... | Set object data |
58,673 | public function addData ( $ data ) { foreach ( $ data as $ key => $ value ) { $ this -> setData ( $ key , $ value ) ; } return $ this ; } | Push data to the object |
58,674 | public function unsetData ( $ key ) { $ key = $ this -> normalizeKeyName ( $ key ) ; if ( isset ( $ this -> _data [ $ key ] ) ) { $ this -> _original [ $ key ] = $ this -> _data [ $ key ] ; $ this -> _changes [ $ key ] = NULL ; unset ( $ this -> _data [ $ key ] ) ; } return $ this ; } | Unset data on object |
58,675 | public function __toArray ( $ attributes = array ( ) ) { if ( empty ( $ attributes ) ) { $ data = $ this -> _data ; } else { $ data = array ( ) ; foreach ( $ attributes as $ attribute ) { if ( isset ( $ this -> _data [ $ attribute ] ) ) { $ data [ $ attribute ] = $ this -> _data [ $ attribute ] ; } else { $ data [ $ at... | Convert object attributes to array |
58,676 | public static function bind ( $ key , $ object = null ) { if ( is_array ( $ key ) ) { foreach ( $ key as $ key => $ object ) { self :: $ bindings [ $ key ] = $ object ; } } else { self :: $ bindings [ $ key ] = $ object ; } } | Bind an object to a key in a bindings array . |
58,677 | public static function instance ( $ key ) { if ( isset ( self :: $ bindings [ $ key ] ) ) { return self :: $ bindings [ $ key ] ; } return false ; } | Grab an instance which has already been bound to this container otherwise we ll return false . |
58,678 | public function parentIdInjection ( array & $ materialIds ) { $ this -> query -> className ( 'material' ) -> cond ( 'MaterialID' , $ materialIds ) -> cond ( 'parent_id' , 0 ) -> cond ( 'Active' , 1 ) -> order_by ( 'Modyfied' , 'DESC' ) -> fieldsNew ( 'MaterialID' , $ materialIds ) ; } | Function to cut off related and table materials |
58,679 | public function psuStates ( $ translate = false ) { $ states = $ this -> getSNMP ( ) -> walk1d ( self :: OID_PSU_STATE ) ; if ( ! $ translate ) return $ states ; return $ this -> getSNMP ( ) -> translate ( $ states , self :: $ PSU_STATES ) ; } | Get the device s PSU states |
58,680 | public function fanStates ( $ translate = false ) { $ states = $ this -> getSNMP ( ) -> walk1d ( self :: OID_FAN_STATE ) ; if ( ! $ translate ) return $ states ; return $ this -> getSNMP ( ) -> translate ( $ states , self :: $ FAN_STATES ) ; } | Get the device s fan states |
58,681 | public function getPattern ( ) { if ( $ this -> _pattern === null ) { $ this -> _pattern = $ this -> extractTag ( 'pattern' ) ; } return $ this -> _pattern ; } | Retrieve defined _pattern tag |
58,682 | public function getSort ( ) { if ( $ this -> _sort === null ) { $ this -> _sort = ( float ) $ this -> extractTag ( 'sort' , 0 ) ; } return $ this -> _sort ; } | Retrieve defined sort tag |
58,683 | protected function _translate ( $ string , $ context = null ) { if ( ! ( ( $ translator = $ this -> _getTranslator ( ) ) instanceof StringTranslatorInterface ) ) { return $ string ; } return $ translator -> translate ( $ string , $ context ) ; } | Translates a string in the specified context . |
58,684 | public function doubleClick ( ) { $ command = $ this -> webDriver -> getDriver ( ) -> factoryCommand ( 'touch/doubleclick' , WebDriver_Command :: METHOD_POST , [ 'element' => $ this -> element -> getElementId ( ) ] ) ; $ this -> webDriver -> getDriver ( ) -> curl ( $ command ) ; return $ this ; } | Double tap on the touch screen using finger motion events . |
58,685 | public function longClick ( ) { $ command = $ this -> webDriver -> getDriver ( ) -> factoryCommand ( 'touch/longclick' , WebDriver_Command :: METHOD_POST , [ 'element' => $ this -> element -> getElementId ( ) ] ) ; $ result = $ this -> webDriver -> getDriver ( ) -> curl ( $ command ) ; return $ this ; } | Long press on the touch screen using finger motion events . |
58,686 | public function scroll ( $ xOffset , $ yOffset ) { $ command = $ this -> webDriver -> getDriver ( ) -> factoryCommand ( 'touch/scroll' , WebDriver_Command :: METHOD_POST , [ 'element' => $ this -> element -> getElementId ( ) , 'xoffset' => ( int ) $ xOffset , 'yoffset' => ( int ) $ yOffset , ] ) ; $ this -> webDriver -... | Scroll on the touch screen using finger based motion events . Use this command to start scrolling at a particular screen location . |
58,687 | public function flick ( $ xOffset , $ yOffset , $ speed = WebDriver :: SPEED_NORMAL ) { $ command = $ this -> webDriver -> getDriver ( ) -> factoryCommand ( 'touch/flick' , WebDriver_Command :: METHOD_POST , [ 'element' => $ this -> element -> getElementId ( ) , 'xoffset' => ( int ) $ xOffset , 'yoffset' => ( int ) $ y... | Flick on the touch screen using finger motion events . This flickcommand starts at a particulat screen location . |
58,688 | public function delete ( $ key ) { Arguments :: define ( $ this -> getKeyType ( ) ) -> check ( $ key ) ; $ cloned = array_merge ( $ this -> value ) ; unset ( $ cloned [ $ key ] ) ; return static :: of ( $ cloned ) ; } | Return a new Map of the same type without the specified key . |
58,689 | public function update ( $ key , callable $ updater , $ default = null ) { return $ this -> insert ( $ key , $ updater ( Maybe :: fromMaybe ( $ default , $ this -> lookup ( $ key ) ) ) ) ; } | Attempt to set a field using the provided updater function . |
58,690 | protected function timestampUpdate ( ) { $ this -> updated = date ( 'Y-m-d H:i:s' ) ; $ this -> id || $ this -> created = $ this -> updated ; } | RedBean update method Fills in the creation and update timestamps |
58,691 | public function addCollection ( Collection $ collection ) { $ metadata = $ collection -> getDocumentMetadata ( ) ; $ this -> collectionMapping [ $ metadata -> getName ( ) ] = $ collection ; } | Adds a collection to the schema . |
58,692 | public function build ( ) : UserAgentNormalizer { return new UserAgentNormalizer ( [ new Normalizer \ BabelFish ( ) , new Normalizer \ IISLogging ( ) , new Normalizer \ LocaleRemover ( ) , new Normalizer \ EncryptionRemover ( ) , new Normalizer \ Mozilla ( ) , new Normalizer \ Linux ( ) , new Normalizer \ KhtmlGecko ( ... | builds a useragent normalizer chain |
58,693 | public function queue ( $ type , JsonArray $ metaData = null ) { $ taskId = $ this -> generateId ( ) ; if ( null === $ metaData ) { $ metaData = new JsonArray ( ) ; } $ metaData -> set ( Task :: SETTING_ID , $ taskId ) -> set ( Task :: SETTING_TYPE , $ type ) -> set ( 'status' , Task :: STATE_PENDING ) -> set ( Task ::... | Add the task to the list . |
58,694 | public function getNext ( ) { $ idList = $ this -> getIds ( ) ; if ( false === ( $ taskId = current ( $ idList ) ) ) { return null ; } return $ this -> getTask ( $ taskId ) ; } | Retrieve the first task from the queue without removing it . |
58,695 | public function remove ( $ taskId ) { $ idList = $ this -> getIds ( ) ; if ( in_array ( $ taskId , $ idList ) ) { $ this -> getConfig ( ) -> remove ( $ taskId ) ; unlink ( $ this -> taskIdToFileName ( $ taskId ) ) ; } return $ this ; } | Remove a task from the list including it s task file . |
58,696 | public function getTask ( $ taskId ) { $ filename = $ this -> taskIdToFileName ( $ taskId ) ; if ( ! file_exists ( $ filename ) ) { return null ; } return $ this -> createTaskFromMetaData ( new JsonFile ( $ filename , null ) ) ; } | Retrieve a task . |
58,697 | private function createTaskFromMetaData ( JsonArray $ config ) { $ typeName = $ config -> get ( Task :: SETTING_TYPE ) ; if ( $ this -> factory -> isTypeSupported ( $ typeName ) ) { return $ this -> factory -> createInstance ( $ typeName , $ config ) ; } return null ; } | Create a task instance from the given MetaData . |
58,698 | static function toList ( iterable $ iterable ) : array { return $ iterable instanceof \ Traversable ? iterator_to_array ( $ iterable , false ) : array_values ( $ iterable ) ; } | Convert an iterable value to an array with consecutive integer indexes |
58,699 | protected function directory ( $ directory = null ) { switch ( $ directory ) { case 'storage' : $ this -> comment ( 'Cleaning assets library in storage.' ) ; $ count = 0 ; foreach ( $ this -> filesystem -> files ( $ this -> directory [ 'storage' ] ) as $ file ) { $ this -> filesystem -> delete ( $ file ) ; $ count ++ ;... | Depends on the directory |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.