idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
12,300 | protected function _insert ( array $ data ) { $ data = $ this -> _setData ( $ data ) ; $ sql = Sql :: createSql ( $ this -> getAdapter ( ) ) -> insert ( $ this -> getTableName ( ) ) ; $ event = new Save ( [ 'action' => Save :: INSERT , 'data' => $ data , 'abort' => false ] ) ; $ this -> getEventManager ( ) -> trigger (... | Inserts a new record in the database |
12,301 | protected function _update ( array $ data ) { $ data = $ this -> _setData ( $ data ) ; $ pmk = $ this -> getPrimaryKey ( ) ; unset ( $ data [ $ pmk ] ) ; $ sql = Sql :: createSql ( $ this -> getAdapter ( ) ) -> update ( $ this -> getTableName ( ) ) ; $ event = new Save ( [ 'action' => Save :: UPDATE , 'data' => $ data ... | Updated current entity or data |
12,302 | protected function _setData ( array $ data ) { $ pmk = $ this -> getPrimaryKey ( ) ; if ( ! empty ( $ data ) ) { if ( ! isset ( $ data [ $ pmk ] ) && ! is_null ( $ this -> $ pmk ) ) { $ data [ $ pmk ] = $ this -> $ pmk ; } return $ data ; } $ columns = Manager :: getInstance ( ) -> get ( $ this ) -> getColumns ( ) ; fo... | Sets the data to be saved |
12,303 | public function asArray ( ) { $ data = [ ] ; $ columns = Manager :: getInstance ( ) -> get ( $ this ) -> getColumns ( ) ; foreach ( array_keys ( $ columns ) as $ field ) { $ data [ trim ( $ field , '_' ) ] = $ this -> $ field ; } $ relations = Manager :: getInstance ( ) -> get ( $ this ) -> getRelations ( ) ; foreach (... | Recursively returns this entity as an array . Used in json and serialization processes . |
12,304 | public function renderEvent ( Event $ event ) { $ parts = array_map ( 'ucfirst' , array_filter ( preg_split ( '/_|\./' , $ event -> name ) ) ) ; $ name = 'on' . implode ( $ parts ) ; if ( is_callable ( array ( $ this , $ name ) ) ) { return call_user_func ( array ( $ this , $ name ) , $ event ) ; } else { return null ;... | Conducts our event_group . action = > onEventGroupAction delegation |
12,305 | public function transliterate ( $ str , $ system = null ) { if ( is_null ( $ system ) ) { $ system = $ this -> system ; } if ( is_null ( $ system ) ) { throw new RuntimeException ( "Transliteration system is not defined" ) ; } return $ system -> transliterate ( $ str ) ; } | Transliterate a string from an alphabet into another alphabet . |
12,306 | public function getDefinition ( $ entryName ) { $ definition = new ObjectDefinition ( $ entryName , $ this -> _className ) ; $ definition -> setMethods ( $ this -> _methods ) -> setProperties ( $ this -> _properties ) -> setScope ( $ this -> _scope ) ; if ( $ this -> _constructor ) { $ definition -> setConstructor ( $ ... | Returns an object definition |
12,307 | public function method ( $ name , array $ parameters = [ ] ) { $ this -> _methods [ $ name ] = new MethodInjection ( $ name , $ parameters ) ; return $ this ; } | Defines a method injection |
12,308 | public function property ( $ name , $ value ) { $ this -> _properties [ $ name ] = new PropertyInjection ( $ name , $ value ) ; return $ this ; } | Defines a property injection |
12,309 | public function run ( ) { $ this -> emit ( 'suite.start' , array ( 'suite' => $ this -> suite , 'result_set' => $ this -> result_set ) ) ; $ result = $ this -> captureAround ( array ( $ this , 'runGroup' ) , $ this -> suite , $ this -> suite ) ; $ this -> emit ( 'suite.complete' , array ( 'suite' => $ this -> suite , '... | Runs the Suite from start to finish . |
12,310 | protected function isFiltered ( Block $ block ) { if ( $ block instanceof Suite ) { return false ; } $ options = & $ this -> options ; $ isFiltered = function ( $ block ) use ( & $ options ) { $ filtered = false ; if ( $ options [ 'grep' ] ) { $ filtered = $ filtered || preg_match ( $ options [ 'grep' ] , $ block -> pa... | Checks if the block or any of it s descendants match our grep filter or do not match our except filter . |
12,311 | public function getForeground ( $ name ) { if ( array_key_exists ( $ name , $ this -> foreground ) ) { return $ this -> foreground [ $ name ] ; } return false ; } | Gets a foreground color code by its name |
12,312 | public function getBackground ( $ name ) { if ( array_key_exists ( $ name , $ this -> background ) ) { return $ this -> background [ $ name ] ; } return false ; } | Gets a background color code by its name |
12,313 | public function compute ( DecimalNumber $ a , DecimalNumber $ b , $ precision = self :: DEFAULT_PRECISION ) { if ( function_exists ( 'bcdiv' ) ) { return $ this -> computeUsingBcMath ( $ a , $ b , $ precision ) ; } return $ this -> computeWithoutBcMath ( $ a , $ b , $ precision ) ; } | Performs the division . |
12,314 | public function computeUsingBcMath ( DecimalNumber $ a , DecimalNumber $ b , $ precision = self :: DEFAULT_PRECISION ) { if ( ( string ) $ b === '0' ) { throw new DivisionByZeroException ( ) ; } return new DecimalNumber ( ( string ) bcdiv ( $ a , $ b , $ precision ) ) ; } | Performs the division using BC Math |
12,315 | public function computeWithoutBcMath ( DecimalNumber $ a , DecimalNumber $ b , $ precision = self :: DEFAULT_PRECISION ) { $ bString = ( string ) $ b ; if ( '0' === $ bString ) { throw new DivisionByZeroException ( ) ; } $ aString = ( string ) $ a ; if ( '0' === $ aString ) { return $ a ; } if ( '1' === $ bString ) { r... | Performs the division without BC Math |
12,316 | private function integerDivision ( DecimalNumber $ a , DecimalNumber $ b , $ precision ) { $ dividend = $ a -> getCoefficient ( ) ; $ divisor = new DecimalNumber ( $ b -> getCoefficient ( ) ) ; $ dividendLength = strlen ( $ dividend ) ; $ result = '' ; $ exponent = 0 ; $ currentSequence = '' ; for ( $ i = 0 ; $ i < $ d... | Computes the division between two integer DecimalNumbers |
12,317 | function categoryExist ( $ title ) { if ( self :: where ( 'title' , $ title ) -> where ( 'model_type' , $ this -> modelType ) -> first ( ) ) return true ; return false ; } | check category exist |
12,318 | function child ( $ depth = null ) { if ( $ depth == null ) return self :: where ( 'parent' , $ this -> attributes [ 'id' ] ) -> get ( ) ; else return self :: where ( 'parent' , $ this -> attributes [ 'id' ] ) -> where ( 'depth' , $ depth ) -> get ( ) ; } | get category child with depth |
12,319 | function getCategory ( $ id ) { if ( is_numeric ( $ id ) ) $ model = self :: where ( 'id' , $ id ) -> select ( ) ; else $ model = self :: where ( 'slug' , $ id ) -> select ( ) ; $ model -> where ( 'model_type' , $ this -> modelType ) ; return $ model -> first ( ) ; } | get category with id |
12,320 | public function join ( $ table , $ on , $ fields = [ '*' ] , $ alias = null , $ type = Join :: JOIN_LEFT ) { $ join = new Join ( $ table , $ on , $ fields , $ type ) ; if ( ! is_null ( $ alias ) ) { $ join -> setAlias ( $ alias ) ; } $ this -> _joins [ ] = $ join ; return $ this ; } | Adds a join table to the select query |
12,321 | public function limit ( $ rows , $ offset = 0 ) { $ this -> _limit = $ rows ; $ this -> _offset = $ offset ; return $ this ; } | Sets query limit and offset |
12,322 | public function innerJoin ( $ join , $ on = null ) { $ this -> getJoins ( ) -> innerJoin ( $ join , $ on ) ; return $ this ; } | Adds INNER JOIN to the query |
12,323 | public function leftJoin ( $ join , $ on = null ) { $ this -> getJoins ( ) -> leftJoin ( $ join , $ on ) ; return $ this ; } | Adds LEFT JOIN to the query |
12,324 | public function where ( $ conditions , $ value = null , $ operator = '=' ) { if ( is_array ( $ conditions ) ) { $ this -> getWhere ( ) -> addConditions ( $ conditions ) ; } else { $ this -> getWhere ( ) -> addCondition ( $ conditions , $ value , $ operator ) ; } return $ this ; } | Add conditions I . E . |
12,325 | public function limit ( $ limit , $ offset = null ) { if ( $ offset ) { $ this -> getLimit ( ) -> setParams ( array ( $ limit , $ offset ) ) ; } else { $ this -> getLimit ( ) -> setParams ( array ( $ limit ) ) ; } return $ this ; } | Add limit I . E . |
12,326 | public function getWhereStatement ( ) { if ( empty ( $ this -> where ) ) { return false ; } $ this -> where [ 0 ] [ 'operation' ] = null ; $ str = '' ; foreach ( $ this -> where as $ clause ) { $ str .= trim ( "{$clause['operation']} {$clause['condition']}" ) ; $ str .= " " ; } return trim ( $ str ) ; } | Returns the where statement for sql |
12,327 | public function getStatement ( ) { return $ this -> _fixBlanks ( trim ( str_replace ( array ( '<fields>' , '<joinFields>' , '<tableName>' , '<joins>' , '<where>' , '<groupBy>' , '<orderBy>' , '<limit>' ) , array ( $ this -> getFields ( ) , $ this -> getJoinFields ( ) , $ this -> _sql -> getTableName ( ) , $ this -> get... | Returns the SQL query string for current Select SQL Object |
12,328 | public function getFields ( ) { $ joins = $ this -> _sql -> getJoins ( ) ; $ fields = $ this -> _sql -> getFields ( ) ; if ( ! is_array ( $ fields ) ) { return $ fields ; } if ( count ( $ joins ) > 0 && $ this -> _sql -> prefixTableName ) { $ table = $ this -> _sql -> getTableName ( ) ; foreach ( $ fields as $ key => $... | Returns the field list from Select object |
12,329 | public function getJoinFields ( ) { $ fields = null ; $ tmpFields = array ( ) ; $ joins = $ this -> _sql -> getJoins ( ) ; if ( count ( $ joins ) > 0 ) { foreach ( $ joins as $ join ) { $ tmpJoin = array ( ) ; foreach ( $ join [ 'fields' ] as $ field ) { $ tmpJoin [ ] = "{$join['table']}.{$field}" ; } $ str = implode (... | Returns the join fields for this query |
12,330 | public function getJoins ( ) { $ template = "%s JOIN %s ON %s" ; $ joinsStr = null ; $ joins = $ this -> _sql -> getJoins ( ) ; $ tmpJoin = array ( ) ; if ( count ( $ joins ) > 0 ) { foreach ( $ joins as $ join ) { $ tmpJoin [ ] = sprintf ( $ template , $ join [ 'type' ] , $ join [ 'table' ] , $ join [ 'onClause' ] ) ;... | Returns the JOIN clauses for this query |
12,331 | public function getWhere ( ) { $ template = "WHERE %s" ; $ where = null ; if ( count ( $ this -> _sql -> conditions -> predicates ) > 0 ) { $ where = trim ( sprintf ( $ template , $ this -> _sql -> conditions -> toString ( ) ) ) ; } return $ where ; } | Returns the WHERE clause for this query |
12,332 | public function getOrderBy ( ) { $ template = "ORDER BY %s" ; $ orderBy = null ; if ( ! is_null ( $ this -> _sql -> orderBy ) ) { $ orderBy = trim ( sprintf ( $ template , $ this -> _sql -> getOrderBy ( ) ) ) ; } return $ orderBy ; } | Returns the order by clause for this query |
12,333 | public function getGroupBy ( ) { $ template = "GROUP BY %s" ; $ groupBy = null ; if ( ! is_null ( $ this -> _sql -> groupBy ) ) { $ groupBy = trim ( sprintf ( $ template , $ this -> _sql -> getGroupBy ( ) ) ) ; } return $ groupBy ; } | Returns the group by clause for this query |
12,334 | protected function _fixBlanks ( $ str ) { $ lines = explode ( PHP_EOL , $ str ) ; $ clean = array ( ) ; foreach ( $ lines as $ line ) { if ( trim ( $ line ) != "" ) { $ clean [ ] = $ line ; } } return implode ( PHP_EOL , $ clean ) ; } | Removes the blank lines in the query string |
12,335 | public function withAttribute ( string $ name , $ value ) : self { return new self ( $ this -> decoratedResponse , $ this -> unformattedContent , [ $ name => $ value ] + $ this -> attributes ) ; } | Returns an instance with the specified attribute |
12,336 | public function isValid ( ) { $ filtered = $ this -> getValue ( ) ; $ valid = $ this -> getValidatorChain ( ) -> isValid ( $ filtered ) ; $ this -> _messages = $ this -> getValidatorChain ( ) -> getMessages ( ) ; return $ valid ; } | Returns true if and only if the values passes all chain validation |
12,337 | public function getValue ( ) { if ( is_null ( $ this -> _filtered ) ) { $ this -> _filtered = $ this -> getFilterChain ( ) -> filter ( $ this -> _value ) ; } return $ this -> _filtered ; } | Retrieves the input value |
12,338 | public function onDelete ( Delete $ event ) { if ( $ this -> isDependent ( ) ) { $ class = $ this -> getRelatedEntity ( ) ; $ entity = new $ class ( ) ; $ fkField = $ this -> getForeignKey ( ) ; $ pmk = $ event -> getTarget ( ) -> getPrimaryKey ( ) ; $ sql = Sql :: createSql ( $ entity -> getAdapter ( ) ) -> delete ( $... | Runs before delete on entity event and deletes the children records on related entity . |
12,339 | public function init ( ) { parent :: init ( ) ; $ this -> db = Instance :: ensure ( $ this -> db , Connection :: className ( ) ) ; $ this -> db -> getCollection ( $ this -> itemTable ) -> createIndex ( [ 'name' => 1 ] , [ 'unique' => true ] ) ; $ this -> db -> getCollection ( $ this -> ruleTable ) -> createIndex ( [ 'n... | Initializes the application component . This method overrides the parent implementation by establishing the database connection . |
12,340 | public function getRoleAssigments ( $ roleName ) { $ query = ( new Query ) -> from ( $ this -> assignmentTable ) -> where ( [ 'item_name' => $ roleName ] ) ; $ assignments = [ ] ; foreach ( $ query -> all ( $ this -> db ) as $ row ) { $ assignments [ $ row [ 'user_id' ] ] = new Assignment ( [ 'userId' => $ row [ 'user_... | Return all user assigment information for the specified role |
12,341 | public function buildTreeRole ( $ item = NULL , $ roleList = [ ] ) { $ tree = [ ] ; $ allParents = [ ] ; if ( empty ( $ roleList ) ) $ roleList = $ this -> getRoles ( ) ; if ( $ item == NULL ) { $ childRoles = [ ] ; $ query = ( new Query ) -> select ( [ 'child' ] ) -> from ( $ this -> itemChildTable ) -> where ( [ ] ) ... | Build tree from item table |
12,342 | public function addConditions ( array $ conditions = array ( ) ) { foreach ( $ conditions as $ key => $ condition ) { if ( is_array ( $ condition ) ) { call_user_func_array ( array ( $ this , 'addCondition' ) , $ condition ) ; } elseif ( ! $ this -> getBuilder ( ) -> getHelper ( ) -> isNumber ( $ key ) ) { call_user_fu... | Add contitions to the statement I . E . |
12,343 | public function onAfterInit ( ) { self :: $ is_mobile = false ; $ config = SiteConfig :: current_site_config ( ) ; $ request = $ this -> owner -> getRequest ( ) ; if ( $ this -> owner -> redirectedTo ( ) ) { return ; } $ fullSite = $ request -> getVar ( 'fullSite' ) ; if ( is_numeric ( $ fullSite ) ) { $ fullSiteCookie... | Override the default behavior to ensure that if this is a mobile device or if they are on the configured mobile domain then they receive the mobile site . |
12,344 | public function requestedMobileSite ( ) { $ config = SiteConfig :: current_site_config ( ) ; if ( $ config -> MobileSiteType == 'Disabled' ) return false ; $ request = $ this -> owner -> getRequest ( ) ; $ fullSite = $ request -> getVar ( 'fullSite' ) ; if ( is_numeric ( $ fullSite ) ) { return ( $ fullSite == 0 ) ; } ... | Return whether the user is requesting the mobile site - either by query string or by saved cookie . Falls back to browser detection for first time visitors |
12,345 | public static function compare ( $ version ) { $ version = strtolower ( $ version ) ; $ version = preg_replace ( '/(\d)pr(\d?)/' , '$1a$2' , $ version ) ; return version_compare ( $ version , strtolower ( static :: VERSION ) ) ; } | Compare the provided version with current Slick version |
12,346 | public function handle ( $ path , $ algo = 'sha256' ) { if ( ! in_array ( $ algo , hash_algos ( ) ) ) { throw new \ InvalidArgumentException ( 'Hash algorithm ' . $ algo . ' is not supported' ) ; } $ stream = $ this -> filesystem -> readStream ( $ path ) ; if ( $ stream === false ) { return false ; } $ hc = hash_init (... | Returns hash value of given path using supplied hash algorithm |
12,347 | public function setDatabase ( string $ dbName ) : bool { $ this -> db -> exec ( 'USE ' . $ this -> quoter -> quoteName ( $ dbName ) . ';' ) ; return true ; } | Switch database . |
12,348 | public function getDatabases ( string $ like = null ) : array { $ sql = 'SHOW DATABASES;' ; if ( $ like !== null ) { $ sql = sprintf ( 'SHOW DATABASES WHERE `database` LIKE %s;' , $ this -> quoter -> quoteValue ( $ like ) ) ; } return $ this -> db -> queryValues ( $ sql , 'Database' ) ; } | Returns all databases . |
12,349 | public function createDatabase ( string $ dbName , string $ characterSet = 'utf8mb4' , string $ collate = 'utf8mb4_unicode_ci' ) : bool { $ sql = 'CREATE DATABASE %s CHARACTER SET %s COLLATE %s;' ; $ sql = vsprintf ( $ sql , [ $ this -> quoter -> quoteName ( $ dbName ) , $ this -> quoter -> quoteValue ( $ characterSet ... | Create a database . |
12,350 | public function useDatabase ( string $ dbName ) : bool { $ sql = sprintf ( 'USE %s;' , $ this -> quoter -> quoteName ( $ dbName ) ) ; $ result = $ this -> db -> exec ( $ sql ) ; return ( bool ) $ result ; } | Change the database . |
12,351 | public function getTables ( $ like = null ) : array { if ( $ like === null ) { $ sql = 'SELECT table_name FROM information_schema.tables WHERE table_schema = database()' ; } else { $ sql = sprintf ( 'SELECT table_name FROM information_schema.tables WHERE table... | Return all Tables from Database . |
12,352 | public function existTable ( string $ tableName ) : bool { [ $ dbName , $ tableName ] = $ this -> parseTableName ( $ tableName ) ; $ sql = 'SELECT table_name FROM information_schema.tables WHERE table_schema = %s AND table_name = %s;' ; $ sql = sprintf ( $ sql , $ dbName , $ tableName )... | Check if table exist . |
12,353 | protected function parseTableName ( string $ tableName ) : array { $ dbName = 'database()' ; if ( strpos ( $ tableName , '.' ) !== false ) { $ parts = explode ( '.' , $ tableName ) ; $ dbName = $ this -> quoter -> quoteValue ( $ parts [ 0 ] ) ; $ tableName = $ this -> quoter -> quoteValue ( $ parts [ 1 ] ) ; } else { $... | Split table into dbname and table name . |
12,354 | public function dropTable ( string $ tableName ) : bool { $ this -> db -> exec ( sprintf ( 'DROP TABLE IF EXISTS %s;' , $ this -> quoter -> quoteName ( $ tableName ) ) ) ; return true ; } | Delete a table . |
12,355 | public function clearTable ( string $ tableName ) : bool { $ delete = new DeleteQuery ( $ this -> db ) ; return $ delete -> from ( $ tableName ) -> execute ( ) ; } | Clear table content . Delete all rows . |
12,356 | public function renameTable ( string $ from , string $ to ) : bool { $ from = $ this -> quoter -> quoteName ( $ from ) ; $ to = $ this -> quoter -> quoteName ( $ to ) ; $ this -> db -> exec ( sprintf ( 'RENAME TABLE %s TO %s;' , $ from , $ to ) ) ; return true ; } | Rename table . |
12,357 | public function copyTable ( string $ tableNameSource , string $ tableNameDestination ) : bool { $ tableNameSource = $ this -> quoter -> quoteName ( $ tableNameSource ) ; $ tableNameDestination = $ this -> quoter -> quoteName ( $ tableNameDestination ) ; $ this -> db -> exec ( sprintf ( 'CREATE TABLE %s LIKE %s;' , $ ta... | Copy an existing table to a new table . |
12,358 | public function getColumnNames ( string $ tableName ) : array { $ result = [ ] ; foreach ( $ this -> getColumns ( $ tableName ) as $ value ) { $ field = $ value [ 'column_name' ] ; $ result [ $ field ] = $ field ; } return $ result ; } | Returns the column names of a table as an array . |
12,359 | public function getColumns ( string $ tableName ) : array { $ sql = 'SELECT column_name, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, characte... | Returns all columns in a table . |
12,360 | public function compareTableSchema ( string $ tableName1 , string $ tableName2 ) : bool { $ schema1 = $ this -> getTableSchemaId ( $ tableName1 ) ; $ schema2 = $ this -> getTableSchemaId ( $ tableName2 ) ; return $ schema1 === $ schema2 ; } | Compare two tables and returns true if the table schema match . |
12,361 | public function isValid ( $ value , $ context = null ) { $ frontController = \ Zend_Controller_Front :: getInstance ( ) ; $ request = $ frontController -> getRequest ( ) ; $ value = $ request -> getParam ( 'g-recaptcha-response' ) ; if ( empty ( $ value ) ) { $ this -> _error ( self :: CAPTCHA_EMPTY ) ; return false ; ... | Validate our form s element |
12,362 | protected function _verify ( $ value ) { $ queryString = http_build_query ( [ 'secret' => $ this -> _secretKey , 'response' => $ value , 'remoteIp' => $ _SERVER [ 'REMOTE_ADDR' ] ] ) ; $ peerKey = version_compare ( PHP_VERSION , '5.6.0' , '<' ) ? 'CN_name' : 'peer_name' ; $ context = stream_context_create ( [ 'http' =>... | Calls the reCAPTCHA siteverify API to verify whether the user passes the captcha test . |
12,363 | final public static function findAll ( Api \ Client $ client , array $ criteria = [ ] ) : Api \ Collection { $ filters = [ 'format' => [ [ 'in' , [ 'comic' , 'hardcover' , 'trade paperback' , 'magazine' , 'digest' , 'graphic novel' , 'digital comic' , 'infinite comic' , ] ] , ] , 'formatType' => [ [ 'in' , [ 'comic' , ... | Returns a collection containing all Comics which match the given criteria . |
12,364 | public function enum ( $ model , $ field , $ value = null , $ domain = null ) { $ enum = ClassRegistry :: init ( $ model ) -> enum ( $ field ) ; list ( $ plugin , $ model ) = pluginSplit ( $ model ) ; if ( ! $ domain ) { if ( $ plugin ) { $ domain = Inflector :: underscore ( $ plugin ) ; } else { $ domain = 'default' ;... | Retrieve an enum list for a Models field and translate the values . |
12,365 | public function gravatar ( $ email , array $ options = array ( ) , array $ attributes = array ( ) ) { $ options = $ options + array ( 'default' => 'mm' , 'size' => 80 , 'rating' => 'g' , 'hash' => 'md5' , 'secure' => env ( 'HTTPS' ) ) ; $ email = Security :: hash ( strtolower ( trim ( $ email ) ) , $ options [ 'hash' ]... | Render out a gravatar thumbnail based on an email . |
12,366 | public function getElasticSearchClient ( ) { $ config = [ ] ; if ( \ Config :: has ( 'elasticquent.config' ) ) { $ config = \ Config :: get ( 'elasticquent.config' ) ; } return new \ Elasticsearch \ Client ( $ config ) ; } | Get ElasticSearch Client . |
12,367 | public function getBasicEsParams ( $ getIdIfPossible = true , $ getSourceIfPossible = false , $ getTimestampIfPossible = false , $ limit = null , $ offset = null ) { $ params = [ 'index' => $ this -> getIndexName ( ) , 'type' => $ this -> getTypeName ( ) , ] ; if ( $ getIdIfPossible and $ this -> getKey ( ) ) { $ param... | Get Basic Elasticsearch Params . |
12,368 | public static function getMapping ( ) { $ instance = new static ( ) ; $ params = $ instance -> getBasicEsParams ( ) ; return $ instance -> getElasticSearchClient ( ) -> indices ( ) -> getMapping ( $ params ) ; } | Get Mapping . |
12,369 | public static function putMapping ( $ ignoreConflicts = false ) { $ instance = new static ( ) ; $ mapping = $ instance -> getBasicEsParams ( ) ; $ params = [ '_source' => [ 'enabled' => true ] , 'properties' => $ instance -> getMappingProperties ( ) , ] ; $ mapping [ 'body' ] [ $ instance -> getTypeName ( ) ] = $ param... | Put Mapping . |
12,370 | public static function createIndex ( $ shards = null , $ replicas = null ) { $ instance = new static ( ) ; $ client = $ instance -> getElasticSearchClient ( ) ; $ index = [ 'index' => $ instance -> getIndexName ( ) , ] ; if ( $ shards ) { $ index [ 'body' ] [ 'settings' ] [ 'number_of_shards' ] = $ shards ; } if ( $ re... | Create Index . |
12,371 | public function buildPrefix ( $ name = null ) { if ( empty ( $ name ) ) { $ name = 'default' ; } elseif ( $ name && preg_match ( '/[^[:alnum:]]/' , $ name ) ) { $ name = md5 ( $ name ) ; } return $ this -> queuePrefix . ':' . $ name ; } | Builds queue prefix |
12,372 | public function push ( $ job , $ data = null , $ queue = null , $ options = [ ] ) { return $ this -> pushInternal ( $ this -> createPayload ( $ job , $ data ) , $ queue , $ options ) ; } | Push job to the queue |
12,373 | protected function createPayload ( $ job , $ data ) { $ payload = [ 'job' => $ job , 'data' => $ data ] ; $ payload = $ this -> setMeta ( $ payload , 'id' , $ this -> getRandomId ( ) ) ; return $ payload ; } | Create job array |
12,374 | public function renderTable ( Table $ table ) { $ rows = $ this -> buildRows ( $ table ) ; $ headerRows = $ this -> buildHeaders ( $ table ) ; $ footerRows = $ this -> buildFooters ( $ table ) ; return $ this -> container ( $ table , $ rows , $ headerRows , $ footerRows ) ; } | Renders the given table into a string . Output depends on the subclass |
12,375 | protected function buildRows ( Table $ table ) { $ rows = array ( ) ; foreach ( $ table -> getRows ( ) as $ row ) { $ cells = array ( ) ; foreach ( $ row as $ cell ) { $ cells [ ] = $ this -> cell ( $ cell ) ; } $ rows [ ] = $ this -> row ( $ row , $ cells ) ; } return $ rows ; } | Renders the main body rows for the table |
12,376 | protected function buildHeaders ( Table $ table ) { $ rows = array ( ) ; foreach ( $ table -> getHeaderRows ( ) as $ row ) { $ cells = array ( ) ; foreach ( $ row as $ cell ) { $ cells [ ] = $ this -> headerCell ( $ cell ) ; } $ rows [ ] = $ this -> headerRow ( $ row , $ cells ) ; } return $ rows ; } | Renders the header rows for the table |
12,377 | protected function buildFooters ( Table $ table ) { $ rows = array ( ) ; foreach ( $ table -> getFooterRows ( ) as $ row ) { $ cells = array ( ) ; foreach ( $ row as $ cell ) { $ cells [ ] = $ this -> footerCell ( $ cell ) ; } $ rows [ ] = $ this -> footerRow ( $ row , $ cells ) ; } return $ rows ; } | Renders the footer rows for the table |
12,378 | public function sum ( string $ field ) : FunctionExpression { $ quoter = $ this -> db -> getQuoter ( ) ; $ expression = sprintf ( 'SUM(%s)' , $ quoter -> quoteName ( $ field ) ) ; return new FunctionExpression ( $ expression , $ quoter ) ; } | Calculate a sum . The arguments will be treated as literal values . |
12,379 | public function call ( string $ name , ... $ parameters ) : FunctionExpression { $ quoter = $ this -> db -> getQuoter ( ) ; $ list = implode ( ', ' , $ quoter -> quoteArray ( $ parameters ) ) ; $ expression = sprintf ( '%s(%s)' , strtoupper ( $ name ) , $ list ) ; return new FunctionExpression ( $ expression , $ quoter... | Create custom SQL function call . |
12,380 | protected function consumeHeadline ( $ lines , $ current ) { $ line = trim ( $ lines [ $ current ] ) ; $ level = 1 ; while ( isset ( $ line [ $ level ] ) && $ line [ $ level ] === '=' && $ level < 6 ) { $ level ++ ; } $ block = [ 'headline' , 'content' => $ this -> parseInline ( trim ( $ line , " \t=" ) ) , 'level' => ... | Consume lines for a headline |
12,381 | public function compress ( $ value ) { if ( $ value === null || $ value === '' ) { return $ value ; } return pack ( 'L' , strlen ( $ value ) ) . gzcompress ( $ value ) ; } | Compress compatible with MySQL COMPRESS . |
12,382 | public function startApplication ( ) : void { if ( $ this -> hasApplicationBeenStarted ( ) ) { throw new ApplicationRunningException ( sprintf ( 'Application has already been started. Please stop the application, before invoking start!' ) ) ; } $ this -> refreshApplication ( ) ; if ( ! $ this -> factory ) { $ this -> f... | Start the application |
12,383 | public function stopApplication ( ) : void { if ( $ this -> hasApplicationBeenStarted ( ) ) { foreach ( $ this -> beforeApplicationDestroyedCallbacks as $ callback ) { call_user_func ( $ callback ) ; } $ this -> app -> flush ( ) ; $ this -> app = null ; Facade :: clearResolvedInstances ( ) ; Facade :: setFacadeApplicat... | Stop the application |
12,384 | public function rangeToArray ( $ pRange = 'A1' , $ nullValue = null , $ calculateFormulas = true , $ formatData = true , $ returnCellRef = false ) { $ returnValue = array ( ) ; list ( $ rangeStart , $ rangeEnd ) = PHPExcel_Cell :: rangeBoundaries ( $ pRange ) ; $ minCol = PHPExcel_Cell :: stringFromColumnIndex ( $ rang... | Create array from a range of cells |
12,385 | protected function getFallbackValue ( $ tagName , array $ params = array ( ) ) { if ( ! empty ( $ params [ 2 ] ) && ( $ request = $ this -> requestStack -> getCurrentRequest ( ) ) !== null ) { return $ request -> getUriForPath ( '/' . ltrim ( $ params [ 2 ] , '/' ) ) ; } return '' ; } | Returns fallback value . |
12,386 | protected function isParagraphEnd ( $ line ) { if ( empty ( $ line ) || ltrim ( $ line ) === '' || $ this -> identifyHeadline ( $ line ) || $ this -> identifyHr ( $ line ) || $ this -> identifyUl ( $ line ) || $ this -> identifyOl ( $ line ) || $ this -> identifyTable ( $ line ) || $ this -> identifyCode ( $ line ) || ... | Checks if the paragraph ends |
12,387 | public function union ( SelectQuery $ query ) : self { $ this -> union [ ] = [ '' , $ query -> build ( false ) ] ; return $ this ; } | UNION is used to combine the result from multiple SELECT statements into a single result set . |
12,388 | public function leftJoinRaw ( string $ table , string $ conditions ) : self { $ this -> join [ ] = [ 'left' , $ table , new RawExp ( $ conditions ) , null , null , null ] ; return $ this ; } | Left join with complex conditions . |
12,389 | public function whereRaw ( string $ condition ) : self { $ this -> condition -> where ( [ new RawExp ( $ condition ) ] ) ; return $ this ; } | Add a raw AND WHERE condition . |
12,390 | public function orWhereRaw ( string $ condition ) : self { $ this -> condition -> orWhere ( [ new RawExp ( $ condition ) ] ) ; return $ this ; } | Add a raw OR WHERE condition . |
12,391 | public function orHavingRaw ( string $ condition ) : self { $ this -> condition -> orHaving ( [ new RawExp ( $ condition ) ] ) ; return $ this ; } | Add OR having condition . |
12,392 | public function input ( $ fieldName , $ options = array ( ) , $ helperOptions = array ( ) ) { $ helperOptions = Set :: merge ( $ this -> _helperOptions , $ helperOptions ) ; return $ this -> Form -> input ( $ fieldName , $ options ) . $ this -> _build ( $ fieldName , $ helperOptions ) ; } | Creates an fckeditor input field |
12,393 | protected function _initialize ( $ options = array ( ) ) { if ( $ this -> _initialized ) { return ; } $ this -> _initialized = true ; if ( ! empty ( $ options [ '_css' ] ) ) { foreach ( ( array ) $ options [ '_css' ] as $ css ) { $ this -> Html -> css ( $ css , null , array ( 'inline' => false ) ) ; } } if ( ! empty ( ... | Initialize the helper css and js for a given input field |
12,394 | protected function _initializationOptions ( $ options = array ( ) ) { $ defaults = array ( '_buffer' => true , '_css' => true , '_cssText' => true , '_scripts' => true , '_scriptBlock' => false , '_editor' => true , '_inline' => true , ) ; return json_encode ( array_diff_key ( array_merge ( $ defaults , ( array ) $ opt... | Returns a json string containing helper settings |
12,395 | public function render ( array $ metaTags = array ( ) ) { $ html = '' ; foreach ( $ metaTags as $ metaTag ) { if ( ! $ metaTag instanceof Item ) { throw new InvalidArgumentException ( 'metaTags' , 'Cannot render meta tag, not an instance of \Netgen\Bundle\OpenGraphBundle\MetaTag\Item' ) ; } $ tagName = htmlspecialchars... | Renders provided meta tags . |
12,396 | public function humanize ( $ str , $ sep = '_' , $ lowercase = true ) { $ sep = $ sep != '-' ? '_' : $ sep ; if ( $ lowercase === true ) { $ str = $ this -> str -> ucfirst ( $ str ) ; } return str_replace ( $ sep , " " , strval ( $ str ) ) ; } | Turns an underscore or dash separated word and turns it into a human looking string . |
12,397 | public function classify ( $ name , $ force_singular = true ) { $ class = ( $ force_singular ) ? $ this -> singularize ( $ name ) : $ name ; return $ this -> wordsToUpper ( $ class ) ; } | Takes a table name and creates the class name . |
12,398 | public function isCountable ( $ word ) { return ! ( \ in_array ( $ this -> str -> lower ( \ strval ( $ word ) ) , $ this -> uncountableWords ) ) ; } | Checks if the given word has a plural version . |
12,399 | public function get ( DateTime $ datetime , $ name ) { $ value = null ; switch ( $ name ) { case 'daysinmonth' : $ value = $ datetime -> format ( 't' ) ; break ; case 'dayofweek' : $ value = $ datetime -> format ( 'N' ) ; break ; case 'dayofyear' : $ value = $ datetime -> format ( 'z' ) ; break ; case 'isleapyear' : $ ... | Return a value of the property . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.