idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
600
protected static function collectUpdates ( $ batchId ) { return collect ( static :: $ updatesQueue ) -> each ( function ( $ entry ) use ( $ batchId ) { $ entry -> change ( [ 'updated_batch_id' => $ batchId ] ) ; } ) ; }
Collect the updated entries for storage .
601
protected function registerStorageDriver ( ) { $ driver = config ( 'telescope.driver' ) ; if ( method_exists ( $ this , $ method = 'register' . ucfirst ( $ driver ) . 'Driver' ) ) { $ this -> $ method ( ) ; } }
Register the package storage driver .
602
protected function registerDatabaseDriver ( ) { $ this -> app -> singleton ( EntriesRepository :: class , DatabaseEntriesRepository :: class ) ; $ this -> app -> singleton ( ClearableRepository :: class , DatabaseEntriesRepository :: class ) ; $ this -> app -> singleton ( PrunableRepository :: class , DatabaseEntriesRe...
Register the package database storage driver .
603
protected function status ( ) { if ( ! config ( 'telescope.enabled' , false ) ) { return 'disabled' ; } if ( cache ( 'telescope:pause-recording' , false ) ) { return 'paused' ; } $ watcher = config ( 'telescope.watchers.' . $ this -> watcher ( ) ) ; if ( ! $ watcher || ( isset ( $ watcher [ 'enabled' ] ) && ! $ watcher...
Determine the watcher recording status .
604
public function recordException ( MessageLogged $ event ) { if ( ! Telescope :: isRecording ( ) || $ this -> shouldIgnore ( $ event ) ) { return ; } $ exception = $ event -> context [ 'exception' ] ; Telescope :: recordException ( IncomingExceptionEntry :: make ( $ exception , [ 'class' => get_class ( $ exception ) , '...
Record an exception was logged .
605
public function recordJob ( $ connection , $ queue , array $ payload ) { if ( ! Telescope :: isRecording ( ) ) { return ; } $ content = array_merge ( [ 'status' => 'pending' , ] , $ this -> defaultJobData ( $ connection , $ queue , $ payload , $ this -> data ( $ payload ) ) ) ; Telescope :: recordJob ( $ entry = Incomi...
Record a job being created .
606
public function recordProcessedJob ( JobProcessed $ event ) { if ( ! Telescope :: isRecording ( ) ) { return ; } $ uuid = $ event -> job -> payload ( ) [ 'telescope_uuid' ] ?? null ; if ( ! $ uuid ) { return ; } Telescope :: recordUpdate ( EntryUpdate :: make ( $ uuid , EntryType :: JOB , [ 'status' => 'processed' ] ) ...
Record a queued job was processed .
607
public function recordFailedJob ( JobFailed $ event ) { if ( ! Telescope :: isRecording ( ) ) { return ; } $ uuid = $ event -> job -> payload ( ) [ 'telescope_uuid' ] ?? null ; if ( ! $ uuid ) { return ; } Telescope :: recordUpdate ( EntryUpdate :: make ( $ uuid , EntryType :: JOB , [ 'status' => 'failed' , 'exception'...
Record a queue job has failed .
608
protected function defaultJobData ( $ connection , $ queue , array $ payload , array $ data ) { return [ 'connection' => $ connection , 'queue' => $ queue , 'name' => $ payload [ 'displayName' ] , 'tries' => $ payload [ 'maxTries' ] , 'timeout' => $ payload [ 'timeout' ] , 'data' => $ data , ] ; }
Get the default entry data for the given job .
609
protected function authorization ( ) { $ this -> gate ( ) ; Telescope :: auth ( function ( $ request ) { return app ( ) -> environment ( 'local' ) || Gate :: check ( 'viewTelescope' , [ $ request -> user ( ) ] ) ; } ) ; }
Configure the Telescope authorization services .
610
public function addTags ( array $ tags ) { $ this -> tagsChanges [ 'added' ] = array_unique ( array_merge ( $ this -> tagsChanges [ 'added' ] , $ tags ) ) ; return $ this ; }
Add tags to the entry .
611
public function removeTags ( array $ tags ) { $ this -> tagsChanges [ 'removed' ] = array_unique ( array_merge ( $ this -> tagsChanges [ 'removed' ] , $ tags ) ) ; return $ this ; }
Remove tags from the entry .
612
public function recordCommand ( CommandExecuted $ event ) { if ( ! Telescope :: isRecording ( ) || $ this -> shouldIgnore ( $ event ) ) { return ; } Telescope :: recordRedis ( IncomingEntry :: make ( [ 'connection' => $ event -> connectionName , 'command' => $ this -> formatCommand ( $ event -> command , $ event -> par...
Record a Redis command was executed .
613
private function formatCommand ( $ command , $ parameters ) { $ parameters = collect ( $ parameters ) -> map ( function ( $ parameter ) { if ( is_array ( $ parameter ) ) { return collect ( $ parameter ) -> map ( function ( $ value , $ key ) { return is_int ( $ key ) ? $ value : "{$key} {$value}" ; } ) -> implode ( ' ' ...
Format the given Redis command .
614
public static function from ( $ target ) { if ( $ tags = static :: explicitTags ( [ $ target ] ) ) { return $ tags ; } return static :: modelsFor ( [ $ target ] ) -> map ( function ( $ model ) { return FormatModel :: given ( $ model ) ; } ) -> all ( ) ; }
Get the tags for the given object .
615
public static function fromArray ( array $ data ) { $ models = collect ( $ data ) -> map ( function ( $ value ) { if ( $ value instanceof Model ) { return [ $ value ] ; } elseif ( $ value instanceof EloquentCollection ) { return $ value -> flatten ( ) ; } } ) -> collapse ( ) -> filter ( ) ; return $ models -> map ( fun...
Determine the tags for the given array .
616
protected static function tagsForListener ( $ job ) { return collect ( [ static :: extractListener ( $ job ) , static :: extractEvent ( $ job ) , ] ) -> map ( function ( $ job ) { return static :: from ( $ job ) ; } ) -> collapse ( ) -> unique ( ) -> toArray ( ) ; }
Determine tags for the given queued listener .
617
protected static function targetsFor ( $ job ) { switch ( true ) { case $ job instanceof BroadcastEvent : return [ $ job -> event ] ; case $ job instanceof CallQueuedListener : return [ static :: extractEvent ( $ job ) ] ; case $ job instanceof SendQueuedMailable : return [ $ job -> mailable ] ; case $ job instanceof S...
Get the actual target for the given job .
618
protected static function modelsFor ( array $ targets ) { $ models = [ ] ; foreach ( $ targets as $ target ) { $ models [ ] = collect ( ( new ReflectionClass ( $ target ) ) -> getProperties ( ) ) -> map ( function ( $ property ) use ( $ target ) { $ property -> setAccessible ( true ) ; $ value = $ property -> getValue ...
Get the models from the given object .
619
protected static function extractEvent ( $ job ) { return isset ( $ job -> data [ 0 ] ) && is_object ( $ job -> data [ 0 ] ) ? $ job -> data [ 0 ] : new stdClass ; }
Extract the event from a queued job .
620
public static function from ( $ target ) { return collect ( ( new ReflectionClass ( $ target ) ) -> getProperties ( ) ) -> mapWithKeys ( function ( $ property ) use ( $ target ) { $ property -> setAccessible ( true ) ; if ( ( $ value = $ property -> getValue ( $ target ) ) instanceof Model ) { return [ $ property -> ge...
Extract the properties for the given object in array form .
621
public function scopeWithTelescopeOptions ( $ query , $ type , EntryQueryOptions $ options ) { $ this -> whereType ( $ query , $ type ) -> whereBatchId ( $ query , $ options ) -> whereTag ( $ query , $ options ) -> whereFamilyHash ( $ query , $ options ) -> whereBeforeSequence ( $ query , $ options ) -> filter ( $ quer...
Scope the query for the given query options .
622
protected function whereBatchId ( $ query , EntryQueryOptions $ options ) { $ query -> when ( $ options -> batchId , function ( $ query , $ batchId ) { return $ query -> where ( 'batch_id' , $ batchId ) ; } ) ; return $ this ; }
Scope the query for the given batch ID .
623
protected function whereBeforeSequence ( $ query , EntryQueryOptions $ options ) { $ query -> when ( $ options -> beforeSequence , function ( $ query , $ beforeSequence ) { return $ query -> where ( 'sequence' , '<' , $ beforeSequence ) ; } ) ; return $ this ; }
Scope the query for the given pagination options .
624
protected function filter ( $ query , EntryQueryOptions $ options ) { if ( $ options -> familyHash || $ options -> tag || $ options -> batchId ) { return $ this ; } $ query -> where ( 'should_display_on_index' , true ) ; return $ this ; }
Scope the query for the given display options .
625
protected function registerTelescopeServiceProvider ( ) { $ namespace = str_replace_last ( '\\' , '' , $ this -> getAppNamespace ( ) ) ; $ appConfig = file_get_contents ( config_path ( 'app.php' ) ) ; if ( Str :: contains ( $ appConfig , $ namespace . '\\Providers\\TelescopeServiceProvider::class' ) ) { return ; } $ li...
Register the Telescope service provider in the application configuration file .
626
public function find ( $ id ) : EntryResult { $ entry = EntryModel :: on ( $ this -> connection ) -> whereUuid ( $ id ) -> firstOrFail ( ) ; $ tags = $ this -> table ( 'telescope_entries_tags' ) -> where ( 'entry_uuid' , $ id ) -> pluck ( 'tag' ) -> all ( ) ; return new EntryResult ( $ entry -> uuid , null , $ entry ->...
Find the entry with the given ID .
627
public function get ( $ type , EntryQueryOptions $ options ) { return EntryModel :: on ( $ this -> connection ) -> withTelescopeOptions ( $ type , $ options ) -> take ( $ options -> limit ) -> orderByDesc ( 'sequence' ) -> get ( ) -> reject ( function ( $ entry ) { return ! is_array ( $ entry -> content ) ; } ) -> map ...
Return all the entries of a given type .
628
public function store ( Collection $ entries ) { if ( $ entries -> isEmpty ( ) ) { return ; } [ $ exceptions , $ entries ] = $ entries -> partition -> isException ( ) ; $ this -> storeExceptions ( $ exceptions ) ; $ table = $ this -> table ( 'telescope_entries' ) ; $ entries -> chunk ( $ this -> chunkSize ) -> each ( f...
Store the given array of entries .
629
protected function storeExceptions ( Collection $ exceptions ) { $ this -> table ( 'telescope_entries' ) -> insert ( $ exceptions -> map ( function ( $ exception ) { $ occurrences = $ this -> table ( 'telescope_entries' ) -> where ( 'type' , EntryType :: EXCEPTION ) -> where ( 'family_hash' , $ exception -> familyHash ...
Store the given array of exception entries .
630
protected function storeTags ( $ results ) { $ this -> table ( 'telescope_entries_tags' ) -> insert ( $ results -> flatMap ( function ( $ tags , $ uuid ) { return collect ( $ tags ) -> map ( function ( $ tag ) use ( $ uuid ) { return [ 'entry_uuid' => $ uuid , 'tag' => $ tag , ] ; } ) ; } ) -> all ( ) ) ; }
Store the tags for the given entries .
631
public function update ( Collection $ updates ) { foreach ( $ updates as $ update ) { $ entry = $ this -> table ( 'telescope_entries' ) -> where ( 'uuid' , $ update -> uuid ) -> where ( 'type' , $ update -> type ) -> first ( ) ; if ( ! $ entry ) { continue ; } $ content = json_encode ( array_merge ( json_decode ( $ ent...
Store the given entry updates .
632
protected function updateTags ( $ entry ) { if ( ! empty ( $ entry -> tagsChanges [ 'added' ] ) ) { $ this -> table ( 'telescope_entries_tags' ) -> insert ( collect ( $ entry -> tagsChanges [ 'added' ] ) -> map ( function ( $ tag ) use ( $ entry ) { return [ 'entry_uuid' => $ entry -> uuid , 'tag' => $ tag , ] ; } ) ->...
Update tags of the given entry .
633
public function isMonitoring ( array $ tags ) { if ( is_null ( $ this -> monitoredTags ) ) { $ this -> loadMonitoredTags ( ) ; } return count ( array_intersect ( $ tags , $ this -> monitoredTags ) ) > 0 ; }
Determine if any of the given tags are currently being monitored .
634
public function monitor ( array $ tags ) { $ tags = array_diff ( $ tags , $ this -> monitoring ( ) ) ; if ( empty ( $ tags ) ) { return ; } $ this -> table ( 'telescope_monitoring' ) -> insert ( collect ( $ tags ) -> mapWithKeys ( function ( $ tag ) { return [ 'tag' => $ tag ] ; } ) -> all ( ) ) ; }
Begin monitoring the given list of tags .
635
protected static function registerWatchers ( $ app ) { foreach ( config ( 'telescope.watchers' ) as $ key => $ watcher ) { if ( is_string ( $ key ) && $ watcher === false ) { continue ; } if ( is_array ( $ watcher ) && ! ( $ watcher [ 'enabled' ] ?? true ) ) { continue ; } $ watcher = $ app -> make ( is_string ( $ key ...
Register the configured Telescope watchers .
636
public function isReportableException ( ) { $ handler = app ( ExceptionHandler :: class ) ; return method_exists ( $ handler , 'shouldReport' ) ? $ handler -> shouldReport ( $ this -> exception ) : true ; }
Determine if the incoming entry is a reportable exception .
637
public function recordGateCheck ( ? Authenticatable $ user , $ ability , $ result , $ arguments ) { if ( ! Telescope :: isRecording ( ) || $ this -> shouldIgnore ( $ ability ) ) { return ; } $ caller = $ this -> getCallerFromStackTrace ( ) ; Telescope :: recordGate ( IncomingEntry :: make ( [ 'ability' => $ ability , '...
Record a gate check .
638
private function formatArguments ( $ arguments ) { return collect ( $ arguments ) -> map ( function ( $ argument ) { return $ argument instanceof Model ? FormatModel :: given ( $ argument ) : $ argument ; } ) -> toArray ( ) ; }
Format the given arguments .
639
public function recordMail ( MessageSent $ event ) { if ( ! Telescope :: isRecording ( ) ) { return ; } Telescope :: recordMail ( IncomingEntry :: make ( [ 'mailable' => $ this -> getMailable ( $ event ) , 'queued' => $ this -> getQueuedStatus ( $ event ) , 'from' => $ event -> message -> getFrom ( ) , 'replyTo' => $ e...
Record a mail message was sent .
640
protected function getQueuedStatus ( $ event ) { if ( isset ( $ event -> data [ '__laravel_notification_queued' ] ) ) { return $ event -> data [ '__laravel_notification_queued' ] ; } return $ event -> data [ '__telescope_queued' ] ?? false ; }
Determine whether the mailable was queued .
641
private function tags ( $ message , $ data ) { return array_merge ( array_keys ( $ message -> getTo ( ) ? : [ ] ) , array_keys ( $ message -> getCc ( ) ? : [ ] ) , array_keys ( $ message -> getBcc ( ) ? : [ ] ) , $ data [ '__telescope' ] ?? [ ] ) ; }
Extract the tags from the message .
642
public function show ( EntriesRepository $ storage , $ id ) { return response ( $ storage -> find ( $ id ) -> content [ 'raw' ] , 200 , [ 'Content-Type' => 'message/rfc822' , 'Content-Disposition' => 'attachment; filename="mail-' . $ id . '.eml"' , ] ) ; }
Download the Eml content of the email .
643
public function recordAction ( $ event , $ data ) { if ( ! Telescope :: isRecording ( ) || ! $ this -> shouldRecord ( $ event ) ) { return ; } $ model = FormatModel :: given ( $ data [ 0 ] ) ; $ changes = $ data [ 0 ] -> getChanges ( ) ; Telescope :: recordModelEvent ( IncomingEntry :: make ( array_filter ( [ 'action' ...
Record an action .
644
public function recordCommand ( CommandStarting $ event ) { if ( ! Telescope :: isRecording ( ) || $ event -> command !== 'schedule:run' && $ event -> command !== 'schedule:finish' ) { return ; } collect ( app ( Schedule :: class ) -> events ( ) ) -> each ( function ( $ event ) { $ event -> then ( function ( ) use ( $ ...
Record a scheduled command was executed .
645
protected function getEventOutput ( Event $ event ) { if ( ! $ event -> output || $ event -> output === $ event -> getDefaultOutput ( ) || $ event -> shouldAppendOutput || ! file_exists ( $ event -> output ) ) { return '' ; } return trim ( file_get_contents ( $ event -> output ) ) ; }
Get the output for the scheduled event .
646
protected static function storeEntriesAfterWorkerLoop ( $ app ) { $ app [ 'events' ] -> listen ( JobProcessing :: class , function ( ) { static :: startRecording ( ) ; static :: $ processingJobs [ ] = true ; } ) ; $ app [ 'events' ] -> listen ( JobProcessed :: class , function ( $ event ) use ( $ app ) { static :: stor...
Store entries after the queue worker loops .
647
protected static function storeIfDoneProcessingJob ( $ event , $ app ) { array_pop ( static :: $ processingJobs ) ; if ( empty ( static :: $ processingJobs ) ) { static :: store ( $ app [ EntriesRepository :: class ] ) ; if ( $ event -> connectionName !== 'sync' ) { static :: stopRecording ( ) ; } } }
Store the recorded entries if totally done processing the current job .
648
public function recordNotification ( NotificationSent $ event ) { if ( ! Telescope :: isRecording ( ) ) { return ; } Telescope :: recordNotification ( IncomingEntry :: make ( [ 'notification' => get_class ( $ event -> notification ) , 'queued' => in_array ( ShouldQueue :: class , class_implements ( $ event -> notificat...
Record a new notification message was sent .
649
private function tags ( $ event ) { return array_merge ( [ $ this -> formatNotifiable ( $ event -> notifiable ) , ] , ExtractTags :: from ( $ event -> notification ) ) ; }
Extract the tags for the given event .
650
private function formatNotifiable ( $ notifiable ) { if ( $ notifiable instanceof Model ) { return FormatModel :: given ( $ notifiable ) ; } elseif ( $ notifiable instanceof AnonymousNotifiable ) { return 'Anonymous:' . implode ( ',' , $ notifiable -> routes ) ; } return get_class ( $ notifiable ) ; }
Format the given notifiable into a tag .
651
public static function get ( Throwable $ exception ) { return collect ( explode ( "\n" , file_get_contents ( $ exception -> getFile ( ) ) ) ) -> slice ( $ exception -> getLine ( ) - 10 , 20 ) -> mapWithKeys ( function ( $ value , $ key ) { return [ $ key + 1 => $ value ] ; } ) -> all ( ) ; }
Get the exception code context for the given exception .
652
public function recordLog ( MessageLogged $ event ) { if ( ! Telescope :: isRecording ( ) || $ this -> shouldIgnore ( $ event ) ) { return ; } Telescope :: recordLog ( IncomingEntry :: make ( [ 'level' => $ event -> level , 'message' => $ event -> message , 'context' => Arr :: except ( $ event -> context , [ 'telescope...
Record a message was logged .
653
public static function fromRequest ( Request $ request ) { return ( new static ) -> batchId ( $ request -> batch_id ) -> uuids ( $ request -> uuids ) -> beforeSequence ( $ request -> before ) -> tag ( $ request -> tag ) -> familyHash ( $ request -> family_hash ) -> limit ( $ request -> take ?? 50 ) ; }
Create new entry query options from the incoming request .
654
public function recordRequest ( RequestHandled $ event ) { if ( ! Telescope :: isRecording ( ) ) { return ; } Telescope :: recordRequest ( IncomingEntry :: make ( [ 'uri' => str_replace ( $ event -> request -> root ( ) , '' , $ event -> request -> fullUrl ( ) ) ? : '/' , 'method' => $ event -> request -> method ( ) , '...
Record an incoming HTTP request .
655
protected function headers ( $ headers ) { $ headers = collect ( $ headers ) -> map ( function ( $ header ) { return $ header [ 0 ] ; } ) -> toArray ( ) ; return $ this -> hideParameters ( $ headers , Telescope :: $ hiddenRequestHeaders ) ; }
Format the given headers .
656
protected function hideParameters ( $ data , $ hidden ) { foreach ( $ hidden as $ parameter ) { if ( Arr :: get ( $ data , $ parameter ) ) { Arr :: set ( $ data , $ parameter , '********' ) ; } } return $ data ; }
Hide the given parameters .
657
private function input ( Request $ request ) { $ files = $ request -> files -> all ( ) ; array_walk_recursive ( $ files , function ( & $ file ) { $ file = [ 'name' => $ file -> getClientOriginalName ( ) , 'size' => $ file -> isFile ( ) ? ( $ file -> getSize ( ) / 1000 ) . 'KB' : '0' , ] ; } ) ; return array_replace_rec...
Extract the input from the given request .
658
protected function response ( Response $ response ) { $ content = $ response -> getContent ( ) ; if ( is_string ( $ content ) && is_array ( json_decode ( $ content , true ) ) && json_last_error ( ) === JSON_ERROR_NONE ) { return $ this -> contentWithinLimits ( $ content ) ? $ this -> hideParameters ( json_decode ( $ co...
Format the given response object .
659
protected function extractDataFromView ( $ view ) { return collect ( $ view -> getData ( ) ) -> map ( function ( $ value ) { if ( $ value instanceof Model ) { return FormatModel :: given ( $ value ) ; } elseif ( is_object ( $ value ) ) { return [ 'class' => get_class ( $ value ) , 'properties' => json_decode ( json_enc...
Extract the data from the given view in array form .
660
public function recordCommand ( CommandFinished $ event ) { if ( ! Telescope :: isRecording ( ) || $ this -> shouldIgnore ( $ event ) ) { return ; } Telescope :: recordCommand ( IncomingEntry :: make ( [ 'command' => $ event -> command ?? $ event -> input -> getArguments ( ) [ 'command' ] ?? 'default' , 'exit_code' => ...
Record an Artisan command was executed .
661
public function recordCacheHit ( CacheHit $ event ) { if ( ! Telescope :: isRecording ( ) || $ this -> shouldIgnore ( $ event ) ) { return ; } Telescope :: recordCache ( IncomingEntry :: make ( [ 'type' => 'hit' , 'key' => $ event -> key , 'value' => $ event -> value , ] ) ) ; }
Record a cache key was found .
662
public function recordCacheMissed ( CacheMissed $ event ) { if ( ! Telescope :: isRecording ( ) || $ this -> shouldIgnore ( $ event ) ) { return ; } Telescope :: recordCache ( IncomingEntry :: make ( [ 'type' => 'missed' , 'key' => $ event -> key , ] ) ) ; }
Record a missing cache key .
663
public function recordKeyWritten ( KeyWritten $ event ) { if ( ! Telescope :: isRecording ( ) || $ this -> shouldIgnore ( $ event ) ) { return ; } Telescope :: recordCache ( IncomingEntry :: make ( [ 'type' => 'set' , 'key' => $ event -> key , 'value' => $ event -> value , 'expiration' => $ this -> formatExpiration ( $...
Record a cache key was updated .
664
public function user ( $ user ) { $ this -> user = $ user ; $ this -> content = array_merge ( $ this -> content , [ 'user' => [ 'id' => $ user -> getAuthIdentifier ( ) , 'name' => $ user -> name ?? null , 'email' => $ user -> email ?? null , ] , ] ) ; $ this -> tags ( [ 'Auth:' . $ user -> getAuthIdentifier ( ) ] ) ; r...
Set the currently authenticated user .
665
public function tags ( array $ tags ) { $ this -> tags = array_unique ( array_merge ( $ this -> tags , $ tags ) ) ; return $ this ; }
Merge tags into the entry s existing tags .
666
public function hasMonitoredTag ( ) { if ( ! empty ( $ this -> tags ) ) { return app ( EntriesRepository :: class ) -> isMonitoring ( $ this -> tags ) ; } return false ; }
Determine if the incoming entry has a monitored tag .
667
public function toArray ( ) { return [ 'uuid' => $ this -> uuid , 'batch_id' => $ this -> batchId , 'type' => $ this -> type , 'content' => $ this -> content , 'created_at' => $ this -> recordedAt -> toDateTimeString ( ) , ] ; }
Get an array representation of the entry for storage .
668
public function assignEntryPointFromBatch ( array $ batch ) { $ entryPoint = collect ( $ batch ) -> first ( function ( $ entry ) { return in_array ( $ entry -> type , [ EntryType :: REQUEST , EntryType :: JOB , EntryType :: COMMAND ] ) ; } ) ; if ( ! $ entryPoint ) { return ; } $ this -> content = array_merge ( $ this ...
Assign entry point parameters from the given batch entries .
669
private function entryPointDescription ( $ entryPoint ) { switch ( $ entryPoint -> type ) { case EntryType :: REQUEST : return $ entryPoint -> content [ 'method' ] . ' ' . $ entryPoint -> content [ 'uri' ] ; case EntryType :: JOB : return $ entryPoint -> content [ 'name' ] ; case EntryType :: COMMAND : return $ entryPo...
Description for the entry point .
670
public function jsonSerialize ( ) { return [ 'id' => $ this -> id , 'sequence' => $ this -> sequence , 'batch_id' => $ this -> batchId , 'type' => $ this -> type , 'content' => $ this -> content , 'tags' => $ this -> tags , 'family_hash' => $ this -> familyHash , 'created_at' => $ this -> createdAt -> toDateTimeString ...
Get the array representation of the entry .
671
public function collect ( ) : GitInfo { $ branch = $ this -> collectBranch ( ) ; $ commit = $ this -> collectCommit ( ) ; $ remotes = $ this -> collectRemotes ( ) ; return new GitInfo ( $ branch , $ commit , $ remotes ) ; }
Collect git repository info .
672
public static function parse ( string $ msg ) : Message { $ obj = new self ; $ parts = explode ( "\r\n" , $ msg ) ; $ obj -> body = MessageBody :: parse ( array_pop ( $ parts ) ) ; foreach ( $ parts as $ line ) { if ( $ line ) { $ pair = explode ( ': ' , $ line ) ; $ obj -> headers [ $ pair [ 0 ] ] = $ pair [ 1 ] ; } }...
Parses a message
673
protected function resolveName ( Name $ name , $ type ) { $ resolvedName = $ this -> nameContext -> getResolvedName ( $ name , $ type ) ; if ( null !== $ resolvedName ) { $ name -> setAttribute ( 'resolvedName' , $ resolvedName -> toString ( ) ) ; } return $ name ; }
Resolve name according to name resolver options .
674
private static function streamForParent ( array $ sockets ) { list ( $ for_read , $ for_write ) = $ sockets ; fclose ( $ for_write ) ; if ( ! stream_set_blocking ( $ for_read , false ) ) { error_log ( 'unable to set read stream to non-blocking' ) ; exit ( self :: EXIT_FAILURE ) ; } return $ for_read ; }
Prepare the socket pair to be used in a parent process and return the stream the parent will use to read results .
675
private function readResultsFromChildren ( ) { $ streams = [ ] ; foreach ( $ this -> read_streams as $ stream ) { $ streams [ intval ( $ stream ) ] = $ stream ; } $ content = array_fill_keys ( array_keys ( $ streams ) , '' ) ; while ( count ( $ streams ) > 0 ) { $ needs_read = array_values ( $ streams ) ; $ needs_write...
Read the results that each child process has serialized on their write streams . The results are returned in an array one for each worker . The order of the results is not maintained .
676
public function wait ( ) : array { $ content = $ this -> readResultsFromChildren ( ) ; foreach ( $ this -> child_pid_list as $ child_pid ) { $ process_lookup = posix_kill ( $ child_pid , 0 ) ; $ status = 0 ; if ( $ process_lookup ) { posix_kill ( $ child_pid , SIGALRM ) ; if ( pcntl_waitpid ( $ child_pid , $ status ) <...
Wait for all child processes to complete
677
protected function traverseNode ( Node $ node ) : Node { foreach ( $ node -> getSubNodeNames ( ) as $ name ) { $ subNode = & $ node -> $ name ; if ( \ is_array ( $ subNode ) ) { $ subNode = $ this -> traverseArray ( $ subNode ) ; if ( $ this -> stopTraversal ) { break ; } } elseif ( $ subNode instanceof Node ) { $ trav...
Recursively traverse a node .
678
public static function getFQCLNFromNameObject ( PhpParser \ Node \ Name $ class_name , Aliases $ aliases ) { $ resolved_name = $ class_name -> getAttribute ( 'resolvedName' ) ; if ( $ resolved_name ) { return $ resolved_name ; } if ( $ class_name instanceof PhpParser \ Node \ Name \ FullyQualified ) { return implode ( ...
Gets the fully - qualified class name from a Name object
679
public static function getTypeFromValue ( $ value ) { switch ( gettype ( $ value ) ) { case 'boolean' : if ( $ value ) { return Type :: getTrue ( ) ; } return Type :: getFalse ( ) ; case 'integer' : return Type :: getInt ( false , $ value ) ; case 'double' : return Type :: getFloat ( $ value ) ; case 'string' : return ...
Gets the Psalm type from a particular value
680
public static function afterStatementAnalysis ( PhpParser \ Node \ Stmt $ stmt , Context $ context , StatementsSource $ statements_source , Codebase $ codebase , array & $ file_replacements = [ ] ) { if ( $ stmt instanceof PhpParser \ Node \ Stmt \ Echo_ ) { foreach ( $ stmt -> exprs as $ expr ) { if ( ! isset ( $ expr...
Called after a statement has been checked
681
private function fileExistsForClassLike ( ClassLikes $ classlikes , $ fq_class_name ) { $ fq_class_name_lc = strtolower ( $ fq_class_name ) ; if ( isset ( $ this -> classlike_files [ $ fq_class_name_lc ] ) ) { return true ; } if ( $ fq_class_name === 'self' ) { return false ; } if ( isset ( $ this -> existing_classlike...
Checks whether a class exists and if it does then records what file it s in for later checking
682
public static function isContainedByInPhp ( Type \ Union $ input_type = null , Type \ Union $ container_type ) { if ( ! $ input_type ) { return false ; } if ( $ input_type -> getId ( ) === $ container_type -> getId ( ) ) { return true ; } if ( $ input_type -> isNullable ( ) && ! $ container_type -> isNullable ( ) ) { r...
Used for comparing signature typehints uses PHP s light contravariance rules
683
public static function isSimplyContainedBy ( Type \ Union $ input_type , Type \ Union $ container_type ) { if ( $ input_type -> getId ( ) === $ container_type -> getId ( ) ) { return true ; } if ( $ input_type -> isNullable ( ) && ! $ container_type -> isNullable ( ) ) { return false ; } $ input_type_not_null = clone $...
Used for comparing docblock types to signature types before we know about all types
684
protected function fillJenkins ( ) : self { if ( isset ( $ this -> env [ 'JENKINS_URL' ] ) && isset ( $ this -> env [ 'BUILD_NUMBER' ] ) ) { $ this -> readEnv [ 'CI_BUILD_NUMBER' ] = $ this -> env [ 'BUILD_NUMBER' ] ; $ this -> readEnv [ 'CI_BUILD_URL' ] = $ this -> env [ 'JENKINS_URL' ] ; $ this -> env [ 'CI_NAME' ] =...
Fill Jenkins environment variables .
685
protected function fillScrutinizer ( ) : self { if ( isset ( $ this -> env [ 'SCRUTINIZER' ] ) && $ this -> env [ 'SCRUTINIZER' ] ) { $ this -> readEnv [ 'CI_JOB_ID' ] = $ this -> env [ 'SCRUTINIZER_INSPECTION_UUID' ] ; $ this -> readEnv [ 'CI_BRANCH' ] = $ this -> env [ 'SCRUTINIZER_BRANCH' ] ; $ this -> readEnv [ 'CI...
Fill Scrutinizer environment variables .
686
public static function checkStatic ( $ method_id , $ self_call , $ is_context_dynamic , Codebase $ codebase , CodeLocation $ code_location , array $ suppressed_issues , & $ is_dynamic_this_method = false ) { $ codebase_methods = $ codebase -> methods ; if ( $ method_id === 'Closure::fromcallable' ) { return true ; } $ ...
Determines whether a given method is static or not
687
public static function simplifyCNF ( array $ clauses ) { $ cloned_clauses = [ ] ; foreach ( $ clauses as $ clause ) { $ unique_clause = clone $ clause ; foreach ( $ unique_clause -> possibilities as $ var_id => $ possibilities ) { if ( count ( $ possibilities ) ) { $ unique_clause -> possibilities [ $ var_id ] = array_...
This is a very simple simplification heuristic for CNF formulae .
688
public static function getTruthsFromFormula ( array $ clauses , array & $ cond_referenced_var_ids = [ ] ) { $ truths = [ ] ; if ( empty ( $ clauses ) ) { return [ ] ; } foreach ( $ clauses as $ clause ) { if ( ! $ clause -> reconcilable ) { continue ; } foreach ( $ clause -> possibilities as $ var => $ possible_types )...
Look for clauses with only one possible value
689
public function publishDiagnostics ( string $ uri , array $ diagnostics ) : Promise { return $ this -> handler -> notify ( 'textDocument/publishDiagnostics' , [ 'uri' => $ uri , 'diagnostics' => $ diagnostics ] ) ; }
Diagnostics notification are sent from the server to the client to signal results of validation runs .
690
public function xcontent ( TextDocumentIdentifier $ textDocument ) : Promise { return call ( function ( ) use ( $ textDocument ) { $ result = yield $ this -> handler -> request ( 'textDocument/xcontent' , [ 'textDocument' => $ textDocument ] ) ; return $ this -> mapper -> map ( $ result , new TextDocumentItem ) ; } ) ;...
The content request is sent from a server to a client to request the current content of a text document identified by the URI
691
public function getFirstAppearance ( $ var_id ) { return isset ( $ this -> all_vars [ $ var_id ] ) ? $ this -> all_vars [ $ var_id ] : null ; }
The first appearance of the variable in this set of statements being evaluated
692
public function propertyExists ( string $ property_id , bool $ read_mode , StatementsSource $ source = null , Context $ context = null , CodeLocation $ code_location = null ) { $ property_id = preg_replace ( '/^\\\\/' , '' , $ property_id ) ; list ( $ fq_class_name , $ property_name ) = explode ( '::$' , $ property_id ...
Whether or not a given property exists
693
public function update ( Context $ start_context , Context $ end_context , $ has_leaving_statements , array $ vars_to_update , array & $ updated_vars ) { foreach ( $ start_context -> vars_in_scope as $ var_id => $ old_type ) { if ( in_array ( $ var_id , $ vars_to_update , true ) ) { $ new_type = ! $ has_leaving_stateme...
Updates the parent context looking at the changes within a block and then applying those changes where necessary to the parent context
694
public static function getConfigForPath ( $ path , $ base_dir , $ output_format ) { $ config_path = self :: locateConfigFile ( $ path ) ; if ( ! $ config_path ) { if ( $ output_format === ProjectAnalyzer :: TYPE_CONSOLE ) { exit ( 'Could not locate a config XML file in path ' . $ path . '. Have you run \'psalm --init\'...
Gets a Config object from an XML file .
695
public static function locateConfigFile ( string $ path ) { $ dir_path = realpath ( $ path ) ; if ( $ dir_path === false ) { throw new ConfigException ( 'Config not found for path ' . $ path ) ; } if ( ! is_dir ( $ dir_path ) ) { $ dir_path = dirname ( $ dir_path ) ; } do { $ maybe_path = $ dir_path . DIRECTORY_SEPARAT...
Searches up a folder hierarchy for the most immediate config .
696
public static function loadFromXMLFile ( $ file_path , $ base_dir ) { $ file_contents = file_get_contents ( $ file_path ) ; if ( $ file_contents === false ) { throw new \ InvalidArgumentException ( 'Cannot open ' . $ file_path ) ; } try { $ config = self :: loadFromXML ( $ base_dir , $ file_contents ) ; $ config -> has...
Creates a new config object from the file
697
private static function coalesceReplacements ( array $ diff ) { $ newDiff = [ ] ; $ c = \ count ( $ diff ) ; for ( $ i = 0 ; $ i < $ c ; $ i ++ ) { $ diffType = $ diff [ $ i ] -> type ; if ( $ diffType !== DiffElem :: TYPE_REMOVE ) { $ newDiff [ ] = $ diff [ $ i ] ; continue ; } $ j = $ i ; while ( $ j < $ c && $ diff ...
Coalesce equal - length sequences of remove + add into a replace operation .
698
public function scanFiles ( int $ threads = 1 ) { $ has_changes = $ this -> scanner -> scanFiles ( $ this -> classlikes , $ threads ) ; if ( $ has_changes ) { $ this -> populator -> populateCodebase ( $ this ) ; } }
Scans all files their related files
699
public function isTypeContainedByType ( Type \ Union $ input_type , Type \ Union $ container_type ) : bool { return TypeAnalyzer :: isContainedBy ( $ this , $ input_type , $ container_type ) ; }
Checks if type is a subtype of other