idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
7,600
public function getKey ( $ value ) { foreach ( $ this -> collection as $ k => $ v ) { if ( $ v === $ value ) { return $ k ; } } return null ; }
Returns the key for the given value
7,601
public function setAll ( $ collection ) { foreach ( $ collection as $ key => $ element ) { $ this -> set ( $ key , $ element ) ; } return $ this ; }
Sets many elements on that map
7,602
public function remove ( $ key ) { $ key = $ this -> extractKey ( $ key ) ; if ( isset ( $ this -> collection [ $ key ] ) ) { $ element = $ this -> collection [ $ key ] ; unset ( $ this -> collection [ $ key ] ) ; return $ element ; } }
Removes and returns an element from the map by the given key . Returns null if the key does not exist .
7,603
public function has ( $ key ) { $ key = $ this -> extractKey ( $ key ) ; return isset ( $ this -> collection [ $ key ] ) ; }
Returns whether the key exist .
7,604
public function findKey ( ) { if ( func_num_args ( ) == 1 ) { $ callback = func_get_arg ( 0 ) ; } else { $ query = func_get_arg ( 0 ) ; $ callback = func_get_arg ( 1 ) ; } $ index = func_num_args ( ) == 1 ? $ this -> find ( $ callback ) : $ this -> find ( $ query , $ callback ) ; if ( $ index !== null ) { $ index = $ t...
Searches the collection with a given callback and returns the key for the first element if found .
7,605
public function findLastKey ( ) { if ( func_num_args ( ) == 1 ) { $ callback = func_get_arg ( 0 ) ; } else { $ query = func_get_arg ( 0 ) ; $ callback = func_get_arg ( 1 ) ; } $ index = func_num_args ( ) == 1 ? $ this -> findLast ( $ callback ) : $ this -> findLast ( $ query , $ callback ) ; if ( $ index !== null ) { $...
Searches the collection with a given callback and returns the key for the last element if found .
7,606
public function checkValuesUponSave ( ) { foreach ( $ this -> getJsonColumns ( ) as $ column_name ) { if ( isset ( $ this -> attributes [ $ column_name ] ) && ! is_string ( $ this -> attributes [ $ column_name ] ) ) { if ( is_array ( $ this -> attributes [ $ column_name ] ) ) { $ this -> attributes [ $ column_name ] = ...
Checks values and ensures the json values are in the correct format .
7,607
public function inspectJson ( ) { if ( ! empty ( $ this -> json_columns ) ) { foreach ( $ this -> json_columns as $ column_name ) { if ( ! in_array ( $ column_name , static :: $ protected_columns ) ) { $ this -> processJson ( $ column_name , $ this -> attributes [ $ column_name ] ) ; } } } }
Decodes each of the declared JSON attributes and allocates them to the json value object . Binds closures based on the column name to access and update the values .
7,608
public function processJson ( $ column_name , & $ value ) { if ( empty ( $ value ) || $ value === 'null' ) { $ value = [ ] ; } $ defaults = ( ! empty ( $ this -> json_defaults [ $ column_name ] ) ) ? $ this -> json_defaults [ $ column_name ] : [ ] ; $ options = ( ! empty ( $ this -> json_options [ $ column_name ] ) ) ?...
Process the json column .
7,609
public function getOriginal ( $ key = null , $ default = null ) { $ original = parent :: getOriginal ( $ key , $ default ) ; if ( ! empty ( $ this -> json_values ) ) { if ( $ key === null ) { foreach ( $ this -> json_values as $ column_name => & $ json_data ) { $ original [ $ column_name ] = $ json_data -> getOriginal ...
Get the model s original attribute values .
7,610
public function fromJson ( $ value , $ asObject = false ) { if ( is_array ( $ value ) ) { return $ value ; } return json_decode ( $ value , ! $ asObject ) ; }
Decode the given JSON back into an array or object .
7,611
public function user ( ? string $ attribute = null ) { if ( $ this -> isGuest ( ) ) { return null ; } $ user = auth ( ) -> user ( ) ; if ( $ attribute ) { return $ user -> { $ attribute } ; } return $ user ; }
Retrieve currently authenticated user or its attribute value .
7,612
public function registerGatePolicies ( ) : void { if ( ! \ Schema :: hasTable ( 'permissions' ) ) { return ; } $ permissions = Permission :: all ( [ 'handle' , 'type' ] ) ; foreach ( $ permissions as $ permission ) { Gate :: define ( $ permission -> code , function ( Authenticatable $ user , ? Model $ model = null , st...
Register Gate policies in order to integrate Membership into Laravel Authorization system .
7,613
public function execute ( $ query , array $ variables = array ( ) ) { $ path = '/graphql' ; $ headers = array ( 'Accept' => 'application/vnd.github.v4+json' , 'Content-Type' => 'application/json' , ) ; $ data = array ( 'query' => $ query , ) ; if ( ! empty ( $ variables ) ) { $ data [ 'variables' ] = $ variables ; } re...
Execute a query against the GraphQL API .
7,614
public function edit ( $ org , $ billingEmail = '' , $ company = '' , $ email = '' , $ location = '' , $ name = '' ) { $ path = '/orgs/' . $ org ; $ args = array ( 'billing_email' , 'company' , 'email' , 'location' , 'name' ) ; $ data = array ( ) ; $ fArgs = \ func_get_args ( ) ; foreach ( $ args as $ i => $ arg ) { if...
Edit an organization .
7,615
public function getList ( $ user , $ repo , $ sha = '' , $ path = '' , $ author = '' , \ DateTime $ since = null , \ DateTime $ until = null ) { $ rPath = '/repos/' . $ user . '/' . $ repo . '/commits' ; $ uri = new Uri ( $ this -> fetchUrl ( $ rPath ) ) ; if ( $ sha ) { $ uri -> setVar ( 'sha' , $ sha ) ; } if ( $ pat...
List commits on a repository .
7,616
public function getSha ( $ user , $ repo , $ ref ) { $ path = '/repos/' . $ user . '/' . $ repo . '/commits/' . $ ref ; $ response = $ this -> client -> get ( $ this -> fetchUrl ( $ path ) ) ; if ( $ response -> code != 200 ) { $ error = json_decode ( $ response -> body ) ; $ message = isset ( $ error -> message ) ? $ ...
Get the SHA - 1 of a commit reference .
7,617
public static function create ( LoggerInterface $ logger = null , $ configuration = array ( ) ) { if ( ! $ configuration instanceof ConfigurationInterface ) { $ configuration = new Configuration ( $ configuration ) ; } $ binaries = $ configuration -> get ( 'pdftohtml.binaries' , 'pdftohtml' ) ; if ( ! $ configuration -...
Creates an Pdftohtml driver .
7,618
public function send ( UserInvitationModel $ invitation ) { Mail :: to ( $ invitation -> email ) -> send ( new UserInvitation ( $ invitation ) ) ; }
Send user invitation .
7,619
public function confirmAction ( Request $ request ) { $ confirmCallback = $ request -> get ( 'confirm_callback' ) ; if ( $ confirmCallback === '' ) { $ confirmCallback = null ; } return [ 'title' => $ request -> get ( 'title' ) , 'body' => $ request -> get ( 'body' ) , 'id' => $ request -> get ( 'id' ) . rand ( 1 , 100...
Confirm modal .
7,620
public static function execute ( ) { \ Deployer \ cd ( '{{deploy_path}}' ) ; $ cmdReleaseDirs = '[ -d releases ] && [ "$(ls -A releases)" ]' ; $ hasReleaseDirs = \ Deployer \ test ( $ cmdReleaseDirs ) ; if ( ! $ hasReleaseDirs ) { return [ ] ; } $ releasesRaw = \ Deployer \ run ( 'cd releases && ls -t -d */' ) ; $ list...
Returns a list of releases on server .
7,621
public function showMessages ( array $ messages , $ extraHeaderHtml = '' ) { if ( $ messages === [ ] ) { throw new \ InvalidArgumentException ( 'No messages given for rendering' , 1416914970 ) ; } $ packageManager = $ this -> bootstrap -> getEarlyInstance ( \ Neos \ Flow \ Package \ PackageManagerInterface :: class ) ;...
Display a message . As we cannot rely on any Flow requirements being fulfilled here we have to statically include the CSS styles at this point and have to in - line the Neos logo .
7,622
public function edit ( $ user , $ repo , $ id , $ name , $ config , array $ events = array ( 'push' ) , array $ addEvents = array ( ) , array $ removeEvents = array ( ) , $ active = true ) { foreach ( $ events as $ event ) { if ( ! \ in_array ( $ event , $ this -> hookEvents ) ) { throw new \ RuntimeException ( 'Your e...
Edit a hook .
7,623
protected function checkBasicRequirementsAndDisplayLoadingScreen ( ) { $ messageRenderer = new MessageRenderer ( $ this -> bootstrap ) ; $ basicRequirements = new BasicRequirements ( ) ; $ result = $ basicRequirements -> findError ( ) ; if ( $ result instanceof Error ) { $ messageRenderer -> showMessages ( [ $ result ]...
Check the basic requirements and display a loading screen on initial request .
7,624
protected function resolveDependencies ( ) { $ objectManager = $ this -> bootstrap -> getObjectManager ( ) ; $ componentChainFactory = $ objectManager -> get ( ComponentChainFactory :: class ) ; $ configurationManager = $ objectManager -> get ( ConfigurationManager :: class ) ; $ this -> settings = $ configurationManag...
Create a HTTP component chain that adds our own routing configuration component only for this request handler .
7,625
protected function checkPhpBinary ( $ phpBinaryPathAndFilename ) { $ phpVersion = null ; if ( $ this -> phpBinaryExistsAndIsExecutableFile ( $ phpBinaryPathAndFilename ) ) { if ( DIRECTORY_SEPARATOR === '/' ) { $ phpCommand = '"' . escapeshellcmd ( Files :: getUnixStylePath ( $ phpBinaryPathAndFilename ) ) . '"' ; } el...
Checks if the given PHP binary is executable and of the same version as the currently running one .
7,626
protected function detectPhpBinaryPathAndFilename ( ) { if ( defined ( 'PHP_BINARY' ) && PHP_BINARY !== '' && dirname ( PHP_BINARY ) === PHP_BINDIR ) { if ( $ this -> checkPhpBinary ( PHP_BINARY ) === null ) { return [ PHP_BINARY , null ] ; } } $ environmentPaths = explode ( PATH_SEPARATOR , getenv ( 'PATH' ) ) ; $ env...
Traverse the PATH locations and check for the existence of a valid PHP binary . If found the path and filename are returned if not NULL is returned .
7,627
protected function phpBinaryExistsAndIsExecutableFile ( $ phpBinaryPathAndFilename ) { $ phpBinaryPathAndFilename = escapeshellarg ( Files :: getUnixStylePath ( $ phpBinaryPathAndFilename ) ) ; if ( DIRECTORY_SEPARATOR === '/' ) { $ command = sprintf ( 'test -f %s && test -x %s' , $ phpBinaryPathAndFilename , $ phpBina...
Checks if PHP binary file exists bypassing open_basedir violation .
7,628
public static function search ( string $ handle , array $ attributes = [ '*' ] ) { $ handle = explode ( '.' , $ handle ) ; $ type = array_shift ( $ handle ) ; if ( ! $ handle ) { throw new InvalidArgumentException ( 'The search argument is not properly formatted.' ) ; } $ handle = $ handle [ 0 ] ; return static :: wher...
Find a permission using its type and handle .
7,629
public function isGrantedTo ( $ user ) : bool { $ userModel = config ( 'auth.providers.users.model' ) ; if ( is_int ( $ user ) && ! $ userModel :: find ( $ user ) ) { return false ; } return $ this -> users ( ) -> where ( 'user_id' , is_int ( $ user ) ? $ user : $ user -> id ) -> exists ( ) ; }
Check whether the permission is granted to a user .
7,630
public function getListContributors ( $ owner , $ repo , $ anon = false ) { $ uri = new Uri ( $ this -> fetchUrl ( '/repos/' . $ owner . '/' . $ repo . '/contributors' ) ) ; if ( $ anon ) { $ uri -> setVar ( 'anon' , 'true' ) ; } return $ this -> processResponse ( $ this -> client -> get ( $ uri ) ) ; }
List contributors .
7,631
public function getBranch ( $ owner , $ repo , $ branch ) { return $ this -> branches -> get ( $ owner , $ repo , $ branch ) ; }
Get a Branch .
7,632
public function upload ( \ Symfony \ Component \ HttpFoundation \ File \ UploadedFile $ file ) { $ result = $ file -> move ( \ Config :: get ( 'plupload::plupload.upload_dir' ) , $ file -> getClientOriginalName ( ) ) ; return $ this -> respond ( array ( 'OK' => ( $ result ) ? 1 : 0 ) ) ; }
The main upload method .
7,633
public function checkFilter ( $ path ) { if ( empty ( $ this -> filters ) ) { return true ; } $ cleanPath = str_replace ( array ( '{' , '}' ) , array ( '' , '' ) , $ path ) ; foreach ( $ this -> filters as $ filter ) { if ( stripos ( $ path , $ filter ) !== false || stripos ( $ cleanPath , $ filter ) !== false ) { retu...
Checks whether the path should be included based on the previously specified filters .
7,634
public function deleteGrant ( $ id ) { $ path = '/authorizations/grants/' . $ id ; return $ this -> processResponse ( $ this -> client -> delete ( $ this -> fetchUrl ( $ path ) ) , 204 ) ; }
Delete a grant
7,635
public function getListGrants ( ) { $ path = '/authorizations/grants' ; return $ this -> processResponse ( $ this -> client -> get ( $ this -> fetchUrl ( $ path ) ) ) ; }
List your grants .
7,636
public function revokeGrantForApplication ( $ clientId , $ accessToken ) { $ path = "/applications/$clientId/grants/$accessToken" ; return $ this -> processResponse ( $ this -> client -> delete ( $ this -> fetchUrl ( $ path ) ) , 204 ) ; }
Revoke a grant for an application
7,637
public static function invalidMessage ( $ message ) { $ type = is_object ( $ message ) ? get_class ( $ message ) : gettype ( $ message ) ; return new static ( 'The message should be an instance of ' . Message :: class . ". Given `{$type}` is invalid." , 1 ) ; }
Thrown when an invalid message was passed .
7,638
public static function sendingFailed ( $ webhook , $ payload ) { if ( ! is_string ( $ payload ) ) { $ payload = json_encode ( $ payload , JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT ) ; } return new static ( "Failed sending to BearyChat with webhook {$webhook} .\n{$payload}" , 4 ) ; }
Thrown when sending failed .
7,639
public function markReadThread ( $ id , $ unread = true , $ read = true ) { $ path = '/notifications/threads/' . $ id ; $ data = array ( 'unread' => $ unread , 'read' => $ read , ) ; return $ this -> processResponse ( $ this -> client -> patch ( $ this -> fetchUrl ( $ path ) , json_encode ( $ data ) ) , 205 ) ; }
Mark a thread as read .
7,640
public function setThreadSubscription ( $ id , $ subscribed , $ ignored ) { $ path = '/notifications/threads/' . $ id . '/subscription' ; $ data = array ( 'subscribed' => $ subscribed , 'ignored' => $ ignored , ) ; return $ this -> processResponse ( $ this -> client -> put ( $ this -> fetchUrl ( $ path ) , json_encode ...
Set a Thread Subscription .
7,641
public function isMet ( ) { $ settings = $ this -> configurationManager -> getConfiguration ( \ Neos \ Flow \ Configuration \ ConfigurationManager :: CONFIGURATION_TYPE_SETTINGS , 'Neos.Flow' ) ; try { \ Doctrine \ DBAL \ DriverManager :: getConnection ( $ settings [ 'persistence' ] [ 'backendOptions' ] ) -> connect ( ...
Returns TRUE if the condition is satisfied otherwise FALSE
7,642
public function massiveSendResetLinkEmail ( Request $ request ) { $ this -> validate ( $ request , [ 'ids' => 'required' ] ) ; $ errors = [ ] ; foreach ( $ request -> input ( 'ids' ) as $ id ) { $ user = User :: find ( $ id ) ; $ response = Password :: broker ( ) -> sendResetLink ( [ 'email' => $ user -> email ] ) ; if...
Send a reset link to the given users .
7,643
public function findIndex ( ) { if ( func_num_args ( ) == 1 ) { $ callback = func_get_arg ( 0 ) ; } else { $ query = func_get_arg ( 0 ) ; $ callback = func_get_arg ( 1 ) ; } $ index = func_num_args ( ) == 1 ? $ this -> find ( $ callback ) : $ this -> find ( $ query , $ callback ) ; if ( $ index !== null ) { $ index = $...
Searches the collection with a given callback and returns the index for the first element if found .
7,644
public function findLastIndex ( ) { if ( func_num_args ( ) == 1 ) { $ callback = func_get_arg ( 0 ) ; } else { $ query = func_get_arg ( 0 ) ; $ callback = func_get_arg ( 1 ) ; } $ index = func_num_args ( ) == 1 ? $ this -> findLast ( $ callback ) : $ this -> findLast ( $ query , $ callback ) ; if ( $ index !== null ) {...
Searches the collection with a given callback and returns the index for the last element if found .
7,645
public function every ( callable $ callback ) { $ match = true ; foreach ( $ this -> collection as $ element ) { $ match = $ match && $ callback ( $ element ) ; } return $ match ; }
Tests whether all elements in the collection pass the test implemented by the provided function .
7,646
public function some ( callable $ callback ) { $ match = false ; foreach ( $ this -> collection as $ element ) { $ match = $ match || $ callback ( $ element ) ; } return $ match ; }
Tests whether at least one element in the collection passes the test implemented by the provided function .
7,647
public function search ( ) { if ( func_num_args ( ) == 1 ) { $ callback = func_get_arg ( 0 ) ; } else { $ query = func_get_arg ( 0 ) ; $ callback = func_get_arg ( 1 ) ; } foreach ( $ this -> collection as $ element ) { $ return = func_num_args ( ) == 1 ? $ callback ( $ element ) : $ callback ( $ element , $ query ) ; i...
Searches the collection for query using the callback function on each element
7,648
public function gate ( ) { if ( true === isset ( $ _GET [ 'upload_handler' ] ) ) { $ handler = ( string ) str_replace ( '::' , '\\' , $ _GET [ 'upload_handler' ] ) ; $ class_name = \ Config :: get ( 'plupload::plupload.upload_handler_' . $ handler ) ; } else { $ class_name = \ Config :: get ( 'plupload::plupload.upload...
Instantiate the upload handler and start the upload process .
7,649
public static function register ( ) { \ Deployer \ set ( 'release_path_app' , function ( ) { return ReleaseConfig :: getReleasePathAppDir ( ) ; } ) ; \ Deployer \ set ( 'shared_path_app' , function ( ) { return ReleaseConfig :: getSharedPathAppDir ( ) ; } ) ; \ Deployer \ set ( 'release_name' , function ( ) { return Ge...
Register Config Proxies that are executed when config is fetched the first time
7,650
protected function processAll ( $ filepath , $ preview = false ) { $ iterator = $ this -> getSource ( ) -> getIterator ( ) ; $ results = new BetterBulkLoader_Result ( ) ; foreach ( $ iterator as $ record ) { if ( $ id = $ this -> processRecord ( $ record , $ this -> columnMap , $ results , $ preview ) ) { $ this -> lis...
Add records to the list .
7,651
public static function generateSharedDirs ( ) { $ dirs = \ Deployer \ get ( 'shared_dirs' ) ; foreach ( $ dirs as $ dir ) { $ cmd = "mkdir -p {{deploy_path}}/shared/$dir" ; \ Deployer \ run ( $ cmd ) ; } }
Generate Shared Dirs
7,652
public static function changeOwnerAndMode ( ) { $ dirs = \ Deployer \ get ( 'change_owner_mode_dirs' ) ; if ( empty ( $ dirs ) ) { return ; } foreach ( $ dirs as $ key => $ dirData ) { $ dir = $ dirData [ 'dir' ] ; $ owner = $ dirData [ 'owner' ] ; $ mode = $ dirData [ 'mode' ] ; \ Deployer \ run ( "sudo chown -RH $own...
Fix File Ownership and access rights for both deploy user and webserver_user
7,653
public function getCanAttribute ( ) { $ permissions = [ ] ; foreach ( Permission :: all ( ) as $ permission ) { if ( Auth :: check ( ) && Auth :: user ( ) -> can ( $ permission -> name ) ) { $ permissions [ $ permission -> name ] = true ; } else { $ permissions [ $ permission -> name ] = false ; } } return $ permission...
Get all user permissions in a flat array .
7,654
public function findError ( ) { $ requiredEnvironmentError = $ this -> ensureRequiredEnvironment ( ) ; if ( $ requiredEnvironmentError !== null ) { return $ this -> setErrorTitle ( $ requiredEnvironmentError , 'Environment requirements not fulfilled' ) ; } $ filePermissionsError = $ this -> checkFilePermissions ( ) ; i...
Ensure that the environment and file permission requirements are fulfilled .
7,655
protected function checkFilePermissions ( ) { foreach ( $ this -> requiredWritableFolders as $ folder ) { $ folderPath = FLOW_PATH_ROOT . $ folder ; if ( ! is_dir ( $ folderPath ) && ! \ Neos \ Utility \ Files :: is_link ( $ folderPath ) ) { try { \ Neos \ Utility \ Files :: createDirectoryRecursively ( $ folderPath ) ...
Check write permissions for folders used for writing files
7,656
public function edit ( $ user , $ repo , $ id , $ comment ) { $ path = '/repos/' . $ user . '/' . $ repo . '/comments/' . $ id ; $ data = json_encode ( array ( 'body' => $ comment , ) ) ; return $ this -> processResponse ( $ this -> client -> patch ( $ this -> fetchUrl ( $ path ) , $ data ) ) ; }
Update a commit comment .
7,657
public function create ( $ user , $ repo , $ sha , $ comment , $ line , $ filepath , $ position ) { $ path = '/repos/' . $ user . '/' . $ repo . '/commits/' . $ sha . '/comments' ; $ data = json_encode ( array ( 'body' => $ comment , 'path' => $ filepath , 'position' => ( int ) $ position , 'line' => ( int ) $ line , )...
Create a commit comment .
7,658
public function verifyReceipt ( $ receipt ) { $ Request = $ this -> getRequest ( $ this -> getEndpointUrl ( ) ) ; $ Request -> addPostField ( 'receipt-data' , $ receipt ) -> addPostField ( 'password' , $ this -> getPassword ( ) ) ; $ data = $ Request -> send ( ) ; try { return ResponsePayload :: initializeByString ( $ ...
Method for receipts data verification
7,659
public function getMessageList ( ) { $ output = array ( ) ; if ( $ this -> CreatedCount ( ) ) { $ output [ 'created' ] = _t ( 'BulkLoader.IMPORTEDRECORDS' , "Imported {count} new records." , array ( 'count' => $ this -> CreatedCount ( ) ) ) ; } if ( $ this -> UpdatedCount ( ) ) { $ output [ 'updated' ] = _t ( 'BulkLoad...
Get an array of messages describing the result .
7,660
public function getOriginal ( $ key = null , $ default = null ) { if ( $ key === null ) { return $ this -> internal_original_data ; } elseif ( array_key_exists ( $ key , $ this -> internal_original_data ) ) { return $ this -> internal_original_data [ $ key ] ; } return $ default ; }
Get the json data original values .
7,661
public function getCurrent ( ) { $ data = [ ] ; foreach ( get_object_vars ( $ this ) as $ key => $ value ) { if ( substr ( $ key , 0 , 8 ) !== 'internal' ) { $ data [ $ key ] = $ value ; } } return $ data ; }
Get the current data as an array .
7,662
public function getJson ( ) { $ dirty = $ this -> getDirty ( ) ; if ( count ( $ dirty ) ) { $ this -> internal_original_value = $ this -> __toString ( ) ; } return $ this -> internal_original_value ; }
Get the current data json encoded .
7,663
public function getDirty ( ) { $ dirty = [ ] ; foreach ( $ this -> getCurrent ( ) as $ key => $ value ) { if ( array_key_exists ( 'no_saving_default_values' , $ this -> internal_options ) && $ this -> internal_options [ 'no_saving_default_values' ] && array_key_exists ( $ key , $ this -> internal_defaults ) && $ this -...
Add json data values that have changed .
7,664
public function deleted ( User $ user ) { \ DB :: table ( ( new Revision ( ) ) -> getTable ( ) ) -> insert ( [ [ 'revisionable_type' => $ user -> getMorphClass ( ) , 'revisionable_id' => $ user -> id , 'key' => 'deleted_at' , 'old_value' => $ user , 'new_value' => new \ DateTime ( ) , 'user_id' => ( \ Auth :: check ( )...
Listen to the User deleted event .
7,665
protected static function bootHandlable ( ) { static :: creating ( function ( $ model ) { if ( ! $ model -> handle ) { $ model -> handle = '' ; } } ) ; static :: updating ( function ( $ model ) { if ( ! $ model -> handle ) { $ model -> handle = '' ; } } ) ; }
Set the handle if missing .
7,666
public function setHandleAttribute ( ? string $ handle ) : void { $ this -> attributes [ 'handle' ] = str_slug ( $ handle ? : $ this -> name ) ; }
Set model s handle if none was provided .
7,667
public function getFunctions ( ) { return [ new Twig_SimpleFunction ( 'plupload' , function ( $ view = null , $ browse_button = null , $ prefix = null , $ additional_data = array ( ) ) { $ view = ( true === is_null ( $ view ) ) ? \ Config :: get ( 'plupload::plupload.view' ) : $ view ; $ prefix = ( true === is_null ( $...
Registers the Twig functions .
7,668
public function normalize ( string $ string ) : string { if ( isset ( $ this -> cache [ $ string ] ) ) { return $ this -> cache [ $ string ] ; } $ result = $ this -> normalizeChain ( $ string ) ; $ toCache = array_map ( function ( RuleInterface $ rule ) use ( & $ result ) { return $ result = $ rule -> apply ( $ result ...
Return normalized string
7,669
protected function normalizeChain ( string $ string ) : string { if ( null === $ this -> chain ) { return $ string ; } return $ this -> chain -> normalize ( $ string ) ; }
Normalize parent if exists
7,670
public function trackModel ( TrackModelRequest $ request ) { $ model = $ request -> input ( 'model' ) ; $ revisions = Revision :: where ( [ 'revisionable_type' => $ model ] ) -> orderBy ( 'created_at' , 'desv' ) -> get ( ) ; $ result = [ ] ; $ lastDate = '' ; foreach ( $ revisions as $ revision ) { $ date = $ revision ...
Obtain tracking info for a Model .
7,671
private function getMessage ( $ revision ) { switch ( $ revision -> key ) { case 'created_at' : return $ this -> getResponsibleInfo ( $ revision ) . ' created user ' . $ this -> getAffectedResourceName ( $ revision ) . ' (' . $ revision -> revisionable_id . ')' ; case 'deleted_at' : return $ this -> getResponsibleInfo ...
Get icon background .
7,672
private function getResponsibleInfo ( $ revision ) { $ username = $ this -> getResponsibleUsername ( $ revision ) ; return '<span title="' . $ username . ' (' . $ revision -> user_id . ')' . '" class="responsibleUser" model="' . $ revision -> revisionable_type . '">' . $ username . '</span>' ; }
Get responsible info .
7,673
private function getAffectedResourceName ( $ revision ) { if ( $ revision -> historyOf ( ) ) { return $ revision -> historyOf ( ) -> name ; } if ( $ revision -> key == 'deleted_at' ) { $ oldUser = json_decode ( $ revision -> old_value ) ; if ( $ oldUser ) { return $ oldUser -> name ; } } return 'Non existing user' ; }
Get affected resource name .
7,674
public function loadCSV ( ) { $ parser = new CSVParser ( $ this -> file ) ; $ count = 0 ; foreach ( $ parser as $ row ) { $ this -> rows [ ] = $ row ; $ count ++ ; if ( $ count == $ this -> previewcount ) { break ; } } $ firstrow = array_keys ( $ this -> rows [ 0 ] ) ; array_unshift ( $ this -> rows , array_combine ( $...
Extract preview of CSV from file
7,675
public function getHeadings ( ) { if ( ! $ this -> headings ) { return ; } $ out = new ArrayList ( ) ; foreach ( $ this -> headings as $ heading ) { $ out -> push ( new ArrayData ( array ( "Label" => $ heading ) ) ) ; } return $ out ; }
Get the CSV headings for use in template
7,676
public function getConnectionState ( ) { $ directory = Google :: make ( 'directory' ) ; try { $ r = $ directory -> users -> get ( $ email = config ( 'users.google_apps_user_email_to_check_connection' ) ) ; if ( $ r ) { $ state = 'connected' ; } else { echo 'User does not exists: $email<br/>' ; } } catch ( \ Exception $...
Get connection state .
7,677
protected function allUsers ( ) { $ directory = Google :: make ( 'directory' ) ; $ pageToken = null ; $ users = [ ] ; do { try { $ r = $ directory -> users -> listUsers ( [ 'domain' => config ( 'users.google_apps_domain' ) , 'maxResults' => config ( 'users.google_apps_users_maxResults' ) , 'pageToken' => $ pageToken ] ...
Get all users from google apps .
7,678
public function localSync ( ) { $ users = Cache :: rememberForever ( 'google_app_users' , function ( ) { return $ this -> allUsers ( ) ; } ) ; try { foreach ( $ users as $ user ) { $ user = GoogleUser :: firstOrCreate ( [ 'customerId' => $ user -> customerId , 'kind' => $ user -> kind , 'google_id' => $ user -> id , 'e...
Sync local database with remote Google apps info .
7,679
public function getUsers ( $ perPage = 15 ) { $ directory = Google :: make ( 'directory' ) ; try { $ r = $ directory -> users -> listUsers ( [ 'domain' => config ( 'users.google_apps_domain' ) , 'maxResults' => $ perPage ] ) ; } catch ( \ Exception $ e ) { return json_decode ( $ e -> getMessage ( ) ) ; } return $ r -> ...
Get users .
7,680
public function getList ( $ owner , $ repo , $ issueId , $ page = 0 , $ limit = 0 , \ DateTime $ since = null ) { $ path = '/repos/' . $ owner . '/' . $ repo . '/issues/' . ( int ) $ issueId . '/comments' ; $ uri = new Uri ( $ this -> fetchUrl ( $ path , $ page , $ limit ) ) ; if ( $ since ) { $ uri -> setVar ( 'since'...
List comments on an issue .
7,681
public function create ( $ files , $ public = false , $ description = null ) { $ path = '/gists' ; $ data = json_encode ( array ( 'files' => $ this -> buildFileData ( ( array ) $ files ) , 'public' => ( bool ) $ public , 'description' => $ description , ) ) ; return $ this -> processResponse ( $ this -> client -> post ...
Create a gist .
7,682
public function edit ( $ gistId , $ files = null , $ public = null , $ description = null ) { $ path = '/gists/' . ( int ) $ gistId ; $ data = new \ stdClass ; if ( isset ( $ description ) ) { $ data -> description = $ description ; } if ( isset ( $ public ) ) { $ data -> public = $ public ; } if ( isset ( $ files ) ) ...
Edit a gist .
7,683
public function fork ( $ gistId ) { $ path = '/gists/' . ( int ) $ gistId . '/forks' ; return $ this -> processResponse ( $ this -> client -> post ( $ this -> fetchUrl ( $ path ) , '' ) , 201 ) ; }
Fork a gist .
7,684
public function getRevision ( $ gistId , $ sha ) { $ path = '/gists/' . ( int ) $ gistId . '/' . $ sha ; return $ this -> processResponse ( $ this -> client -> get ( $ this -> fetchUrl ( $ path ) ) ) ; }
Get a specific revision of a gist .
7,685
public function star ( $ gistId ) { $ path = '/gists/' . ( int ) $ gistId . '/star' ; $ this -> processResponse ( $ this -> client -> put ( $ this -> fetchUrl ( $ path ) , '' ) , 204 ) ; }
Star a gist .
7,686
public function unstar ( $ gistId ) { $ path = '/gists/' . ( int ) $ gistId . '/star' ; $ this -> processResponse ( $ this -> client -> delete ( $ this -> fetchUrl ( $ path ) ) , 204 ) ; }
Unstar a gist .
7,687
public function getList ( $ user , $ repo , $ state = 'open' , $ sort = 'due_date' , $ direction = 'desc' , $ page = 0 , $ limit = 0 ) { $ path = '/repos/' . $ user . '/' . $ repo . '/milestones' ; $ uri = new Uri ( $ this -> fetchUrl ( $ path , $ page , $ limit ) ) ; $ uri -> setVar ( 'state' , $ state ) ; $ uri -> se...
List milestones for a repository .
7,688
public function create ( $ user , $ repo , $ title , $ state = null , $ description = null , $ dueOn = null ) { $ path = '/repos/' . $ user . '/' . $ repo . '/milestones' ; $ data = array ( 'title' => $ title , ) ; if ( $ state !== null ) { $ data [ 'state' ] = $ state ; } if ( $ description !== null ) { $ data [ 'desc...
Create a milestone .
7,689
public function edit ( $ user , $ repo , $ milestoneId , $ title = null , $ state = null , $ description = null , $ dueOn = null ) { $ path = '/repos/' . $ user . '/' . $ repo . '/milestones/' . ( int ) $ milestoneId ; $ data = array ( ) ; if ( $ title !== null ) { $ data [ 'title' ] = $ title ; } if ( $ state !== null...
Update a milestone .
7,690
public function create ( $ user , $ repo , $ ref , $ sha ) { $ path = '/repos/' . $ user . '/' . $ repo . '/git/refs' ; $ data = json_encode ( array ( 'ref' => $ ref , 'sha' => $ sha , ) ) ; return $ this -> processResponse ( $ this -> client -> post ( $ this -> fetchUrl ( $ path ) , $ data ) , 201 ) ; }
Create a Reference .
7,691
public function edit ( $ user , $ repo , $ ref , $ sha , $ force = false ) { $ path = '/repos/' . $ user . '/' . $ repo . '/git/refs/' . $ ref ; $ data = new \ stdClass ; if ( $ force ) { $ data -> force = true ; } $ data -> sha = $ sha ; $ data = json_encode ( $ data ) ; return $ this -> processResponse ( $ this -> cl...
Update a Reference .
7,692
public function deleted ( UserInvitation $ invitation ) { \ DB :: table ( ( new Revision ( ) ) -> getTable ( ) ) -> insert ( [ [ 'revisionable_type' => $ invitation -> getMorphClass ( ) , 'revisionable_id' => $ invitation -> id , 'key' => 'deleted_at' , 'old_value' => null , 'new_value' => new \ DateTime ( ) , 'user_id...
Listen to the UserInvitation deleted event .
7,693
public function getInfo ( $ inputfile ) { if ( ! file_exists ( $ inputfile ) ) { throw new FileNotFoundException ( "File $inputfile not found." ) ; } $ args = array ( $ inputfile ) ; $ output = $ this -> pdfinfo -> command ( $ args ) ; $ info = array ( ) ; foreach ( explode ( PHP_EOL , $ output ) as $ line ) { if ( str...
Write to file or return content
7,694
public function getList ( $ since = 0 ) { $ uri = new Uri ( $ this -> fetchUrl ( '/users' ) ) ; if ( $ since ) { $ uri -> setVar ( 'since' , $ since ) ; } return $ this -> processResponse ( $ this -> client -> get ( $ uri ) ) ; }
Get all users .
7,695
public function create ( $ owner , $ repo , $ path , $ message , $ content , $ branch = 'master' , $ authorName = '' , $ authorEmail = '' , $ committerName = '' , $ committerEmail = '' ) { $ route = '/repos/' . $ owner . '/' . $ repo . '/contents/' . $ path ; $ data = array ( 'message' => $ message , 'content' => $ con...
Create a file .
7,696
public function assignTo ( $ group ) : void { $ group = $ this -> resolveGroup ( $ group ) ; $ this -> groups ( ) -> attach ( $ group ) ; }
Assign the model to a group .
7,697
public function retractFrom ( $ group ) : void { $ group = $ this -> resolveGroup ( $ group ) ; $ this -> groups ( ) -> detach ( $ group ) ; }
Retract the model from a group .
7,698
public function isAssignedTo ( $ group ) : bool { $ group = $ this -> resolveGroup ( $ group ) ; return $ this -> groups ( ) -> where ( 'group_id' , is_int ( $ group ) ? $ group : $ group -> id ) -> exists ( ) ; }
Check whether the model is assigned to a group .
7,699
protected function resolveGroup ( $ group ) { if ( is_string ( $ group ) ) { $ group = Group :: whereHandle ( $ group ) -> firstOrFail ( ) ; } return $ group ; }
Resolve the group parameter .