idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
18,200
private function getClassDiscriminatorValues ( ClassMetadata $ metadata ) { $ discriminatorValues = array ( $ metadata -> discriminatorValue ) ; foreach ( $ metadata -> subClasses as $ className ) { if ( $ key = array_search ( $ className , $ metadata -> discriminatorMap ) ) { $ discriminatorValues [ ] = $ key ; } } re...
Gets the array of discriminator values for the given ClassMetadata
18,201
private function guardMissingShardKey ( $ document , $ shardKeyField , $ actualDocumentData ) { $ dcs = $ this -> uow -> getDocumentChangeSet ( $ document ) ; $ isUpdate = $ this -> uow -> isScheduledForUpdate ( $ document ) ; $ fieldMapping = $ this -> class -> getFieldMappingByDbFieldName ( $ shardKeyField ) ; $ fiel...
If the document is new ignore shard key field value otherwise throw an exception . Also shard key field should be presented in actual document data .
18,202
public function classify ( array $ classes , DocumentInterface $ d ) { list ( $ token , $ before , $ after ) = $ d -> getDocumentData ( ) ; $ dotcnt = count ( explode ( '.' , $ token ) ) - 1 ; $ lastdot = substr ( $ token , - 1 ) == '.' OR substr ( $ token , - 1 ) == '?' OR substr ( $ token , - 1 ) == '!' ; if ( ! $ la...
Splits up a certain text into a sentence array
18,203
public static function invalidMappingType ( $ itemClass , $ attributeName , $ type , $ ownerName = null ) { return new self ( 'The mapping attribute "' . $ attributeName . ( isset ( $ ownerName ) ? ' of "' . $ ownerName . '"' : '' ) . ' is not a valid "' . $ type . '" in "' . $ itemClass . '".' ) ; }
Return MappingException with invalid type mapping message
18,204
public static function requiredMapping ( $ itemClass , $ attributeName , $ ownerName = null ) { return new self ( 'The mapping attribute "' . $ attributeName . '"' . ( isset ( $ ownerName ) ? ' of "' . $ ownerName . '"' : '' ) . ' is required in "' . $ itemClass . '".' ) ; }
Return MappingException with required mapping message
18,205
public static function filter ( $ alias , $ value ) { $ filter = self :: create ( $ alias ) ; return $ filter -> filter ( $ value ) ; }
Creates the filter in the alias or class name and applies it to the provided value .
18,206
protected static function getClass ( $ alias ) { if ( array_key_exists ( $ alias , self :: $ filters ) ) { return self :: $ filters [ $ alias ] ; } if ( ! class_exists ( $ alias ) ) { throw new InvalidArgumentException ( "Class {$alias} does not exists." ) ; } return $ alias ; }
Returns the class name for provided alias
18,207
protected function queryXml ( $ apiUrl , $ apiServiceFilter = null ) { $ useCache = self :: $ useCache ; if ( $ apiServiceFilter ) { $ url = $ apiUrl . $ apiServiceFilter -> getURLQuery ( ) ; } else { $ url = $ apiUrl ; } if ( ! $ useCache || $ this -> cacheManager -> has ( md5 ( $ url ) ) == false ) { $ ch = curl_init...
Queries XML data from server or cache
18,208
protected function writeCache ( $ key , & $ data , $ lifetime ) { $ this -> cacheManager -> set ( $ key , $ data , [ ] , $ lifetime ) ; }
Caches the HTTP response body into database
18,209
public static function Gd2gce ( $ a , $ f , $ elong , $ phi , $ height , array & $ xyz ) { $ sp ; $ cp ; $ w ; $ d ; $ ac ; $ as ; $ r ; $ sp = sin ( $ phi ) ; $ cp = cos ( $ phi ) ; $ w = 1.0 - $ f ; $ w = $ w * $ w ; $ d = $ cp * $ cp + $ w * $ sp * $ sp ; if ( $ d <= 0.0 ) return - 1 ; $ ac = $ a / sqrt ( $ d ) ; $ ...
- - - - - - - - - - i a u G d 2 g c e - - - - - - - - - -
18,210
function checkLink ( $ link , $ id ) { $ result = $ this -> db -> query ( 'SELECT link FROM ' . $ this -> articleTable . ' WHERE link = :link AND id != :id' , [ ':link' => $ link , ':id' => 0 + $ id ] ) ; i...
Check link and if ID is diferent
18,211
function getCategory ( $ id ) { $ result = $ this -> db -> query ( 'SELECT * FROM category WHERE id = :id' , [ ':id' => ( 0 + $ id ) ] ) ; if ( isset ( $ result [ 0 ] ) ) { return [ 'name' => $ result [ 0 ] -> get ( 'name' ) , 'description' => $ result [ 0 ] -> get ( 'description' ) ] ; } return false ; }
Get Category by id
18,212
private function comList ( $ result ) { foreach ( $ result as $ res ) { $ data [ $ res -> get ( 'id' ) ] [ 'title' ] = $ res -> get ( 'title' ) ; $ data [ $ res -> get ( 'id' ) ] [ 'resume' ] = $ res -> get ( 'resume' ) ; $ data [ $ res -> get ( 'id' ) ] [ 'author' ] = $ res -> get ( 'author' ) ; $ data [ $ res -> get ...
Private util function
18,213
public function listByCategory ( $ cat = null ) { $ result = $ this -> db -> query ( 'SELECT id, title, resume, category, author, link FROM ' . $ this -> articleTable . ' WHERE category = :cat' , [ ':cat' => $ cat ] ) ; if ( isset ( $ result [...
List ao article in this category
18,214
public function Index ( ) { $ this -> Permission ( 'Garden.Settings.Manage' ) ; $ this -> AddSideMenu ( 'dashboard/statistics' ) ; $ this -> Title ( T ( 'Vanilla Statistics' ) ) ; $ this -> EnableSlicing ( $ this ) ; if ( $ this -> Form -> IsPostBack ( ) ) { $ Flow = TRUE ; if ( $ Flow && $ this -> Form -> GetFormValue...
Statistics setup & configuration .
18,215
public function Verify ( ) { $ CredentialsValid = Gdn :: Statistics ( ) -> ValidateCredentials ( ) ; $ this -> SetData ( 'StatisticsVerified' , $ CredentialsValid ) ; $ this -> Render ( ) ; }
Verify connection credentials .
18,216
public function has ( string $ name ) : bool { $ parts = explode ( '[' , $ name ) ; $ lastKey = trim ( array_pop ( $ parts ) , ']' ) ; $ current = & $ this -> parameters ; foreach ( $ parts as $ part ) { $ target = trim ( $ part , ']' ) ; if ( ! is_array ( $ current ) || ! array_key_exists ( $ target , $ current ) ) { ...
Checks if a parameter exists .
18,217
public function get ( string $ name , $ default = null ) { $ parts = explode ( '[' , $ name ) ; $ lastKey = trim ( array_pop ( $ parts ) , ']' ) ; $ current = & $ this -> parameters ; foreach ( $ parts as $ part ) { $ target = trim ( $ part , ']' ) ; if ( ! is_array ( $ current ) || ! array_key_exists ( $ target , $ cu...
Returns the value of a parameter .
18,218
protected function requestProjects ( $ name , \ Closure $ finder , $ nameKey ) { $ projects = [ ] ; if ( $ this -> repoParser -> isConcrete ( $ name ) ) { $ project = $ this -> getProject ( $ name ) ; $ projects [ $ project -> getName ( ) ] = $ project ; } else { $ repos = $ finder ( $ name ) ; if ( true === $ this -> ...
searches for projects .
18,219
public static function getViewHelper ( $ appName = null , bool $ layout = false ) { if ( $ appName === false ) { $ class = '\Osf\View\Helper' ; $ instance = 'osf' ; } else { $ appName = $ appName === null ? Router :: getDefaultControllerName ( true ) : $ appName ; $ class = "\\App\\" . $ appName . '\View\Helper' ; $ in...
Get a view helpers object with a context
18,220
public static function getCrypt ( $ cryptKey = Crypt :: DEFAULT_KEY , $ mode = Crypt :: MODE_ASCII ) : \ Osf \ Crypt \ Crypt { return self :: buildObject ( '\Osf\Crypt\Crypt' , [ $ cryptKey , $ mode ] ) ; }
Get Osf Crypt object . Parameters are usefull ONLY for the first call
18,221
public function thumbnail ( $ width , $ height = null ) { if ( $ this -> type != 'image' ) { throw new \ LogicException ( "Tried to create thumbnail for not image file." , 500 ) ; } $ thumbnail = new \ Routegroup \ Media \ Helpers \ Thumbnail ( $ this ) ; $ filename = $ thumbnail -> name ( $ width , $ height ) ; if ( $...
Gets thumbnail for given sizes .
18,222
public static function argsValidation ( $ cacheDir , $ cacheTTL , $ caching , $ cacheForever , $ charset ) { if ( ! self :: validateDirName ( $ cacheDir ) ) throw new \ Franzip \ SerpFetcher \ Exceptions \ InvalidArgumentException ( 'Invalid SerpFetcher $cacheDir: please supply a valid non-empty string.' ) ; if ( ! sel...
Perform validation on SerpFetcher constructor arguments .
18,223
public function tableExists ( $ tableName ) { if ( is_null ( $ this -> dbh ) ) { throw new NoConnectionException ( ) ; } $ mrSql = "SHOW TABLES LIKE :table_name" ; $ mrStmt = $ this -> dbh -> prepare ( $ mrSql ) ; $ mrStmt -> bindParam ( ":table_name" , $ tableName , \ PDO :: PARAM_STR ) ; $ sqlResult = $ mrStmt -> exe...
This function checks if the table exists in the passed PDO database connection
18,224
public static function deleteCrops ( $ originalFilePath , $ cropsFolder = null ) { $ self = static :: create ( $ originalFilePath , $ cropsFolder ) ; return $ self -> removeCrops ( ) ; }
Quickly remove crops
18,225
public function removeCrops ( ) { $ justTheName = pathinfo ( $ this -> originalImagePath , PATHINFO_FILENAME ) ; $ filesToRemove = glob ( sprintf ( '%s/%s-*' , $ this -> cropsFolder , $ justTheName ) ) ; foreach ( $ filesToRemove as $ file ) { if ( is_file ( $ file ) ) unlink ( $ file ) ; } return $ this ; }
Reset all created crops for the image
18,226
public function server ( string $ key , $ default = null ) { return $ this -> server -> has ( $ key ) ? $ this -> server -> get ( $ key ) : $ default ; }
Shortcut to fetch a SERVER - parameter with optional default value
18,227
public function cookie ( string $ key , $ default = null ) { return $ this -> cookie -> has ( $ key ) ? $ this -> cookie -> get ( $ key ) : $ default ; }
Shortcut to fetch a COOKIE - parameter with optional default value
18,228
public function session ( string $ key , $ default = null ) { if ( null === $ this -> session ) { throw new \ Exception ( 'No session object set. Use \'Request::setSession\'.' ) ; } return $ this -> session -> has ( $ key ) ? $ this -> session -> get ( $ key ) : $ default ; }
Shortcut to fetch a SESSION - parameter with optional default value . The session object must me manualy set and started!
18,229
public function header ( string $ key , $ default = null ) { return $ this -> header -> has ( $ key ) ? $ this -> header -> get ( $ key ) : $ default ; }
Shortcut to fetch a HEADER - parameter with optional default value .
18,230
public function getMethod ( ) : ? int { switch ( $ this -> server ( 'REQUEST_METHOD' ) ) { case 'GET' : return self :: HTTP_GET ; case 'POST' : return self :: HTTP_POST ; case 'HEAD' : return self :: HTTP_HEAD ; case 'PUT' : return self :: HTTP_PUT ; case 'DELETE' : return self :: HTTP_DELETE ; case 'TRACE' : return se...
Returns the bit - code of the request method or null if the method is unknown .
18,231
protected function protocolWithActiveSsl ( $ protocol ) : bool { $ protocol = strtolower ( ( string ) $ protocol ) ; return in_array ( $ protocol , [ 'on' , '1' , 'https' , 'ssl' ] , true ) ; }
Detects an active SSL protocol value .
18,232
public function getPort ( ) : string { $ port = self :: server ( 'HTTP_X_FORWARDED_PORT' ) ; if ( $ port ) { return ( string ) $ port ; } $ protocol = ( string ) self :: server ( 'HTTP_X_FORWARDED_PROTO' ) ; if ( $ protocol === 'https' ) { return '443' ; } return ( string ) self :: server ( 'SERVER_PORT' ) ; }
Get the port of this request as string .
18,233
public function getUrl ( ) : Url { return Url :: from ( $ this -> getHttpScheme ( ) . '://' . $ this -> getHost ( ) . $ this -> server ( 'REQUEST_URI' ) ) ; }
Gets a new ieu \ Http \ Url object based on the request URL
18,234
public function getResults ( EntityManager $ em , Request $ request , $ page ) { $ query = $ this -> buildResultQuery ( $ em , $ request , $ page ) ; return $ query -> getResult ( ) ; }
Get results for request
18,235
public function getCount ( EntityManager $ em , Request $ request ) { $ stmt = $ this -> buildCountQuery ( $ em , $ request ) ; $ stmt -> execute ( ) ; return ( int ) $ stmt -> fetchColumn ( ) ; }
Get result count for request
18,236
protected function buildResultQuery ( EntityManager $ em , Request $ request , $ page ) { $ searchWords = preg_split ( '/[^[:alnum:]]+/' , $ request -> getSearchText ( ) ) ; $ offset = $ request -> getLimit ( ) * ( $ page - 1 ) ; $ limit = $ request -> getLimit ( ) ; $ selects = array ( ) ; foreach ( $ this -> database...
Build result query
18,237
protected function buildCountQuery ( EntityManager $ em , Request $ request ) { $ searchWords = preg_split ( '/[^[:alnum:]]+/' , $ request -> getSearchText ( ) ) ; $ selects = array ( ) ; foreach ( $ this -> databaseMapping as $ tableMapping ) { $ score = $ this -> buildScoreColumn ( $ tableMapping [ 'columns' ] , coun...
Build count query
18,238
protected function buildScoreColumn ( array $ columns , $ searchWordsCount ) { $ scoreExpression = $ this -> buildScore ( $ columns , $ searchWordsCount ) ; return array ( 'expression' => $ scoreExpression , 'type' => Type :: INTEGER ) ; }
Build score column with same structure as hit
18,239
protected function buildScore ( array $ columns , $ searchWordsCount ) { $ scores = array ( ) ; foreach ( $ columns as $ column ) { if ( $ column [ 'scoreFactor' ] != 0 && isset ( $ column [ 'expression' ] ) ) { $ stringConvertedExpression = $ this -> convertToString ( $ column [ 'type' ] , $ column [ 'expression' ] ) ...
Build score expression
18,240
protected function buildJoinExpressions ( array $ joins ) { $ joinExpressions = array ( ) ; foreach ( $ joins as $ joins ) { $ joinExpressions [ ] = 'LEFT JOIN ' . $ joins [ 'table' ] . ' ' . $ joins [ 'tableAlias' ] . ' ON ' . $ joins [ 'onClause' ] ; } return $ joinExpressions ; }
Build joins expression
18,241
protected function convertToString ( $ type , $ expression ) { switch ( $ type ) { case Type :: STRING : case Type :: TEXT : return $ expression ; case Type :: BIGINT : case Type :: DECIMAL : case Type :: FLOAT : case Type :: INTEGER : case Type :: SMALLINT : case Type :: DATE : case Type :: DATETIME : case Type :: DAT...
Return string string converted column
18,242
public function mapDatabase ( array $ databaseMapping , $ itemClass , array $ hitPositions ) { $ this -> databaseMapping = $ databaseMapping ; $ this -> loadFinalType ( $ hitPositions ) ; $ this -> loadResultSetMappingAndScorePosition ( $ itemClass , $ hitPositions ) ; $ this -> finalTypes [ $ this -> scorePos ] = Type...
Loads and complete databaseMapping
18,243
function isUTF8 ( $ str ) { if ( is_array ( $ str ) ) { $ str = implode ( '' , $ str ) ; return ! ( ( ord ( $ str [ 0 ] ) != 239 ) && ( ord ( $ str [ 1 ] ) != 187 ) && ( ord ( $ str [ 2 ] ) != 191 ) ) ; } else { return ( utf8_encode ( utf8_decode ( $ str ) ) == $ str ) ; } }
Fonction permettant de savoir s il y a des caracteres en utf8 dans la chaine
18,244
function encodeToUTF8 ( $ str ) { $ encodage = mb_detect_encoding ( $ str , "UTF-8, ISO-8859-1, ISO-8859-15, windows-1252" , true ) ; $ str_utf8 = mb_convert_encoding ( $ str , "UTF-8" , $ encodage ) ; return $ str_utf8 ; }
Fonction d encodage en utf8 a partir d autre encodage pratique = > detection
18,245
public function getTexteDifferences ( $ params = array ( ) ) { $ retour = "" ; if ( isset ( $ params [ 'nouveau' ] ) && isset ( $ params [ 'ancien' ] ) ) { $ fd = new filediff ( ) ; $ fd -> set_textes ( $ params [ 'nouveau' ] , $ params [ 'ancien' ] ) ; $ fd -> execute ( ) ; $ retour [ 'html' ] = $ fd -> display ( ) ; ...
Permet de comparer 2 fichiers
18,246
protected function view ( $ file , $ param = array ( ) ) { extract ( $ param ) ; if ( ! is_array ( $ file ) ) { $ path = explode ( '\\' , get_class ( $ this ) ) ; if ( count ( $ path ) > 2 ) { $ view_path = '' ; for ( $ i = 0 ; $ i < count ( $ path ) - 2 ; $ i ++ ) { $ view_path .= strtolower ( $ path [ $ i ] ) . '/' ;...
view Funngsi untuk menampilkan view
18,247
public function setQuestion ( $ question ) { if ( false === is_string ( $ question ) ) { throw new \ InvalidArgumentException ( 'Question should be a string' ) ; } $ this -> question = trim ( $ question ) . " " ; return $ this ; }
Sets the value of question .
18,248
protected function doFindAndRemove ( array $ query , array $ options = array ( ) ) { $ document = parent :: doFindAndRemove ( $ query , $ options ) ; if ( isset ( $ document ) ) { $ this -> riakCollection -> chunks -> remove ( array ( 'files_id' => $ document [ '_id' ] ) , $ options ) ; } return $ document ; }
Execute the findAndModify command with the remove option and delete any chunks for the document .
18,249
protected function doInsert ( array & $ a , array $ options = array ( ) ) { if ( ! isset ( $ a [ 'file' ] ) ) { parent :: doInsert ( $ a , $ options ) ; return ; } $ file = $ a [ 'file' ] ; unset ( $ a [ 'file' ] ) ; if ( $ file -> isDirty ( ) ) { $ this -> storeFile ( $ file , $ a , $ options ) ; } else { parent :: do...
Execute the insert query and persist the GridFSFile if necessary .
18,250
protected function doSave ( array & $ a , array $ options = array ( ) ) { if ( isset ( $ a [ '_id' ] ) ) { return $ this -> doUpdate ( array ( '_id' => $ a [ '_id' ] ) , $ a , $ options ) ; } else { return $ this -> doInsert ( $ a , $ options ) ; } }
Execute the save query and persist the GridFSFile if necessary .
18,251
public static function parse ( $ path ) { $ path = explode ( ':' , $ path , 2 ) ; if ( count ( $ path ) == 2 ) { if ( head ( $ path ) == 'app' ) { $ path = app_path ( last ( $ path ) ) ; } elseif ( head ( $ path ) == 'base' ) { $ path = base_path ( last ( $ path ) ) ; } elseif ( head ( $ path ) == 'config' ) { $ path =...
Parse a path .
18,252
public function reset ( ) { $ this -> class = null ; $ this -> with = [ ] ; $ this -> flags = [ ] ; $ this -> columns = [ ] ; $ this -> from = [ ] ; $ this -> join = [ ] ; $ this -> where = [ ] ; $ this -> groupBy = [ ] ; $ this -> having = [ ] ; $ this -> orderBy = [ ] ; $ this -> limit = null ; $ this -> offset = nul...
Reset the query .
18,253
protected function quoteColumn ( $ column ) { if ( ( $ pos = strpos ( $ column , '.' ) ) !== false ) { return $ this -> db -> quoteName ( substr ( $ column , 0 , $ pos ) ) . '.' . $ this -> db -> quoteName ( substr ( $ column , $ pos + 1 ) ) ; } return $ this -> db -> quoteName ( $ column ) ; }
Quote a column .
18,254
protected function eagerLoadRelations ( array $ entities ) { if ( empty ( $ entities ) ) { return ; } if ( $ this -> class === null ) { throw new LogicException ( 'A class must be specified for Eager Loading using the `asClass` method.' ) ; } foreach ( $ this -> with as $ method ) { $ relation = $ this -> getRelation (...
Eager load the relationships .
18,255
protected function getRelation ( $ entity , $ method ) { if ( ! method_exists ( $ entity , $ method ) ) { throw new LogicException ( 'Call to undefined relationship "' . $ method . '" on model "' . get_class ( $ entity ) . '".' ) ; } $ relation = \ Core \ Models \ Relation :: noConstraints ( function ( ) use ( $ entity...
Get the relation instance for the given relationship method .
18,256
private function hasExactlyOneColumn ( ) { if ( count ( $ this -> columns ) != 1 || strpos ( $ this -> columns [ 0 ] , '*' ) !== false ) { return false ; } if ( strpos ( $ this -> columns [ 0 ] , ',' ) === false ) { return true ; } $ column = $ this -> columns [ 0 ] ; $ n = strlen ( $ column ) ; $ braces = 0 ; for ( $ ...
Determine if the statement has exactly one column .
18,257
protected function aggregate ( $ function , $ column = null ) { if ( $ column === null ) { if ( $ this -> hasExactlyOneColumn ( ) ) { if ( ( $ pos = strpos ( $ this -> columns [ 0 ] , ' AS ' ) ) !== false ) { $ column = substr ( $ this -> columns [ 0 ] , 0 , $ pos ) ; } else { $ column = $ this -> columns [ 0 ] ; } $ b...
Execute an aggregate function .
18,258
protected function doInsert ( array $ data = [ ] ) { if ( empty ( $ data ) ) { $ this -> insertEmptyRecord ( ) ; return $ this -> db -> lastInsertId ( ) ; } if ( ! is_int ( key ( $ data ) ) ) { $ columns = implode ( ', ' , array_map ( [ $ this -> db , 'quoteName' ] , array_keys ( $ data ) ) ) ; $ params = implode ( ', ...
Insert rows to the table and return the inserted autoincrement sequence value .
18,259
protected function doUpdate ( array $ data ) { if ( empty ( $ data ) ) { throw new InvalidArgumentException ( 'Cannot update an empty record.' ) ; } $ bindings = array_merge ( $ this -> bindings [ 'join' ] , $ this -> bindings [ 'where' ] ) ; $ settings = [ ] ; $ values = [ ] ; if ( empty ( $ bindings ) || is_int ( key...
Update all records of the query result with th given data and return the number of affected rows .
18,260
protected function doDelete ( ) { $ bindings = array_merge ( $ this -> bindings [ 'join' ] , $ this -> bindings [ 'where' ] ) ; $ query = 'DELETE' . $ this -> buildFrom ( ) . $ this -> buildJoin ( ) . $ this -> buildWhere ( ) ; return $ this -> db -> exec ( $ query , $ bindings ) ; }
Delete all records of the query result and return the number of affected rows .
18,261
protected function putBindings ( $ clause , array $ bindings ) { if ( ! empty ( $ bindings ) ) { $ this -> bindings [ $ clause ] = array_merge ( $ this -> bindings [ $ clause ] , $ bindings ) ; } }
Put the bindings into the list .
18,262
protected function compileColumns ( $ columns , $ clause ) { $ list = [ ] ; foreach ( ( array ) $ columns as $ alias => $ column ) { if ( is_string ( $ column ) && preg_match ( '/^(?:([0-9a-zA-Z$_]+)\.)?([0-9a-zA-Z$_]+)$/s' , trim ( $ column ) , $ match ) ) { $ column = ( ! empty ( $ match [ 1 ] ) ? $ this -> db -> quo...
Render the column list .
18,263
protected function buildLimit ( ) { return $ this -> limit !== null ? ' LIMIT ' . $ this -> limit . ( $ this -> offset ? ' OFFSET ' . $ this -> offset : '' ) : '' ; }
Builds the LIMIT ... OFFSET clause .
18,264
public function initialize ( ) { if ( $ this -> riakClient !== null ) { return ; } if ( $ this -> eventManager -> hasListeners ( Events :: preConnect ) ) { $ this -> eventManager -> dispatchEvent ( Events :: preConnect , new EventArgs ( $ this ) ) ; } $ server = $ this -> server ? : 'http://localhost:8098' ; $ options ...
Construct the wrapped RiakClient instance if necessary .
18,265
protected function convertConnectTimeout ( array $ options ) { if ( version_compare ( phpversion ( 'mongo' ) , '1.4.0' , '<' ) ) { return $ options ; } if ( isset ( $ options [ 'timeout' ] ) && ! isset ( $ options [ 'connectTimeoutMS' ] ) ) { $ options [ 'connectTimeoutMS' ] = $ options [ 'timeout' ] ; unset ( $ option...
Converts timeout RiakClient constructor option to connectTimeoutMS for driver versions 1 . 4 . 0 + .
18,266
protected function convertWriteTimeout ( array $ options ) { if ( version_compare ( phpversion ( 'mongo' ) , '1.4.0' , '<' ) ) { return $ options ; } if ( isset ( $ options [ 'wTimeout' ] ) && ! isset ( $ options [ 'wTimeoutMS' ] ) ) { $ options [ 'wTimeoutMS' ] = $ options [ 'wTimeout' ] ; unset ( $ options [ 'wTimeou...
Converts wTimeout RiakClient constructor option to wTimeoutMS for driver versions 1 . 4 . 0 + .
18,267
public static function createRole ( $ name , $ description ) { $ auth = Yii :: $ app -> authManager ; $ role = $ auth -> createRole ( $ name ) ; $ role -> description = $ description ; $ auth -> add ( $ role ) ; return $ role ; }
Creates role with a given name and description and adds it to RBAC system .
18,268
public static function createChildPermission ( $ role , $ name , $ description ) { $ auth = Yii :: $ app -> authManager ; $ permission = $ auth -> createPermission ( $ name ) ; $ permission -> description = $ description ; $ auth -> add ( $ permission ) ; $ auth -> addChild ( $ role , $ permission ) ; return $ permissi...
Creates permission with a given name and description and adds it to RBAC system assigning permission to the role .
18,269
public static function removeRuleByName ( $ name ) { $ auth = Yii :: $ app -> authManager ; $ rule = $ auth -> getRule ( $ name ) ; return $ auth -> remove ( $ rule ) ; }
Removes rule from RBAC system by name .
18,270
public static function removePermissionByName ( $ name ) { $ auth = Yii :: $ app -> authManager ; $ permission = $ auth -> getPermission ( $ name ) ; return $ auth -> remove ( $ permission ) ; }
Removes permission from RBAC system by name .
18,271
public static function removeRoleByName ( $ name ) { $ auth = Yii :: $ app -> authManager ; $ role = $ auth -> getRole ( $ name ) ; return $ auth -> remove ( $ role ) ; }
Removes role from RBAC system by name .
18,272
protected function buildListExpression ( ClassProfile $ entity , $ index = null , $ group = null ) { $ expr = 'obj:' . $ entity -> getReflectionClass ( ) -> getName ( ) ; if ( isset ( $ group ) ) $ expr .= '<' . $ group . '>' ; if ( isset ( $ index ) ) $ expr .= '[' . $ index . ']' ; else $ expr .= '[]' ; return $ expr...
Obtains a list mapping expression for the give profile
18,273
private function vulgarize ( $ string ) { return trim ( preg_replace ( '/(-+)/' , '-' , preg_replace ( '/([^a-z0-9-]*)/' , '' , preg_replace ( '/((\s|\.|\'|\/)+)/' , '-' , html_entity_decode ( preg_replace ( '/&(a|o)elig;/' , '$1e' , preg_replace ( '/&([a-z])(uml|acute|grave|circ|tilde|ring|cedil|slash);/' , '$1' , str...
Makes a string URL - compatible
18,274
protected function isNameUnique ( $ association ) { $ associations = $ this -> determineAssociationsByName ( $ association -> getName ( ) ) ; return $ associations -> getAssociations ( ) -> count ( ) == 1 ; }
determine if the association is unique by the name
18,275
protected function determineAssociationsByName ( $ name ) { $ associationsFilter = new AssociationsFilter ( ) ; $ associationsFilter -> setName ( $ name ) ; $ associations = $ this -> associationRepository -> findAssociationsByRootAssociations ( $ associationsFilter ) ; return $ associations ; }
determine offset for association
18,276
public function setData ( $ data ) { try { parent :: setData ( $ data ) ; $ this -> invalidData = null ; $ this -> invalidDataTypeException = null ; } catch ( InputFilterInvalidArgumentException $ e ) { $ this -> invalidData = $ data ; $ this -> invalidDataTypeException = $ e ; } return $ this ; }
Set data to use when validating and filtering
18,277
public function isValid ( $ context = null ) { if ( $ this -> invalidDataTypeException !== null ) { return false ; } if ( ! $ this -> data && ! $ this -> isRequired ( ) ) { return true ; } if ( ! $ this -> needsFiltering ( ) ) { return true ; } return parent :: isValid ( $ context ) ; }
Is the data set valid?
18,278
public function getMessages ( ) { if ( $ this -> invalidDataTypeException !== null ) { return array ( 'invalidType' => sprintf ( 'Value must be an array or Traversable object; received %s' , is_object ( $ this -> invalidData ) ? get_class ( $ this -> invalidData ) : gettype ( $ this -> invalidData ) ) ) ; } return pare...
Return a list of validation failure messages .
18,279
public function getValues ( ) { if ( ! $ this -> data && ! $ this -> isRequired ( ) ) { return null ; } if ( ! $ this -> needsFiltering ( ) ) { return array ( ) ; } return parent :: getValues ( ) ; }
Return a list of filtered values .
18,280
protected function needsFiltering ( array $ inputs = null ) { $ inputsToFilter = $ inputs ? : $ this -> getInputsToFilter ( ) ; return ! ( is_array ( $ inputsToFilter ) && count ( $ inputsToFilter ) === 0 ) ; }
Do we have to filter at all?
18,281
public function upload ( $ filename , $ destination ) { if ( isset ( $ this [ $ filename ] ) ) { $ file = $ this [ $ filename ] ; if ( is_uploaded_file ( $ file [ static :: TMP_NAME ] ) ) { try { return move_uploaded_file ( $ file [ static :: TMP_NAME ] , $ destination ) ; } catch ( \ Exception $ e ) { var_dump ( $ e -...
Upload a file to the destination on the server
18,282
public function pregGet ( string $ pattern , $ match = 0 ) : string { preg_match ( $ pattern , ltrim ( $ this -> content , "\t" ) , $ matches ) ; return $ matches [ $ match ] ?? '' ; }
Matching a preg pattern and return the all or one of groups of matchment .
18,283
public function pregMap ( string $ pattern , callable $ callback ) : array { preg_match_all ( $ pattern , ltrim ( $ this -> content , "\t" ) , $ matches ) ; return array_map ( $ callback , ... $ matches ) ; }
Multiple matching a preg pattern and map result with a callback .
18,284
public function set ( array $ parameters ) { foreach ( $ parameters as $ parameter => $ value ) { $ this -> add ( $ parameter , $ value ) ; } return $ this ; }
Set all parameters at once
18,285
public function getReleases ( $ moduleName , $ coreVersion ) { $ request = $ this -> httpClient -> get ( [ '{module_name}/{core_version}' , [ 'module_name' => $ moduleName , 'core_version' => $ coreVersion ] ] ) ; if ( $ request -> getStatusCode ( ) != 200 ) { throw new \ Exception ( sprintf ( 'Status code was not OK. ...
Fetch releases according to given module and core version
18,286
public function createDb ( array $ aOptions = array ( ) ) { if ( isset ( $ aOptions [ 'a' ] ) ) { $ sSqlJsonFile = $ aOptions [ 'a' ] ; } else { $ sSqlJsonFile = false ; } if ( isset ( $ aOptions [ 'b' ] ) ) { $ sSqlJson = $ aOptions [ 'b' ] ; } else { $ sSqlJson = false ; $ sSqlJsonFile = str_replace ( 'Batch' , '' , ...
run the batch to create entity
18,287
public function one ( $ query ) { $ authSession = $ this -> repositoryDispatcher -> getCookieAuthSession ( ) ; $ url = null ; $ options = [ RequestOptions :: HEADERS => [ 'Cookie' => $ authSession -> getName ( ) . '=' . $ authSession -> getValue ( ) , ] , ] ; if ( is_scalar ( $ query ) ) { $ url = $ this -> endpoint . ...
Returns issue of Jira
18,288
public function all ( $ query ) { $ authSession = $ this -> repositoryDispatcher -> getCookieAuthSession ( ) ; $ response = $ this -> client -> request ( 'POST' , $ this -> endpoint . '/rest/api/2/search' , [ RequestOptions :: HEADERS => [ 'Cookie' => $ authSession -> getName ( ) . '=' . $ authSession -> getValue ( ) ,...
Returns issues of Jira
18,289
public function setPropertyValue ( $ property , $ value = NULL , $ objectId = NULL ) { $ property = strtolower ( $ property ) ; if ( ! array_key_exists ( $ property , $ this -> propertyModel ) ) return false ; if ( empty ( $ value ) ) : if ( isset ( $ this -> propertyModel [ $ property ] [ 3 ] ) ) $ value = $ this -> p...
Sets the property Value before save
18,290
public function getPropertyValue ( $ propertyName , $ objectId = null ) { if ( in_array ( $ propertyName , array ( "objectId" , "objectType" , "objectURI" ) ) && isset ( $ this -> $ propertyName ) ) { return $ this -> $ propertyName ; } $ property = strtolower ( $ propertyName ) ; if ( ! array_key_exists ( $ property ,...
Returns an entity property value by propery name if exists
18,291
public function getObjectsByPropertyValueBetween ( $ property , $ valueA , $ valueB , array $ select , $ objectType = NULL , $ objectURI = NULL , $ objectId = NULL ) { if ( empty ( $ property ) || empty ( $ valueA ) || empty ( $ valueB ) || empty ( $ select ) ) return false ; $ query = static :: getObjectQuery ( $ sele...
Return Object lists with matched properties between two values
18,292
public function getObjectsByPropertyValueMatch ( array $ properties , array $ values , array $ select = array ( ) , $ objectType = NULL , $ objectURI = NULL , $ objectId = NULL ) { if ( empty ( $ properties ) || empty ( $ values ) ) return false ; $ select = array_merge ( $ properties , $ select ) ; $ query = static ::...
Return Object lists with properties matching the given value
18,293
final public function setListOrderBy ( $ fields , $ direction = "ASC" ) { $ direction = ( in_array ( strtoupper ( trim ( $ direction ) ) , array ( 'ASC' , 'DESC' ) , TRUE ) ) ? ' ' . $ direction : ' ASC' ; $ orderby = NULL ; if ( ! empty ( $ fields ) && ! is_array ( $ fields ) ) { $ temp = array ( ) ; foreach ( explode...
Sets the list order direction
18,294
final public function setListLookUpConditions ( $ key , $ value = NULL , $ type = 'AND' , $ exact = FALSE , $ escape = TRUE , $ comparison = "LIKE" ) { if ( empty ( $ key ) ) { return $ this ; } if ( ! is_array ( $ key ) ) { if ( is_null ( $ value ) ) { return $ this ; } $ key = array ( $ key => $ value ) ; } $ dataMod...
Sets lookup conditions for entity table search
18,295
public function getListLookUpConditionsClause ( ) { $ query = null ; if ( is_array ( $ this -> listLookUpConditions ) && ! empty ( $ this -> listLookUpConditions ) ) : $ query .= "\nHAVING\t" ; $ query .= implode ( "\t" , $ this -> listLookUpConditions ) ; endif ; return $ query ; }
Returns the list select clause additional conditions
18,296
final public function getObjectsList ( $ objectType , $ properties = array ( ) , $ objectURI = NULL , $ objectId = NULL ) { if ( empty ( $ properties ) ) : if ( ! empty ( $ this -> propertyModel ) ) $ properties = array_keys ( $ this -> propertyModel ) ; endif ; $ query = static :: getObjectQuery ( $ properties , "?{$t...
Returns objects lists table with attributes list and values
18,297
final public function getObjectsListCount ( $ objectType , $ properties = array ( ) , $ objectURI = NULL , $ objectId = NULL ) { if ( empty ( $ properties ) ) : if ( ! empty ( $ this -> propertyModel ) ) $ properties = array_keys ( $ this -> propertyModel ) ; endif ; $ query = $ this -> getObjectCountQuery ( $ properti...
Gets the object List Count
18,298
final private static function getObjectQuery ( $ properties , $ vtable = '?property_values' , $ objectId = NULL , $ objectType = NULL , $ objectURI = NULL ) { $ query = "SELECT o.object_id, o.object_uri, o.object_type, o.object_created_on, o.object_updated_on, o.object_status" ; if ( ! empty ( $ properties ) ) : $ i = ...
Builds the original portion of the Object Query without conditions
18,299
final private function getObjectCountQuery ( $ properties , $ vtable = '?property_values' , $ objectId = NULL , $ objectType = NULL , $ objectURI = NULL ) { $ query = "SELECT DISTINCT o.object_id as total_objects" ; $ hasProperties = FALSE ; if ( ! empty ( $ properties ) ) : $ i = 0 ; $ count = \ sizeof ( $ properties ...
Get the final count