idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
239,100 | private function _get_path ( ) { if ( empty ( $ this -> file ) && is_string ( $ this -> file ) ) return false ; if ( strpos ( $ this -> file , '/' ) !== false ) { $ path = explode ( '/' , $ this -> file ) ; array_pop ( $ path ) ; $ this -> path = ( string ) implode ( '/' , $ path ) . '/' ; } elseif ( strpos ( '\\' , $ ... | gets the filename out of the entered path |
239,101 | public function open ( $ filename ) { if ( ! is_file ( $ filename ) ) return false ; $ this -> file = @ ( string ) $ filename ; $ this -> group = @ ( int ) filegroup ( $ filename ) ; $ this -> owner = @ ( int ) fileowner ( $ filename ) ; $ this -> size = @ ( int ) filesize ( $ filename ) ; $ this -> type = @ ( string )... | gets all the information about the file |
239,102 | function open_fp ( $ option = 'r' ) { if ( empty ( $ option ) || ! is_string ( $ option ) ) return false ; switch ( true ) { case ( strpos ( $ option , 'r' ) !== false ) : $ mode = LOCK_SH ; break ; case ( strpos ( $ option , 'a' ) !== false || strpos ( $ option , 'w' ) !== false ) : $ mode = LOCK_EX ; break ; default ... | opens a filepointer |
239,103 | public function read ( ) { if ( $ this -> readable !== true ) return false ; if ( ! empty ( $ this -> fp ) && is_resource ( $ this -> fp ) ) fclose ( $ this -> fp ) ; $ this -> open_fp ( 'r' ) ; if ( filesize ( $ this -> file ) == 0 ) return false ; $ this -> lock ( LOCK_SH ) ; $ content = ( string ) fread ( $ this -> ... | read the current content of the file |
239,104 | public static function getArgumentSpecifications ( ) { $ specs = new OptionCollection ; $ specs -> add ( 'd|dir:' , 'Tests directory path' ) -> isa ( 'String' ) ; $ specs -> add ( 's|subdir+' , 'Optional, subdirectory pattern, can be used multiple times as OR expression' ) -> isa ( 'String' ) -> defaultValue ( null ) ;... | Get argument specifications |
239,105 | public function colored ( $ text , $ color ) { $ colors = [ 'black' => '0;30' , 'red' => '0;31' , 'green' => '0;32' , 'blue' => '1;34' , 'yellow' => '1;33' ] ; $ c = ( array_key_exists ( $ color , $ colors ) ? $ colors [ $ color ] : $ colors [ 'black' ] ) ; if ( $ this -> arguments -> { 'no-colors' } ) { return $ text ... | Returned colored text |
239,106 | public function mergePackageLoader ( $ directory ) { if ( $ vendor = $ this -> findVendor ( $ directory ) ) { $ this -> mergeComposerNamespaces ( $ vendor ) ; $ this -> mergeComposerPsr4 ( $ vendor ) ; $ this -> mergeComposerClassMap ( $ vendor ) ; } } | Autoloads a packages dependencies by merging them with the current auto - loader . |
239,107 | private function mergeComposerNamespaces ( $ vendor ) { if ( $ namespaceFile = $ this -> findComposerDirectory ( $ vendor , 'autoload_namespaces.php' ) ) { $ this -> log -> debug ( 'Located autoload_namespaces.php file' , [ 'path' => $ namespaceFile ] ) ; $ map = require $ namespaceFile ; foreach ( $ map as $ namespace... | Merges the dependencies namespaces . |
239,108 | private function mergeComposerPsr4 ( $ vendor ) { if ( $ psr4Autoload = $ this -> findComposerDirectory ( $ vendor , 'autoload_psr4.php' ) ) { $ this -> log -> debug ( 'Located autoload_psr4.php file' , [ 'path' => $ psr4Autoload ] ) ; $ map = require $ psr4Autoload ; foreach ( $ map as $ namespace => $ path ) { $ this... | Merges the dependencies PSR - 4 namespaces . |
239,109 | private function mergeComposerClassMap ( $ vendor ) { if ( $ composerClassMap = $ this -> findComposerDirectory ( $ vendor , 'autoload_classmap.php' ) ) { $ this -> log -> debug ( 'Located autoload_classmap.php file' , [ 'path' => $ composerClassMap ] ) ; $ classMap = require $ composerClassMap ; if ( $ classMap ) { $ ... | Merges the dependencies class maps . |
239,110 | private function findComposerDirectory ( $ vendor , $ file = '' ) { $ composerDirectory = $ this -> normalizePath ( $ vendor . '/composer/' . $ file ) ; if ( $ this -> files -> exists ( $ composerDirectory ) ) { return $ composerDirectory ; } return false ; } | Finds the composer directory . |
239,111 | private function findVendor ( $ directory ) { $ vendorDirectory = $ this -> normalizePath ( $ directory . '/_newup_vendor' ) ; if ( $ this -> files -> exists ( $ vendorDirectory ) && $ this -> files -> isDirectory ( $ vendorDirectory ) ) { return $ vendorDirectory ; } return false ; } | Gets the vendor directory location if it exists . |
239,112 | public function disconnect ( $ drop = false ) { $ this -> handler -> onClose ( $ this ) ; parent :: disconnect ( $ drop ) ; } | Disconnects client from server . It also notifies clients handler about that fact . |
239,113 | public function ping ( $ payload = null ) { if ( $ payload === null ) { $ payload = microtime ( true ) ; } elseif ( isset ( $ payload [ 125 ] ) ) { throw new LengthException ( "Ping payload cannot be larger than 125 bytes" ) ; } $ this -> currentPingFrame = new DataFrame ( $ this -> logger ) ; $ this -> currentPingFram... | Sends PING frame to connected client . |
239,114 | public function isJson ( ) { if ( ! $ this -> endsWith ( '}' ) && ! $ this -> endsWith ( ']' ) ) { return false ; } return ! is_null ( json_decode ( $ this -> str ) ) ; } | Returns true if the string is JSON false otherwise . |
239,115 | public function setFileClassname ( $ classname = null ) { if ( $ classname === null ) { $ this -> fileClass = null ; } elseif ( ! class_exists ( $ classname ) ) { throw ClassDoesNotExistException :: create ( $ classname ) ; } else { $ this -> fileClass = ( string ) $ classname ; } return $ this ; } | Set file classname |
239,116 | public function setController ( $ controller ) { if ( ! is_callable ( $ controller ) ) { throw new \ LogicException ( sprintf ( 'The controller must be a callable (%s given).' , gettype ( $ controller ) ) ) ; } $ this -> controller = $ controller ; } | Sets a controller |
239,117 | public function headers ( $ key = null , $ fallback = null ) { return $ key ? $ this -> request -> headers -> get ( $ key , $ fallback ) : $ this -> request -> headers ; } | Get a request header value |
239,118 | private function callActon ( $ sName , array $ aArgs ) { if ( empty ( $ aArgs ) ) { $ this -> ctrl -> { $ sName } ( ) ; } else { $ oMethod = new \ ReflectionMethod ( $ this -> ctrl , $ sName ) ; $ oMethod -> invokeArgs ( $ this -> ctrl , $ aArgs ) ; } } | It calls the controller action with passage the parameters if necessary . |
239,119 | protected function processAuth ( $ sName , array $ aArgs ) { if ( class_exists ( '\extensions\core\Auth' ) ) { $ oAuth = new \ extensions \ core \ Auth ( $ this -> ctrl -> getRequest ( ) ) ; $ oAuth -> run ( ) ; if ( $ oAuth -> isValid ( ) ) { $ this -> callActon ( $ sName , $ aArgs ) ; } else { $ oAuth -> onFail ( ) ;... | The method calls user s auth checking on successful complition of which it invokes the target controller and the onFail method of Auth class in other case . |
239,120 | public function getValidator ( ) { if ( ! isset ( $ this -> validator ) ) { $ this -> validator = new ArgsValidator ( $ this -> arguments_spec , $ this -> parsed_args ) ; } return $ this -> validator ; } | get the validator for these values |
239,121 | public function offsetGet ( $ key ) { $ resolved_key = $ this -> arguments_spec -> normalizeOptionName ( $ key ) ; if ( $ resolved_key === null ) { if ( isset ( $ this -> merged_arg_values [ $ key ] ) ) { return parent :: offsetGet ( $ key ) ; } } if ( isset ( $ this -> merged_arg_values [ $ resolved_key ] ) ) { return... | returns the argument or option value |
239,122 | public function offsetExists ( $ key ) { $ resolved_key = $ this -> arguments_spec -> normalizeOptionName ( $ key ) ; if ( $ resolved_key === null ) { return isset ( $ this -> merged_arg_values [ $ key ] ) ; } return isset ( $ this -> merged_arg_values [ $ resolved_key ] ) ; } | returns true if the argument or option value exists |
239,123 | protected function extractAllLongOpts ( ArgumentsSpec $ arguments_spec , $ parsed_args ) { $ long_opts = array ( ) ; foreach ( $ parsed_args [ 'options' ] as $ option_name => $ value ) { if ( $ long_option_name = $ arguments_spec -> normalizeOptionName ( $ option_name ) ) { $ long_opts [ $ long_option_name ] = $ value ... | builds argument values by long option name |
239,124 | protected function _getStoreConfigValue ( $ configKey , $ store , $ asFlag ) { foreach ( $ this -> _configModels as $ configModel ) { if ( $ configModel -> hasKey ( $ configKey ) ) { $ configMethod = $ asFlag ? 'getStoreConfigFlag' : 'getStoreConfig' ; return Mage :: $ configMethod ( $ configModel -> getPathForKey ( $ ... | Search through registered config models for one that knows about the key and get the actual config path from it for the lookup . |
239,125 | public function getConfigFlag ( $ configKey , $ store = null ) { $ store = count ( func_get_args ( ) ) > 1 ? $ store : $ this -> getStore ( ) ; return $ this -> _getStoreConfigValue ( $ configKey , $ store , true ) ; } | Get the configuration value represented by the given configKey |
239,126 | public function getConfig ( $ configKey , $ store = null ) { $ store = count ( func_get_args ( ) ) > 1 ? $ store : $ this -> getStore ( ) ; return $ this -> _getStoreConfigValue ( $ configKey , $ store , false ) ; } | Get the configuration flag value represented by the given configKey |
239,127 | protected function dump ( Route $ route , $ name ) { if ( ! $ route -> isVisible ( ) ) { return ; } if ( ! in_array ( 'GET' , $ route -> getMethods ( ) ) ) { throw new Exception ( sprintf ( 'Only GET mehtod supported, "%s" given.' , $ name ) ) ; } if ( $ route -> hasContent ( ) ) { if ( $ route -> isList ( ) ) { if ( $... | Dump route content to destination file |
239,128 | protected function buildPaginatedRoute ( Route $ route , $ name ) { $ contentType = $ route -> getContent ( ) ; $ contents = $ this -> app [ 'content_repository' ] -> listContents ( $ contentType ) ; $ paginator = new Paginator ( $ contents , $ route -> getPerPage ( ) ) ; $ this -> logger -> log ( sprintf ( 'Building r... | Build paginated route |
239,129 | protected function buildListRoute ( Route $ route , $ name ) { $ contentType = $ route -> getContent ( ) ; $ contents = $ this -> app [ 'content_repository' ] -> listContents ( $ contentType ) ; $ this -> logger -> log ( sprintf ( 'Building route <comment>%s</comment> with <info>%s</info> <comment>%s(s)</comment>' , $ ... | Build list route |
239,130 | protected function buildContentRoute ( Route $ route , $ name ) { $ contentType = $ route -> getContent ( ) ; $ contents = $ this -> app [ 'content_repository' ] -> listContents ( $ contentType ) ; $ this -> logger -> log ( sprintf ( 'Building route <comment>%s</comment> for <info>%s</info> <comment>%s(s)</comment>' , ... | Build content route |
239,131 | protected function buildSitemap ( Sitemap $ sitemap ) { $ content = $ this -> app [ 'twig' ] -> render ( '@phpillip/sitemap.xml.twig' , [ 'sitemap' => $ sitemap ] ) ; $ this -> builder -> write ( '/' , $ content , 'xml' , 'sitemap' ) ; } | Build sitemap xml file from Sitemap |
239,132 | private function authCookie ( Request $ request ) { if ( $ request -> cookies -> has ( self :: COOKIE_TOKEN_NAME ) ) { $ token = $ request -> cookies -> get ( self :: COOKIE_TOKEN_NAME ) ; return $ this -> authToken ( $ token ) ; } return null ; } | Authenticates a user by a token in a cookie |
239,133 | private function authHeader ( Request $ request ) { if ( $ request -> headers -> has ( 'authorization' ) ) { $ auth = $ request -> headers -> get ( 'authorization' ) ; if ( ! empty ( $ auth ) ) { list ( , $ token ) = explode ( ' ' , $ auth ) ; if ( empty ( $ token ) ) { return null ; } return $ this -> authToken ( $ to... | Authenticates a user by an authorization header |
239,134 | private function authBasic ( Request $ request ) { $ user = $ this -> findUser ( $ request -> getUser ( ) ) ; if ( $ user !== null && $ this -> verifyUser ( $ user , $ request -> getPassword ( ) ) ) { $ session = $ this -> findSession ( $ user ) ; if ( $ session === null ) { $ session = $ this -> createSession ( $ user... | Authenticates a user by basic authentication |
239,135 | protected function resolveIdentity ( $ username , $ accountId ) { $ identitySeed = $ this -> getServiceBroker ( ) -> service ( 'User' ) -> resolveIdentity ( $ username ) ; $ accountIds = isset ( $ identitySeed [ 'accountIds' ] ) ? $ identitySeed [ 'accountIds' ] : [ ] ; if ( in_array ( $ accountId , $ accountIds ) ) { ... | Resolve identity based on username |
239,136 | protected function prepareIdentity ( $ identitySeed ) { $ this -> getServiceBroker ( ) -> service ( 'Identity' ) -> setIdentity ( $ identitySeed ) ; $ identity = $ this -> getServiceBroker ( ) -> service ( 'Identity' ) -> getIdentity ( ) ; $ this -> getServiceBroker ( ) -> setDefaultIdentity ( $ identity ) ; return $ i... | Build new identity from identity seed |
239,137 | public static function validateServiceName ( $ serviceName ) { if ( ! in_array ( $ serviceName , self :: getAvailableServices ( ) ) ) { throw new DomainException ( sprintf ( "Notification service '%s' is not supported." , $ serviceName ) ) ; } return $ serviceName ; } | Checks if notification service is supported |
239,138 | protected function _typesNice ( ) { $ enumValues = singleton ( "SilverStripe\SiteConfig\SiteConfig" ) -> dbObject ( "Type" ) -> enumValues ( ) ; $ values = array ( ) ; foreach ( $ enumValues as $ enumValue ) { $ values [ $ enumValue ] = _t ( "SiteInfo.TYPE" . strtoupper ( $ enumValue ) , $ enumValue ) ; } return $ valu... | Add translated labels for the dropdown field |
239,139 | public function incrementByPk ( $ primary_key , $ keys , $ step = 1 ) { if ( $ this -> is_single ) { return $ this -> incrementOrDecrementByPk ( $ primary_key , $ keys , $ step ) ; } return false ; } | Increase key or keys by primary key |
239,140 | public function decrementByPk ( $ primary_key , $ keys , $ step = 1 ) { if ( $ this -> is_single ) { return $ this -> incrementOrDecrementByPk ( $ primary_key , $ keys , $ step , self :: MINUS_NOTIFICATION ) ; } return false ; } | Decrease key or keys by primary key |
239,141 | public function incrementOrDecrementByPk ( $ primary_key , $ keys , $ steps = 1 , $ op = self :: PLUS_NOTIFICATION ) { if ( $ this -> is_single ) { $ values = [ ] ; if ( is_array ( $ keys ) ) { foreach ( $ keys as $ k => $ key ) { if ( is_array ( $ steps ) && isset ( $ steps [ $ k ] ) ) { $ values [ $ key ] = [ $ op =>... | Increase or decrease key or keys by primary key |
239,142 | public function locateAlong ( LinearReferenceOpEvent $ evt ) { $ geometry = $ evt -> getGeometry ( ) ; $ this -> validGeometry ( $ geometry ) ; $ mValue = $ evt [ 'mValue' ] ; $ offset = $ evt [ 'offset' ] ; try { $ results = $ this -> getLocateAlong ( $ geometry , $ mValue , $ offset ) ; $ evt -> setResults ( $ result... | Gets the derived geometry collection with elements that match the specified measure . |
239,143 | public function locateBetween ( LinearReferenceOpEvent $ evt ) { $ geometry = $ evt -> getGeometry ( ) ; $ this -> validGeometry ( $ geometry ) ; $ mStart = $ evt [ 'mStart' ] ; $ mEnd = $ evt [ 'mEnd' ] ; $ offset = $ evt [ 'offset' ] ; try { $ results = $ this -> getLocateBetween ( $ geometry , $ mStart , $ mEnd , $ ... | Gets the derived geometry collection with elements that match the specified range of measured inclusively . |
239,144 | public function apply ( $ testable , array $ config = array ( ) ) { $ tokens = $ testable -> tokens ( ) ; $ message = 'Weak comparison operator {:key} used, try {:value} instead' ; $ filtered = $ testable -> findAll ( array_keys ( $ this -> inspectableTokens ) ) ; foreach ( $ filtered as $ id ) { $ token = $ tokens [ $... | Will iterate over each line checking if any weak comparison operators are used within the code . |
239,145 | protected function addFindersByConfigs ( array $ configs ) : self { foreach ( $ configs as $ package => $ path ) { $ data = @ include $ path ; if ( $ data && isset ( $ data [ 'easy-extend' ] ) ) { $ config = $ data [ 'easy-extend' ] ; if ( $ config ) { if ( isset ( $ config [ 'finder' ] ) ) { $ finder_callbacks = $ con... | Add finders by configs |
239,146 | protected function getConfigFilesByComposer ( ) : array { $ this -> getLogger ( ) -> write ( '<info>Searching for ".apishka" files</info>' ) ; if ( $ this -> getEvent ( ) === null ) throw new \ LogicException ( 'Event not exists' ) ; $ configs = array ( ) ; if ( $ this -> isDependantPackage ( $ this -> getEvent ( ) -> ... | Get config files by composer |
239,147 | protected function getConfigPackagePath ( string $ dir , PackageInterface $ package ) : ? string { $ dir = preg_replace ( '#^(' . preg_quote ( getcwd ( ) . DIRECTORY_SEPARATOR , '#' ) . ')#' , '.' . DIRECTORY_SEPARATOR , $ dir ) ; $ path = $ this -> getConfigPath ( $ dir ) ; if ( file_exists ( $ path ) ) { $ this -> ge... | Get config package file path |
239,148 | protected function boundsCheck ( ) { $ scores = $ this -> bitrank -> getScores ( ) ; if ( $ this -> score > $ scores -> max ) { $ this -> score = $ scores -> max ; } if ( $ this -> score < $ scores -> min ) { $ this -> score = $ scores -> min ; } } | Ensure score is within bounds |
239,149 | public function getFlagsOfType ( $ type ) { if ( $ this -> flags === null ) { return [ ] ; } $ matches = [ ] ; foreach ( $ this -> flags as $ flag ) { if ( $ flag -> type == $ type ) { $ matches [ ] = $ flag ; } } return $ matches ; } | Returns flags of the specified type associated with this address if any . |
239,150 | public function hasFlagsOfType ( $ type ) { if ( $ this -> flags === null ) { return false ; } foreach ( $ this -> flags as $ flag ) { if ( $ flag -> type == $ type ) { return true ; } } return false ; } | Returns whether or not this address has any flags of type . |
239,151 | protected function taskSymlinkFolderFileContents ( $ source , $ destination , Finder $ finder = null ) { return $ this -> task ( SymlinkFolderFileContents :: class , $ source , $ destination , $ finder ) ; } | Creates a SymlinkFolderFileContents task . |
239,152 | public function reset ( ) { $ this -> oosql_limit = null ; $ this -> oosql_order = null ; $ this -> oosql_where = null ; $ this -> oosql_join = null ; $ this -> oosql_stmt = null ; $ this -> oosql_conValues = array ( ) ; $ this -> oosql_numargs = null ; $ this -> oosql_fromFlag = false ; $ this -> oosql_multiFlag = fal... | Resets the class vars to their initial values for a new query |
239,153 | protected function sql ( $ sql = null , $ replace = false ) { if ( null !== $ sql ) { if ( ! isset ( $ this -> oosql_sql [ $ this -> oosql_table ] ) || $ replace ) { $ this -> oosql_sql [ $ this -> oosql_table ] = $ sql ; } else { $ this -> oosql_sql [ $ this -> oosql_table ] .= $ sql ; } return ; } return $ this -> oo... | Append to the query string or return the current one |
239,154 | public function select ( ) { self :: $ instance -> reset ( ) ; $ this -> sql ( 'SELECT ' ) ; if ( $ this -> oosql_distinct ) { $ this -> sql ( 'DISTINCT ' ) ; } $ numargs = func_num_args ( ) ; if ( $ numargs > 0 ) { $ arg_list = func_get_args ( ) ; $ this -> oosql_fields = $ arg_list ; for ( $ i = 0 ; $ i < $ numargs ;... | Create a select statement |
239,155 | public function getFields ( $ table = null ) { if ( null == $ table ) { $ table = $ this -> oosql_table ; } $ newFields = array ( ) ; foreach ( $ this -> oosql_fields as $ field ) { $ newFields [ ] = $ table . '.' . $ field ; } return $ newFields ; } | Get an array of fields of the current or given table |
239,156 | public function insert ( ) { self :: $ instance -> reset ( ) ; $ this -> sql ( 'INSERT INTO ' . $ this -> oosql_table ) ; $ arg_list = func_get_args ( ) ; $ numargs = func_num_args ( ) ; if ( $ numargs > 0 ) { $ this -> oosql_numargs = $ numargs ; $ this -> sql ( ' (' ) ; $ this -> sql ( implode ( ',' , $ arg_list ) ) ... | Creates an INSERT query |
239,157 | public function update ( ) { self :: $ instance -> reset ( ) ; $ this -> sql ( 'UPDATE' ) ; $ numargs = func_num_args ( ) ; if ( $ numargs > 0 ) { $ arg_list = func_get_args ( ) ; $ this -> oosql_multiFlag = true ; $ this -> oosql_multi = $ arg_list ; for ( $ i = 0 ; $ i < $ numargs ; $ i ++ ) { if ( $ i != 0 && $ numa... | Creates an UPDATE query |
239,158 | public function delete ( ) { self :: $ instance -> reset ( ) ; $ this -> sql ( 'DELETE' ) ; $ this -> oosql_where = null ; $ numargs = func_num_args ( ) ; if ( $ numargs > 0 ) { if ( $ numargs > 1 ) { $ this -> oosql_del_multiFlag = true ; $ this -> oosql_del_numargs = $ numargs ; } $ arg_list = func_get_args ( ) ; if ... | Creates a DELETE query |
239,159 | public function deleteRecord ( $ oosql = null , array $ criteria ) { if ( null == $ oosql ) { $ oosql = $ this ; } $ oosql -> delete ( ) -> createWhere ( $ criteria ) -> exe ( ) ; return $ this ; } | Delete a record or more from a table |
239,160 | public function set ( array $ data ) { $ sql = '' ; foreach ( $ data as $ field => $ value ) { $ sql .= $ field . ' = ?,' ; $ this -> oosql_conValues [ ] = $ value ; } $ this -> sql ( rtrim ( $ sql , ',' ) ) ; return $ this ; } | Sets the column value pairs in update queries |
239,161 | public function values ( ) { $ arg_list = func_get_args ( ) ; $ numargs = func_num_args ( ) ; if ( ( $ this -> oosql_numargs !== 0 && $ numargs !== $ this -> oosql_numargs ) || $ numargs === 0 ) { $ msg = 'Insert numargs: ' . $ this -> oosql_numargs . ' | values numargs = ' . $ numargs . ', Columns and passed data do n... | Assembles values part of an insert |
239,162 | public function from ( ) { $ from = '' ; $ numargs = func_num_args ( ) ; if ( $ this -> oosql_del_multiFlag ) { if ( $ numargs < $ this -> oosql_del_numargs ) { $ msg = 'Columns and passed data do not match! ' . $ this -> sql ( ) ; throw new \ Exception ( $ msg , 9810 , null ) ; } } $ from .= ' FROM ' ; $ from .= $ thi... | Assembles the FROM part of the query |
239,163 | public function where ( $ condition , $ value = null , $ type = null ) { switch ( $ type ) { case null : $ clause = 'WHERE' ; break ; case 'or' : $ clause = 'OR' ; break ; case 'and' : $ clause = 'AND' ; break ; default : $ clause = 'WHERE' ; } $ this -> oosql_where .= " $clause $condition" ; if ( $ value instanceof oo... | Assembles a WHERE clause |
239,164 | public function sub ( ) { $ this -> oosql_sub = true ; $ this -> exe ( ) ; $ this -> sql ( '(' . $ this -> getSql ( ) . ')' , true ) ; return $ this ; } | Declares current query as a sub - query |
239,165 | public function prep ( $ values = null ) { $ hash = $ this -> queryHash ( ) ; $ prepOnly = true ; if ( is_array ( $ values ) ) { $ prepOnly = false ; } if ( $ this -> oosql_prepParams ) { $ this -> oosql_stmt = $ this -> prepare ( trim ( $ this -> sql ( ) ) , $ this -> oosql_prepParams ) ; } else { $ this -> oosql_stmt... | Prepare a query statement |
239,166 | public function execBound ( \ PDOStatement $ stmt , array $ values ) { $ ord = 1 ; foreach ( $ values as $ val ) { if ( is_bool ( $ val ) ) { $ stmt -> bindValue ( $ ord , $ val , \ PDO :: PARAM_BOOL ) ; } elseif ( is_resource ( $ val ) ) { $ stmt -> bindValue ( $ ord , $ val , \ PDO :: PARAM_LOB ) ; } elseif ( ( strin... | Executes a prepared statement with parameterized values |
239,167 | public function exe ( ) { if ( $ this -> oosql_fromFlag ) { $ this -> from ( ) ; } if ( null != $ this -> oosql_join ) { $ this -> sql ( $ this -> oosql_join ) ; } if ( null != $ this -> oosql_where ) { $ this -> sql ( $ this -> oosql_where ) ; } if ( null != $ this -> oosql_in ) { $ this -> sql ( $ this -> oosql_in ) ... | Checks flags and clauses then assembles and executes the query |
239,168 | protected function prepFetch ( ) { if ( $ this -> oosql_sub ) { return $ this ; } if ( ! $ this -> oosql_select instanceof oosql ) { $ this -> select ( ) ; } $ this -> oosql_select -> exe ( ) ; if ( ! $ this -> oosql_stmt ) { $ msg = 'Query returned no results! ' . $ this -> sql ( ) ; throw new \ Exception ( $ msg , 98... | Returns the results of a SELECT if any |
239,169 | public function with ( array $ related ) { $ relations = $ this -> getEntityObject ( ) -> getRelations ( ) ; foreach ( $ relations as $ fk => $ target ) { $ table = strstr ( $ target , '.' , true ) ; if ( in_array ( $ table , $ related ) ) { $ this -> sql ( " ,$table.*" ) ; $ this -> join ( $ table , "$this->oosql_tabl... | Creates a join automatically based on the relationships of current entity |
239,170 | public function limit ( $ from , $ size ) { if ( ! $ this -> oosql_multiFlag ) { $ this -> oosql_limit = ' LIMIT ' . $ from . ', ' . $ size ; } return $ this ; } | Creates a limit clause for MySQL |
239,171 | public function orderBy ( $ field , $ dir = 'ASC' ) { if ( ! $ this -> oosql_multiFlag ) { $ this -> oosql_order = ' ORDER BY ' . $ field . ' ' . $ dir ; } return $ this ; } | Creates an ORDER BY clause |
239,172 | public function findOne ( $ arg = null , $ operator = '=' , $ fields = array ( '*' ) ) { return $ this -> find ( $ arg , $ operator , $ fields ) -> limit ( 0 , 1 ) ; } | Find first random value returned by the query |
239,173 | public function findLimited ( $ from , $ to , $ arg = null , $ operator = '=' , $ fields = array ( '*' ) ) { return $ this -> find ( $ arg , $ operator , $ fields ) -> limit ( $ from , $ to ) ; } | Find with limit |
239,174 | public function find ( $ arg = null , $ operator = '=' , $ fields = array ( '*' ) ) { if ( $ fields [ 0 ] == '*' ) { $ this -> select ( ) ; } else { $ select_args = '' ; foreach ( $ fields as $ key => $ field ) { if ( is_array ( $ field ) && is_string ( $ key ) ) { foreach ( $ field as $ part ) { $ select_args .= $ key... | Find records with a filtering condition |
239,175 | public function alias ( $ alias = null ) { if ( null === $ alias ) { $ alias = $ this -> getTableAlias ( ) ; } $ this -> oosql_table_alias = $ alias ; return $ this ; } | Creates or bind provided alias with the current loaded table class |
239,176 | public function notIn ( $ item , array $ list , $ cond = null , $ not = true ) { return $ this -> in ( $ item , $ list , $ cond , $ not ) ; } | Creates a NOT IN clause |
239,177 | public function orIn ( $ item , array $ list , $ cond = 'or' , $ not = false ) { return $ this -> in ( $ item , $ list , $ cond , $ not ) ; } | Creates a OR IN clause |
239,178 | public function orNotIn ( $ item , array $ list , $ cond = 'or' , $ not = true ) { return $ this -> in ( $ item , $ list , $ cond , $ not ) ; } | Creates an OR NOT IN clause |
239,179 | public function in ( $ item , array $ list , $ cond = null , $ not = false ) { $ inClause = '' ; if ( null == $ this -> oosql_where && null == $ this -> oosql_in && null == $ this -> oosql_between ) { $ inClause .= ' WHERE ' ; } else { $ cnd = ' AND ' ; if ( null != $ cond ) { if ( strtolower ( $ cond ) == 'or' ) { $ c... | Creates an IN clause |
239,180 | public function between ( $ item , $ low , $ up , $ cond = null , $ not = false ) { $ bClause = '' ; if ( null == $ this -> oosql_where && null == $ this -> oosql_between && null == $ this -> oosql_in ) { $ bClause .= ' WHERE ' ; } else { $ cnd = ' AND ' ; if ( null != $ cond ) { if ( strtolower ( $ cond ) == 'or' ) { ... | Creates a BETWEEN clause |
239,181 | public static function transactional ( $ fn ) { $ oosql = self :: getInstance ( 'oosql' , 'void' ) ; if ( ! $ oosql -> beginTransaction ( ) ) { $ msg = 'Could not start this transaction. BeginTransaction failed!' ; throw new \ Exception ( $ msg , 9815 , null ) ; } if ( is_callable ( $ fn ) ) { $ ret = $ fn ( $ oosql ) ... | Starts a transaction if current driver supports it |
239,182 | public function getNamedLock ( $ name , $ timeout = 15 ) { $ stmt = $ this -> query ( 'SELECT GET_LOCK("' . $ name . '", ' . $ timeout . ')' ) ; return $ stmt -> fetch ( self :: FETCH_COLUMN ) ; } | Try to obtain a named lock |
239,183 | public function releaseNamedLock ( $ name ) { $ stmt = $ this -> query ( 'SELECT RELEASE_LOCK("' . $ name . '")' ) ; return $ stmt -> fetch ( self :: FETCH_COLUMN ) ; } | releases a named lock |
239,184 | public function packPayload ( $ payload ) { $ payload = JsonEncoder :: jsonEncode ( $ payload ) ; $ message = $ this -> message ; $ recipientId = $ message -> getRecipientDeviceCollection ( ) -> current ( ) -> getIdentifier ( ) ; $ messageRecipientId = $ this -> notificationId . '_' . $ recipientId ; $ packedPayload = ... | Pack message body into binary string |
239,185 | public static function set ( $ uri , $ path = false ) { $ route = new \ Ginger \ Route ( $ uri , $ path ) ; self :: $ routes [ $ route -> route ] = $ route ; } | set function . |
239,186 | public static function detect ( $ uri ) { $ routes = self :: get ( ) ; $ found = false ; foreach ( $ routes as $ key => $ route ) { $ currentLength = strlen ( $ route -> route ) ; if ( substr ( $ uri , 0 , $ currentLength ) == $ route -> route ) { $ found = $ route ; break ; } } return $ found ; } | detect function . |
239,187 | private function _lookUpBy ( $ service , $ data ) { $ batch = false ; $ urlFormat = self :: $ URLS [ $ service ] ; if ( is_array ( $ data ) ) { $ data = implode ( ',' , $ data ) ; $ batch = true ; } $ url = self :: BASE_URL . sprintf ( $ urlFormat , urlencode ( $ data ) ) . sprintf ( self :: API_KEY , $ this -> _apiKey... | Looks up an user using the given service data . |
239,188 | private function _checkdatabase ( $ database ) { if ( count ( $ this -> _collection ) == 0 ) { $ this -> _collection [ $ database ] = new $ database ( ) ; return $ this -> _collection [ $ database ] ; } $ new = false ; foreach ( $ this -> _collection as $ db ) { if ( $ db === $ database ) continue ; $ new = true ; } if... | checks if a database already exists |
239,189 | protected function getPossibleEmails ( ) { $ this -> checkGit ( ) ; $ github_email = null ; $ github_email = str_replace ( array ( "\r" , "\n" ) , '' , shell_exec ( 'git config user.email' ) ) ; if ( filter_var ( $ github_email , FILTER_VALIDATE_EMAIL ) ) { return [ $ github_email ] ; } else { return [ ] ; } } | Get possible emails |
239,190 | protected function createMySQLUser ( ) { $ this -> checkParameters ( ) ; $ this -> url = $ this -> obtainAPIURLEndpoint ( ) ; $ this -> http -> post ( $ this -> url , [ 'form_params' => $ this -> getData ( ) , 'headers' => [ 'X-Requested-With' => 'XMLHttpRequest' , 'Authorization' => 'Bearer ' . fp_env ( 'ACACHA_FORGE_... | Create MySQL user . |
239,191 | protected function listMySQLUsers ( ) { $ this -> url = $ this -> obtainAPIURLEndpointForList ( ) ; $ response = $ this -> http -> get ( $ this -> url , [ 'headers' => [ 'X-Requested-With' => 'XMLHttpRequest' , 'Authorization' => 'Bearer ' . fp_env ( 'ACACHA_FORGE_ACCESS_TOKEN' ) ] ] ) ; $ users = json_decode ( $ respo... | List MySQL users . |
239,192 | protected function addValueToEnv ( $ key , $ value ) { $ env_path = base_path ( '.env' ) ; $ sed_command = "/bin/sed -i '/^$key=/d' " . $ env_path ; passthru ( $ sed_command ) ; File :: append ( $ env_path , "\n$key=$value\n" ) ; } | Add value to env . |
239,193 | public function Anchor ( ) { if ( $ this -> MenuTitle && $ this -> ShowInMenus ) { return strtolower ( trim ( preg_replace ( '/[^a-zA-Z0-9]+/' , '-' , $ this -> MenuTitle ) , '-' ) ) ; } return false ; } | Applies anchor to section in template . |
239,194 | public function Classes ( ) { $ classes = array ( $ this -> config ( ) -> get ( 'base_class' ) ) ; if ( $ this -> Style ) { $ classes [ ] = strtolower ( $ this -> Style ) . '-' . strtolower ( preg_replace ( '/([a-z]+)([A-Z0-9])/' , '$1-$2' , get_called_class ( ) ) ) ; } else { $ classes [ ] = strtolower ( preg_replace ... | Applies classes to section in template . |
239,195 | static function write_json_file ( $ filename , $ json_array , array $ whitelist = null , $ json_options = null ) { $ stop_snippet = "<?php printf('_%c%c}%c',34,10,10);__halt_compiler();?>" ; if ( $ whitelist === null ) { $ result = array_merge ( array ( '_' => null ) , $ json_array ) ; } else { $ header = array_interse... | Encode array to JSON using json_encode but insert PHP snippet to protect sensitive data . |
239,196 | public function filterLoad ( AssetInterface $ asset ) { $ assetRoot = $ asset -> getSourceRoot ( ) ; $ assetPath = $ asset -> getSourcePath ( ) ; $ assetImportDir = dirname ( $ assetRoot . '/' . $ assetPath ) ; $ importDir = $ this -> config -> getBootstrapPath ( ) . '/less' ; $ this -> setupLoadPaths ( $ assetImportDi... | Sets the by - config generated imports on the asset . |
239,197 | protected function extractImports ( $ importsFile ) { $ str = file_get_contents ( $ importsFile ) ; preg_match_all ( '/@import "(?!variables)(?<imports>[\w-_\.]+)";/' , $ str , $ matches ) ; return array_map ( 'trim' , $ matches [ 'imports' ] ) ; } | Extract the imports from the import file . |
239,198 | protected function extractVariables ( $ variablesFile ) { $ str = file_get_contents ( $ variablesFile ) ; $ parts = explode ( ';' , preg_replace ( '/(\/\/.*?\n|\s\n|\s{2,})/' , '' , $ str ) ) ; $ vars = array ( ) ; foreach ( $ parts as $ part ) { $ varMeta = explode ( ':' , $ part ) ; if ( empty ( $ varMeta [ 0 ] ) || ... | Extract the variables from the less file . |
239,199 | protected function filterImportFiles ( array $ imports ) { $ config = $ this -> config ; $ excludedComponents = $ config -> getExcludedComponents ( ) ; $ includedComponents = $ config -> getIncludedComponents ( ) ; if ( ! empty ( $ excludedComponents ) && ! empty ( $ includedComponents ) ) { throw new Exception \ Runti... | Filter the import files needed . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.