idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
49,200
public function isSameAs ( Hstore $ compStore ) { $ thisArray = $ this -> jsonSerialize ( ) ; ksort ( $ thisArray ) ; $ compStore = $ compStore -> jsonSerialize ( ) ; ksort ( $ compStore ) ; return json_encode ( $ thisArray ) == json_encode ( $ compStore ) ; }
Compare two hstores
49,201
private function fromStringToArray ( $ str ) { $ p = 0 ; $ c = $ this -> charAfterSpaces ( $ str , $ p ) ; if ( $ c === false ) { return array ( ) ; } $ result = [ ] ; while ( true ) { $ c = $ this -> charAfterSpaces ( $ str , $ p ) ; if ( $ c === false ) { break ; } if ( $ c == ',' ) { $ p ++ ; continue ; } $ key = $ ...
Build a array from a postgres hstore string representation
49,202
private function readKeyValue ( $ str , & $ p ) { $ c = substr ( $ str , $ p , 1 ) ; if ( $ c != '"' ) { $ len = strcspn ( $ str , " \r\n\t,=>" , $ p ) ; $ value = substr ( $ str , $ p , $ len ) ; $ p += $ len ; $ value = str_replace ( '\\"' , '"' , $ value ) ; $ value = str_replace ( '\\\\' , '\\' , $ value ) ; return...
Read a key or value component from a hstore s string representation
49,203
public function reloadTableSchema ( ) { $ this -> columns = [ ] ; $ described = $ this -> describe ( ) -> execute ( ) ; while ( $ column = $ described -> get ( ) ) { $ this -> columns [ ] = $ column [ 'COLUMNS' ] [ 'Field' ] ; } return $ this ; }
Reload the table schema .
49,204
public function select ( $ fields = null ) { $ select = new Select ( $ this ) ; if ( $ fields !== null ) { $ select -> fields ( $ fields ) ; } return $ select ; }
Get a select object for the current table .
49,205
public function exists ( ) { $ quotedTable = \ Database \ DatabaseConnectionFactory :: get ( ) -> quote ( $ this -> getTable ( ) ) ; $ record = \ Database \ DatabaseConnectionFactory :: get ( ) -> query ( "show tables like {$quotedTable}" ) ; return ! is_a ( $ record , 'Database\DatabaseRecord\EmptyDatabaseRecord' ) &&...
Check if the table exists in the database .
49,206
public function put ( array $ values = [ ] ) { $ this -> qb -> setQueryClass ( PutItem :: class ) ; foreach ( $ values as $ attributeName => $ value ) { $ value = $ this -> value ( $ value ) ; if ( $ attributeName !== $ this -> qb -> class -> discriminatorAttribute ) { $ attribute = $ this -> attr ( $ attributeName ) ;...
Sets the query operation to put and optionally specifies an array of data to add to the put command .
49,207
public function publishPostEvent ( Request $ request ) { $ post = $ this -> model -> FindOrFail ( $ request -> input ( 'postID' ) ) -> toArray ( ) ; $ post [ 'listID' ] = $ request -> input ( 'listID' ) ; $ post [ 'eventDescription' ] = $ request -> input ( 'eventDescription' ) ; event ( new PublishThePost ( $ post ) )...
Fire the SendPostToLaSalleCRMemailList event .
49,208
public function setFetchMode ( $ fetchMode , $ fetchArgument = null , array $ fetchConstructorArgument = [ ] ) { $ this -> fetchMode = $ fetchMode ; $ this -> fetchArgument = $ fetchArgument ; $ this -> fetchConstructorArgument = $ fetchConstructorArgument ; }
Set the default fetch mode for the connection and optional arguments for the given fetch mode .
49,209
protected function access ( $ values , string $ field ) { return isset ( $ values [ $ field ] ) ? $ values [ $ field ] : null ; }
Gets a field from the values .
49,210
public function assert ( $ values ) { $ errors = $ this -> iterate ( $ values ) ; if ( ! empty ( $ errors ) ) { throw new Exception \ Invalid ( $ errors ) ; } }
Validates the provided value throwing an exception upon failure .
49,211
public function getLatinName ( ) { if ( $ this -> hasParent ( ) && ! $ this -> latin_name ) { return $ this -> getParent ( ) -> getLatinName ( ) ; } return $ this -> latin_name ; }
Get latinName .
49,212
public function getAlias ( ) { if ( $ this -> hasParent ( ) && ! $ this -> alias ) { return $ this -> getParent ( ) -> getAlias ( ) ; } return $ this -> alias ; }
Get alias .
49,213
public function getLifeCycle ( ) { if ( $ this -> hasParent ( ) && ! $ this -> life_cycle ) { return $ this -> getParent ( ) -> getLifeCycle ( ) ; } if ( ! $ this -> life_cycle && $ this -> getSpecies ( ) ) { return $ this -> getSpecies ( ) -> getLifeCycle ( ) ; } return $ this -> life_cycle ; }
Get lifeCycle .
49,214
public function getLegalGerminationRate ( ) { if ( ! $ this -> legal_germination_rate && $ this -> getSpecies ( ) ) { return $ this -> getSpecies ( ) -> getLegalGerminationRate ( ) ; } return $ this -> legal_germination_rate ; }
Get legalGerminationRate .
49,215
public function setSpecies ( \ Librinfo \ VarietiesBundle \ Entity \ Species $ species = null ) { $ this -> species = $ species ; return $ this ; }
Set species .
49,216
public function getSpecies ( ) { if ( $ this -> hasParent ( ) && ! $ this -> species ) { return $ this -> getParent ( ) -> getSpecies ( ) ; } return $ this -> species ; }
Get species .
49,217
public function addPlantCategory ( \ Librinfo \ VarietiesBundle \ Entity \ PlantCategory $ plantCategory ) { $ this -> plant_categories [ ] = $ plantCategory ; return $ this ; }
Add plantCategory .
49,218
public function removePlantCategory ( \ Librinfo \ VarietiesBundle \ Entity \ PlantCategory $ plantCategory ) { return $ this -> plant_categories -> removeElement ( $ plantCategory ) ; }
Remove plantCategory .
49,219
public function getPlantCategories ( ) { if ( ! $ this -> plant_categories && $ this -> getSpecies ( ) ) { return $ this -> getSpecies ( ) -> getPlantCategories ( ) ; } return $ this -> plant_categories ; }
Get plantCategories .
49,220
public function getTkw ( ) { if ( ! $ this -> tkw && $ this -> getSpecies ( ) ) { return $ this -> getSpecies ( ) -> getTkw ( ) ; } return $ this -> tkw ; }
Get tkw .
49,221
public function getSeedLifespan ( ) { if ( ! $ this -> seed_lifespan && $ this -> getSpecies ( ) ) { return $ this -> getSpecies ( ) -> getSeedLifeSpan ( ) ; } return $ this -> seed_lifespan ; }
Get seedLifespan .
49,222
public function getRaiseDuration ( ) { if ( ! $ this -> raise_duration && $ this -> getSpecies ( ) ) { return $ this -> getSpecies ( ) -> getRaiseDuration ( ) ; } return $ this -> raise_duration ; }
Get raiseDuration .
49,223
public function setVariety ( \ Librinfo \ VarietiesBundle \ Entity \ Variety $ variety = null ) { $ this -> variety = $ variety ; return $ this ; }
Set variety .
49,224
public function addProfessionalDescription ( \ Librinfo \ VarietiesBundle \ Entity \ VarietyDescriptionProfessional $ professionalDescription ) { $ this -> professional_descriptions [ ] = $ professionalDescription ; return $ this ; }
Add professionalDescription .
49,225
public function removeProfessionalDescription ( \ Librinfo \ VarietiesBundle \ Entity \ VarietyDescriptionProfessional $ professionalDescription ) { return $ this -> professional_descriptions -> removeElement ( $ professionalDescription ) ; }
Remove professionalDescription .
49,226
public function setProfessionalDescriptions ( $ descriptions ) { foreach ( $ descriptions as $ description ) { $ description -> setVariety ( $ this ) ; } $ this -> professional_descriptions = $ descriptions ; return $ this ; }
Set professional descriptions .
49,227
public function addAmateurDescription ( \ Librinfo \ VarietiesBundle \ Entity \ VarietyDescriptionAmateur $ amateurDescription ) { $ this -> amateur_descriptions [ ] = $ amateurDescription ; return $ this ; }
Add amateurDescription .
49,228
public function removeAmateurDescription ( \ Librinfo \ VarietiesBundle \ Entity \ VarietyDescriptionAmateur $ amateurDescription ) { return $ this -> amateur_descriptions -> removeElement ( $ amateurDescription ) ; }
Remove amateurDescription .
49,229
public function setAmateurDescriptions ( $ descriptions ) { foreach ( $ descriptions as $ description ) { $ description -> setVariety ( $ this ) ; } $ this -> amateur_descriptions = $ descriptions ; return $ this ; }
Set amateur descriptions .
49,230
public function addProductionDescription ( \ Librinfo \ VarietiesBundle \ Entity \ VarietyDescriptionProduction $ productionDescription ) { $ this -> production_descriptions [ ] = $ productionDescription ; return $ this ; }
Add productionDescription .
49,231
public function removeProductionDescription ( \ Librinfo \ VarietiesBundle \ Entity \ VarietyDescriptionProduction $ productionDescription ) { return $ this -> production_descriptions -> removeElement ( $ productionDescription ) ; }
Remove productionDescription .
49,232
public function setProductionDescriptions ( $ descriptions ) { foreach ( $ descriptions as $ description ) { $ description -> setVariety ( $ this ) ; } $ this -> production_descriptions = $ descriptions ; return $ this ; }
Set production descriptions .
49,233
public function addCommercialDescription ( \ Librinfo \ VarietiesBundle \ Entity \ VarietyDescriptionCommercial $ commercialDescription ) { $ this -> commercial_descriptions [ ] = $ commercialDescription ; return $ this ; }
Add commercialDescription .
49,234
public function removeCommercialDescription ( \ Librinfo \ VarietiesBundle \ Entity \ VarietyDescriptionCommercial $ commercialDescription ) { return $ this -> commercial_descriptions -> removeElement ( $ commercialDescription ) ; }
Remove commercialDescription .
49,235
public function setCommercialDescriptions ( $ descriptions ) { foreach ( $ descriptions as $ description ) { $ description -> setVariety ( $ this ) ; } $ this -> commercial_descriptions = $ descriptions ; return $ this ; }
Set commercial descriptions .
49,236
public function addPlantDescription ( \ Librinfo \ VarietiesBundle \ Entity \ VarietyDescriptionPlant $ plantDescription ) { $ this -> plant_descriptions [ ] = $ plantDescription ; return $ this ; }
Add plantDescription .
49,237
public function removePlantDescription ( \ Librinfo \ VarietiesBundle \ Entity \ VarietyDescriptionPlant $ plantDescription ) { return $ this -> plant_descriptions -> removeElement ( $ plantDescription ) ; }
Remove plantDescription .
49,238
public function setPlantDescriptions ( $ descriptions ) { foreach ( $ descriptions as $ description ) { $ description -> setVariety ( $ this ) ; } $ this -> plant_descriptions = $ descriptions ; return $ this ; }
Set plant descriptions .
49,239
public function addCultureDescription ( \ Librinfo \ VarietiesBundle \ Entity \ VarietyDescriptionCulture $ cultureDescription ) { $ this -> culture_descriptions [ ] = $ cultureDescription ; return $ this ; }
Add cultureDescription .
49,240
public function removeCultureDescription ( \ Librinfo \ VarietiesBundle \ Entity \ VarietyDescriptionCulture $ cultureDescription ) { return $ this -> culture_descriptions -> removeElement ( $ cultureDescription ) ; }
Remove cultureDescription .
49,241
public function setCultureDescriptions ( $ descriptions ) { foreach ( $ descriptions as $ description ) { $ description -> setVariety ( $ this ) ; } $ this -> culture_descriptions = $ descriptions ; return $ this ; }
Set culture descriptions .
49,242
public function addInnerDescription ( \ Librinfo \ VarietiesBundle \ Entity \ VarietyDescriptionInner $ innerDescription ) { $ this -> inner_descriptions [ ] = $ innerDescription ; return $ this ; }
Add innerDescription .
49,243
public function removeInnerDescription ( \ Librinfo \ VarietiesBundle \ Entity \ VarietyDescriptionInner $ innerDescription ) { return $ this -> inner_descriptions -> removeElement ( $ innerDescription ) ; }
Remove innerDescription .
49,244
public function search ( string $ model , array $ fields ) : ? array { $ response = array ( ) ; foreach ( $ fields as $ param => $ value ) { $ check = $ model :: where ( $ param , $ value ) -> first ( ) ; if ( $ check != null ) { $ response = array_merge ( $ response , array ( $ param => "The $param has already been ta...
Check if a model value has already been used or not
49,245
public function isFeatureEnabled ( $ featureName ) { try { $ path = preg_split ( '/\./' , $ featureName ) ; $ foundValue = $ this -> findValueInMultiArray ( $ path , $ this -> features ) ; if ( is_array ( $ foundValue ) ) { return $ this -> checkEveryChild ( $ foundValue ) ; } else { return $ foundValue ; } } catch ( \...
Tests if given feature is enabled
49,246
protected function findValueInMultiArray ( array $ path , array $ reference ) { if ( count ( $ path ) == 0 || ! isset ( $ reference [ $ path [ 0 ] ] ) ) { throw new \ OutOfRangeException ( ) ; } $ currentElement = $ reference [ $ path [ 0 ] ] ; if ( ! isset ( $ path [ 1 ] ) ) { return $ currentElement ; } else if ( is_...
Find value in a multi - array
49,247
protected function checkEveryChild ( array $ features ) { foreach ( $ features as $ feature ) { $ result = is_array ( $ feature ) ? $ this -> checkEveryChild ( $ feature ) : $ feature ; if ( ! $ result ) { return false ; } } return true ; }
Checks every child of the array
49,248
public function add ( $ key , $ val ) { if ( ! isset ( $ this -> _attrs [ $ key ] ) ) { $ this -> _attrs [ $ key ] = [ ] ; } if ( ! strcasecmp ( $ key , 'id' ) ) { $ this -> _attrs [ $ key ] = $ val ; } else { array_push ( $ this -> _attrs [ $ key ] , $ val ) ; } return $ this ; }
Add attribute to tag
49,249
public function remove ( $ key ) { if ( isset ( $ this -> _attrs [ $ key ] ) ) { unset ( $ this -> _attrs [ $ key ] ) ; } return $ this ; }
Remove tag attribute
49,250
public function contains ( $ data , $ append = true ) { $ this -> _content = $ append ? $ this -> _content . $ data : $ data ; return $ this ; }
Set contents of tag
49,251
private function _format ( $ data ) { $ output_callback_function = '' ; if ( is_array ( $ data ) || is_object ( $ data ) ) { $ this -> header ( 'Content-type: application/json' ) ; $ output_callback_function = json_encode ( $ data ) ; } else { $ output_callback_function = $ data ; } $ output = $ output_callback_functio...
Return string value for data
49,252
public function get ( $ raw = false ) { return $ raw ? $ this -> _data : $ this -> _format ( $ this -> _data ) ; }
Get formatted responsed data
49,253
public function render ( ) { $ res = $ this -> get ( ) ; foreach ( $ this -> _headers as $ header ) { header ( $ header ) ; } foreach ( $ this -> _cookies as $ k => $ v ) { Cookie :: set ( $ k , $ v ) ; } print ( $ res ) ; }
Set response headers and print response text
49,254
protected function execUpload ( ) { $ this -> loadTranslations ( 'form' , sprintf ( 'private/global/locales/%s/form.ini' , LANGUAGE ) ) ; foreach ( $ this -> uploadFieldsDefinitions as $ fieldName => $ definition ) { $ validations = isset ( $ definition [ 'validations' ] ) ? $ definition [ 'validations' ] : null ; $ pr...
Execs upload action
49,255
protected function checkUpload ( ) { if ( ! isset ( $ this -> uploadFields [ $ this -> uploadedField ] ) ) { $ this -> uploadMessages [ ] = sprintf ( 'No definition set for POST uploadField field "%s"' , $ this -> uploadedField ) ; return false ; } foreach ( $ this -> uploadFieldsDefinitions [ $ this -> uploadedField ]...
Checks whether an upload has been tried
49,256
protected function handleUpload ( ) { $ this -> uploadedField = array_keys ( $ _FILES ) [ 0 ] ; $ this -> uploadOk = $ this -> checkUpload ( ) ; if ( ! $ this -> uploadOk ) { return ; } $ this -> uploadOk = $ this -> uploadFields [ $ this -> uploadedField ] -> handleUpload ( $ this -> uploader ) ; if ( ! $ this -> uplo...
Executes the upload action
49,257
protected function outputUploadOutcome ( ) { $ json = new \ stdClass ( ) ; if ( ! $ this -> uploadOk ) { if ( $ this -> uploader -> getMessages ( ) ) { $ this -> uploadMessages [ ] = implode ( '\n' , $ this -> uploader -> getMessages ( ) ) ; } $ json -> error = implode ( '\n' , $ this -> uploadMessages ) ; $ this -> ht...
Outputs to browser upload outcome in json format for ajax calls benefit
49,258
protected function purgeFiles ( ) { $ input = $ this -> processSaveInput ( filter_input_array ( INPUT_POST , $ this -> configuration [ 'subjects' ] [ $ this -> name ] [ 'CRUD' ] [ 'inputFields' ] ) ) ; $ primaryKeyValue = $ this -> extractPrimaryKeyValue ( $ input , 'a' ) ; $ record = $ this -> getByPrimaryKey ( $ prim...
Checks in case of CRUD update or delete if any file is to be deleted
49,259
public function extractFieldsOutputs ( & $ record , $ fieldsOutputs , $ propertyName = '_files' ) { foreach ( $ fieldsOutputs as $ field => $ outputs ) { $ this -> extractFieldOutputs ( $ record , $ field , $ outputs , $ propertyName ) ; } }
extracts for a record for one or more upload fields one or more outputs paths
49,260
public function extractFieldsOutputsList ( & $ records , $ fieldsOutputs , $ propertyName = '_files' ) { foreach ( $ records as $ record ) { $ this -> extractFieldsOutputs ( $ record , $ fieldsOutputs , $ propertyName ) ; } }
extracts for a list of records for one or more upload fields one or more outputs paths
49,261
public function toSQL ( Parameters $ params , bool $ inner_clause ) { $ drv = $ params -> getDriver ( ) ; $ lhs = $ this -> getLHS ( ) === null ? null : $ drv -> toSQL ( $ params , $ this -> getLHS ( ) , true ) ; $ rhs = $ drv -> toSQL ( $ params , $ this -> getRHS ( ) , true ) ; $ op = $ this -> getOperator ( ) ; if (...
Write an operator expression as SQL query syntax
49,262
protected function prepareValue ( $ value ) { $ value = $ this -> asDateTime ( $ value ) -> startOfDay ( ) ; return $ value -> format ( $ this -> getDateFormat ( ) ) ; }
Prepare the value to be stored .
49,263
public function bind ( $ id , $ concrete , $ singleton = false ) { $ concrete = $ concrete ? : $ id ; if ( ! $ concrete instanceof Closure ) { $ concrete = function ( Container $ container ) use ( $ id , $ concrete ) { $ method = ( $ id == $ concrete ) ? 'build' : 'resolve' ; return $ container -> $ method ( $ concrete...
Register a binding
49,264
public function enableInjecterDetection ( array $ blacklist = array ( ) , $ version = PHP_VERSION ) { if ( version_compare ( $ version , '5.4.0' ) <= 0 ) { throw new RunTimeException ( 'This feature requires PHP 5.4 or higher' ) ; } if ( $ this -> detector === null ) { $ this -> setDetector ( new SimpleDetector ) ; } $...
Enable the powerful injector method detection .
49,265
public function onResolving ( Closure $ callback , $ priority = 0 ) { if ( ! isset ( $ this -> callbacks [ $ priority ] ) ) { $ this -> callbacks [ $ priority ] = array ( ) ; } $ this -> callbacks [ $ priority ] [ ] = $ callback ; }
Register a listener for the resolving event . This is only fired on the main resolve not internal dependency resolves .
49,266
protected function isSingelton ( $ id ) { return ( isset ( $ this -> binds [ $ id ] [ 'singleton' ] ) && $ this -> binds [ $ id ] [ 'singleton' ] === true ) ; }
Checks whether the binding is a singelton
49,267
protected function buildDimdBlacklist ( array $ blacklist ) { if ( ! empty ( $ blacklist ) ) { return $ blacklist ; } elseif ( ! empty ( $ this -> dimbBlacklist ) ) { return $ this -> dimbBlacklist ; } else { return array ( ) ; } }
Just a wrapper for some basic control structured
49,268
public function loadSitesList ( $ user ) { if ( ! is_super_admin ( ) ) { return ; } if ( ! is_network_admin ( ) ) { return ; } if ( file_exists ( MSROLEPROPAGINATION_TEMPLATE_PATH . 'profile.php' ) ) { $ data = array ( 'sites' => array_chunk ( get_sites ( ) , 3 ) , 'savedState' => $ this -> getUserRoles ( $ user -> ID ...
Fetch the view
49,269
public function saveUserPofile ( $ user_id ) { if ( ! is_super_admin ( ) ) { return ; } if ( ! is_network_admin ( ) ) { return ; } if ( isset ( $ _POST [ 'userEnabled' ] ) && is_array ( $ _POST [ 'userEnabled' ] ) && ! empty ( $ _POST [ 'userEnabled' ] ) ) { foreach ( ( array ) $ _POST [ 'userEnabled' ] as $ site_key =...
Handle save data
49,270
public function getUserRoles ( $ user_id ) { $ roles = array ( ) ; foreach ( ( array ) get_sites ( ) as $ site ) { if ( $ site -> blog_id != 1 ) { $ userSettings = get_user_meta ( $ user_id , $ this -> db -> prefix . $ site -> blog_id . '_capabilities' , true ) ; } else { $ userSettings = get_user_meta ( $ user_id , $ ...
Get roles that are defined at each site
49,271
public function isValidJson ( string $ data ) : bool { json_decode ( $ data ) ; if ( json_last_error ( ) !== JSON_ERROR_NONE ) { return false ; } return true ; }
Check if json is valid
49,272
private function createJson ( ) { $ content = $ this -> getContent ( ) -> get ( ) ; $ json = json_encode ( $ content , JSON_PRESERVE_ZERO_FRACTION | JSON_BIGINT_AS_STRING | JSON_NUMERIC_CHECK | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ) ; if ( ! $ this -> isValidJson ( $ json ) ) { throw new \ Nuki \ Exceptions \ Bas...
Create json object
49,273
public function doCreate ( callable $ callbackAskNameAndService ) { assert ( $ this -> _dispatcher ) ; assert ( $ this -> _container ) ; $ this -> _clearStatProperties ( ) ; $ this -> _dispatcher -> dispatch ( self :: EVENT_INIT_SERVICE , OnInitService :: create ( ) ) ; try { $ this -> notify ( self :: STATE_FIRED ) ; ...
Create INI file template for new migration .
49,274
public function doStatus ( ) { assert ( $ this -> _dispatcher ) ; assert ( $ this -> _container ) ; $ this -> _clearStatProperties ( ) ; $ this -> _dispatcher -> dispatch ( self :: EVENT_INIT_SERVICE , OnInitService :: create ( ) ) ; try { $ this -> notify ( self :: STATE_FIRED ) ; $ modulesAndFiles = $ this -> _findMo...
Execute status command .
49,275
public function notify ( $ state = null ) { assert ( $ state === null || is_int ( $ state ) ) ; $ this -> _state = intval ( $ state ) ? : $ this -> _state ; foreach ( $ this -> _observers as $ observer ) { $ observer -> update ( $ this ) ; } }
Notify any observers about state change .
49,276
protected function _clearStatProperties ( ) { $ this -> _statErrors = 0 ; $ this -> _statMigrationsTotal = 0 ; $ this -> _statMigrationForCommit = 0 ; $ this -> _statMigrationForRollback = 0 ; $ this -> _statMigrationRejected = 0 ; $ this -> _statMigrationApplied = 0 ; }
Reset properties with statistic information .
49,277
public function doAction ( $ action , $ params ) { if ( method_exists ( $ this , $ action ) ) { $ this -> $ action ( $ params ) ; } else { $ this -> ActionNotFound ( $ action , $ params ) ; } }
Execute the action if it exists else calling ActionNotFound method
49,278
public function fragmentize ( ) { $ re = implode ( '|' , array ( self :: RE_SHORT_TOKEN_START , self :: RE_SHORT_TOKEN_END , self :: RE_LONG_TOKEN_START , self :: RE_LONG_TOKEN_END , self :: RE_TEXT ) ) ; preg_match_all ( '/' . $ re . '/' , $ this -> text , $ matches ) ; $ this -> fragments = $ matches [ 0 ] ; $ this -...
Splits texts into fragments where some fragments are tokens others are text
49,279
public static function escape ( $ value ) { if ( $ value instanceof Htmlable ) return $ value -> toHtml ( ) ; return htmlentities ( $ value , ENT_QUOTES , 'UTF-8' , false ) ; }
Escape HTML entities in a string .
49,280
public static function dms ( $ d , $ m = 0 , $ s = 0 , $ f = 0 ) { $ asec = static :: dmsf2asec ( $ d , $ m , $ s , $ f ) ; return static :: mas ( $ asec * 1000 ) ; }
Creates a new angle from degree arcminute and arcsecond components .
49,281
public static function time ( Time $ time , Time $ interval = null ) { $ secInDay = Time :: days ( 1 ) -> sec ; $ interval = $ interval ? $ interval -> sec : $ secInDay ; return static :: deg ( $ time -> sec / $ interval * 360 ) ; }
Creates a new angle equal to the number of revolutions of a duration of time within a specified time interval .
49,282
public static function atan2 ( $ y , $ x ) { $ y = $ y instanceof Angle ? $ y -> rad : $ y ; $ x = $ x instanceof Angle ? $ x -> rad : $ x ; return static :: rad ( atan2 ( $ y , $ x ) ) ; }
Creates a new angle from the arc tangent of two Angle instances or float values expressed in radians .
49,283
public function toTime ( Time $ interval = null ) { $ secInDay = Time :: days ( 1 ) -> sec ; $ interval = $ interval ? $ interval -> sec : $ secInDay ; return Time :: sec ( ( $ this -> deg / 360 ) * $ interval ) ; }
Converts this instance to a proportion of time passed within a specified time interval where 360 degrees is equal to the interval .
49,284
public static function make ( string $ path , string $ manifestDirectory ) : string { static $ manifest ; if ( $ manifestDirectory && strpos ( $ manifestDirectory , DIRECTORY_SEPARATOR ) !== 0 ) { $ manifestDirectory = DIRECTORY_SEPARATOR . "{$manifestDirectory}" ; } if ( ! $ manifest ) { if ( ! file_exists ( $ manifes...
Get mix file
49,285
public function field ( string $ key , $ value = null , $ description = null ) { if ( ! $ field = $ this -> fields -> where ( 'key' , $ key ) -> first ( ) ) { $ this -> fields -> push ( $ field = $ this -> fields ( ) -> firstOrNew ( compact ( 'key' ) ) ) ; } $ field -> setDefaultValue ( $ value ) ; $ field -> setDefaul...
Get or create a field .
49,286
protected function extractPrimaryKeyValue ( $ record , $ returnAs ) { $ record = ( object ) $ record ; $ values = [ ] ; foreach ( ( array ) $ this -> ORMParameters [ 'primaryKey' ] as $ field ) { $ values [ $ field ] = $ record -> $ field ; } switch ( $ returnAs ) { case 's' : return implode ( '|' , $ values ) ; break ...
Builds primary key value for a record
49,287
protected function purgePrimaryKeyValue ( & $ record ) { foreach ( ( array ) $ this -> ORMParameters [ 'primaryKey' ] as $ field ) { if ( is_array ( $ record ) && ( isset ( $ record [ $ field ] ) || $ record [ $ field ] === null ) ) { unset ( $ record [ $ field ] ) ; } elseif ( is_object ( $ record ) && isset ( $ recor...
Purges primary key value for a record
49,288
protected function execList ( ) { if ( ! empty ( $ this -> ancestors ) ) { end ( $ this -> ancestors ) ; $ parentPrimaryKey = current ( $ this -> ancestors ) ; } else { $ parentPrimaryKey = [ ] ; } $ this -> templateParameters [ 'records' ] = $ this -> get ( $ parentPrimaryKey ) ; $ this -> loadTranslations ( 'list' , ...
Displays list table
49,289
protected function execInsertForm ( ) { $ this -> loadTranslations ( 'form' , sprintf ( 'private/global/locales/%s/form.ini' , LANGUAGE ) ) ; $ this -> renderTemplate ( sprintf ( '%s/%s/save-form' , AREA , $ this -> name ) ) ; }
Displays insert form
49,290
protected function execUpdateForm ( ) { $ this -> loadTranslations ( 'form' , sprintf ( 'private/global/locales/%s/form.ini' , LANGUAGE ) ) ; $ this -> templateParameters [ 'record' ] = $ this -> getByPrimaryKey ( $ this -> primaryKeyValue ) ; $ this -> renderTemplate ( sprintf ( '%s/%s/save-form' , AREA , $ this -> na...
Displays update form
49,291
public function execInsert ( $ redirectAction = false ) { $ this -> loadTranslations ( 'database' , sprintf ( 'private/global/locales/%s/database.ini' , LANGUAGE ) ) ; $ input = $ this -> processSaveInput ( filter_input_array ( INPUT_POST , $ this -> configuration [ 'subjects' ] [ $ this -> name ] [ 'CRUD' ] [ 'inputFi...
Insert record action
49,292
public function execUpdate ( $ redirectAction = false ) { $ this -> loadTranslations ( 'database' , sprintf ( 'private/global/locales/%s/database.ini' , LANGUAGE ) ) ; $ input = $ this -> processSaveInput ( filter_input_array ( INPUT_POST , $ this -> configuration [ 'subjects' ] [ $ this -> name ] [ 'CRUD' ] [ 'inputFi...
Update record action
49,293
public function execDelete ( $ redirectAction = false ) { $ this -> loadTranslations ( 'database' , sprintf ( 'private/global/locales/%s/database.ini' , LANGUAGE ) ) ; $ input = $ this -> processSaveInput ( filter_input_array ( INPUT_POST , $ this -> configuration [ 'subjects' ] [ $ this -> name ] [ 'CRUD' ] [ 'inputFi...
Delete record action
49,294
protected function execDeleteBulk ( ) { $ primaryKeyValues = $ _POST [ 'primaryKeyValues' ] ; $ this -> loadTranslations ( 'database' , sprintf ( 'private/global/locales/%s/database.ini' , LANGUAGE ) ) ; $ deletedNumber = 0 ; foreach ( $ primaryKeyValues as $ recordPrimaryKeyValues ) { try { $ this -> delete ( $ record...
deletes multiple record
49,295
private function createElasticClient ( $ clientName , ContainerBuilder $ container ) { $ smfName = sprintf ( '%s.metadata' , $ clientName ) ; $ definition = new Definition ( Utility :: getLibraryClass ( 'Search\Elastic\StorageMetadataFactory' ) ) ; $ definition -> setPublic ( false ) ; $ container -> setDefinition ( $ ...
Creates the Elastic search client service definition . Will also load support services .
49,296
protected function compiled ( $ template ) { $ template = ltrim ( $ template , '/' ) ; if ( strrchr ( $ template , '.' ) == $ this -> extension ) $ template = substr ( $ template , 0 , - strlen ( $ this -> extension ) ) ; $ file = $ this -> dir . DIRECTORY_SEPARATOR . $ template . $ this -> extension ; if ( ! is_file (...
Fetch Compiled Template
49,297
protected static function initWidgetParameters ( $ widget , array $ parameters ) { $ param = var_export ( $ parameters , true ) ; $ param = preg_replace ( "/'\\$(.*)',/isU" , "\$\\1," , $ param ) ; $ param = str_replace ( '\\\'' , '\'' , $ param ) ; return "<?php \$this->widget->setParameters($param);?>\n" ; }
Set Widget Parameters
49,298
protected static function writeFile ( $ target , $ content , $ tmp ) { $ dir = dirname ( $ target ) ; if ( ! is_dir ( $ dir ) ) mkdir ( $ dir , 644 , true ) ; $ file = tempnam ( $ tmp , 'hum' ) ; if ( ! ( $ fd = fopen ( $ file , 'w' ) ) ) throw new \ RuntimeException ( "create template tmp file failed:$file!" ) ; fwrit...
Write Compiled File
49,299
public function execute ( ) : void { $ path = '' ; try { $ path = $ this -> getPath ( ) ; if ( $ this -> config -> cache ) { try { $ this -> setCache ( ) ; } catch ( StorageNotSupportedException $ e ) { $ this -> cache = null ; } catch ( StorageConnectException $ e ) { $ this -> cache = null ; } } if ( null !== $ this ...
Application main workflow .