idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
236,000
protected function getListenerEvents ( $ listener , $ eventName = '' ) { if ( ! $ this -> isListener ( $ listener ) ) { throw new Exception \ InvalidArgumentException ( Message :: get ( Message :: INVALID_EVENT_LISTENER , is_object ( $ listener ) ? get_class ( $ listener ) : $ listener ) , Message :: INVALID_EVENT_LIST...
Get listener events array
236,001
protected function makeCallables ( $ listener , $ callable , $ priority ) { $ result = [ ] ; if ( is_array ( $ callable ) ) { if ( isset ( $ callable [ 1 ] ) && is_int ( $ callable [ 1 ] ) ) { $ priority = $ callable [ 1 ] ; $ xc = $ callable [ 0 ] ; } else { foreach ( $ callable as $ cc ) { $ result = array_merge ( $ ...
Returns an array of callables
236,002
protected function attachIt ( $ eventName , $ listener , $ callable , $ priority ) { if ( $ this -> hasEventQueue ( $ eventName ) ) { $ q = $ this -> getEventQueue ( $ eventName ) ; } else { $ q = new EventQueue ( ) ; $ this -> events [ $ eventName ] = $ q ; } if ( is_null ( $ listener ) ) { if ( empty ( $ eventName ) ...
Attach callable to event queque
236,003
protected function detachIt ( $ eventName , $ listener , $ callable ) { if ( $ eventName != '' && ! $ this -> hasEventQueue ( $ eventName ) ) { return ; } if ( is_null ( $ listener ) ) { $ xc = [ [ $ callable , 50 ] ] ; } else { $ xc = $ this -> makeCallables ( $ listener , $ callable , 50 ) ; } if ( empty ( $ xc ) ) {...
Detach callable to event queque
236,004
protected function matchEventQueue ( $ eventName , EventManagerInterface $ manager ) { $ names = $ this -> globNames ( $ eventName , $ manager -> getEventNames ( ) ) ; $ queue = new EventQueue ( ) ; foreach ( $ names as $ n ) { if ( $ manager -> hasEventQueue ( $ n ) ) { $ queue = $ queue -> combine ( $ manager -> getE...
Match proper event queue with globbing support
236,005
protected function globNames ( $ eventName , array $ names ) { $ result = [ ] ; foreach ( $ names as $ n ) { if ( $ n === '*' || $ n === $ eventName || $ eventName === '' ) { $ result [ ] = $ n ; } elseif ( strpos ( $ n , '*' ) !== false ) { $ regex = str_replace ( array ( '.' , '*' ) , array ( '[.]' , '.*?' ) , $ n ) ...
Return those globbing event names based on the given one
236,006
public function from ( $ table , string $ alias = null ) : self { return $ this -> table ( $ table , $ alias ) ; }
Table method alias
236,007
public function addSelect ( $ columns , string $ alias = null ) : self { if ( ! is_array ( $ columns ) ) { if ( $ alias === null ) { $ columns = [ $ columns ] ; } else { $ columns = [ $ alias => $ columns ] ; } } foreach ( $ columns as $ alias => $ column ) { $ column = $ this -> checkStringValue ( 'Argument $columns['...
Adds column or columns to the SELECT section .
236,008
public function addCount ( $ column = '*' , string $ alias = null ) : self { return $ this -> addAggregate ( 'COUNT' , $ column , $ alias ) ; }
Adds a COUNT aggregate to the SELECT section .
236,009
public function addAvg ( $ column , string $ alias = null ) : self { return $ this -> addAggregate ( 'AVG' , $ column , $ alias ) ; }
Adds a AVG aggregate to the SELECT section .
236,010
public function addSum ( $ column , string $ alias = null ) : self { return $ this -> addAggregate ( 'SUM' , $ column , $ alias ) ; }
Adds a SUM aggregate to the SELECT section .
236,011
public function addMin ( $ column , string $ alias = null ) : self { return $ this -> addAggregate ( 'MIN' , $ column , $ alias ) ; }
Adds a MIN aggregate to the SELECT section .
236,012
public function addMax ( $ column , string $ alias = null ) : self { return $ this -> addAggregate ( 'MAX' , $ column , $ alias ) ; }
Adds a MAX aggregate to the SELECT section .
236,013
protected function addAggregate ( string $ function , $ column , string $ alias = null ) : self { $ column = $ this -> checkStringValue ( 'Argument $column' , $ column ) ; $ aggregate = new Aggregate ( $ function , $ column ) ; if ( $ alias === null ) { $ this -> select [ ] = $ aggregate ; } else { $ this -> select [ $...
Adds an arbitrary aggregate to the SELECT section .
236,014
public function run ( Migration $ migration , $ executeQueries = false , $ forcedRollback = false ) { $ this -> migration = $ migration ; try { $ this -> playQueries ( $ executeQueries ) ; if ( $ forcedRollback ) { $ this -> playRollbackQueries ( $ executeQueries ) ; } } catch ( Exception $ e ) { $ this -> playRollback...
Run a migration
236,015
private function playQueries ( $ executeQueries = false ) { foreach ( $ this -> migration -> getQueries ( ) as $ idx => $ query ) { try { $ this -> runQuery ( $ query , $ executeQueries ) ; } catch ( \ Exception $ e ) { if ( $ idx >= 1 ) { throw new Exception ( $ e -> getMessage ( ) ) ; } throw $ e ; } } }
Play Script queries
236,016
private function playRollbackQueries ( $ executeQueries = false ) { foreach ( $ this -> migration -> getRollbackQueries ( ) as $ query ) { $ this -> runQuery ( $ query , $ executeQueries ) ; } }
Play rollback queries
236,017
private function runQuery ( Query $ query , $ executeQueries = false ) { $ this -> playedQueries [ ] = $ query ; if ( $ executeQueries ) { $ this -> connection -> executeQuery ( ( string ) $ query ) ; } }
Run a query if execute query is true else simply add query to played queries stack
236,018
public function rewind ( ) { $ this -> dir -> rewind ( ) ; $ this -> iter = 0 ; $ this -> hasNext ( ) ; $ this -> cur_entry = $ this -> next_entry ; $ this -> next_entry = null ; }
Rewind the directory reader to the start
236,019
public function setPlatform ( $ platform ) { if ( ! in_array ( $ platform , array ( Software :: PLATFORM_MAC , Software :: PLATFORM_IOS ) , true ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Undefined software platform "%s".' , $ platform ) ) ; } $ this -> platform = $ platform ; return $ this ; }
Set software platform
236,020
public function setUserRatingCount ( $ userRatingCount ) { $ userRatingCount = ( int ) $ userRatingCount ; if ( $ userRatingCount < 0 ) { throw new \ InvalidArgumentException ( sprintf ( 'User rating can\'t be less than "0", "%s" given.' , $ userRatingCount ) ) ; } $ this -> userRatingCount = ( int ) $ userRatingCount ...
Set user rating count
236,021
public function setAverageUserRating ( $ averageUserRating ) { $ averageUserRating = ( float ) $ averageUserRating ; if ( $ averageUserRating < 0 || $ averageUserRating > 5 ) { throw new \ InvalidArgumentException ( sprintf ( 'Average user rating must be between 0 and 5, "%s" given.' , $ averageUserRating ) ) ; } if ( ...
Set user average rating
236,022
public function setUserRatingCountCurrent ( $ userRatingCountCurrent ) { $ userRatingCountCurrent = ( int ) $ userRatingCountCurrent ; if ( $ userRatingCountCurrent < 0 ) { throw new \ InvalidArgumentException ( sprintf ( 'User rating can\'t be less than "0", "%s" given.' , $ userRatingCountCurrent ) ) ; } $ this -> us...
Set user rating count for current version
236,023
public function setAverageUserRatingCurrent ( $ averageUserRatingCurrent ) { $ averageUserRatingCurrent = ( float ) $ averageUserRatingCurrent ; if ( $ averageUserRatingCurrent < 0 || $ averageUserRatingCurrent > 5 ) { throw new \ InvalidArgumentException ( sprintf ( 'Average user rating must be between 0 and 5, "%s" g...
Set average user rating for current version
236,024
public function actionIndex ( ) { $ model = new Events ( 'search' ) ; $ model -> unsetAttributes ( ) ; if ( isset ( $ _GET [ 'Event' ] ) ) $ model -> attributes = $ _GET [ 'Event' ] ; $ dataProvider = $ model -> search ( ) ; $ dataProvider -> pagination = array ( 'pageVar' => 'page' ) ; if ( $ dataProvider -> totalItem...
Provides functionality to search through events
236,025
public function actionPageviews ( ) { $ models = Events :: model ( ) -> groupByUrl ( ) -> findAll ( ) ; $ response = array ( ) ; foreach ( $ models as $ model ) $ response [ ] = array ( 'uri' => $ model -> uri , 'count' => $ model -> id ) ; return $ response ; }
Shows pageview results
236,026
public function setColumnNames ( array $ columnNames ) { $ this -> columnNames = array ( ) ; foreach ( $ columnNames as $ columnName ) { $ this -> addColumnName ( $ columnName ) ; } }
Sets the column names .
236,027
public function actionShowOrderList ( ) { if ( ! \ Yii :: $ app -> user -> isGuest ) { $ userOrders = \ Yii :: $ app -> cart -> getAllUserOrders ( ) ; $ filterModel = new OrderSearch ( ) ; $ dataProvider = $ filterModel -> search ( Yii :: $ app -> request -> get ( ) ) ; return $ this -> render ( 'order-list' , [ 'userO...
Return list of user orders .
236,028
public function switchOrganization ( User $ user , OrganizationInterface $ organization ) { $ role = $ this -> getOrganizationRole ( $ user , $ organization ) ; if ( $ role == false && ! $ this -> authorizationChecker -> isGranted ( 'ROLE_SUPER_ADMIN' ) ) { throw new NotFoundHttpException ( 'Roles in organization not f...
Switch the working organization of logged user
236,029
public function getOrganizationRole ( $ user , $ organization ) { return $ this -> dm -> getRepository ( 'WobbleCodeUserBundle:Role' ) -> findOneBy ( [ 'organization.$id' => new \ MongoId ( $ organization -> getId ( ) ) , 'user.$id' => new \ MongoId ( $ user -> getId ( ) ) ] ) ; }
Get user role definition within an organization
236,030
protected function _createProduct ( $ config , $ data ) { $ className = static :: PRODUCT_CLASS_NAME ; $ referenceContainer = $ this -> _getReferenceContainer ( $ config ) ; return new $ className ( $ data , $ referenceContainer ) ; }
Creates a new factory product .
236,031
protected function _getReferenceContainer ( $ config ) { try { $ container = $ this -> _containerHas ( $ config , static :: K_REFERENCE_CONTAINER ) ? $ this -> _containerGet ( $ config , static :: K_REFERENCE_CONTAINER ) : $ this -> _getContainer ( ) ; } catch ( RootException $ e ) { throw $ this -> _createRuntimeExcep...
Retrieves the reference container to create the child with .
236,032
public function insert ( $ model , $ onDuplicate = false ) { $ query = $ this -> insertQuery ( $ model , $ onDuplicate ) ; $ query -> execute ( ) ; return $ this -> getDB ( ) -> lastInsertID ( ) ; }
Inserts a Record into the database
236,033
public function update ( Record $ model ) { $ query = $ this -> updateQuery ( $ model ) ; if ( $ query ) { return $ query -> execute ( ) ; } return false ; }
Updates a Record s database entry
236,034
public function save ( Record $ model ) { $ pk = $ this -> getPrimaryKey ( ) ; if ( isset ( $ model -> { $ pk } ) ) { $ model -> update ( ) ; return $ model -> { $ pk } ; } else { $ previous = $ model -> exists ( ) ; if ( $ previous ) { $ data = $ model -> toArray ( ) ; if ( $ data ) { $ previous -> writeData ( $ model...
Saves a Record s database entry
236,035
public function addSeedBatch ( $ seedBatch ) { $ this -> seedBatches [ ] = $ seedBatch ; if ( method_exists ( get_class ( $ this ) , 'setProducer' ) ) { $ seedBatch -> setProducer ( $ this ) ; } return $ this ; }
Add seed batch .
236,036
public function fetchEntityFromCache ( EntityLoadEvent $ event ) { $ entity = $ event -> getEntity ( ) ; if ( false !== $ data = $ this -> cache -> get ( $ entity ) ) { $ entity -> setDataFromCache ( $ data ) ; $ entity -> setIsLoaded ( true ) ; $ this -> dispatcher -> dispatch ( 'cache.load' , new CacheEvent ( $ entit...
Load data from cache
236,037
public function decode ( $ fromjson ) { $ textfilter = $ this -> di -> get ( "textfilter" ) ; $ toparse = json_decode ( $ fromjson ) ; $ comt = $ textfilter -> parse ( $ toparse -> text , [ "yamlfrontmatter" , "shortcode" , "markdown" , "titlefromheader" ] ) ; $ comt = strip_tags ( $ comt -> text ) ; return $ comt ; }
Converts json - string back to variables
236,038
public function isSubmitted ( Request $ request ) { $ arguments = $ this -> method === "GET" ? $ request -> get : $ request -> post ; return $ this -> method === $ request -> method && $ arguments [ '_form_name' ] === $ this -> name ; }
Check if the form has been submitted
236,039
public function isValid ( Request $ request ) { $ arguments = $ this -> method === "GET" ? $ request -> get : $ request -> post ; $ files = $ request -> files ; if ( ! $ this -> validate ( $ arguments , $ files ) ) return false ; $ params = [ 'form' => $ this , 'request' => $ request , 'valid' => true , 'arguments' => ...
Check if the form submission is valid
236,040
public function validate ( Dictionary $ arguments , Dictionary $ files ) { $ complete = true ; $ this -> errors = [ ] ; $ this -> value = [ ] ; foreach ( $ this -> form_elements as $ name => $ element ) { if ( $ element instanceof Form ) { if ( ! $ element -> validateAsSubForm ( $ arguments , $ files ) ) { $ this -> er...
Make sure the form was submitted correctly . When errors occur these can be obtained using getErrors .
236,041
public function validateAsSubForm ( Dictionary $ arguments , Dictionary $ files ) { $ name = $ this -> name ; if ( ! $ arguments -> has ( $ name , Type :: ARRAY ) ) { $ this -> errors = [ ] ; if ( $ this -> isRequired ( ) ) { $ this -> errors = [ '' => [ 'msg' => "{name} is required" , 'context' => [ 'name' => $ name ]...
Validate the form as a sub form
236,042
public function prepare ( Session $ session = null , bool $ is_root_form = true ) { foreach ( $ this -> form_elements as $ field ) { if ( $ field instanceof Form ) $ field -> prepare ( null , false ) ; } $ params = [ 'form' => $ this , 'session' => $ session , 'is_root_form' => $ is_root_form ] ; $ params = TypedDictio...
Prepare the form for rendering . This will generate the nonce and add the form name
236,043
public function offsetSet ( $ offset , $ value ) { if ( ! ( $ value instanceof FormField ) ) throw new InvalidArgumentException ( "Value must be a FormField" ) ; $ this -> form_elements [ $ offset ] = $ value ; }
Add or replace a form element
236,044
protected function verifyClassMap ( array $ classMap ) { foreach ( $ classMap as $ type => $ class ) { if ( ! class_exists ( $ class ) ) { throw new Exception ( "Class '$class' that has been registered for type '$type' does not exist" ) ; } if ( ! in_array ( PropertyInterface :: class , class_implements ( $ class ) ) )...
Ensures that the given class map contains valid values .
236,045
protected function setRelation ( $ request ) { $ this -> changeRelationModel ( ) ; $ relation = [ ] ; if ( $ request -> has ( 'group-thumbnail' ) ) { $ this -> relations [ 'thumbnails' ] [ 'datas' ] = collect ( $ request -> get ( 'group-thumbnail' ) ) -> reject ( function ( $ item ) { return ! $ item [ 'thumbnail_slug'...
set the relations
236,046
protected function setRelationDefine ( $ parent ) { $ this -> changeRelationModel ( ) ; $ this -> setDefineValues ( $ this -> defineValues ) ; $ this -> relations [ 'thumbnails' ] [ 'datas' ] = $ parent -> thumbnails ( ) -> get ( [ 'slug' , 'photo_width' , 'photo_height' ] ) -> toArray ( ) ; $ this -> relations [ 'extr...
set relation define datas
236,047
protected function changeRelationModel ( ) { $ module = getModule ( get_called_class ( ) ) ; $ module = explode ( '-' , $ module ) ; $ module = ucfirst_tr ( $ module [ 1 ] ) ; $ this -> relations [ 'thumbnails' ] [ 'relation_model' ] = "\\App\\{$module}Thumbnail" ; $ this -> relations [ 'extras' ] [ 'relation_model' ] ...
change relation model
236,048
public function updateFields ( Guard $ auth , $ ip = null ) : bool { $ ip = $ this -> setIpValue ( $ ip ) ; $ user = $ auth -> user ( ) ; if ( ! $ user instanceof Model ) { return false ; } $ user -> last_login_ip = $ ip ; $ lastLoginDate = config ( 'iptraceable.fields.last_login_date' ) ; if ( ! is_null ( $ lastLoginD...
Update the fields for the user .
236,049
public function contains ( DateTime $ datetime ) { $ lower = $ this -> lower -> toUnixTimestamp ( ) ; $ upper = $ this -> upper -> toUnixTimestamp ( ) ; $ working = $ datetime -> toUnixTimestamp ( ) ; $ lowerCompare = bccomp ( $ lower , $ working ) ; $ upperCompare = bccomp ( $ upper , $ working ) ; if ( $ lowerCompare...
Does this interval contain our time
236,050
private function getFieldOutputEnumSet ( $ tblSrc , $ fldType , $ val , $ iar = [ ] ) { $ adnlThings = $ this -> establishDefaultEnumSet ( $ fldType ) ; if ( array_key_exists ( 'readonly' , $ val ) ) { return $ this -> getFieldOutputEnumSetReadOnly ( $ val , $ adnlThings ) ; } $ inAdtnl = $ adnlThings [ 'additional' ] ...
Returns a Enum or Set field to use in form
236,051
private function getFieldOutputText ( $ tbl , $ fieldType , $ value , $ iar = [ ] ) { if ( ! in_array ( $ fieldType , [ 'char' , 'tinytext' , 'varchar' ] ) ) { return '' ; } $ foreignKeysArray = $ this -> getFieldOutputTextPrerequisites ( $ tbl , $ value ) ; if ( $ foreignKeysArray !== [ ] ) { return $ this -> getField...
Returns a Char field 2 use in a form
236,052
protected function getFieldOutputTextLarge ( $ fieldType , $ value , $ iar = [ ] ) { if ( ! in_array ( $ fieldType , [ 'blob' , 'text' ] ) ) { return '' ; } $ inAdtnl = [ 'name' => $ value [ 'COLUMN_NAME' ] , 'id' => $ value [ 'COLUMN_NAME' ] , 'rows' => 4 , 'cols' => 55 , ] ; if ( $ iar !== [ ] ) { $ inAdtnl = array_m...
Returns a Text field 2 use in a form
236,053
private function getFieldOutputTimestamp ( $ dtl , $ iar = [ ] ) { if ( ( $ dtl [ 'COLUMN_DEFAULT' ] == 'CURRENT_TIMESTAMP' ) || ( $ dtl [ 'EXTRA' ] == 'on update CURRENT_TIMESTAMP' ) ) { return $ this -> getTimestamping ( $ dtl ) [ 'input' ] ; } $ input = $ this -> getFieldOutputTT ( $ dtl , 19 , $ iar ) ; if ( ! arra...
Returns a Timestamp field 2 use in a form
236,054
private function getFieldOutputYear ( $ tblName , $ details , $ iar ) { $ listOfValues = [ ] ; for ( $ cntr = 1901 ; $ cntr <= 2155 ; $ cntr ++ ) { $ listOfValues [ $ cntr ] = $ cntr ; } if ( $ iar == [ ] ) { $ slDflt = $ this -> getFieldValue ( $ details ) ; return $ this -> setArrayToSelect ( $ listOfValues , $ slDfl...
Returns a Year field 2 use in a form
236,055
protected function getSetOrEnum2Array ( $ refTbl , $ refCol ) { $ dat = $ this -> establishDatabaseAndTable ( $ refTbl ) ; foreach ( $ this -> advCache [ 'tableStructureCache' ] [ $ dat [ 0 ] ] [ $ dat [ 1 ] ] as $ vle ) { if ( $ vle [ 'COLUMN_NAME' ] == $ refCol ) { $ kVl = explode ( '\',\'' , substr ( $ vle [ 'COLUMN...
Returns an array with possible values of a SET or ENUM column
236,056
private function getTimestamping ( $ dtl ) { $ fieldValue = $ this -> getFieldValue ( $ dtl ) ; $ inM = $ this -> setStringIntoTag ( $ fieldValue , 'span' ) ; if ( in_array ( $ fieldValue , [ '' , 'CURRENT_TIMESTAMP' , 'NULL' ] ) ) { $ mCN = [ 'InsertDateTime' => 'data/timpul ad. informatiei' , 'ModificationDateTime' =...
Returns a timestamp field value
236,057
public function indexAction ( Request $ request ) { $ response = $ this -> getCacheTimeKeeper ( ) -> getResponse ( 'AnimeDbAppBundle:Notice' ) ; if ( $ response -> isNotModified ( $ request ) ) { return $ response ; } $ rep = $ this -> getRepository ( ) ; $ change_form = $ this -> createForm ( new ChangeNotice ( ) ) ->...
Edit list notices .
236,058
public function listAction ( Request $ request ) { $ current_page = $ request -> get ( 'page' , 1 ) ; $ current_page = $ current_page > 1 ? $ current_page : 1 ; $ rep = $ this -> getRepository ( ) ; $ filter = $ this -> createForm ( 'notices_filter' ) -> handleRequest ( $ request ) ; if ( $ filter -> isValid ( ) ) { $ ...
Get notice list .
236,059
public function getAllPublished ( $ orderBy = null , $ limit = null ) { return $ this -> repository -> findAllPublished ( $ orderBy , $ limit ) ; }
Method which finds all published items in the repository
236,060
public function getById ( $ id = null ) { if ( $ id === null ) { throw new ItemNotSelectedException ; } $ entity = $ this -> repository -> findById ( $ id ) ; if ( ! $ entity ) { throw new NonexistingItemException ; } return $ entity ; }
Method which finds one item in the repository
236,061
public static function parseHeader ( MessageInterface $ message , $ header ) { static $ trimmed = "\"' \n\t\r" ; $ params = $ matches = [ ] ; foreach ( self :: normalizeHeader ( $ message , $ header ) as $ val ) { $ part = [ ] ; foreach ( preg_split ( '/;(?=([^"]*"[^"]*")*[^"]*$)/' , $ val ) as $ kvp ) { if ( preg_mat...
Parse an array of header values containing ; separated data into an array of associative arrays representing the header key value pair data of the header . When a parameter does not contain a value but just contains a key this function will inject a key with a string value .
236,062
public static function getHeadersAsString ( MessageInterface $ message ) { $ result = '' ; foreach ( $ message -> getHeaders ( ) as $ name => $ values ) { $ result .= "\r\n{$name}: " . implode ( ', ' , $ values ) ; } return $ result ; }
Gets the headers of a message as a string
236,063
public static function getStartLine ( MessageInterface $ message ) { if ( $ message instanceof RequestInterface ) { return trim ( $ message -> getMethod ( ) . ' ' . $ message -> getResource ( ) ) . ' HTTP/' . $ message -> getProtocolVersion ( ) ; } elseif ( $ message instanceof ResponseInterface ) { return 'HTTP/' . $ ...
Gets the start line of a message
236,064
public function url ( $ withParams = false ) { $ url = $ this -> scheme ( ) . '://' ; $ url .= $ this -> domain ( ) ; return $ url . $ this -> urlPath ( $ withParams ) ; }
Gets request URL
236,065
public function urlPath ( $ withParams = false ) { $ path = $ this -> server ( 'request_uri' ) ; if ( ! $ withParams ) { $ position = mb_strpos ( $ path , '?' ) ; if ( $ position !== false ) { $ path = mb_substr ( $ path , 0 , $ position ) ; } } return $ path ; }
without host & schema
236,066
public function addColumn ( $ type , $ column , array $ parameters = array ( ) ) { if ( ! $ this -> builder -> hasColumn ( $ this -> table , $ column ) ) return parent :: addColumn ( $ type , $ column , $ parameters ) ; }
Add column only if there isn t one . So it will not throw if there already exists .
236,067
private function configLaravelAuthPackage ( ) { $ config = $ this -> config ( ) ; $ config -> set ( 'laravel-auth' , Arr :: only ( $ config -> get ( 'arcanesoft.auth' ) , [ 'database' , 'users' , 'roles' , 'role-user' , 'permissions-groups' , 'permissions' , 'permission-role' , 'password-resets' , 'events' , 'user-conf...
Config the Laravel Auth package .
236,068
private function rebindModels ( ) { $ config = $ this -> config ( ) ; $ bindings = [ [ 'abstract' => \ Arcanesoft \ Contracts \ Auth \ Models \ User :: class , 'concrete' => $ config -> get ( 'arcanesoft.auth.users.model' ) , ] , [ 'abstract' => \ Arcanesoft \ Contracts \ Auth \ Models \ Role :: class , 'concrete' => $...
Rebind the auth models .
236,069
public function actionGenfake ( $ file ) { $ path = $ this -> buildFakePath ( $ file ) ; if ( ! $ this -> force && file_exists ( $ path ) ) { Yii :: warning ( "already exists: $path" ) ; return 1 ; } return $ this -> genFake ( $ file , $ path ) ; }
Generates skeleton class for fake .
236,070
public function toSQL ( Parameters $ params , bool $ inner_clause ) { $ alias = $ this -> alias ; $ drv = $ params -> getDriver ( ) ; $ sql = $ drv -> toSQL ( $ params , $ this -> expression , true ) ; if ( empty ( $ this -> alias ) ) $ this -> alias = $ params -> generateAlias ( $ this -> expression ) ; if ( ! empty (...
Write a select return clause as SQL query syntax
236,071
public function parseXMLString ( $ xmlString , $ simpleXMLClass = 'SimpleXMLExtended' ) { libxml_use_internal_errors ( true ) ; $ doc = simplexml_load_string ( $ xmlString , $ simpleXMLClass ) ; if ( false === $ doc ) { $ xml = explode ( "\n" , $ xmlString ) ; $ errors = libxml_get_errors ( ) ; $ errorString = '' ; for...
Converts an XML string into a SimpleXMLElement object
236,072
protected function loadIncludes ( $ xmlPath , $ xmlString ) { $ m = null ; if ( preg_match_all ( "/\<include\s*href\=\"([^\"]+)\".*?\/\>/si" , $ xmlString , $ m , PREG_SET_ORDER ) !== false ) { foreach ( $ m as $ match ) { $ includeFile = rtrim ( $ xmlPath , '/' ) . '/' . $ match [ 1 ] ; if ( file_exists ( $ includeFil...
Loads all the includes into the xml string .
236,073
public function attachSubject ( $ event , \ SplSubject $ subject ) { $ key = $ this -> getUniqueKey ( $ event ) ; if ( ! array_key_exists ( $ event , $ this -> subjects ) ) { $ this -> subjects [ $ event ] = array ( ) ; } $ this -> subjects [ $ event ] [ $ key ] = $ subject ; return $ key ; }
Registers a subject to be called an a specific event .
236,074
public function detachSubject ( $ event , $ key ) { Assertion :: notEmptyKey ( $ this -> subjects , $ event , 'Provided event does not exist.' ) ; Assertion :: notEmptyKey ( $ this -> subjects [ $ event ] , $ key , 'Subject to be detached does not exist.' ) ; unset ( $ this -> subjects [ $ event ] [ $ key ] ) ; }
Unregisters a subject from a specific event .
236,075
public function emit ( $ event ) { if ( ! empty ( $ this -> subjects [ $ event ] ) ) { foreach ( $ this -> subjects [ $ event ] as $ subject ) { $ subject -> notify ( ) ; } } }
Triggers every subject attached to an event .
236,076
protected static function handleError ( ) { if ( self :: $ errorHandler === NULL ) { self :: $ errorHandler = function ( $ type , $ message , $ file , $ line ) { throw new \ RuntimeException ( $ message ) ; } ; } return self :: $ errorHandler ; }
Initialize and return the error handler callback .
236,077
public function isAllowCountry ( array $ codes = [ '*' ] ) { try { return in_array ( '*' , $ codes , true ) || in_array ( Utility :: isoCode ( $ this -> ip ( ) ) , $ codes , true ) ; } catch ( \ Exception $ e ) { return true ; } }
Determine the request ip address is in allow countries .
236,078
public function ban ( $ ip = null , $ type = 'regular' ) { $ this -> validateType ( $ type ) ; if ( ! is_null ( $ ip ) ) { if ( 'segment' === $ type ) { $ ip = Utility :: cidr ( $ ip ) ; } } else { $ ip = $ this -> ip ( ) ; session ( [ 'isBan' => $ type ] ) ; } return $ this -> model -> firstOrCreate ( compact ( 'ip' )...
Ban ip address .
236,079
public function unban ( $ ip = null ) { if ( is_null ( $ ip ) ) { $ ip = $ this -> ip ( ) ; session ( ) -> forget ( 'isBan' ) ; } return $ this -> model -> destroy ( $ ip ) ; }
Unban ip address .
236,080
public function fileExists ( StorageFacilityParams $ params , $ fileid ) { $ this -> validateFileID ( $ fileid ) ; return file_exists ( $ this -> generateStoragePath ( $ params , $ fileid ) ) ; }
Returns true if the file exists in the storage facility or false if it doesn t exist . Throws an exception is the operation failed .
236,081
public function deleteFile ( StorageFacilityParams $ params , $ fileid ) { $ this -> validateFileID ( $ fileid ) ; $ storagePath = $ this -> generateStoragePath ( $ params , $ fileid ) ; if ( is_file ( $ storagePath ) ) { if ( ! @ unlink ( $ storagePath ) ) { throw new StorageFacilityException ( "Cannot delete file '" ...
Deletes a file in the storage facility .
236,082
public function renameFile ( StorageFacilityParams $ params , StorageFacilityFile & $ file , $ newfileid ) { $ this -> validateFileID ( $ newfileid ) ; if ( $ file -> getId ( ) == null ) throw new StorageFacilityException ( "Invalid fileid '" . $ file -> getId ( ) . "'" ) ; if ( $ this -> fileExists ( $ params , $ newf...
Renames a StorageFacilityFile in the storage facility .
236,083
public function cmdGetCountry ( ) { $ result = $ this -> getListCountry ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableCountry ( $ result ) ; $ this -> output ( ) ; }
Callback for country - get command
236,084
public function cmdUpdateCountry ( ) { $ params = $ this -> getParam ( ) ; if ( empty ( $ params [ 0 ] ) || count ( $ params ) < 2 ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } $ this -> setSubmitted ( null , $ params ) ; $ this -> setSubmitted ( 'update' , $ params [ 0 ] ) ; $ this -> setSubm...
Callback for country - update command
236,085
public function cmdDeleteCountry ( ) { $ code = $ this -> getParam ( 0 ) ; $ all = $ this -> getParam ( 'all' ) ; if ( empty ( $ code ) && empty ( $ all ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } $ result = null ; if ( ! empty ( $ code ) ) { $ result = $ this -> country -> delete ( $ code...
Callback for country - delete command
236,086
protected function addCountry ( ) { if ( ! $ this -> isError ( ) && ! $ this -> country -> add ( $ this -> getSubmitted ( ) ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } }
Add a new country
236,087
protected function updateCountry ( $ code ) { if ( ! $ this -> isError ( ) && ! $ this -> country -> update ( $ code , $ this -> getSubmitted ( ) ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } }
Updates an country
236,088
protected function submitAddCountry ( ) { $ this -> setSubmitted ( null , $ this -> getParam ( ) ) ; $ this -> setSubmittedJson ( 'format' ) ; $ this -> validateComponent ( 'country' ) ; $ this -> addCountry ( ) ; }
Add a new country at once
236,089
protected function wizardAddCountry ( ) { $ this -> validatePrompt ( 'code' , $ this -> text ( 'Code' ) , 'country' ) ; $ this -> validatePrompt ( 'name' , $ this -> text ( 'Name' ) , 'country' , '' ) ; $ this -> validatePrompt ( 'native_name' , $ this -> text ( 'Native name' ) , 'country' , '' ) ; $ this -> validatePr...
Add a new country step by step
236,090
public function get ( $ pattern , $ callback , array $ middleware = null , $ name = null ) { $ this -> addRoute ( 'get' , $ pattern , $ callback , $ middleware , $ name ) ; return $ this ; }
Defines a route which will respond to GET and HEAD requests
236,091
protected function addRoute ( $ method , $ pattern , $ callback , array $ middleware = null , $ name = null ) { $ concatenatedPattern = ( ! is_null ( $ this -> prefix ) ? '/' . $ this -> prefix : '' ) . $ pattern ; $ this -> collector -> addRoute ( strtoupper ( $ method ) , $ concatenatedPattern , new Route ( $ callbac...
Proxies the route definition with the backend routing library
236,092
public function post ( $ pattern , $ callback , array $ middleware = null , $ name = null ) { $ this -> addRoute ( 'post' , $ pattern , $ callback , $ middleware , $ name ) ; return $ this ; }
Defines a route which will respond to POST requests
236,093
public function put ( $ pattern , $ callback , array $ middleware = null , $ name = null ) { $ this -> addRoute ( 'put' , $ pattern , $ callback , $ middleware , $ name ) ; return $ this ; }
Defines a route which will respond to PUT requests
236,094
public function patch ( $ pattern , $ callback , array $ middleware = null , $ name = null ) { $ this -> addRoute ( 'patch' , $ pattern , $ callback , $ middleware , $ name ) ; return $ this ; }
Defines a route which will respond to PATCH requests
236,095
public function delete ( $ pattern , $ callback , array $ middleware = null , $ name = null ) { $ this -> addRoute ( 'delete' , $ pattern , $ callback , $ middleware , $ name ) ; return $ this ; }
Defines a route which will respond to DELETE requests
236,096
public function options ( $ pattern , $ callback , array $ middleware = null , $ name = null ) { $ this -> addRoute ( 'options' , $ pattern , $ callback , $ middleware , $ name ) ; return $ this ; }
Defines a route which will respond to OPTIONS requests
236,097
public function dispatch ( ServerRequestInterface $ request , ResponseInterface $ response ) { $ method = $ request -> getMethod ( ) ; $ uri = $ request -> getUri ( ) -> getPath ( ) ; $ d = new \ FastRoute \ Dispatcher \ GroupCountBased ( $ this -> collector -> getData ( ) ) ; $ r = $ d -> dispatch ( ( $ method === 'HE...
Performs the route matching and invokes the handler for the route if there is an error it throws exception .
236,098
public static function prettyPrint ( $ xmlString , $ htmlDisplay = false ) { $ doc = new \ DOMDocument ( ) ; $ doc -> loadXML ( $ xmlString ) ; $ doc -> preserveWhiteSpace = false ; $ doc -> formatOutput = true ; $ prettyXML = $ doc -> saveXML ( ) ; if ( $ htmlDisplay ) $ prettyXML = str_replace ( array ( "<" , ">" , "...
Pretty print an XML string - if the HTML Display flag is passed it will be formatted for display on a web page with special characters escaped .
236,099
public function cmdUpdateLanguage ( ) { $ params = $ this -> getParam ( ) ; if ( empty ( $ params [ 0 ] ) || count ( $ params ) < 2 ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } $ this -> setSubmitted ( null , $ params ) ; $ this -> setSubmitted ( 'update' , $ params [ 0 ] ) ; $ this -> valida...
Callback for language - update